Skip to content

Commit

Permalink
Merge pull request #246 from poolakiran/06_21_2019_12_05_pm
Browse files Browse the repository at this point in the history
Latest pyloxi.
  • Loading branch information
Kiran Poola committed Jun 21, 2019
2 parents a297ab5 + bd5a03f commit 7f686a5
Show file tree
Hide file tree
Showing 8 changed files with 737 additions and 0 deletions.
170 changes: 170 additions & 0 deletions src/python/loxi/of13/bsn_tlv.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,44 @@ def pretty_print(self, q):
q.text('}')


class active(bsn_tlv):
type = 192

def __init__(self):
return

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

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

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

def pretty_print(self, q):
q.text("active {")
with q.group():
with q.indent(2):
q.breakable()
q.breakable()
q.text('}')

bsn_tlv.subtypes[192] = active

class actor_key(bsn_tlv):
type = 44

Expand Down Expand Up @@ -1972,6 +2010,53 @@ def pretty_print(self, q):

bsn_tlv.subtypes[165] = fabric_port_role

class fail_count(bsn_tlv):
type = 194

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("!Q", self.value))
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
return ''.join(packed)

@staticmethod
def unpack(reader):
obj = fail_count()
_type = reader.read("!H")[0]
assert(_type == 194)
_length = reader.read("!H")[0]
orig_reader = reader
reader = orig_reader.slice(_length, 4)
obj.value = reader.read("!Q")[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("fail_count {")
with q.group():
with q.indent(2):
q.breakable()
q.text("value = ");
q.text("%#x" % self.value)
q.breakable()
q.text('}')

bsn_tlv.subtypes[194] = fail_count

class flood(bsn_tlv):
type = 163

Expand Down Expand Up @@ -4074,6 +4159,44 @@ def pretty_print(self, q):

bsn_tlv.subtypes[160] = lag_options

class link_up(bsn_tlv):
type = 193

def __init__(self):
return

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

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

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

def pretty_print(self, q):
q.text("link_up {")
with q.group():
with q.indent(2):
q.breakable()
q.breakable()
q.text('}')

bsn_tlv.subtypes[193] = link_up

class loopback_mode(bsn_tlv):
type = 146

Expand Down Expand Up @@ -6836,6 +6959,53 @@ def pretty_print(self, q):

bsn_tlv.subtypes[74] = set_loopback_mode

class src_mac_cml(bsn_tlv):
type = 191

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("!H", self.value))
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
return ''.join(packed)

@staticmethod
def unpack(reader):
obj = src_mac_cml()
_type = reader.read("!H")[0]
assert(_type == 191)
_length = reader.read("!H")[0]
orig_reader = reader
reader = orig_reader.slice(_length, 4)
obj.value = reader.read("!H")[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("src_mac_cml {")
with q.group():
with q.indent(2):
q.breakable()
q.text("value = ");
q.text("%#x" % self.value)
q.breakable()
q.text('}')

bsn_tlv.subtypes[191] = src_mac_cml

class status(bsn_tlv):
type = 97

Expand Down
13 changes: 13 additions & 0 deletions src/python/loxi/of13/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,19 @@
6: 'OFP_BSN_BFD_ENDPOINT_PARAMS_CHANGE',
}

# Identifiers from group ofp_bsn_cml
OFP_BSN_CML_NONE = 0
OFP_BSN_CML_CPU_DROP = 1
OFP_BSN_CML_FORWARD = 2
OFP_BSN_CML_CPU_FORWARD = 3

ofp_bsn_cml_map = {
0: 'OFP_BSN_CML_NONE',
1: 'OFP_BSN_CML_CPU_DROP',
2: 'OFP_BSN_CML_FORWARD',
3: 'OFP_BSN_CML_CPU_FORWARD',
}

# Identifiers from group ofp_bsn_controller_connection_state
OFP_BSN_CONTROLLER_CONNECTION_STATE_DISCONNECTED = 0
OFP_BSN_CONTROLLER_CONNECTION_STATE_CONNECTED = 1
Expand Down
Loading

0 comments on commit 7f686a5

Please sign in to comment.