Merge into master from pull request #163:
update pyloxi to floodlight/loxigen-artifacts @ 7f8b06392f610bae43424f2a5ba2ec243203a865 (https://github.com/floodlight/oftest/pull/163)
diff --git a/src/python/loxi/of14/port_desc_prop.py b/src/python/loxi/of14/port_desc_prop.py
index 7b6aa89..217e004 100644
--- a/src/python/loxi/of14/port_desc_prop.py
+++ b/src/python/loxi/of14/port_desc_prop.py
@@ -61,6 +61,169 @@
q.text('}')
+class experimenter(port_desc_prop):
+ subtypes = {}
+
+ type = 65535
+
+ def __init__(self, experimenter=None, exp_type=None):
+ if experimenter != None:
+ self.experimenter = experimenter
+ else:
+ self.experimenter = 0
+ if exp_type != None:
+ self.exp_type = exp_type
+ else:
+ self.exp_type = 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("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.exp_type))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 4)
+ subclass = experimenter.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = experimenter()
+ _type = reader.read("!H")[0]
+ assert(_type == 65535)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ obj.experimenter = reader.read("!L")[0]
+ obj.exp_type = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.experimenter != other.experimenter: return False
+ if self.exp_type != other.exp_type: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("experimenter {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("exp_type = ");
+ q.text("%#x" % self.exp_type)
+ q.breakable()
+ q.text('}')
+
+port_desc_prop.subtypes[65535] = experimenter
+
+class bsn(experimenter):
+ subtypes = {}
+
+ type = 65535
+ experimenter = 6035143
+
+ def __init__(self, exp_type=None):
+ if exp_type != None:
+ self.exp_type = exp_type
+ else:
+ self.exp_type = 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("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.exp_type))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 8)
+ subclass = bsn.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+ obj = bsn()
+ _type = reader.read("!H")[0]
+ assert(_type == 65535)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ obj.exp_type = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.exp_type != other.exp_type: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.breakable()
+ q.text('}')
+
+experimenter.subtypes[6035143] = bsn
+
+class bsn_uplink(bsn):
+ type = 65535
+ experimenter = 6035143
+ exp_type = 0
+
+ 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
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.exp_type))
+ length = sum([len(x) for x in packed])
+ packed[1] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_uplink()
+ _type = reader.read("!H")[0]
+ assert(_type == 65535)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length, 4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _exp_type = reader.read("!L")[0]
+ assert(_exp_type == 0)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_uplink {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.breakable()
+ q.text('}')
+
+bsn.subtypes[0] = bsn_uplink
+
class ethernet(port_desc_prop):
type = 0
@@ -160,67 +323,6 @@
port_desc_prop.subtypes[0] = ethernet
-class experimenter(port_desc_prop):
- subtypes = {}
-
- type = 65535
-
- def __init__(self, experimenter=None, exp_type=None):
- if experimenter != None:
- self.experimenter = experimenter
- else:
- self.experimenter = 0
- if exp_type != None:
- self.exp_type = exp_type
- else:
- self.exp_type = 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("!L", self.experimenter))
- packed.append(struct.pack("!L", self.exp_type))
- length = sum([len(x) for x in packed])
- packed[1] = struct.pack("!H", length)
- return ''.join(packed)
-
- @staticmethod
- def unpack(reader):
- subtype, = reader.peek('!L', 4)
- subclass = experimenter.subtypes.get(subtype)
- if subclass:
- return subclass.unpack(reader)
-
- obj = experimenter()
- _type = reader.read("!H")[0]
- assert(_type == 65535)
- _length = reader.read("!H")[0]
- orig_reader = reader
- reader = orig_reader.slice(_length, 4)
- obj.experimenter = reader.read("!L")[0]
- obj.exp_type = reader.read("!L")[0]
- return obj
-
- def __eq__(self, other):
- if type(self) != type(other): return False
- if self.experimenter != other.experimenter: return False
- if self.exp_type != other.exp_type: return False
- return True
-
- def pretty_print(self, q):
- q.text("experimenter {")
- with q.group():
- with q.indent(2):
- q.breakable()
- q.text("exp_type = ");
- q.text("%#x" % self.exp_type)
- q.breakable()
- q.text('}')
-
-port_desc_prop.subtypes[65535] = experimenter
-
class optical(port_desc_prop):
type = 1