-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: Add support for NXAST_LEARN #298
Open
shun159
wants to merge
2
commits into
trema:develop
Choose a base branch
from
shun159:feature/of13_nx_learn
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list | ||
end | ||
|
||
def length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use delegate
to define delegations.
|
||
def destination_class | ||
Match.const_get(@destination.to_s | ||
.split('_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the . on the previous line, together with the method call receiver.
書きかけ NiciraLearnNiciraLearn.new(
idle_timeout: 0,
hard_timeout: 0,
table_id: 255, # 0xff が有効な値かどうかは未確認です。
# => 追記: 0xffは無効です。bad action/bad argumentが帰ってきてしまいます。なので、defaultは0が無難か
priority: 65535,
cookie: 0,
flags: [], # :send_flow_rem || :delete_learned
fin_hard_timeout: 0,
fin_idle_timeout: 0,
specs: []) specs# NXM_OF_VLAN_TCI[0..11]がマッチフィールドに追加される。vlan_tciフィールドの12bitをコピーする。
# 同じマッチフィールドへのコピーの場合は、単に #{ field名 }[ofs:nbits] となる。
# コピー先のマッチフィールドは、以下のようになる。
# vlan_tci=0x0000/0x0fff
# NXM_NX_VLAN_TCIは16bit長さであるが、vlan_idは0..11bitの範囲である。
# 上のようにマスクがかかり、vlan_idとマッチできる。
LearnMatch.new(
n_bits: 12, # デフォルトはdstに指定したoxm_fieldのビット数
src: :vlan_tci,
dst: :vlan_tci)
# NXM_NX_REG0[0..15]=0x1をマッチフィールドに追加する。dst_fieldのビット長 == ofs+nbitsなら、単に#{dst_field名}=#{value}
# となる。dst_fieldのビット長 > ofs+nbitsの場合には、#{dst_field名}[ofs:nbits]表記となる。コピー後にはmaskがかかる。
# コピー先のマッチフィールドは、以下のようになる。
# reg0=0x1/0xffff
# となる。LearnMatchと同様にマスクが可能。
WriteMatch.new(
n_bits: 16,
value: 1,
dst: :reg0)
# load:#{ source_field値 }[ofs:nbits]->#{dst_field}[ofs:nbits]をactionsに追加する。
# *Matchとはことなり、指定したdst_fieldにsrc_fieldの値がloadされる。
# コピー先のアクションは、以下のようになる。
# load:0->NXM_NX_REG1[0..11]
LearnLoad.new(
n_bits: 12, # デフォルトはdstに指定したoxm_fieldのビット数
src: :vlan_tci,
dst: :reg1)
# load:#{value}->#{dst_field}[ofs:nbits]をactionsに追加する。
# *Matchとはことなり、指定したdst_fieldにsrc_fieldの値がloadされる。
# コピー先のアクションは、以下のようになる。
# load:2->NXM_NX_REG2[]
WriteLoad.new(
n_bits: 32, # デフォルトはdstに指定したoxm_fieldのビット数
value: 2,
dst: :reg2)
SendOutReg.new(
n_bits: 32, # デフォルトはoutputに指定したoxm_fieldのビット数
output: :reg0,
offset: 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.