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 floodlight/loxigen-artifacts @ b8fb6551d5838818fd65a415909d742a0ea16092 #187

Merged
merged 1 commit into from
Jul 8, 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
217 changes: 217 additions & 0 deletions src/python/loxi/of13/bsn_tlv.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,53 @@ def pretty_print(self, q):

bsn_tlv.subtypes[40] = actor_system_priority

class anchor(bsn_tlv):
type = 81

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 = anchor()
_type = reader.read("!H")[0]
assert(_type == 81)
_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("anchor {")
with q.group():
with q.indent(2):
q.breakable()
q.text("value = ");
q.text("%#x" % self.value)
q.breakable()
q.text('}')

bsn_tlv.subtypes[81] = anchor

class broadcast_query_timeout(bsn_tlv):
type = 10

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

bsn_tlv.subtypes[25] = external_netmask

class generation_id(bsn_tlv):
type = 80

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 = generation_id()
_type = reader.read("!H")[0]
assert(_type == 80)
_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("generation_id {")
with q.group():
with q.indent(2):
q.breakable()
q.text("value = ");
q.text("%#x" % self.value)
q.breakable()
q.text('}')

bsn_tlv.subtypes[80] = generation_id

class header_size(bsn_tlv):
type = 31

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

bsn_tlv.subtypes[8] = idle_timeout

class igmp_snooping(bsn_tlv):
type = 78

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 = igmp_snooping()
_type = reader.read("!H")[0]
assert(_type == 78)
_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("igmp_snooping {")
with q.group():
with q.indent(2):
q.breakable()
q.breakable()
q.text('}')

bsn_tlv.subtypes[78] = igmp_snooping

class internal_gateway_mac(bsn_tlv):
type = 28

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

bsn_tlv.subtypes[34] = ipv4_src

class l2_multicast_lookup(bsn_tlv):
type = 79

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 = l2_multicast_lookup()
_type = reader.read("!H")[0]
assert(_type == 79)
_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("l2_multicast_lookup {")
with q.group():
with q.indent(2):
q.breakable()
q.breakable()
q.text('}')

bsn_tlv.subtypes[79] = l2_multicast_lookup

class mac(bsn_tlv):
type = 1

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

bsn_tlv.subtypes[52] = name

class offset(bsn_tlv):
type = 82

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 = offset()
_type = reader.read("!H")[0]
assert(_type == 82)
_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("offset {")
with q.group():
with q.indent(2):
q.breakable()
q.text("value = ");
q.text("%#x" % self.value)
q.breakable()
q.text('}')

bsn_tlv.subtypes[82] = offset

class partner_key(bsn_tlv):
type = 51

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 @@ -226,6 +226,19 @@
13: 'OFPBRC_MULTIPART_BUFFER_OVERFLOW',
}

# Identifiers from group ofp_bsn_anchor
OFP_BSN_ANCHOR_PACKET_START = 0
OFP_BSN_ANCHOR_L3_HEADER_START = 1
OFP_BSN_ANCHOR_L4_HEADER_START = 2
OFP_BSN_ANCHOR_L4_PAYLOAD_START = 3

ofp_bsn_anchor_map = {
0: 'OFP_BSN_ANCHOR_PACKET_START',
1: 'OFP_BSN_ANCHOR_L3_HEADER_START',
2: 'OFP_BSN_ANCHOR_L4_HEADER_START',
3: 'OFP_BSN_ANCHOR_L4_PAYLOAD_START',
}

# 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