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

update pyloxi to latest #173

Merged
merged 1 commit into from
Apr 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions src/python/loxi/of13/bsn_tlv.py
Original file line number Diff line number Diff line change
Expand Up @@ -3305,6 +3305,53 @@ def pretty_print(self, q):

bsn_tlv.subtypes[9] = unicast_query_timeout

class vlan_pcp(bsn_tlv):
type = 72

def __init__(self, value=None):
if value != None:
self.value = value
else:
self.value = 0
return

def pack(self):
packed = []
packed.append(struct.pack("!H", self.type))
packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
packed.append(struct.pack("!B", self.value))
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
return ''.join(packed)

@staticmethod
def unpack(reader):
obj = vlan_pcp()
_type = reader.read("!H")[0]
assert(_type == 72)
_length = reader.read("!H")[0]
orig_reader = reader
reader = orig_reader.slice(_length, 4)
obj.value = reader.read("!B")[0]
return obj

def __eq__(self, other):
if type(self) != type(other): return False
if self.value != other.value: return False
return True

def pretty_print(self, q):
q.text("vlan_pcp {")
with q.group():
with q.indent(2):
q.breakable()
q.text("value = ");
q.text("%#x" % self.value)
q.breakable()
q.text('}')

bsn_tlv.subtypes[72] = vlan_pcp

class vlan_vid(bsn_tlv):
type = 6

Expand Down
47 changes: 47 additions & 0 deletions src/python/loxi/of14/bsn_tlv.py
Original file line number Diff line number Diff line change
Expand Up @@ -3305,6 +3305,53 @@ def pretty_print(self, q):

bsn_tlv.subtypes[9] = unicast_query_timeout

class vlan_pcp(bsn_tlv):
type = 72

def __init__(self, value=None):
if value != None:
self.value = value
else:
self.value = 0
return

def pack(self):
packed = []
packed.append(struct.pack("!H", self.type))
packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
packed.append(struct.pack("!B", self.value))
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
return ''.join(packed)

@staticmethod
def unpack(reader):
obj = vlan_pcp()
_type = reader.read("!H")[0]
assert(_type == 72)
_length = reader.read("!H")[0]
orig_reader = reader
reader = orig_reader.slice(_length, 4)
obj.value = reader.read("!B")[0]
return obj

def __eq__(self, other):
if type(self) != type(other): return False
if self.value != other.value: return False
return True

def pretty_print(self, q):
q.text("vlan_pcp {")
with q.group():
with q.indent(2):
q.breakable()
q.text("value = ");
q.text("%#x" % self.value)
q.breakable()
q.text('}')

bsn_tlv.subtypes[72] = vlan_pcp

class vlan_vid(bsn_tlv):
type = 6

Expand Down