update pyloxi to 026ff024585f1588a7f11fa4c1a9a48d44dc098d
diff --git a/src/python/loxi/of13/message.py b/src/python/loxi/of13/message.py
index 9de2440..2737bd1 100644
--- a/src/python/loxi/of13/message.py
+++ b/src/python/loxi/of13/message.py
@@ -3,31 +3,59 @@
# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
# See the file LICENSE.pyloxi which should have been included in the source distribution
-# Automatically generated by LOXI from template message.py
+# Automatically generated by LOXI from template module.py
# Do not modify
import struct
import loxi
import const
import common
-import action # for unpack_list
-import instruction # for unpack_list
-import meter_band # for unpack_list
+import action
+import instruction
+import oxm
+import action_id
+import instruction_id
+import meter_band
import util
import loxi.generic_util
-class Message(object):
- version = const.OFP_VERSION
- type = None # override in subclass
- xid = None
+class message(loxi.OFObject):
+ subtypes = {}
-class aggregate_stats_reply(Message):
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('B', 1)
+ try:
+ subclass = message.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+
+class stats_reply(message):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 8)
+ try:
+ subclass = stats_reply.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown stats_reply message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+message.subtypes[19] = stats_reply
+
+class aggregate_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 2
def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -44,6 +72,7 @@
self.flow_count = flow_count
else:
self.flow_count = 0
+ return
def pack(self):
packed = []
@@ -63,18 +92,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = aggregate_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 2)
@@ -88,8 +114,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.packet_count != other.packet_count: return False
@@ -97,16 +121,6 @@
if self.flow_count != other.flow_count: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("aggregate_stats_reply {")
with q.group():
@@ -132,13 +146,32 @@
q.breakable()
q.text('}')
-class aggregate_stats_request(Message):
+stats_reply.subtypes[2] = aggregate_stats_reply
+
+class stats_request(message):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 8)
+ try:
+ subclass = stats_request.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown stats_request message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+message.subtypes[18] = stats_request
+
+class aggregate_stats_request(stats_request):
version = 4
type = 18
stats_type = 2
def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -167,6 +200,7 @@
self.match = match
else:
self.match = common.match()
+ return
def pack(self):
packed = []
@@ -190,18 +224,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = aggregate_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 2)
@@ -219,8 +250,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.table_id != other.table_id: return False
@@ -231,16 +260,6 @@
if self.match != other.match: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("aggregate_stats_request {")
with q.group():
@@ -275,12 +294,17 @@
q.breakable()
q.text('}')
-class async_get_reply(Message):
+stats_request.subtypes[2] = aggregate_stats_request
+
+class async_get_reply(message):
version = 4
type = 27
def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if packet_in_mask_equal_master != None:
self.packet_in_mask_equal_master = packet_in_mask_equal_master
else:
@@ -305,6 +329,7 @@
self.flow_removed_mask_slave = flow_removed_mask_slave
else:
self.flow_removed_mask_slave = 0
+ return
def pack(self):
packed = []
@@ -323,18 +348,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = async_get_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 27)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.packet_in_mask_equal_master = reader.read("!L")[0]
obj.packet_in_mask_slave = reader.read("!L")[0]
@@ -346,8 +368,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
@@ -357,16 +377,6 @@
if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("async_get_reply {")
with q.group():
@@ -398,12 +408,17 @@
q.breakable()
q.text('}')
-class async_get_request(Message):
+message.subtypes[27] = async_get_reply
+
+class async_get_request(message):
version = 4
type = 26
def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if packet_in_mask_equal_master != None:
self.packet_in_mask_equal_master = packet_in_mask_equal_master
else:
@@ -428,6 +443,7 @@
self.flow_removed_mask_slave = flow_removed_mask_slave
else:
self.flow_removed_mask_slave = 0
+ return
def pack(self):
packed = []
@@ -446,18 +462,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = async_get_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 26)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.packet_in_mask_equal_master = reader.read("!L")[0]
obj.packet_in_mask_slave = reader.read("!L")[0]
@@ -469,8 +482,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
@@ -480,16 +491,6 @@
if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("async_get_request {")
with q.group():
@@ -521,12 +522,17 @@
q.breakable()
q.text('}')
-class async_set(Message):
+message.subtypes[26] = async_get_request
+
+class async_set(message):
version = 4
type = 28
def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if packet_in_mask_equal_master != None:
self.packet_in_mask_equal_master = packet_in_mask_equal_master
else:
@@ -551,6 +557,7 @@
self.flow_removed_mask_slave = flow_removed_mask_slave
else:
self.flow_removed_mask_slave = 0
+ return
def pack(self):
packed = []
@@ -569,18 +576,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = async_set()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 28)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.packet_in_mask_equal_master = reader.read("!L")[0]
obj.packet_in_mask_slave = reader.read("!L")[0]
@@ -592,8 +596,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False
if self.packet_in_mask_slave != other.packet_in_mask_slave: return False
@@ -603,16 +605,6 @@
if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("async_set {")
with q.group():
@@ -644,13 +636,32 @@
q.breakable()
q.text('}')
-class bad_action_error_msg(Message):
+message.subtypes[28] = async_set
+
+class error_msg(message):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 8)
+ try:
+ subclass = error_msg.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown error_msg message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+message.subtypes[1] = error_msg
+
+class bad_action_error_msg(error_msg):
version = 4
type = 1
err_type = 2
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -659,6 +670,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -674,18 +686,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bad_action_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 2)
@@ -695,23 +704,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bad_action_error_msg {")
with q.group():
@@ -731,13 +728,18 @@
q.breakable()
q.text('}')
-class bad_instruction_error_msg(Message):
+error_msg.subtypes[2] = bad_action_error_msg
+
+class bad_instruction_error_msg(error_msg):
version = 4
type = 1
err_type = 3
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -746,6 +748,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -761,18 +764,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bad_instruction_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 3)
@@ -782,23 +782,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bad_instruction_error_msg {")
with q.group():
@@ -818,13 +806,18 @@
q.breakable()
q.text('}')
-class bad_match_error_msg(Message):
+error_msg.subtypes[3] = bad_instruction_error_msg
+
+class bad_match_error_msg(error_msg):
version = 4
type = 1
err_type = 4
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -833,6 +826,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -848,18 +842,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bad_match_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 4)
@@ -869,23 +860,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bad_match_error_msg {")
with q.group():
@@ -905,13 +884,18 @@
q.breakable()
q.text('}')
-class bad_request_error_msg(Message):
+error_msg.subtypes[4] = bad_match_error_msg
+
+class bad_request_error_msg(error_msg):
version = 4
type = 1
err_type = 1
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -920,6 +904,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -935,18 +920,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bad_request_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 1)
@@ -956,23 +938,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bad_request_error_msg {")
with q.group():
@@ -992,12 +962,18 @@
q.breakable()
q.text('}')
-class barrier_reply(Message):
+error_msg.subtypes[1] = bad_request_error_msg
+
+class barrier_reply(message):
version = 4
type = 21
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -1010,38 +986,23 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = barrier_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 21)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("barrier_reply {")
with q.group():
@@ -1055,12 +1016,18 @@
q.breakable()
q.text('}')
-class barrier_request(Message):
+message.subtypes[21] = barrier_reply
+
+class barrier_request(message):
version = 4
type = 20
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -1073,38 +1040,23 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = barrier_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 20)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("barrier_request {")
with q.group():
@@ -1118,18 +1070,52 @@
q.breakable()
q.text('}')
-class bsn_bw_clear_data_reply(Message):
+message.subtypes[20] = barrier_request
+
+class experimenter(message):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 8)
+ try:
+ subclass = experimenter.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown experimenter message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+message.subtypes[4] = experimenter
+
+class bsn_header(experimenter):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 12)
+ try:
+ subclass = bsn_header.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown bsn_header experimenter message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+experimenter.subtypes[6035143] = bsn_header
+
+class bsn_bw_clear_data_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 22
def __init__(self, xid=None, status=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if status != None:
self.status = status
else:
self.status = 0
+ return
def pack(self):
packed = []
@@ -1145,18 +1131,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_bw_clear_data_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1167,22 +1150,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.status != other.status: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_bw_clear_data_reply {")
with q.group():
@@ -1199,14 +1170,20 @@
q.breakable()
q.text('}')
-class bsn_bw_clear_data_request(Message):
+bsn_header.subtypes[22] = bsn_bw_clear_data_reply
+
+class bsn_bw_clear_data_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 21
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -1221,18 +1198,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_bw_clear_data_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1242,21 +1216,9 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_bw_clear_data_request {")
with q.group():
@@ -1270,18 +1232,24 @@
q.breakable()
q.text('}')
-class bsn_bw_enable_get_reply(Message):
+bsn_header.subtypes[21] = bsn_bw_clear_data_request
+
+class bsn_bw_enable_get_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 20
def __init__(self, xid=None, enabled=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enabled != None:
self.enabled = enabled
else:
self.enabled = 0
+ return
def pack(self):
packed = []
@@ -1297,18 +1265,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_bw_enable_get_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1319,22 +1284,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enabled != other.enabled: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_bw_enable_get_reply {")
with q.group():
@@ -1351,14 +1304,20 @@
q.breakable()
q.text('}')
-class bsn_bw_enable_get_request(Message):
+bsn_header.subtypes[20] = bsn_bw_enable_get_reply
+
+class bsn_bw_enable_get_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 19
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -1373,18 +1332,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_bw_enable_get_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1394,21 +1350,9 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_bw_enable_get_request {")
with q.group():
@@ -1422,14 +1366,19 @@
q.breakable()
q.text('}')
-class bsn_bw_enable_set_reply(Message):
+bsn_header.subtypes[19] = bsn_bw_enable_get_request
+
+class bsn_bw_enable_set_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 23
def __init__(self, xid=None, enable=None, status=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enable != None:
self.enable = enable
else:
@@ -1438,6 +1387,7 @@
self.status = status
else:
self.status = 0
+ return
def pack(self):
packed = []
@@ -1454,18 +1404,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_bw_enable_set_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1477,23 +1424,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enable != other.enable: return False
if self.status != other.status: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_bw_enable_set_reply {")
with q.group():
@@ -1513,18 +1448,24 @@
q.breakable()
q.text('}')
-class bsn_bw_enable_set_request(Message):
+bsn_header.subtypes[23] = bsn_bw_enable_set_reply
+
+class bsn_bw_enable_set_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 18
def __init__(self, xid=None, enable=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enable != None:
self.enable = enable
else:
self.enable = 0
+ return
def pack(self):
packed = []
@@ -1540,18 +1481,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_bw_enable_set_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1562,22 +1500,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enable != other.enable: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_bw_enable_set_request {")
with q.group():
@@ -1594,14 +1520,19 @@
q.breakable()
q.text('}')
-class bsn_flow_idle(Message):
+bsn_header.subtypes[18] = bsn_bw_enable_set_request
+
+class bsn_flow_idle(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 40
def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if cookie != None:
self.cookie = cookie
else:
@@ -1618,6 +1549,7 @@
self.match = match
else:
self.match = common.match()
+ return
def pack(self):
packed = []
@@ -1637,18 +1569,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_flow_idle()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1663,8 +1592,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.cookie != other.cookie: return False
if self.priority != other.priority: return False
@@ -1672,16 +1599,6 @@
if self.match != other.match: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_flow_idle {")
with q.group():
@@ -1707,18 +1624,24 @@
q.breakable()
q.text('}')
-class bsn_flow_idle_enable_get_reply(Message):
+bsn_header.subtypes[40] = bsn_flow_idle
+
+class bsn_flow_idle_enable_get_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 39
def __init__(self, xid=None, enabled=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enabled != None:
self.enabled = enabled
else:
self.enabled = 0
+ return
def pack(self):
packed = []
@@ -1734,18 +1657,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_flow_idle_enable_get_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1756,22 +1676,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enabled != other.enabled: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_flow_idle_enable_get_reply {")
with q.group():
@@ -1788,14 +1696,20 @@
q.breakable()
q.text('}')
-class bsn_flow_idle_enable_get_request(Message):
+bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
+
+class bsn_flow_idle_enable_get_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 38
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -1810,18 +1724,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_flow_idle_enable_get_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1831,21 +1742,9 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_flow_idle_enable_get_request {")
with q.group():
@@ -1859,14 +1758,19 @@
q.breakable()
q.text('}')
-class bsn_flow_idle_enable_set_reply(Message):
+bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
+
+class bsn_flow_idle_enable_set_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 37
def __init__(self, xid=None, enable=None, status=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enable != None:
self.enable = enable
else:
@@ -1875,6 +1779,7 @@
self.status = status
else:
self.status = 0
+ return
def pack(self):
packed = []
@@ -1891,18 +1796,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_flow_idle_enable_set_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1914,23 +1816,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enable != other.enable: return False
if self.status != other.status: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_flow_idle_enable_set_reply {")
with q.group():
@@ -1950,18 +1840,24 @@
q.breakable()
q.text('}')
-class bsn_flow_idle_enable_set_request(Message):
+bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
+
+class bsn_flow_idle_enable_set_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 36
def __init__(self, xid=None, enable=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enable != None:
self.enable = enable
else:
self.enable = 0
+ return
def pack(self):
packed = []
@@ -1977,18 +1873,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_flow_idle_enable_set_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -1999,22 +1892,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enable != other.enable: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_flow_idle_enable_set_request {")
with q.group():
@@ -2031,18 +1912,24 @@
q.breakable()
q.text('}')
-class bsn_get_interfaces_reply(Message):
+bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
+
+class bsn_get_interfaces_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 10
def __init__(self, xid=None, interfaces=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if interfaces != None:
self.interfaces = interfaces
else:
self.interfaces = []
+ return
def pack(self):
packed = []
@@ -2052,24 +1939,21 @@
packed.append(struct.pack("!L", self.xid))
packed.append(struct.pack("!L", self.experimenter))
packed.append(struct.pack("!L", self.subtype))
- packed.append(util.pack_list(self.interfaces))
+ packed.append(loxi.generic_util.pack_list(self.interfaces))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_get_interfaces_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2080,22 +1964,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.interfaces != other.interfaces: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_get_interfaces_reply {")
with q.group():
@@ -2112,14 +1984,20 @@
q.breakable()
q.text('}')
-class bsn_get_interfaces_request(Message):
+bsn_header.subtypes[10] = bsn_get_interfaces_reply
+
+class bsn_get_interfaces_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 9
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -2134,18 +2012,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_get_interfaces_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2155,21 +2030,9 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_get_interfaces_request {")
with q.group():
@@ -2183,18 +2046,24 @@
q.breakable()
q.text('}')
-class bsn_get_mirroring_reply(Message):
+bsn_header.subtypes[9] = bsn_get_interfaces_request
+
+class bsn_get_mirroring_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 5
def __init__(self, xid=None, report_mirror_ports=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if report_mirror_ports != None:
self.report_mirror_ports = report_mirror_ports
else:
self.report_mirror_ports = 0
+ return
def pack(self):
packed = []
@@ -2211,18 +2080,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_get_mirroring_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2234,22 +2100,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.report_mirror_ports != other.report_mirror_ports: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_get_mirroring_reply {")
with q.group():
@@ -2266,18 +2120,24 @@
q.breakable()
q.text('}')
-class bsn_get_mirroring_request(Message):
+bsn_header.subtypes[5] = bsn_get_mirroring_reply
+
+class bsn_get_mirroring_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 4
def __init__(self, xid=None, report_mirror_ports=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if report_mirror_ports != None:
self.report_mirror_ports = report_mirror_ports
else:
self.report_mirror_ports = 0
+ return
def pack(self):
packed = []
@@ -2294,18 +2154,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_get_mirroring_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2317,22 +2174,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.report_mirror_ports != other.report_mirror_ports: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_get_mirroring_request {")
with q.group():
@@ -2349,14 +2194,153 @@
q.breakable()
q.text('}')
-class bsn_lacp_convergence_notif(Message):
+bsn_header.subtypes[4] = bsn_get_mirroring_request
+
+class bsn_get_switch_pipeline_reply(bsn_header):
+ version = 4
+ type = 4
+ experimenter = 6035143
+ subtype = 52
+
+ def __init__(self, xid=None, pipeline=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if pipeline != None:
+ self.pipeline = pipeline
+ else:
+ self.pipeline = ""
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(struct.pack("!256s", self.pipeline))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_get_switch_pipeline_reply()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 4)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 52)
+ obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.pipeline != other.pipeline: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_get_switch_pipeline_reply {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("pipeline = ");
+ q.pp(self.pipeline)
+ q.breakable()
+ q.text('}')
+
+bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
+
+class bsn_get_switch_pipeline_request(bsn_header):
+ version = 4
+ type = 4
+ experimenter = 6035143
+ subtype = 51
+
+ def __init__(self, xid=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_get_switch_pipeline_request()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 4)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 51)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_get_switch_pipeline_request {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.breakable()
+ q.text('}')
+
+bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
+
+class bsn_lacp_convergence_notif(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 43
def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if convergence_status != None:
self.convergence_status = convergence_status
else:
@@ -2405,6 +2389,7 @@
self.partner_key = partner_key
else:
self.partner_key = 0
+ return
def pack(self):
packed = []
@@ -2432,18 +2417,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_lacp_convergence_notif()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2466,8 +2448,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.convergence_status != other.convergence_status: return False
if self.port_no != other.port_no: return False
@@ -2483,16 +2463,6 @@
if self.partner_key != other.partner_key: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_lacp_convergence_notif {")
with q.group():
@@ -2542,7 +2512,37 @@
q.breakable()
q.text('}')
-class bsn_lacp_stats_reply(Message):
+bsn_header.subtypes[43] = bsn_lacp_convergence_notif
+
+class experimenter_stats_reply(stats_reply):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 16)
+ try:
+ subclass = experimenter_stats_reply.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown experimenter_stats_reply stats_reply message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+stats_reply.subtypes[65535] = experimenter_stats_reply
+
+class bsn_stats_reply(experimenter_stats_reply):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 20)
+ try:
+ subclass = bsn_stats_reply.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown bsn_stats_reply experimenter_stats_reply stats_reply message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
+
+class bsn_lacp_stats_reply(bsn_stats_reply):
version = 4
type = 19
stats_type = 65535
@@ -2550,7 +2550,10 @@
subtype = 1
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -2559,6 +2562,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -2571,24 +2575,21 @@
packed.append('\x00' * 4)
packed.append(struct.pack("!L", self.experimenter))
packed.append(struct.pack("!L", self.subtype))
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_lacp_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 65535)
@@ -2603,23 +2604,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_lacp_stats_reply {")
with q.group():
@@ -2639,7 +2628,37 @@
q.breakable()
q.text('}')
-class bsn_lacp_stats_request(Message):
+bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
+
+class experimenter_stats_request(stats_request):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 16)
+ try:
+ subclass = experimenter_stats_request.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown experimenter_stats_request stats_request message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+stats_request.subtypes[65535] = experimenter_stats_request
+
+class bsn_stats_request(experimenter_stats_request):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 20)
+ try:
+ subclass = bsn_stats_request.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown bsn_stats_request experimenter_stats_request stats_request message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+experimenter_stats_request.subtypes[6035143] = bsn_stats_request
+
+class bsn_lacp_stats_request(bsn_stats_request):
version = 4
type = 18
stats_type = 65535
@@ -2647,11 +2666,15 @@
subtype = 1
def __init__(self, xid=None, flags=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
self.flags = 0
+ return
def pack(self):
packed = []
@@ -2669,18 +2692,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_lacp_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 65535)
@@ -2694,22 +2714,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_lacp_stats_request {")
with q.group():
@@ -2726,14 +2734,19 @@
q.breakable()
q.text('}')
-class bsn_pdu_rx_reply(Message):
+bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
+
+class bsn_pdu_rx_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 34
def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if status != None:
self.status = status
else:
@@ -2746,6 +2759,7 @@
self.slot_num = slot_num
else:
self.slot_num = 0
+ return
def pack(self):
packed = []
@@ -2763,18 +2777,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_pdu_rx_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2787,24 +2798,12 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.status != other.status: return False
if self.port_no != other.port_no: return False
if self.slot_num != other.slot_num: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_pdu_rx_reply {")
with q.group():
@@ -2827,14 +2826,19 @@
q.breakable()
q.text('}')
-class bsn_pdu_rx_request(Message):
+bsn_header.subtypes[34] = bsn_pdu_rx_reply
+
+class bsn_pdu_rx_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 33
def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if timeout_ms != None:
self.timeout_ms = timeout_ms
else:
@@ -2851,6 +2855,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -2870,18 +2875,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_pdu_rx_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2896,8 +2898,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.timeout_ms != other.timeout_ms: return False
if self.port_no != other.port_no: return False
@@ -2905,16 +2905,6 @@
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_pdu_rx_request {")
with q.group():
@@ -2940,14 +2930,19 @@
q.breakable()
q.text('}')
-class bsn_pdu_rx_timeout(Message):
+bsn_header.subtypes[33] = bsn_pdu_rx_request
+
+class bsn_pdu_rx_timeout(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 35
def __init__(self, xid=None, port_no=None, slot_num=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if port_no != None:
self.port_no = port_no
else:
@@ -2956,6 +2951,7 @@
self.slot_num = slot_num
else:
self.slot_num = 0
+ return
def pack(self):
packed = []
@@ -2972,18 +2968,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_pdu_rx_timeout()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -2995,23 +2988,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.port_no != other.port_no: return False
if self.slot_num != other.slot_num: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_pdu_rx_timeout {")
with q.group():
@@ -3031,14 +3012,19 @@
q.breakable()
q.text('}')
-class bsn_pdu_tx_reply(Message):
+bsn_header.subtypes[35] = bsn_pdu_rx_timeout
+
+class bsn_pdu_tx_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 32
def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if status != None:
self.status = status
else:
@@ -3051,6 +3037,7 @@
self.slot_num = slot_num
else:
self.slot_num = 0
+ return
def pack(self):
packed = []
@@ -3068,18 +3055,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_pdu_tx_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3092,24 +3076,12 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.status != other.status: return False
if self.port_no != other.port_no: return False
if self.slot_num != other.slot_num: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_pdu_tx_reply {")
with q.group():
@@ -3132,14 +3104,19 @@
q.breakable()
q.text('}')
-class bsn_pdu_tx_request(Message):
+bsn_header.subtypes[32] = bsn_pdu_tx_reply
+
+class bsn_pdu_tx_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 31
def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if tx_interval_ms != None:
self.tx_interval_ms = tx_interval_ms
else:
@@ -3156,6 +3133,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -3175,18 +3153,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_pdu_tx_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3201,8 +3176,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.tx_interval_ms != other.tx_interval_ms: return False
if self.port_no != other.port_no: return False
@@ -3210,16 +3183,6 @@
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_pdu_tx_request {")
with q.group():
@@ -3245,14 +3208,195 @@
q.breakable()
q.text('}')
-class bsn_set_lacp_reply(Message):
+bsn_header.subtypes[31] = bsn_pdu_tx_request
+
+class bsn_port_counter_stats_reply(bsn_stats_reply):
+ version = 4
+ type = 19
+ stats_type = 65535
+ experimenter = 6035143
+ subtype = 8
+
+ def __init__(self, xid=None, flags=None, entries=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if entries != None:
+ self.entries = entries
+ else:
+ self.entries = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!H", self.stats_type))
+ packed.append(struct.pack("!H", self.flags))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(loxi.generic_util.pack_list(self.entries))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_port_counter_stats_reply()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 19)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _stats_type = reader.read("!H")[0]
+ assert(_stats_type == 65535)
+ obj.flags = reader.read("!H")[0]
+ reader.skip(4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 8)
+ obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.flags != other.flags: return False
+ if self.entries != other.entries: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_port_counter_stats_reply {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("entries = ");
+ q.pp(self.entries)
+ q.breakable()
+ q.text('}')
+
+bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
+
+class bsn_port_counter_stats_request(bsn_stats_request):
+ version = 4
+ type = 18
+ stats_type = 65535
+ experimenter = 6035143
+ subtype = 8
+
+ def __init__(self, xid=None, flags=None, port_no=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if port_no != None:
+ self.port_no = port_no
+ else:
+ self.port_no = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!H", self.stats_type))
+ packed.append(struct.pack("!H", self.flags))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(util.pack_port_no(self.port_no))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_port_counter_stats_request()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 18)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _stats_type = reader.read("!H")[0]
+ assert(_stats_type == 65535)
+ obj.flags = reader.read("!H")[0]
+ reader.skip(4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 8)
+ obj.port_no = util.unpack_port_no(reader)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.flags != other.flags: return False
+ if self.port_no != other.port_no: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_port_counter_stats_request {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("port_no = ");
+ q.text(util.pretty_port(self.port_no))
+ q.breakable()
+ q.text('}')
+
+bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
+
+class bsn_set_lacp_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 42
def __init__(self, xid=None, status=None, port_no=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if status != None:
self.status = status
else:
@@ -3261,6 +3405,7 @@
self.port_no = port_no
else:
self.port_no = 0
+ return
def pack(self):
packed = []
@@ -3277,18 +3422,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_set_lacp_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3300,23 +3442,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.status != other.status: return False
if self.port_no != other.port_no: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_set_lacp_reply {")
with q.group():
@@ -3336,14 +3466,19 @@
q.breakable()
q.text('}')
-class bsn_set_lacp_request(Message):
+bsn_header.subtypes[42] = bsn_set_lacp_reply
+
+class bsn_set_lacp_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 41
def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enabled != None:
self.enabled = enabled
else:
@@ -3372,6 +3507,7 @@
self.actor_key = actor_key
else:
self.actor_key = 0
+ return
def pack(self):
packed = []
@@ -3394,18 +3530,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_set_lacp_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3423,8 +3556,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enabled != other.enabled: return False
if self.port_no != other.port_no: return False
@@ -3435,16 +3566,6 @@
if self.actor_key != other.actor_key: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_set_lacp_request {")
with q.group():
@@ -3479,18 +3600,24 @@
q.breakable()
q.text('}')
-class bsn_set_mirroring(Message):
+bsn_header.subtypes[41] = bsn_set_lacp_request
+
+class bsn_set_mirroring(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 3
def __init__(self, xid=None, report_mirror_ports=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if report_mirror_ports != None:
self.report_mirror_ports = report_mirror_ports
else:
self.report_mirror_ports = 0
+ return
def pack(self):
packed = []
@@ -3507,18 +3634,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_set_mirroring()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3530,22 +3654,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.report_mirror_ports != other.report_mirror_ports: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_set_mirroring {")
with q.group():
@@ -3562,18 +3674,24 @@
q.breakable()
q.text('}')
-class bsn_set_pktin_suppression_reply(Message):
+bsn_header.subtypes[3] = bsn_set_mirroring
+
+class bsn_set_pktin_suppression_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 25
def __init__(self, xid=None, status=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if status != None:
self.status = status
else:
self.status = 0
+ return
def pack(self):
packed = []
@@ -3589,18 +3707,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_set_pktin_suppression_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3611,22 +3726,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.status != other.status: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_set_pktin_suppression_reply {")
with q.group():
@@ -3643,14 +3746,19 @@
q.breakable()
q.text('}')
-class bsn_set_pktin_suppression_request(Message):
+bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
+
+class bsn_set_pktin_suppression_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 11
def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if enabled != None:
self.enabled = enabled
else:
@@ -3671,6 +3779,7 @@
self.cookie = cookie
else:
self.cookie = 0
+ return
def pack(self):
packed = []
@@ -3691,18 +3800,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_set_pktin_suppression_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3718,8 +3824,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.enabled != other.enabled: return False
if self.idle_timeout != other.idle_timeout: return False
@@ -3728,16 +3832,6 @@
if self.cookie != other.cookie: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_set_pktin_suppression_request {")
with q.group():
@@ -3766,18 +3860,334 @@
q.breakable()
q.text('}')
-class bsn_time_reply(Message):
+bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
+
+class bsn_set_switch_pipeline_reply(bsn_header):
+ version = 4
+ type = 4
+ experimenter = 6035143
+ subtype = 54
+
+ def __init__(self, xid=None, status=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if status != None:
+ self.status = status
+ else:
+ self.status = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(struct.pack("!L", self.status))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_set_switch_pipeline_reply()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 4)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 54)
+ obj.status = reader.read("!L")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.status != other.status: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_set_switch_pipeline_reply {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("status = ");
+ q.text("%#x" % self.status)
+ q.breakable()
+ q.text('}')
+
+bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
+
+class bsn_set_switch_pipeline_request(bsn_header):
+ version = 4
+ type = 4
+ experimenter = 6035143
+ subtype = 53
+
+ def __init__(self, xid=None, pipeline=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if pipeline != None:
+ self.pipeline = pipeline
+ else:
+ self.pipeline = ""
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(struct.pack("!256s", self.pipeline))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_set_switch_pipeline_request()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 4)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 53)
+ obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.pipeline != other.pipeline: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_set_switch_pipeline_request {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("pipeline = ");
+ q.pp(self.pipeline)
+ q.breakable()
+ q.text('}')
+
+bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
+
+class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
+ version = 4
+ type = 19
+ stats_type = 65535
+ experimenter = 6035143
+ subtype = 6
+
+ def __init__(self, xid=None, flags=None, entries=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if entries != None:
+ self.entries = entries
+ else:
+ self.entries = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!H", self.stats_type))
+ packed.append(struct.pack("!H", self.flags))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(loxi.generic_util.pack_list(self.entries))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_switch_pipeline_stats_reply()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 19)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _stats_type = reader.read("!H")[0]
+ assert(_stats_type == 65535)
+ obj.flags = reader.read("!H")[0]
+ reader.skip(4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 6)
+ obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.flags != other.flags: return False
+ if self.entries != other.entries: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_switch_pipeline_stats_reply {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("entries = ");
+ q.pp(self.entries)
+ q.breakable()
+ q.text('}')
+
+bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
+
+class bsn_switch_pipeline_stats_request(bsn_stats_request):
+ version = 4
+ type = 18
+ stats_type = 65535
+ experimenter = 6035143
+ subtype = 6
+
+ def __init__(self, xid=None, flags=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!H", self.stats_type))
+ packed.append(struct.pack("!H", self.flags))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_switch_pipeline_stats_request()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 18)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _stats_type = reader.read("!H")[0]
+ assert(_stats_type == 65535)
+ obj.flags = reader.read("!H")[0]
+ reader.skip(4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 6)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.flags != other.flags: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_switch_pipeline_stats_request {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.breakable()
+ q.text('}')
+
+bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
+
+class bsn_time_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 45
def __init__(self, xid=None, time_ms=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if time_ms != None:
self.time_ms = time_ms
else:
self.time_ms = 0
+ return
def pack(self):
packed = []
@@ -3793,18 +4203,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_time_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3815,22 +4222,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.time_ms != other.time_ms: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_time_reply {")
with q.group():
@@ -3847,14 +4242,20 @@
q.breakable()
q.text('}')
-class bsn_time_request(Message):
+bsn_header.subtypes[45] = bsn_time_reply
+
+class bsn_time_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 44
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -3869,18 +4270,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_time_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3890,21 +4288,9 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_time_request {")
with q.group():
@@ -3918,14 +4304,19 @@
q.breakable()
q.text('}')
-class bsn_virtual_port_create_reply(Message):
+bsn_header.subtypes[44] = bsn_time_request
+
+class bsn_virtual_port_create_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 16
def __init__(self, xid=None, status=None, vport_no=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if status != None:
self.status = status
else:
@@ -3934,6 +4325,7 @@
self.vport_no = vport_no
else:
self.vport_no = 0
+ return
def pack(self):
packed = []
@@ -3950,18 +4342,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_virtual_port_create_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -3973,23 +4362,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.status != other.status: return False
if self.vport_no != other.vport_no: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_virtual_port_create_reply {")
with q.group():
@@ -4009,18 +4386,24 @@
q.breakable()
q.text('}')
-class bsn_virtual_port_create_request(Message):
+bsn_header.subtypes[16] = bsn_virtual_port_create_reply
+
+class bsn_virtual_port_create_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 15
def __init__(self, xid=None, vport=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if vport != None:
self.vport = vport
else:
self.vport = common.bsn_vport_q_in_q()
+ return
def pack(self):
packed = []
@@ -4036,18 +4419,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_virtual_port_create_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -4058,22 +4438,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.vport != other.vport: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_virtual_port_create_request {")
with q.group():
@@ -4090,18 +4458,24 @@
q.breakable()
q.text('}')
-class bsn_virtual_port_remove_reply(Message):
+bsn_header.subtypes[15] = bsn_virtual_port_create_request
+
+class bsn_virtual_port_remove_reply(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 26
def __init__(self, xid=None, status=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if status != None:
self.status = status
else:
self.status = 0
+ return
def pack(self):
packed = []
@@ -4117,18 +4491,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_virtual_port_remove_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -4139,22 +4510,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.status != other.status: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_virtual_port_remove_reply {")
with q.group():
@@ -4171,18 +4530,24 @@
q.breakable()
q.text('}')
-class bsn_virtual_port_remove_request(Message):
+bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
+
+class bsn_virtual_port_remove_request(bsn_header):
version = 4
type = 4
experimenter = 6035143
subtype = 17
def __init__(self, xid=None, vport_no=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if vport_no != None:
self.vport_no = vport_no
else:
self.vport_no = 0
+ return
def pack(self):
packed = []
@@ -4198,18 +4563,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = bsn_virtual_port_remove_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 4)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_experimenter = reader.read("!L")[0]
assert(_experimenter == 6035143)
@@ -4220,22 +4582,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.vport_no != other.vport_no: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("bsn_virtual_port_remove_request {")
with q.group():
@@ -4252,13 +4602,194 @@
q.breakable()
q.text('}')
-class desc_stats_reply(Message):
+bsn_header.subtypes[17] = bsn_virtual_port_remove_request
+
+class bsn_vlan_counter_stats_reply(bsn_stats_reply):
+ version = 4
+ type = 19
+ stats_type = 65535
+ experimenter = 6035143
+ subtype = 9
+
+ def __init__(self, xid=None, flags=None, entries=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if entries != None:
+ self.entries = entries
+ else:
+ self.entries = []
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!H", self.stats_type))
+ packed.append(struct.pack("!H", self.flags))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(loxi.generic_util.pack_list(self.entries))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_vlan_counter_stats_reply()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 19)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _stats_type = reader.read("!H")[0]
+ assert(_stats_type == 65535)
+ obj.flags = reader.read("!H")[0]
+ reader.skip(4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 9)
+ obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.flags != other.flags: return False
+ if self.entries != other.entries: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_vlan_counter_stats_reply {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("entries = ");
+ q.pp(self.entries)
+ q.breakable()
+ q.text('}')
+
+bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
+
+class bsn_vlan_counter_stats_request(bsn_stats_request):
+ version = 4
+ type = 18
+ stats_type = 65535
+ experimenter = 6035143
+ subtype = 9
+
+ def __init__(self, xid=None, flags=None, vlan_vid=None):
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ if flags != None:
+ self.flags = flags
+ else:
+ self.flags = 0
+ if vlan_vid != None:
+ self.vlan_vid = vlan_vid
+ else:
+ self.vlan_vid = 0
+ return
+
+ def pack(self):
+ packed = []
+ packed.append(struct.pack("!B", self.version))
+ packed.append(struct.pack("!B", self.type))
+ packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
+ packed.append(struct.pack("!L", self.xid))
+ packed.append(struct.pack("!H", self.stats_type))
+ packed.append(struct.pack("!H", self.flags))
+ packed.append('\x00' * 4)
+ packed.append(struct.pack("!L", self.experimenter))
+ packed.append(struct.pack("!L", self.subtype))
+ packed.append(struct.pack("!H", self.vlan_vid))
+ length = sum([len(x) for x in packed])
+ packed[2] = struct.pack("!H", length)
+ return ''.join(packed)
+
+ @staticmethod
+ def unpack(reader):
+ obj = bsn_vlan_counter_stats_request()
+ _version = reader.read("!B")[0]
+ assert(_version == 4)
+ _type = reader.read("!B")[0]
+ assert(_type == 18)
+ _length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
+ obj.xid = reader.read("!L")[0]
+ _stats_type = reader.read("!H")[0]
+ assert(_stats_type == 65535)
+ obj.flags = reader.read("!H")[0]
+ reader.skip(4)
+ _experimenter = reader.read("!L")[0]
+ assert(_experimenter == 6035143)
+ _subtype = reader.read("!L")[0]
+ assert(_subtype == 9)
+ obj.vlan_vid = reader.read("!H")[0]
+ return obj
+
+ def __eq__(self, other):
+ if type(self) != type(other): return False
+ if self.xid != other.xid: return False
+ if self.flags != other.flags: return False
+ if self.vlan_vid != other.vlan_vid: return False
+ return True
+
+ def pretty_print(self, q):
+ q.text("bsn_vlan_counter_stats_request {")
+ with q.group():
+ with q.indent(2):
+ q.breakable()
+ q.text("xid = ");
+ if self.xid != None:
+ q.text("%#x" % self.xid)
+ else:
+ q.text('None')
+ q.text(","); q.breakable()
+ q.text("flags = ");
+ q.text("%#x" % self.flags)
+ q.text(","); q.breakable()
+ q.text("vlan_vid = ");
+ q.text("%#x" % self.vlan_vid)
+ q.breakable()
+ q.text('}')
+
+bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
+
+class desc_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 0
def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -4283,6 +4814,7 @@
self.dp_desc = dp_desc
else:
self.dp_desc = ""
+ return
def pack(self):
packed = []
@@ -4303,18 +4835,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = desc_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 0)
@@ -4329,8 +4858,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.mfr_desc != other.mfr_desc: return False
@@ -4340,16 +4867,6 @@
if self.dp_desc != other.dp_desc: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("desc_stats_reply {")
with q.group():
@@ -4381,17 +4898,23 @@
q.breakable()
q.text('}')
-class desc_stats_request(Message):
+stats_reply.subtypes[0] = desc_stats_reply
+
+class desc_stats_request(stats_request):
version = 4
type = 18
stats_type = 0
def __init__(self, xid=None, flags=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
self.flags = 0
+ return
def pack(self):
packed = []
@@ -4407,18 +4930,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = desc_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 0)
@@ -4428,22 +4948,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("desc_stats_request {")
with q.group():
@@ -4460,16 +4968,22 @@
q.breakable()
q.text('}')
-class echo_reply(Message):
+stats_request.subtypes[0] = desc_stats_request
+
+class echo_reply(message):
version = 4
type = 3
def __init__(self, xid=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if data != None:
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -4483,40 +4997,25 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = echo_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 3)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.data = str(reader.read_all())
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("echo_reply {")
with q.group():
@@ -4533,16 +5032,22 @@
q.breakable()
q.text('}')
-class echo_request(Message):
+message.subtypes[3] = echo_reply
+
+class echo_request(message):
version = 4
type = 2
def __init__(self, xid=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if data != None:
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -4556,40 +5061,25 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = echo_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 2)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.data = str(reader.read_all())
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("echo_request {")
with q.group():
@@ -4606,13 +5096,18 @@
q.breakable()
q.text('}')
-class experimenter_error_msg(Message):
+message.subtypes[2] = echo_request
+
+class experimenter_error_msg(error_msg):
version = 4
type = 1
err_type = 65535
def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if subtype != None:
self.subtype = subtype
else:
@@ -4625,6 +5120,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -4641,18 +5137,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = experimenter_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 65535)
@@ -4663,24 +5156,12 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.subtype != other.subtype: return False
if self.experimenter != other.experimenter: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("experimenter_error_msg {")
with q.group():
@@ -4703,12 +5184,17 @@
q.breakable()
q.text('}')
-class features_reply(Message):
+error_msg.subtypes[65535] = experimenter_error_msg
+
+class features_reply(message):
version = 4
type = 6
def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if datapath_id != None:
self.datapath_id = datapath_id
else:
@@ -4733,6 +5219,7 @@
self.reserved = reserved
else:
self.reserved = 0
+ return
def pack(self):
packed = []
@@ -4752,18 +5239,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = features_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 6)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.datapath_id = reader.read("!Q")[0]
obj.n_buffers = reader.read("!L")[0]
@@ -4776,8 +5260,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.datapath_id != other.datapath_id: return False
if self.n_buffers != other.n_buffers: return False
@@ -4787,16 +5269,6 @@
if self.reserved != other.reserved: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("features_reply {")
with q.group():
@@ -4828,12 +5300,18 @@
q.breakable()
q.text('}')
-class features_request(Message):
+message.subtypes[6] = features_reply
+
+class features_request(message):
version = 4
type = 5
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -4846,38 +5324,23 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = features_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 5)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("features_request {")
with q.group():
@@ -4891,13 +5354,32 @@
q.breakable()
q.text('}')
-class flow_add(Message):
+message.subtypes[5] = features_request
+
+class flow_mod(message):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('B', 25)
+ try:
+ subclass = flow_mod.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown flow_mod message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+message.subtypes[14] = flow_mod
+
+class flow_add(flow_mod):
version = 4
type = 14
_command = 0
def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if cookie != None:
self.cookie = cookie
else:
@@ -4946,6 +5428,7 @@
self.instructions = instructions
else:
self.instructions = []
+ return
def pack(self):
packed = []
@@ -4966,24 +5449,21 @@
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 2)
packed.append(self.match.pack())
- packed.append(util.pack_list(self.instructions))
+ packed.append(loxi.generic_util.pack_list(self.instructions))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_add()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 14)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.cookie = reader.read("!Q")[0]
obj.cookie_mask = reader.read("!Q")[0]
@@ -4999,13 +5479,11 @@
obj.flags = reader.read("!H")[0]
reader.skip(2)
obj.match = common.match.unpack(reader)
- obj.instructions = instruction.unpack_list(reader)
+ obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.cookie != other.cookie: return False
if self.cookie_mask != other.cookie_mask: return False
@@ -5021,16 +5499,6 @@
if self.instructions != other.instructions: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_add {")
with q.group():
@@ -5080,13 +5548,18 @@
q.breakable()
q.text('}')
-class flow_delete(Message):
+flow_mod.subtypes[0] = flow_add
+
+class flow_delete(flow_mod):
version = 4
type = 14
_command = 3
def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if cookie != None:
self.cookie = cookie
else:
@@ -5135,6 +5608,7 @@
self.instructions = instructions
else:
self.instructions = []
+ return
def pack(self):
packed = []
@@ -5155,24 +5629,21 @@
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 2)
packed.append(self.match.pack())
- packed.append(util.pack_list(self.instructions))
+ packed.append(loxi.generic_util.pack_list(self.instructions))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_delete()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 14)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.cookie = reader.read("!Q")[0]
obj.cookie_mask = reader.read("!Q")[0]
@@ -5188,13 +5659,11 @@
obj.flags = reader.read("!H")[0]
reader.skip(2)
obj.match = common.match.unpack(reader)
- obj.instructions = instruction.unpack_list(reader)
+ obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.cookie != other.cookie: return False
if self.cookie_mask != other.cookie_mask: return False
@@ -5210,16 +5679,6 @@
if self.instructions != other.instructions: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_delete {")
with q.group():
@@ -5269,13 +5728,18 @@
q.breakable()
q.text('}')
-class flow_delete_strict(Message):
+flow_mod.subtypes[3] = flow_delete
+
+class flow_delete_strict(flow_mod):
version = 4
type = 14
_command = 4
def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if cookie != None:
self.cookie = cookie
else:
@@ -5324,6 +5788,7 @@
self.instructions = instructions
else:
self.instructions = []
+ return
def pack(self):
packed = []
@@ -5344,24 +5809,21 @@
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 2)
packed.append(self.match.pack())
- packed.append(util.pack_list(self.instructions))
+ packed.append(loxi.generic_util.pack_list(self.instructions))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_delete_strict()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 14)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.cookie = reader.read("!Q")[0]
obj.cookie_mask = reader.read("!Q")[0]
@@ -5377,13 +5839,11 @@
obj.flags = reader.read("!H")[0]
reader.skip(2)
obj.match = common.match.unpack(reader)
- obj.instructions = instruction.unpack_list(reader)
+ obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.cookie != other.cookie: return False
if self.cookie_mask != other.cookie_mask: return False
@@ -5399,16 +5859,6 @@
if self.instructions != other.instructions: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_delete_strict {")
with q.group():
@@ -5458,13 +5908,18 @@
q.breakable()
q.text('}')
-class flow_mod_failed_error_msg(Message):
+flow_mod.subtypes[4] = flow_delete_strict
+
+class flow_mod_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 5
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -5473,6 +5928,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -5488,18 +5944,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_mod_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 5)
@@ -5509,23 +5962,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_mod_failed_error_msg {")
with q.group():
@@ -5545,13 +5986,18 @@
q.breakable()
q.text('}')
-class flow_modify(Message):
+error_msg.subtypes[5] = flow_mod_failed_error_msg
+
+class flow_modify(flow_mod):
version = 4
type = 14
_command = 1
def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if cookie != None:
self.cookie = cookie
else:
@@ -5600,6 +6046,7 @@
self.instructions = instructions
else:
self.instructions = []
+ return
def pack(self):
packed = []
@@ -5620,24 +6067,21 @@
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 2)
packed.append(self.match.pack())
- packed.append(util.pack_list(self.instructions))
+ packed.append(loxi.generic_util.pack_list(self.instructions))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_modify()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 14)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.cookie = reader.read("!Q")[0]
obj.cookie_mask = reader.read("!Q")[0]
@@ -5653,13 +6097,11 @@
obj.flags = reader.read("!H")[0]
reader.skip(2)
obj.match = common.match.unpack(reader)
- obj.instructions = instruction.unpack_list(reader)
+ obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.cookie != other.cookie: return False
if self.cookie_mask != other.cookie_mask: return False
@@ -5675,16 +6117,6 @@
if self.instructions != other.instructions: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_modify {")
with q.group():
@@ -5734,13 +6166,18 @@
q.breakable()
q.text('}')
-class flow_modify_strict(Message):
+flow_mod.subtypes[1] = flow_modify
+
+class flow_modify_strict(flow_mod):
version = 4
type = 14
_command = 2
def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if cookie != None:
self.cookie = cookie
else:
@@ -5789,6 +6226,7 @@
self.instructions = instructions
else:
self.instructions = []
+ return
def pack(self):
packed = []
@@ -5809,24 +6247,21 @@
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 2)
packed.append(self.match.pack())
- packed.append(util.pack_list(self.instructions))
+ packed.append(loxi.generic_util.pack_list(self.instructions))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_modify_strict()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 14)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.cookie = reader.read("!Q")[0]
obj.cookie_mask = reader.read("!Q")[0]
@@ -5842,13 +6277,11 @@
obj.flags = reader.read("!H")[0]
reader.skip(2)
obj.match = common.match.unpack(reader)
- obj.instructions = instruction.unpack_list(reader)
+ obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.cookie != other.cookie: return False
if self.cookie_mask != other.cookie_mask: return False
@@ -5864,16 +6297,6 @@
if self.instructions != other.instructions: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_modify_strict {")
with q.group():
@@ -5923,12 +6346,17 @@
q.breakable()
q.text('}')
-class flow_removed(Message):
+flow_mod.subtypes[2] = flow_modify_strict
+
+class flow_removed(message):
version = 4
type = 11
def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if cookie != None:
self.cookie = cookie
else:
@@ -5973,6 +6401,7 @@
self.match = match
else:
self.match = common.match()
+ return
def pack(self):
packed = []
@@ -5996,18 +6425,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_removed()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 11)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.cookie = reader.read("!Q")[0]
obj.priority = reader.read("!H")[0]
@@ -6024,8 +6450,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.cookie != other.cookie: return False
if self.priority != other.priority: return False
@@ -6040,16 +6464,6 @@
if self.match != other.match: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_removed {")
with q.group():
@@ -6096,13 +6510,18 @@
q.breakable()
q.text('}')
-class flow_stats_reply(Message):
+message.subtypes[11] = flow_removed
+
+class flow_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 1
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -6111,6 +6530,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -6121,51 +6541,36 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 1)
obj.flags = reader.read("!H")[0]
reader.skip(4)
- obj.entries = common.unpack_list_flow_stats_entry(reader)
+ obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_stats_reply {")
with q.group():
@@ -6185,13 +6590,18 @@
q.breakable()
q.text('}')
-class flow_stats_request(Message):
+stats_reply.subtypes[1] = flow_stats_reply
+
+class flow_stats_request(stats_request):
version = 4
type = 18
stats_type = 1
def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -6220,6 +6630,7 @@
self.match = match
else:
self.match = common.match()
+ return
def pack(self):
packed = []
@@ -6243,18 +6654,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = flow_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 1)
@@ -6272,8 +6680,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.table_id != other.table_id: return False
@@ -6284,16 +6690,6 @@
if self.match != other.match: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("flow_stats_request {")
with q.group():
@@ -6328,12 +6724,17 @@
q.breakable()
q.text('}')
-class get_config_reply(Message):
+stats_request.subtypes[1] = flow_stats_request
+
+class get_config_reply(message):
version = 4
type = 8
def __init__(self, xid=None, flags=None, miss_send_len=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -6342,6 +6743,7 @@
self.miss_send_len = miss_send_len
else:
self.miss_send_len = 0
+ return
def pack(self):
packed = []
@@ -6356,18 +6758,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = get_config_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 8)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.flags = reader.read("!H")[0]
obj.miss_send_len = reader.read("!H")[0]
@@ -6375,23 +6774,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.miss_send_len != other.miss_send_len: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("get_config_reply {")
with q.group():
@@ -6411,12 +6798,18 @@
q.breakable()
q.text('}')
-class get_config_request(Message):
+message.subtypes[8] = get_config_reply
+
+class get_config_request(message):
version = 4
type = 7
def __init__(self, xid=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
+ return
def pack(self):
packed = []
@@ -6429,38 +6822,23 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = get_config_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 7)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("get_config_request {")
with q.group():
@@ -6474,13 +6852,32 @@
q.breakable()
q.text('}')
-class group_add(Message):
+message.subtypes[7] = get_config_request
+
+class group_mod(message):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!H', 8)
+ try:
+ subclass = group_mod.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown group_mod message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+message.subtypes[15] = group_mod
+
+class group_add(group_mod):
version = 4
type = 15
command = 0
def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if group_type != None:
self.group_type = group_type
else:
@@ -6493,6 +6890,7 @@
self.buckets = buckets
else:
self.buckets = []
+ return
def pack(self):
packed = []
@@ -6504,53 +6902,38 @@
packed.append(struct.pack("!B", self.group_type))
packed.append('\x00' * 1)
packed.append(struct.pack("!L", self.group_id))
- packed.append(util.pack_list(self.buckets))
+ packed.append(loxi.generic_util.pack_list(self.buckets))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_add()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 15)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_command = reader.read("!H")[0]
assert(_command == 0)
obj.group_type = reader.read("!B")[0]
reader.skip(1)
obj.group_id = reader.read("!L")[0]
- obj.buckets = common.unpack_list_bucket(reader)
+ obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.group_type != other.group_type: return False
if self.group_id != other.group_id: return False
if self.buckets != other.buckets: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_add {")
with q.group():
@@ -6573,13 +6956,18 @@
q.breakable()
q.text('}')
-class group_delete(Message):
+group_mod.subtypes[0] = group_add
+
+class group_delete(group_mod):
version = 4
type = 15
command = 2
def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if group_type != None:
self.group_type = group_type
else:
@@ -6592,6 +6980,7 @@
self.buckets = buckets
else:
self.buckets = []
+ return
def pack(self):
packed = []
@@ -6603,53 +6992,38 @@
packed.append(struct.pack("!B", self.group_type))
packed.append('\x00' * 1)
packed.append(struct.pack("!L", self.group_id))
- packed.append(util.pack_list(self.buckets))
+ packed.append(loxi.generic_util.pack_list(self.buckets))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_delete()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 15)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_command = reader.read("!H")[0]
assert(_command == 2)
obj.group_type = reader.read("!B")[0]
reader.skip(1)
obj.group_id = reader.read("!L")[0]
- obj.buckets = common.unpack_list_bucket(reader)
+ obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.group_type != other.group_type: return False
if self.group_id != other.group_id: return False
if self.buckets != other.buckets: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_delete {")
with q.group():
@@ -6672,13 +7046,18 @@
q.breakable()
q.text('}')
-class group_desc_stats_reply(Message):
+group_mod.subtypes[2] = group_delete
+
+class group_desc_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 7
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -6687,6 +7066,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -6697,51 +7077,36 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_desc_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 7)
obj.flags = reader.read("!H")[0]
reader.skip(4)
- obj.entries = common.unpack_list_group_desc_stats_entry(reader)
+ obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_desc_stats_reply {")
with q.group():
@@ -6761,17 +7126,23 @@
q.breakable()
q.text('}')
-class group_desc_stats_request(Message):
+stats_reply.subtypes[7] = group_desc_stats_reply
+
+class group_desc_stats_request(stats_request):
version = 4
type = 18
stats_type = 7
def __init__(self, xid=None, flags=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
self.flags = 0
+ return
def pack(self):
packed = []
@@ -6787,18 +7158,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_desc_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 7)
@@ -6808,22 +7176,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_desc_stats_request {")
with q.group():
@@ -6840,13 +7196,18 @@
q.breakable()
q.text('}')
-class group_features_stats_reply(Message):
+stats_request.subtypes[7] = group_desc_stats_request
+
+class group_features_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 8
def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -6891,6 +7252,7 @@
self.actions_ff = actions_ff
else:
self.actions_ff = 0
+ return
def pack(self):
packed = []
@@ -6916,18 +7278,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_features_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 8)
@@ -6947,8 +7306,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.types != other.types: return False
@@ -6963,16 +7320,6 @@
if self.actions_ff != other.actions_ff: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_features_stats_reply {")
with q.group():
@@ -7019,17 +7366,23 @@
q.breakable()
q.text('}')
-class group_features_stats_request(Message):
+stats_reply.subtypes[8] = group_features_stats_reply
+
+class group_features_stats_request(stats_request):
version = 4
type = 18
stats_type = 8
def __init__(self, xid=None, flags=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
self.flags = 0
+ return
def pack(self):
packed = []
@@ -7045,18 +7398,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_features_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 8)
@@ -7066,22 +7416,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_features_stats_request {")
with q.group():
@@ -7098,13 +7436,18 @@
q.breakable()
q.text('}')
-class group_mod_failed_error_msg(Message):
+stats_request.subtypes[8] = group_features_stats_request
+
+class group_mod_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 6
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -7113,6 +7456,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -7128,18 +7472,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_mod_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 6)
@@ -7149,23 +7490,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_mod_failed_error_msg {")
with q.group():
@@ -7185,13 +7514,18 @@
q.breakable()
q.text('}')
-class group_modify(Message):
+error_msg.subtypes[6] = group_mod_failed_error_msg
+
+class group_modify(group_mod):
version = 4
type = 15
command = 1
def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if group_type != None:
self.group_type = group_type
else:
@@ -7204,6 +7538,7 @@
self.buckets = buckets
else:
self.buckets = []
+ return
def pack(self):
packed = []
@@ -7215,53 +7550,38 @@
packed.append(struct.pack("!B", self.group_type))
packed.append('\x00' * 1)
packed.append(struct.pack("!L", self.group_id))
- packed.append(util.pack_list(self.buckets))
+ packed.append(loxi.generic_util.pack_list(self.buckets))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_modify()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 15)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_command = reader.read("!H")[0]
assert(_command == 1)
obj.group_type = reader.read("!B")[0]
reader.skip(1)
obj.group_id = reader.read("!L")[0]
- obj.buckets = common.unpack_list_bucket(reader)
+ obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.group_type != other.group_type: return False
if self.group_id != other.group_id: return False
if self.buckets != other.buckets: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_modify {")
with q.group():
@@ -7284,13 +7604,18 @@
q.breakable()
q.text('}')
-class group_stats_reply(Message):
+group_mod.subtypes[1] = group_modify
+
+class group_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 6
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -7299,6 +7624,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -7309,51 +7635,36 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 6)
obj.flags = reader.read("!H")[0]
reader.skip(4)
- obj.entries = common.unpack_list_group_stats_entry(reader)
+ obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_stats_reply {")
with q.group():
@@ -7373,13 +7684,18 @@
q.breakable()
q.text('}')
-class group_stats_request(Message):
+stats_reply.subtypes[6] = group_stats_reply
+
+class group_stats_request(stats_request):
version = 4
type = 18
stats_type = 6
def __init__(self, xid=None, flags=None, group_id=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -7388,6 +7704,7 @@
self.group_id = group_id
else:
self.group_id = 0
+ return
def pack(self):
packed = []
@@ -7405,18 +7722,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = group_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 6)
@@ -7428,23 +7742,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.group_id != other.group_id: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("group_stats_request {")
with q.group():
@@ -7464,16 +7766,22 @@
q.breakable()
q.text('}')
-class hello(Message):
+stats_request.subtypes[6] = group_stats_request
+
+class hello(message):
version = 4
type = 0
def __init__(self, xid=None, elements=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if elements != None:
self.elements = elements
else:
self.elements = []
+ return
def pack(self):
packed = []
@@ -7481,46 +7789,31 @@
packed.append(struct.pack("!B", self.type))
packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
packed.append(struct.pack("!L", self.xid))
- packed.append(util.pack_list(self.elements))
+ packed.append(loxi.generic_util.pack_list(self.elements))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = hello()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 0)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
- obj.elements = common.unpack_list_hello_elem(reader)
+ obj.elements = util.unpack_list_hello_elem(reader)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.elements != other.elements: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("hello {")
with q.group():
@@ -7537,13 +7830,18 @@
q.breakable()
q.text('}')
-class hello_failed_error_msg(Message):
+message.subtypes[0] = hello
+
+class hello_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 0
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -7552,6 +7850,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -7567,18 +7866,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = hello_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 0)
@@ -7588,23 +7884,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("hello_failed_error_msg {")
with q.group():
@@ -7624,13 +7908,18 @@
q.breakable()
q.text('}')
-class meter_config_stats_reply(Message):
+error_msg.subtypes[0] = hello_failed_error_msg
+
+class meter_config_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 10
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -7639,6 +7928,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -7649,51 +7939,36 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_config_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 10)
obj.flags = reader.read("!H")[0]
reader.skip(4)
- obj.entries = meter_band.unpack_list(reader)
+ obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_config_stats_reply {")
with q.group():
@@ -7713,13 +7988,18 @@
q.breakable()
q.text('}')
-class meter_config_stats_request(Message):
+stats_reply.subtypes[10] = meter_config_stats_reply
+
+class meter_config_stats_request(stats_request):
version = 4
type = 18
stats_type = 10
def __init__(self, xid=None, flags=None, meter_id=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -7728,6 +8008,7 @@
self.meter_id = meter_id
else:
self.meter_id = 0
+ return
def pack(self):
packed = []
@@ -7745,18 +8026,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_config_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 10)
@@ -7768,23 +8046,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.meter_id != other.meter_id: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_config_stats_request {")
with q.group():
@@ -7804,13 +8070,18 @@
q.breakable()
q.text('}')
-class meter_features_stats_reply(Message):
+stats_request.subtypes[10] = meter_config_stats_request
+
+class meter_features_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 11
def __init__(self, xid=None, flags=None, features=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -7819,6 +8090,7 @@
self.features = features
else:
self.features = common.meter_features()
+ return
def pack(self):
packed = []
@@ -7835,18 +8107,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_features_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 11)
@@ -7857,23 +8126,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.features != other.features: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_features_stats_reply {")
with q.group():
@@ -7893,17 +8150,23 @@
q.breakable()
q.text('}')
-class meter_features_stats_request(Message):
+stats_reply.subtypes[11] = meter_features_stats_reply
+
+class meter_features_stats_request(stats_request):
version = 4
type = 18
stats_type = 11
def __init__(self, xid=None, flags=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
self.flags = 0
+ return
def pack(self):
packed = []
@@ -7919,18 +8182,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_features_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 11)
@@ -7940,22 +8200,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_features_stats_request {")
with q.group():
@@ -7972,12 +8220,17 @@
q.breakable()
q.text('}')
-class meter_mod(Message):
+stats_request.subtypes[11] = meter_features_stats_request
+
+class meter_mod(message):
version = 4
type = 29
def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if command != None:
self.command = command
else:
@@ -7994,6 +8247,7 @@
self.meters = meters
else:
self.meters = []
+ return
def pack(self):
packed = []
@@ -8004,35 +8258,30 @@
packed.append(struct.pack("!H", self.command))
packed.append(struct.pack("!H", self.flags))
packed.append(struct.pack("!L", self.meter_id))
- packed.append(util.pack_list(self.meters))
+ packed.append(loxi.generic_util.pack_list(self.meters))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_mod()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 29)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.command = reader.read("!H")[0]
obj.flags = reader.read("!H")[0]
obj.meter_id = reader.read("!L")[0]
- obj.meters = meter_band.unpack_list(reader)
+ obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.command != other.command: return False
if self.flags != other.flags: return False
@@ -8040,16 +8289,6 @@
if self.meters != other.meters: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_mod {")
with q.group():
@@ -8075,13 +8314,18 @@
q.breakable()
q.text('}')
-class meter_mod_failed_error_msg(Message):
+message.subtypes[29] = meter_mod
+
+class meter_mod_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 12
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -8090,6 +8334,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -8105,18 +8350,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_mod_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 12)
@@ -8126,23 +8368,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_mod_failed_error_msg {")
with q.group():
@@ -8162,13 +8392,18 @@
q.breakable()
q.text('}')
-class meter_stats_reply(Message):
+error_msg.subtypes[12] = meter_mod_failed_error_msg
+
+class meter_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 9
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -8177,6 +8412,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -8187,51 +8423,36 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 9)
obj.flags = reader.read("!H")[0]
reader.skip(4)
- obj.entries = common.unpack_list_meter_stats(reader)
+ obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_stats_reply {")
with q.group():
@@ -8251,13 +8472,18 @@
q.breakable()
q.text('}')
-class meter_stats_request(Message):
+stats_reply.subtypes[9] = meter_stats_reply
+
+class meter_stats_request(stats_request):
version = 4
type = 18
stats_type = 9
def __init__(self, xid=None, flags=None, meter_id=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -8266,6 +8492,7 @@
self.meter_id = meter_id
else:
self.meter_id = 0
+ return
def pack(self):
packed = []
@@ -8283,18 +8510,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = meter_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 9)
@@ -8306,23 +8530,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.meter_id != other.meter_id: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("meter_stats_request {")
with q.group():
@@ -8342,12 +8554,31 @@
q.breakable()
q.text('}')
-class packet_in(Message):
+stats_request.subtypes[9] = meter_stats_request
+
+class nicira_header(experimenter):
+ subtypes = {}
+
+ @staticmethod
+ def unpack(reader):
+ subtype, = reader.peek('!L', 12)
+ try:
+ subclass = nicira_header.subtypes[subtype]
+ except KeyError:
+ raise loxi.ProtocolError("unknown nicira_header experimenter message subtype %#x" % subtype)
+ return subclass.unpack(reader)
+
+experimenter.subtypes[8992] = nicira_header
+
+class packet_in(message):
version = 4
type = 10
def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if buffer_id != None:
self.buffer_id = buffer_id
else:
@@ -8376,6 +8607,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -8396,18 +8628,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = packet_in()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 10)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.buffer_id = reader.read("!L")[0]
obj.total_len = reader.read("!H")[0]
@@ -8421,8 +8650,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.buffer_id != other.buffer_id: return False
if self.total_len != other.total_len: return False
@@ -8433,16 +8660,6 @@
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("packet_in {")
with q.group():
@@ -8477,12 +8694,17 @@
q.breakable()
q.text('}')
-class packet_out(Message):
+message.subtypes[10] = packet_in
+
+class packet_out(message):
version = 4
type = 13
def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if buffer_id != None:
self.buffer_id = buffer_id
else:
@@ -8499,6 +8721,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -8510,7 +8733,7 @@
packed.append(util.pack_port_no(self.in_port))
packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
packed.append('\x00' * 6)
- packed.append(util.pack_list(self.actions))
+ packed.append(loxi.generic_util.pack_list(self.actions))
packed[6] = struct.pack("!H", len(packed[-1]))
packed.append(self.data)
length = sum([len(x) for x in packed])
@@ -8518,31 +8741,26 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = packet_out()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 13)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.buffer_id = reader.read("!L")[0]
obj.in_port = util.unpack_port_no(reader)
_actions_len = reader.read("!H")[0]
reader.skip(6)
- obj.actions = action.unpack_list(reader.slice(_actions_len))
+ obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
obj.data = str(reader.read_all())
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.buffer_id != other.buffer_id: return False
if self.in_port != other.in_port: return False
@@ -8550,16 +8768,6 @@
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("packet_out {")
with q.group():
@@ -8585,13 +8793,18 @@
q.breakable()
q.text('}')
-class port_desc_stats_reply(Message):
+message.subtypes[13] = packet_out
+
+class port_desc_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 13
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -8600,6 +8813,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -8610,24 +8824,21 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = port_desc_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 13)
@@ -8638,23 +8849,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("port_desc_stats_reply {")
with q.group():
@@ -8674,17 +8873,23 @@
q.breakable()
q.text('}')
-class port_desc_stats_request(Message):
+stats_reply.subtypes[13] = port_desc_stats_reply
+
+class port_desc_stats_request(stats_request):
version = 4
type = 18
stats_type = 13
def __init__(self, xid=None, flags=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
self.flags = 0
+ return
def pack(self):
packed = []
@@ -8700,18 +8905,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = port_desc_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 13)
@@ -8721,22 +8923,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("port_desc_stats_request {")
with q.group():
@@ -8753,12 +8943,17 @@
q.breakable()
q.text('}')
-class port_mod(Message):
+stats_request.subtypes[13] = port_desc_stats_request
+
+class port_mod(message):
version = 4
type = 16
def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if port_no != None:
self.port_no = port_no
else:
@@ -8779,6 +8974,7 @@
self.advertise = advertise
else:
self.advertise = 0
+ return
def pack(self):
packed = []
@@ -8799,18 +8995,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = port_mod()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 16)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.port_no = util.unpack_port_no(reader)
reader.skip(4)
@@ -8824,8 +9017,6 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.port_no != other.port_no: return False
if self.hw_addr != other.hw_addr: return False
@@ -8834,16 +9025,6 @@
if self.advertise != other.advertise: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("port_mod {")
with q.group():
@@ -8872,13 +9053,18 @@
q.breakable()
q.text('}')
-class port_mod_failed_error_msg(Message):
+message.subtypes[16] = port_mod
+
+class port_mod_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 7
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -8887,6 +9073,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -8902,18 +9089,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = port_mod_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 7)
@@ -8923,23 +9107,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("port_mod_failed_error_msg {")
with q.group():
@@ -8959,13 +9131,18 @@
q.breakable()
q.text('}')
-class port_stats_reply(Message):
+error_msg.subtypes[7] = port_mod_failed_error_msg
+
+class port_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 4
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -8974,6 +9151,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -8984,24 +9162,21 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = port_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 4)
@@ -9012,23 +9187,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("port_stats_reply {")
with q.group():
@@ -9048,13 +9211,18 @@
q.breakable()
q.text('}')
-class port_stats_request(Message):
+stats_reply.subtypes[4] = port_stats_reply
+
+class port_stats_request(stats_request):
version = 4
type = 18
stats_type = 4
def __init__(self, xid=None, flags=None, port_no=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -9063,6 +9231,7 @@
self.port_no = port_no
else:
self.port_no = 0
+ return
def pack(self):
packed = []
@@ -9080,18 +9249,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = port_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 4)
@@ -9103,23 +9269,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.port_no != other.port_no: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("port_stats_request {")
with q.group():
@@ -9139,12 +9293,17 @@
q.breakable()
q.text('}')
-class port_status(Message):
+stats_request.subtypes[4] = port_stats_request
+
+class port_status(message):
version = 4
type = 12
def __init__(self, xid=None, reason=None, desc=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if reason != None:
self.reason = reason
else:
@@ -9153,6 +9312,7 @@
self.desc = desc
else:
self.desc = common.port_desc()
+ return
def pack(self):
packed = []
@@ -9168,18 +9328,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = port_status()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 12)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.reason = reader.read("!B")[0]
reader.skip(7)
@@ -9188,23 +9345,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.reason != other.reason: return False
if self.desc != other.desc: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("port_status {")
with q.group():
@@ -9224,12 +9369,17 @@
q.breakable()
q.text('}')
-class queue_get_config_reply(Message):
+message.subtypes[12] = port_status
+
+class queue_get_config_reply(message):
version = 4
type = 23
def __init__(self, xid=None, port=None, queues=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if port != None:
self.port = port
else:
@@ -9238,6 +9388,7 @@
self.queues = queues
else:
self.queues = []
+ return
def pack(self):
packed = []
@@ -9247,49 +9398,34 @@
packed.append(struct.pack("!L", self.xid))
packed.append(util.pack_port_no(self.port))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.queues))
+ packed.append(loxi.generic_util.pack_list(self.queues))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = queue_get_config_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 23)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.port = util.unpack_port_no(reader)
reader.skip(4)
- obj.queues = common.unpack_list_packet_queue(reader)
+ obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.port != other.port: return False
if self.queues != other.queues: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("queue_get_config_reply {")
with q.group():
@@ -9309,16 +9445,22 @@
q.breakable()
q.text('}')
-class queue_get_config_request(Message):
+message.subtypes[23] = queue_get_config_reply
+
+class queue_get_config_request(message):
version = 4
type = 22
def __init__(self, xid=None, port=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if port != None:
self.port = port
else:
self.port = 0
+ return
def pack(self):
packed = []
@@ -9333,18 +9475,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = queue_get_config_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 22)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.port = util.unpack_port_no(reader)
reader.skip(4)
@@ -9352,22 +9491,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.port != other.port: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("queue_get_config_request {")
with q.group():
@@ -9384,13 +9511,18 @@
q.breakable()
q.text('}')
-class queue_op_failed_error_msg(Message):
+message.subtypes[22] = queue_get_config_request
+
+class queue_op_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 9
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -9399,6 +9531,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -9414,18 +9547,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = queue_op_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 9)
@@ -9435,23 +9565,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("queue_op_failed_error_msg {")
with q.group():
@@ -9471,13 +9589,18 @@
q.breakable()
q.text('}')
-class queue_stats_reply(Message):
+error_msg.subtypes[9] = queue_op_failed_error_msg
+
+class queue_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 5
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -9486,6 +9609,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -9496,24 +9620,21 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = queue_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 5)
@@ -9524,23 +9645,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("queue_stats_reply {")
with q.group():
@@ -9560,13 +9669,18 @@
q.breakable()
q.text('}')
-class queue_stats_request(Message):
+stats_reply.subtypes[5] = queue_stats_reply
+
+class queue_stats_request(stats_request):
version = 4
type = 18
stats_type = 5
def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -9579,6 +9693,7 @@
self.queue_id = queue_id
else:
self.queue_id = 0
+ return
def pack(self):
packed = []
@@ -9596,18 +9711,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = queue_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 5)
@@ -9619,24 +9731,12 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.port_no != other.port_no: return False
if self.queue_id != other.queue_id: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("queue_stats_request {")
with q.group():
@@ -9659,12 +9759,17 @@
q.breakable()
q.text('}')
-class role_reply(Message):
+stats_request.subtypes[5] = queue_stats_request
+
+class role_reply(message):
version = 4
type = 25
def __init__(self, xid=None, role=None, generation_id=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if role != None:
self.role = role
else:
@@ -9673,6 +9778,7 @@
self.generation_id = generation_id
else:
self.generation_id = 0
+ return
def pack(self):
packed = []
@@ -9688,18 +9794,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = role_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 25)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.role = reader.read("!L")[0]
reader.skip(4)
@@ -9708,23 +9811,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.role != other.role: return False
if self.generation_id != other.generation_id: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("role_reply {")
with q.group():
@@ -9744,12 +9835,17 @@
q.breakable()
q.text('}')
-class role_request(Message):
+message.subtypes[25] = role_reply
+
+class role_request(message):
version = 4
type = 24
def __init__(self, xid=None, role=None, generation_id=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if role != None:
self.role = role
else:
@@ -9758,6 +9854,7 @@
self.generation_id = generation_id
else:
self.generation_id = 0
+ return
def pack(self):
packed = []
@@ -9773,18 +9870,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = role_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 24)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.role = reader.read("!L")[0]
reader.skip(4)
@@ -9793,23 +9887,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.role != other.role: return False
if self.generation_id != other.generation_id: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("role_request {")
with q.group():
@@ -9829,13 +9911,18 @@
q.breakable()
q.text('}')
-class role_request_failed_error_msg(Message):
+message.subtypes[24] = role_request
+
+class role_request_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 11
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -9844,6 +9931,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -9859,18 +9947,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = role_request_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 11)
@@ -9880,23 +9965,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("role_request_failed_error_msg {")
with q.group():
@@ -9916,12 +9989,17 @@
q.breakable()
q.text('}')
-class set_config(Message):
+error_msg.subtypes[11] = role_request_failed_error_msg
+
+class set_config(message):
version = 4
type = 9
def __init__(self, xid=None, flags=None, miss_send_len=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -9930,6 +10008,7 @@
self.miss_send_len = miss_send_len
else:
self.miss_send_len = 0
+ return
def pack(self):
packed = []
@@ -9944,18 +10023,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = set_config()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 9)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.flags = reader.read("!H")[0]
obj.miss_send_len = reader.read("!H")[0]
@@ -9963,23 +10039,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.miss_send_len != other.miss_send_len: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("set_config {")
with q.group():
@@ -9999,13 +10063,18 @@
q.breakable()
q.text('}')
-class switch_config_failed_error_msg(Message):
+message.subtypes[9] = set_config
+
+class switch_config_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 10
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -10014,6 +10083,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -10029,18 +10099,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = switch_config_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 10)
@@ -10050,23 +10117,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("switch_config_failed_error_msg {")
with q.group():
@@ -10086,13 +10141,18 @@
q.breakable()
q.text('}')
-class table_features_failed_error_msg(Message):
+error_msg.subtypes[10] = switch_config_failed_error_msg
+
+class table_features_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 13
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -10101,6 +10161,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -10116,18 +10177,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = table_features_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 13)
@@ -10137,23 +10195,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("table_features_failed_error_msg {")
with q.group():
@@ -10173,13 +10219,18 @@
q.breakable()
q.text('}')
-class table_features_stats_reply(Message):
+error_msg.subtypes[13] = table_features_failed_error_msg
+
+class table_features_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 12
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -10188,6 +10239,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -10198,51 +10250,36 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = table_features_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 12)
obj.flags = reader.read("!H")[0]
reader.skip(4)
- obj.entries = loxi.unimplemented('unpack list(of_table_features_t)')
+ obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("table_features_stats_reply {")
with q.group():
@@ -10262,13 +10299,18 @@
q.breakable()
q.text('}')
-class table_features_stats_request(Message):
+stats_reply.subtypes[12] = table_features_stats_reply
+
+class table_features_stats_request(stats_request):
version = 4
type = 18
stats_type = 12
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -10277,6 +10319,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -10287,51 +10330,36 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = table_features_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 12)
obj.flags = reader.read("!H")[0]
reader.skip(4)
- obj.entries = loxi.unimplemented('unpack list(of_table_features_t)')
+ obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
return obj
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("table_features_stats_request {")
with q.group():
@@ -10351,12 +10379,17 @@
q.breakable()
q.text('}')
-class table_mod(Message):
+stats_request.subtypes[12] = table_features_stats_request
+
+class table_mod(message):
version = 4
type = 17
def __init__(self, xid=None, table_id=None, config=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if table_id != None:
self.table_id = table_id
else:
@@ -10365,6 +10398,7 @@
self.config = config
else:
self.config = 0
+ return
def pack(self):
packed = []
@@ -10380,18 +10414,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = table_mod()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 17)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
obj.table_id = reader.read("!B")[0]
reader.skip(3)
@@ -10400,23 +10431,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.table_id != other.table_id: return False
if self.config != other.config: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("table_mod {")
with q.group():
@@ -10436,13 +10455,18 @@
q.breakable()
q.text('}')
-class table_mod_failed_error_msg(Message):
+message.subtypes[17] = table_mod
+
+class table_mod_failed_error_msg(error_msg):
version = 4
type = 1
err_type = 8
def __init__(self, xid=None, code=None, data=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if code != None:
self.code = code
else:
@@ -10451,6 +10475,7 @@
self.data = data
else:
self.data = ''
+ return
def pack(self):
packed = []
@@ -10466,18 +10491,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = table_mod_failed_error_msg()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 1)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_err_type = reader.read("!H")[0]
assert(_err_type == 8)
@@ -10487,23 +10509,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.code != other.code: return False
if self.data != other.data: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("table_mod_failed_error_msg {")
with q.group():
@@ -10523,13 +10533,18 @@
q.breakable()
q.text('}')
-class table_stats_reply(Message):
+error_msg.subtypes[8] = table_mod_failed_error_msg
+
+class table_stats_reply(stats_reply):
version = 4
type = 19
stats_type = 3
def __init__(self, xid=None, flags=None, entries=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
@@ -10538,6 +10553,7 @@
self.entries = entries
else:
self.entries = []
+ return
def pack(self):
packed = []
@@ -10548,24 +10564,21 @@
packed.append(struct.pack("!H", self.stats_type))
packed.append(struct.pack("!H", self.flags))
packed.append('\x00' * 4)
- packed.append(util.pack_list(self.entries))
+ packed.append(loxi.generic_util.pack_list(self.entries))
length = sum([len(x) for x in packed])
packed[2] = struct.pack("!H", length)
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = table_stats_reply()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 19)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 3)
@@ -10576,23 +10589,11 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
if self.entries != other.entries: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("table_stats_reply {")
with q.group():
@@ -10612,17 +10613,23 @@
q.breakable()
q.text('}')
-class table_stats_request(Message):
+stats_reply.subtypes[3] = table_stats_reply
+
+class table_stats_request(stats_request):
version = 4
type = 18
stats_type = 3
def __init__(self, xid=None, flags=None):
- self.xid = xid
+ if xid != None:
+ self.xid = xid
+ else:
+ self.xid = None
if flags != None:
self.flags = flags
else:
self.flags = 0
+ return
def pack(self):
packed = []
@@ -10638,18 +10645,15 @@
return ''.join(packed)
@staticmethod
- def unpack(buf):
- if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message")
+ def unpack(reader):
obj = table_stats_request()
- if type(buf) == loxi.generic_util.OFReader:
- reader = buf
- else:
- reader = loxi.generic_util.OFReader(buf)
_version = reader.read("!B")[0]
assert(_version == 4)
_type = reader.read("!B")[0]
assert(_type == 18)
_length = reader.read("!H")[0]
+ orig_reader = reader
+ reader = orig_reader.slice(_length - (2 + 2))
obj.xid = reader.read("!L")[0]
_stats_type = reader.read("!H")[0]
assert(_stats_type == 3)
@@ -10659,22 +10663,10 @@
def __eq__(self, other):
if type(self) != type(other): return False
- if self.version != other.version: return False
- if self.type != other.type: return False
if self.xid != other.xid: return False
if self.flags != other.flags: return False
return True
- def __ne__(self, other):
- return not self.__eq__(other)
-
- def __str__(self):
- return self.show()
-
- def show(self):
- import loxi.pp
- return loxi.pp.pp(self)
-
def pretty_print(self, q):
q.text("table_stats_request {")
with q.group():
@@ -10691,6 +10683,8 @@
q.breakable()
q.text('}')
+stats_request.subtypes[3] = table_stats_request
+
def parse_header(buf):
if len(buf) < 8:
@@ -10703,244 +10697,4 @@
raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
if len(buf) != msg_len:
raise loxi.ProtocolError("incorrect message size")
- if msg_type in parsers:
- return parsers[msg_type](buf)
- else:
- raise loxi.ProtocolError("unexpected message type")
-
-def parse_error(buf):
- if len(buf) < 8 + 2:
- raise loxi.ProtocolError("message too short")
- err_type, = struct.unpack_from("!H", buf, 8)
- if err_type in error_msg_parsers:
- return error_msg_parsers[err_type](buf)
- else:
- raise loxi.ProtocolError("unexpected error type %u" % err_type)
-
-def parse_flow_mod(buf):
- if len(buf) < 25 + 1:
- raise loxi.ProtocolError("message too short")
- # Technically uint16_t for OF 1.0
- cmd, = struct.unpack_from("!B", buf, 25)
- if cmd in flow_mod_parsers:
- return flow_mod_parsers[cmd](buf)
- else:
- raise loxi.ProtocolError("unexpected flow mod cmd %u" % cmd)
-
-def parse_group_mod(buf):
- if len(buf) < 8 + 2:
- raise loxi.ProtocolError("message too short")
- cmd, = struct.unpack_from("!H", buf, 8)
- if cmd in flow_mod_parsers:
- return group_mod_parsers[cmd](buf)
- else:
- raise loxi.ProtocolError("unexpected group mod cmd %u" % cmd)
-
-def parse_stats_reply(buf):
- if len(buf) < 8 + 2:
- raise loxi.ProtocolError("message too short")
- stats_type, = struct.unpack_from("!H", buf, 8)
- if stats_type in stats_reply_parsers:
- return stats_reply_parsers[stats_type](buf)
- else:
- raise loxi.ProtocolError("unexpected stats type %u" % stats_type)
-
-def parse_stats_request(buf):
- if len(buf) < 8 + 2:
- raise loxi.ProtocolError("message too short")
- stats_type, = struct.unpack_from("!H", buf, 8)
- if stats_type in stats_request_parsers:
- return stats_request_parsers[stats_type](buf)
- else:
- raise loxi.ProtocolError("unexpected stats type %u" % stats_type)
-
-def parse_experimenter_stats_request(buf):
- if len(buf) < 24:
- raise loxi.ProtocolError("experimenter stats request message too short")
-
- experimenter, exp_type = struct.unpack_from("!LL", buf, 16)
-
- if experimenter in experimenter_stats_request_parsers and \
- exp_type in experimenter_stats_request_parsers[experimenter]:
- return experimenter_stats_request_parsers[experimenter][exp_type](buf)
- else:
- raise loxi.ProtocolError("unexpected stats request experimenter %#x exp_type %#x" % (experimenter, exp_type))
-
-def parse_experimenter_stats_reply(buf):
- if len(buf) < 24:
- raise loxi.ProtocolError("experimenter stats reply message too short")
-
- experimenter, exp_type = struct.unpack_from("!LL", buf, 16)
-
- if experimenter in experimenter_stats_reply_parsers and \
- exp_type in experimenter_stats_reply_parsers[experimenter]:
- return experimenter_stats_reply_parsers[experimenter][exp_type](buf)
- else:
- raise loxi.ProtocolError("unexpected stats reply experimenter %#x exp_type %#x" % (experimenter, exp_type))
-
-def parse_experimenter(buf):
- if len(buf) < 16:
- raise loxi.ProtocolError("experimenter message too short")
-
- experimenter, = struct.unpack_from("!L", buf, 8)
- if experimenter == 0x005c16c7: # Big Switch Networks
- subtype, = struct.unpack_from("!L", buf, 12)
- elif experimenter == 0x00002320: # Nicira
- subtype, = struct.unpack_from("!L", buf, 12)
- else:
- raise loxi.ProtocolError("unexpected experimenter id %#x" % experimenter)
-
- if subtype in experimenter_parsers[experimenter]:
- return experimenter_parsers[experimenter][subtype](buf)
- else:
- raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype))
-
-parsers = {
- const.OFPT_HELLO : hello.unpack,
- const.OFPT_ERROR : parse_error,
- const.OFPT_ECHO_REQUEST : echo_request.unpack,
- const.OFPT_ECHO_REPLY : echo_reply.unpack,
- const.OFPT_EXPERIMENTER : parse_experimenter,
- const.OFPT_FEATURES_REQUEST : features_request.unpack,
- const.OFPT_FEATURES_REPLY : features_reply.unpack,
- const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack,
- const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack,
- const.OFPT_SET_CONFIG : set_config.unpack,
- const.OFPT_PACKET_IN : packet_in.unpack,
- const.OFPT_FLOW_REMOVED : flow_removed.unpack,
- const.OFPT_PORT_STATUS : port_status.unpack,
- const.OFPT_PACKET_OUT : packet_out.unpack,
- const.OFPT_FLOW_MOD : parse_flow_mod,
- const.OFPT_GROUP_MOD : parse_group_mod,
- const.OFPT_PORT_MOD : port_mod.unpack,
- const.OFPT_TABLE_MOD : table_mod.unpack,
- const.OFPT_STATS_REQUEST : parse_stats_request,
- const.OFPT_STATS_REPLY : parse_stats_reply,
- const.OFPT_BARRIER_REQUEST : barrier_request.unpack,
- const.OFPT_BARRIER_REPLY : barrier_reply.unpack,
- const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack,
- const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack,
- const.OFPT_ROLE_REQUEST : role_request.unpack,
- const.OFPT_ROLE_REPLY : role_reply.unpack,
- const.OFPT_GET_ASYNC_REQUEST : async_get_request.unpack,
- const.OFPT_GET_ASYNC_REPLY : async_get_reply.unpack,
- const.OFPT_SET_ASYNC : async_set.unpack,
- const.OFPT_METER_MOD : meter_mod.unpack,
-}
-
-error_msg_parsers = {
- const.OFPET_HELLO_FAILED : hello_failed_error_msg.unpack,
- const.OFPET_BAD_REQUEST : bad_request_error_msg.unpack,
- const.OFPET_BAD_ACTION : bad_action_error_msg.unpack,
- const.OFPET_FLOW_MOD_FAILED : flow_mod_failed_error_msg.unpack,
- const.OFPET_PORT_MOD_FAILED : port_mod_failed_error_msg.unpack,
- const.OFPET_QUEUE_OP_FAILED : queue_op_failed_error_msg.unpack,
- const.OFPET_BAD_INSTRUCTION : bad_instruction_error_msg.unpack,
- const.OFPET_BAD_MATCH : bad_match_error_msg.unpack,
- const.OFPET_GROUP_MOD_FAILED : group_mod_failed_error_msg.unpack,
- const.OFPET_TABLE_MOD_FAILED : table_mod_failed_error_msg.unpack,
- const.OFPET_SWITCH_CONFIG_FAILED : switch_config_failed_error_msg.unpack,
- const.OFPET_ROLE_REQUEST_FAILED : role_request_failed_error_msg.unpack,
- const.OFPET_EXPERIMENTER : experimenter_error_msg.unpack,
- const.OFPET_METER_MOD_FAILED : meter_mod_failed_error_msg.unpack,
- const.OFPET_TABLE_FEATURES_FAILED : table_features_failed_error_msg.unpack,
-}
-
-flow_mod_parsers = {
- const.OFPFC_ADD : flow_add.unpack,
- const.OFPFC_MODIFY : flow_modify.unpack,
- const.OFPFC_MODIFY_STRICT : flow_modify_strict.unpack,
- const.OFPFC_DELETE : flow_delete.unpack,
- const.OFPFC_DELETE_STRICT : flow_delete_strict.unpack,
-}
-
-group_mod_parsers = {
- const.OFPGC_ADD : group_add.unpack,
- const.OFPGC_MODIFY : group_modify.unpack,
- const.OFPGC_DELETE : group_delete.unpack,
-}
-
-stats_reply_parsers = {
- const.OFPST_DESC : desc_stats_reply.unpack,
- const.OFPST_FLOW : flow_stats_reply.unpack,
- const.OFPST_AGGREGATE : aggregate_stats_reply.unpack,
- const.OFPST_TABLE : table_stats_reply.unpack,
- const.OFPST_PORT : port_stats_reply.unpack,
- const.OFPST_QUEUE : queue_stats_reply.unpack,
- const.OFPST_EXPERIMENTER : parse_experimenter_stats_reply,
- const.OFPST_GROUP : group_stats_reply.unpack,
- const.OFPST_GROUP_DESC : group_desc_stats_reply.unpack,
- const.OFPST_GROUP_FEATURES : group_features_stats_reply.unpack,
- const.OFPST_METER : meter_stats_reply.unpack,
- const.OFPST_METER_CONFIG : meter_config_stats_reply.unpack,
- const.OFPST_METER_FEATURES : meter_features_stats_reply.unpack,
- const.OFPST_TABLE_FEATURES : table_features_stats_reply.unpack,
- const.OFPST_PORT_DESC : port_desc_stats_reply.unpack,
-}
-
-stats_request_parsers = {
- const.OFPST_DESC : desc_stats_request.unpack,
- const.OFPST_FLOW : flow_stats_request.unpack,
- const.OFPST_AGGREGATE : aggregate_stats_request.unpack,
- const.OFPST_TABLE : table_stats_request.unpack,
- const.OFPST_PORT : port_stats_request.unpack,
- const.OFPST_QUEUE : queue_stats_request.unpack,
- const.OFPST_EXPERIMENTER : parse_experimenter_stats_request,
- const.OFPST_GROUP : group_stats_request.unpack,
- const.OFPST_GROUP_DESC : group_desc_stats_request.unpack,
- const.OFPST_GROUP_FEATURES : group_features_stats_request.unpack,
- const.OFPST_METER : meter_stats_request.unpack,
- const.OFPST_METER_CONFIG : meter_config_stats_request.unpack,
- const.OFPST_METER_FEATURES : meter_features_stats_request.unpack,
- const.OFPST_TABLE_FEATURES : table_features_stats_request.unpack,
- const.OFPST_PORT_DESC : port_desc_stats_request.unpack,
-}
-
-experimenter_parsers = {
- 6035143 : {
- 22: bsn_bw_clear_data_reply.unpack,
- 21: bsn_bw_clear_data_request.unpack,
- 20: bsn_bw_enable_get_reply.unpack,
- 19: bsn_bw_enable_get_request.unpack,
- 23: bsn_bw_enable_set_reply.unpack,
- 18: bsn_bw_enable_set_request.unpack,
- 40: bsn_flow_idle.unpack,
- 39: bsn_flow_idle_enable_get_reply.unpack,
- 38: bsn_flow_idle_enable_get_request.unpack,
- 37: bsn_flow_idle_enable_set_reply.unpack,
- 36: bsn_flow_idle_enable_set_request.unpack,
- 10: bsn_get_interfaces_reply.unpack,
- 9: bsn_get_interfaces_request.unpack,
- 5: bsn_get_mirroring_reply.unpack,
- 4: bsn_get_mirroring_request.unpack,
- 43: bsn_lacp_convergence_notif.unpack,
- 34: bsn_pdu_rx_reply.unpack,
- 33: bsn_pdu_rx_request.unpack,
- 35: bsn_pdu_rx_timeout.unpack,
- 32: bsn_pdu_tx_reply.unpack,
- 31: bsn_pdu_tx_request.unpack,
- 42: bsn_set_lacp_reply.unpack,
- 41: bsn_set_lacp_request.unpack,
- 3: bsn_set_mirroring.unpack,
- 25: bsn_set_pktin_suppression_reply.unpack,
- 11: bsn_set_pktin_suppression_request.unpack,
- 45: bsn_time_reply.unpack,
- 44: bsn_time_request.unpack,
- 16: bsn_virtual_port_create_reply.unpack,
- 15: bsn_virtual_port_create_request.unpack,
- 26: bsn_virtual_port_remove_reply.unpack,
- 17: bsn_virtual_port_remove_request.unpack,
- },
-}
-
-experimenter_stats_request_parsers = {
- 0x005c16c7: {
- 1: bsn_lacp_stats_request.unpack,
- },
-}
-
-experimenter_stats_reply_parsers = {
- 0x005c16c7: {
- 1: bsn_lacp_stats_reply.unpack,
- },
-}
+ return message.unpack(loxi.generic_util.OFReader(buf))