Skip to content
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

Added a way to handle 4096/4096 and 0 #98

Merged
merged 12 commits into from
Mar 9, 2023
12 changes: 9 additions & 3 deletions v0x04/match_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ def as_of_tlv(self):
value = int(self.value)
mask = None
oxm_hasmask = False
value = value | VlanId.OFPVID_PRESENT
except ValueError:
value, mask = map(int, self.value.split('/'))
oxm_hasmask = True
value = value | VlanId.OFPVID_PRESENT
try:
value, mask = map(int, self.value.split('/'))
oxm_hasmask = True
value = value | VlanId.OFPVID_PRESENT
except ValueError:
mask = None
oxm_hasmask = False
value = VlanId.OFPVID_NONE
Alopalao marked this conversation as resolved.
Show resolved Hide resolved
value_bytes = value.to_bytes(2, 'big')
if mask:
Alopalao marked this conversation as resolved.
Show resolved Hide resolved
mask = mask | VlanId.OFPVID_PRESENT
Expand Down