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
5 changes: 4 additions & 1 deletion v0x04/match_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ def as_of_tlv(self):
"""Return a pyof OXM TLV instance."""
try:
value = int(self.value)
value = value | VlanId.OFPVID_PRESENT
if value == 0:
viniarck marked this conversation as resolved.
Show resolved Hide resolved
value = VlanId.OFPVID_NONE
mask = None
oxm_hasmask = False
except ValueError:
value, mask = map(int, self.value.split('/'))
oxm_hasmask = True
value = value | VlanId.OFPVID_PRESENT
value = value | VlanId.OFPVID_PRESENT
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