loxi-prep: move header fields into the message classes
diff --git a/src/python/of10/message.py b/src/python/of10/message.py
index d614110..5b4ce02 100644
--- a/src/python/of10/message.py
+++ b/src/python/of10/message.py
@@ -19,7 +19,6 @@
Constructor for base class
"""
- self.header = ofp_header()
# Additional base data members declared here
# Normally will define pack, unpack, __len__ functions
@@ -42,9 +41,8 @@
##@var header
# OpenFlow message header: length, version, xid, type
ofp_template_msg.__init__(self)
- self.header = ofp_header()
# For a real message, will be set to an integer
- self.header.type = "TEMPLATE_MSG_VALUE"
+ self.type = "TEMPLATE_MSG_VALUE"
def pack(self):
"""
Pack object into string
@@ -107,7 +105,7 @@
#
################################################################
-class barrier_reply:
+class barrier_reply(ofp_header):
"""
Wrapper class for barrier_reply
@@ -117,12 +115,18 @@
@arg xid: The transaction ID
@arg type: The message type (OFPT_BARRIER_REPLY=19)
+ Data members inherited from ofp_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_BARRIER_REPLY
+ ofp_header.__init__(self)
+ self.version = OFP_VERSION
+ self.type = OFPT_BARRIER_REPLY
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -137,9 +141,10 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
+ packed += ofp_header.pack(self)
return packed
def unpack(self, binary_string):
@@ -151,8 +156,8 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
+ binary_string = ofp_header.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
return binary_string
@@ -164,8 +169,9 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
+ length += ofp_header.__len__(self)
return length
def show(self, prefix=''):
@@ -180,7 +186,7 @@
outstr = prefix + 'barrier_reply (OFPT_BARRIER_REPLY)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
+ outstr += ofp_header.show(self, prefix)
return outstr
def __eq__(self, other):
@@ -191,8 +197,8 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
+ if not ofp_header.__eq__(self, other): return False
return True
def __ne__(self, other):
@@ -205,7 +211,7 @@
return not self.__eq__(other)
-class barrier_request:
+class barrier_request(ofp_header):
"""
Wrapper class for barrier_request
@@ -215,12 +221,18 @@
@arg xid: The transaction ID
@arg type: The message type (OFPT_BARRIER_REQUEST=18)
+ Data members inherited from ofp_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_BARRIER_REQUEST
+ ofp_header.__init__(self)
+ self.version = OFP_VERSION
+ self.type = OFPT_BARRIER_REQUEST
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -235,9 +247,10 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
+ packed += ofp_header.pack(self)
return packed
def unpack(self, binary_string):
@@ -249,8 +262,8 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
+ binary_string = ofp_header.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
return binary_string
@@ -262,8 +275,9 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
+ length += ofp_header.__len__(self)
return length
def show(self, prefix=''):
@@ -278,7 +292,7 @@
outstr = prefix + 'barrier_request (OFPT_BARRIER_REQUEST)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
+ outstr += ofp_header.show(self, prefix)
return outstr
def __eq__(self, other):
@@ -289,8 +303,8 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
+ if not ofp_header.__eq__(self, other): return False
return True
def __ne__(self, other):
@@ -303,7 +317,7 @@
return not self.__eq__(other)
-class echo_reply:
+class echo_reply(ofp_header):
"""
Wrapper class for echo_reply
@@ -313,13 +327,19 @@
@arg xid: The transaction ID
@arg type: The message type (OFPT_ECHO_REPLY=3)
+ Data members inherited from ofp_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg data: Binary string following message members
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_ECHO_REPLY
+ ofp_header.__init__(self)
+ self.version = OFP_VERSION
+ self.type = OFPT_ECHO_REPLY
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -335,9 +355,10 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
+ packed += ofp_header.pack(self)
packed += self.data
return packed
@@ -350,8 +371,8 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
+ binary_string = ofp_header.unpack(self, binary_string)
self.data = binary_string
binary_string = ''
return binary_string
@@ -364,8 +385,9 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
+ length += ofp_header.__len__(self)
length += len(self.data)
return length
@@ -381,7 +403,7 @@
outstr = prefix + 'echo_reply (OFPT_ECHO_REPLY)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
+ outstr += ofp_header.show(self, prefix)
outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
##@todo Fix this circular reference
# if len(self.data) > 0:
@@ -400,8 +422,8 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
+ if not ofp_header.__eq__(self, other): return False
if self.data != other.data: return False
return True
@@ -415,7 +437,7 @@
return not self.__eq__(other)
-class echo_request:
+class echo_request(ofp_header):
"""
Wrapper class for echo_request
@@ -425,13 +447,19 @@
@arg xid: The transaction ID
@arg type: The message type (OFPT_ECHO_REQUEST=2)
+ Data members inherited from ofp_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg data: Binary string following message members
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_ECHO_REQUEST
+ ofp_header.__init__(self)
+ self.version = OFP_VERSION
+ self.type = OFPT_ECHO_REQUEST
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -447,9 +475,10 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
+ packed += ofp_header.pack(self)
packed += self.data
return packed
@@ -462,8 +491,8 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
+ binary_string = ofp_header.unpack(self, binary_string)
self.data = binary_string
binary_string = ''
return binary_string
@@ -476,8 +505,9 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
+ length += ofp_header.__len__(self)
length += len(self.data)
return length
@@ -493,7 +523,7 @@
outstr = prefix + 'echo_request (OFPT_ECHO_REQUEST)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
+ outstr += ofp_header.show(self, prefix)
outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
##@todo Fix this circular reference
# if len(self.data) > 0:
@@ -512,8 +542,8 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
+ if not ofp_header.__eq__(self, other): return False
if self.data != other.data: return False
return True
@@ -538,6 +568,10 @@
@arg type: The message type (OFPT_ERROR=1)
Data members inherited from ofp_error_msg:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg err_type
@arg code
@arg data: Binary string following message members
@@ -546,8 +580,8 @@
def __init__(self, **kwargs):
ofp_error_msg.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_ERROR
+ self.version = OFP_VERSION
+ self.type = OFPT_ERROR
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -563,8 +597,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_error_msg.pack(self)
packed += self.data
@@ -579,7 +613,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_error_msg.unpack(self, binary_string)
self.data = binary_string
@@ -594,7 +627,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_error_msg.__len__(self)
length += len(self.data)
@@ -612,7 +645,6 @@
outstr = prefix + 'error (OFPT_ERROR)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_error_msg.show(self, prefix)
outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
##@todo Fix this circular reference
@@ -632,7 +664,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_error_msg.__eq__(self, other): return False
if self.data != other.data: return False
@@ -659,6 +690,10 @@
@arg type: The message type (OFPT_FEATURES_REPLY=6)
Data members inherited from ofp_switch_features:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg datapath_id
@arg n_buffers
@arg n_tables
@@ -670,8 +705,8 @@
def __init__(self, **kwargs):
ofp_switch_features.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FEATURES_REPLY
+ self.version = OFP_VERSION
+ self.type = OFPT_FEATURES_REPLY
self.ports = []
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -687,8 +722,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_switch_features.pack(self)
for obj in self.ports:
@@ -704,7 +739,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_switch_features.unpack(self, binary_string)
while len(binary_string) >= OFP_PHY_PORT_BYTES:
@@ -722,7 +756,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_switch_features.__len__(self)
for obj in self.ports:
@@ -741,7 +775,6 @@
outstr = prefix + 'features_reply (OFPT_FEATURES_REPLY)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_switch_features.show(self, prefix)
outstr += prefix + "Array ports\n"
for obj in self.ports:
@@ -756,7 +789,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_switch_features.__eq__(self, other): return False
if self.ports != other.ports: return False
@@ -772,7 +804,7 @@
return not self.__eq__(other)
-class features_request:
+class features_request(ofp_header):
"""
Wrapper class for features_request
@@ -782,12 +814,18 @@
@arg xid: The transaction ID
@arg type: The message type (OFPT_FEATURES_REQUEST=5)
+ Data members inherited from ofp_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_FEATURES_REQUEST
+ ofp_header.__init__(self)
+ self.version = OFP_VERSION
+ self.type = OFPT_FEATURES_REQUEST
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -802,9 +840,10 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
+ packed += ofp_header.pack(self)
return packed
def unpack(self, binary_string):
@@ -816,8 +855,8 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
+ binary_string = ofp_header.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
return binary_string
@@ -829,8 +868,9 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
+ length += ofp_header.__len__(self)
return length
def show(self, prefix=''):
@@ -845,7 +885,7 @@
outstr = prefix + 'features_request (OFPT_FEATURES_REQUEST)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
+ outstr += ofp_header.show(self, prefix)
return outstr
def __eq__(self, other):
@@ -856,8 +896,8 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
+ if not ofp_header.__eq__(self, other): return False
return True
def __ne__(self, other):
@@ -881,6 +921,10 @@
@arg type: The message type (OFPT_FLOW_MOD=14)
Data members inherited from ofp_flow_mod:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg match
@arg cookie
@arg command
@@ -896,8 +940,8 @@
def __init__(self, **kwargs):
ofp_flow_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FLOW_MOD
+ self.version = OFP_VERSION
+ self.type = OFPT_FLOW_MOD
self.actions = []
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -913,8 +957,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_flow_mod.pack(self)
packed += action_list(self.actions).pack()
@@ -929,10 +973,9 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_flow_mod.unpack(self, binary_string)
- ai_len = self.header.length - (OFP_FLOW_MOD_BYTES + OFP_HEADER_BYTES)
+ ai_len = self.length - (OFP_FLOW_MOD_BYTES + OFP_HEADER_BYTES)
obj = action_list()
binary_string = obj.unpack(binary_string, bytes=ai_len)
self.actions = list(obj)
@@ -947,7 +990,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_flow_mod.__len__(self)
for obj in self.actions:
@@ -966,7 +1009,6 @@
outstr = prefix + 'flow_mod (OFPT_FLOW_MOD)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_flow_mod.show(self, prefix)
outstr += prefix + "List actions\n"
for obj in self.actions:
@@ -981,7 +1023,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_flow_mod.__eq__(self, other): return False
if self.actions != other.actions: return False
@@ -1008,6 +1049,10 @@
@arg type: The message type (OFPT_FLOW_REMOVED=11)
Data members inherited from ofp_flow_removed:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg match
@arg cookie
@arg priority
@@ -1022,8 +1067,8 @@
def __init__(self, **kwargs):
ofp_flow_removed.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_FLOW_REMOVED
+ self.version = OFP_VERSION
+ self.type = OFPT_FLOW_REMOVED
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1038,8 +1083,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_flow_removed.pack(self)
return packed
@@ -1053,7 +1098,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_flow_removed.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -1067,7 +1111,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_flow_removed.__len__(self)
return length
@@ -1084,7 +1128,6 @@
outstr = prefix + 'flow_removed (OFPT_FLOW_REMOVED)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_flow_removed.show(self, prefix)
return outstr
@@ -1096,7 +1139,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_flow_removed.__eq__(self, other): return False
return True
@@ -1122,6 +1164,10 @@
@arg type: The message type (OFPT_GET_CONFIG_REPLY=8)
Data members inherited from ofp_switch_config:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg flags
@arg miss_send_len
@@ -1129,8 +1175,8 @@
def __init__(self, **kwargs):
ofp_switch_config.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_GET_CONFIG_REPLY
+ self.version = OFP_VERSION
+ self.type = OFPT_GET_CONFIG_REPLY
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1145,8 +1191,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_switch_config.pack(self)
return packed
@@ -1160,7 +1206,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_switch_config.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -1174,7 +1219,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_switch_config.__len__(self)
return length
@@ -1191,7 +1236,6 @@
outstr = prefix + 'get_config_reply (OFPT_GET_CONFIG_REPLY)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_switch_config.show(self, prefix)
return outstr
@@ -1203,7 +1247,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_switch_config.__eq__(self, other): return False
return True
@@ -1218,7 +1261,7 @@
return not self.__eq__(other)
-class get_config_request:
+class get_config_request(ofp_header):
"""
Wrapper class for get_config_request
@@ -1228,12 +1271,18 @@
@arg xid: The transaction ID
@arg type: The message type (OFPT_GET_CONFIG_REQUEST=7)
+ Data members inherited from ofp_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_GET_CONFIG_REQUEST
+ ofp_header.__init__(self)
+ self.version = OFP_VERSION
+ self.type = OFPT_GET_CONFIG_REQUEST
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1248,9 +1297,10 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
+ packed += ofp_header.pack(self)
return packed
def unpack(self, binary_string):
@@ -1262,8 +1312,8 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
+ binary_string = ofp_header.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
return binary_string
@@ -1275,8 +1325,9 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
+ length += ofp_header.__len__(self)
return length
def show(self, prefix=''):
@@ -1291,7 +1342,7 @@
outstr = prefix + 'get_config_request (OFPT_GET_CONFIG_REQUEST)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
+ outstr += ofp_header.show(self, prefix)
return outstr
def __eq__(self, other):
@@ -1302,8 +1353,8 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
+ if not ofp_header.__eq__(self, other): return False
return True
def __ne__(self, other):
@@ -1316,7 +1367,7 @@
return not self.__eq__(other)
-class hello:
+class hello(ofp_header):
"""
Wrapper class for hello
@@ -1326,13 +1377,19 @@
@arg xid: The transaction ID
@arg type: The message type (OFPT_HELLO=0)
+ Data members inherited from ofp_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg data: Binary string following message members
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
- self.header.type = OFPT_HELLO
+ ofp_header.__init__(self)
+ self.version = OFP_VERSION
+ self.type = OFPT_HELLO
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -1348,9 +1405,10 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
+ packed += ofp_header.pack(self)
packed += self.data
return packed
@@ -1363,8 +1421,8 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
+ binary_string = ofp_header.unpack(self, binary_string)
self.data = binary_string
binary_string = ''
return binary_string
@@ -1377,8 +1435,9 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
+ length += ofp_header.__len__(self)
length += len(self.data)
return length
@@ -1394,7 +1453,7 @@
outstr = prefix + 'hello (OFPT_HELLO)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
+ outstr += ofp_header.show(self, prefix)
outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
##@todo Fix this circular reference
# if len(self.data) > 0:
@@ -1413,8 +1472,8 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
+ if not ofp_header.__eq__(self, other): return False
if self.data != other.data: return False
return True
@@ -1439,6 +1498,10 @@
@arg type: The message type (OFPT_PACKET_IN=10)
Data members inherited from ofp_packet_in:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg buffer_id
@arg total_len
@arg in_port
@@ -1449,8 +1512,8 @@
def __init__(self, **kwargs):
ofp_packet_in.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PACKET_IN
+ self.version = OFP_VERSION
+ self.type = OFPT_PACKET_IN
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -1466,8 +1529,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_packet_in.pack(self)
packed += self.data
@@ -1482,7 +1545,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_packet_in.unpack(self, binary_string)
self.data = binary_string
@@ -1497,7 +1559,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_packet_in.__len__(self)
length += len(self.data)
@@ -1515,7 +1577,6 @@
outstr = prefix + 'packet_in (OFPT_PACKET_IN)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_packet_in.show(self, prefix)
outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
##@todo Fix this circular reference
@@ -1535,7 +1596,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_packet_in.__eq__(self, other): return False
if self.data != other.data: return False
@@ -1562,6 +1622,10 @@
@arg type: The message type (OFPT_PACKET_OUT=13)
Data members inherited from ofp_packet_out:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg buffer_id
@arg in_port
@arg actions_len
@@ -1572,8 +1636,8 @@
def __init__(self, **kwargs):
ofp_packet_out.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PACKET_OUT
+ self.version = OFP_VERSION
+ self.type = OFPT_PACKET_OUT
self.actions = []
self.data = ""
for (k, v) in kwargs.items():
@@ -1590,8 +1654,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
self.actions_len = 0
for obj in self.actions:
@@ -1610,7 +1674,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_packet_out.unpack(self, binary_string)
obj = action_list()
@@ -1628,7 +1691,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_packet_out.__len__(self)
for obj in self.actions:
@@ -1648,7 +1711,6 @@
outstr = prefix + 'packet_out (OFPT_PACKET_OUT)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_packet_out.show(self, prefix)
outstr += prefix + "List actions\n"
for obj in self.actions:
@@ -1671,7 +1733,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_packet_out.__eq__(self, other): return False
if self.data != other.data: return False
@@ -1699,6 +1760,10 @@
@arg type: The message type (OFPT_PORT_MOD=15)
Data members inherited from ofp_port_mod:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg port_no
@arg hw_addr
@arg config
@@ -1709,8 +1774,8 @@
def __init__(self, **kwargs):
ofp_port_mod.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PORT_MOD
+ self.version = OFP_VERSION
+ self.type = OFPT_PORT_MOD
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1725,8 +1790,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_port_mod.pack(self)
return packed
@@ -1740,7 +1805,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_port_mod.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -1754,7 +1818,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_port_mod.__len__(self)
return length
@@ -1771,7 +1835,6 @@
outstr = prefix + 'port_mod (OFPT_PORT_MOD)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_port_mod.show(self, prefix)
return outstr
@@ -1783,7 +1846,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_port_mod.__eq__(self, other): return False
return True
@@ -1809,6 +1871,10 @@
@arg type: The message type (OFPT_PORT_STATUS=12)
Data members inherited from ofp_port_status:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg reason
@arg desc
@@ -1816,8 +1882,8 @@
def __init__(self, **kwargs):
ofp_port_status.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_PORT_STATUS
+ self.version = OFP_VERSION
+ self.type = OFPT_PORT_STATUS
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1832,8 +1898,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_port_status.pack(self)
return packed
@@ -1847,7 +1913,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_port_status.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -1861,7 +1926,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_port_status.__len__(self)
return length
@@ -1878,7 +1943,6 @@
outstr = prefix + 'port_status (OFPT_PORT_STATUS)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_port_status.show(self, prefix)
return outstr
@@ -1890,7 +1954,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_port_status.__eq__(self, other): return False
return True
@@ -1916,6 +1979,10 @@
@arg type: The message type (OFPT_QUEUE_GET_CONFIG_REPLY=21)
Data members inherited from ofp_queue_get_config_reply:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg port
@arg queues: Variable length array of TBD
@@ -1923,8 +1990,8 @@
def __init__(self, **kwargs):
ofp_queue_get_config_reply.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_QUEUE_GET_CONFIG_REPLY
+ self.version = OFP_VERSION
+ self.type = OFPT_QUEUE_GET_CONFIG_REPLY
self.queues = []
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -1940,8 +2007,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_queue_get_config_reply.pack(self)
for obj in self.queues:
@@ -1957,7 +2024,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_queue_get_config_reply.unpack(self, binary_string)
for obj in self.queues:
@@ -1973,7 +2039,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_queue_get_config_reply.__len__(self)
for obj in self.queues:
@@ -1992,7 +2058,6 @@
outstr = prefix + 'queue_get_config_reply (OFPT_QUEUE_GET_CONFIG_REPLY)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_queue_get_config_reply.show(self, prefix)
outstr += prefix + "Array queues\n"
for obj in self.queues:
@@ -2007,7 +2072,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_queue_get_config_reply.__eq__(self, other): return False
if self.queues != other.queues: return False
@@ -2034,14 +2098,18 @@
@arg type: The message type (OFPT_QUEUE_GET_CONFIG_REQUEST=20)
Data members inherited from ofp_queue_get_config_request:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg port
"""
def __init__(self, **kwargs):
ofp_queue_get_config_request.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_QUEUE_GET_CONFIG_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_QUEUE_GET_CONFIG_REQUEST
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2056,8 +2124,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_queue_get_config_request.pack(self)
return packed
@@ -2071,7 +2139,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_queue_get_config_request.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -2085,7 +2152,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_queue_get_config_request.__len__(self)
return length
@@ -2102,7 +2169,6 @@
outstr = prefix + 'queue_get_config_request (OFPT_QUEUE_GET_CONFIG_REQUEST)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_queue_get_config_request.show(self, prefix)
return outstr
@@ -2114,7 +2180,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_queue_get_config_request.__eq__(self, other): return False
return True
@@ -2140,6 +2205,10 @@
@arg type: The message type (OFPT_SET_CONFIG=9)
Data members inherited from ofp_switch_config:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg flags
@arg miss_send_len
@@ -2147,8 +2216,8 @@
def __init__(self, **kwargs):
ofp_switch_config.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_SET_CONFIG
+ self.version = OFP_VERSION
+ self.type = OFPT_SET_CONFIG
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2163,8 +2232,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_switch_config.pack(self)
return packed
@@ -2178,7 +2247,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_switch_config.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -2192,7 +2260,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_switch_config.__len__(self)
return length
@@ -2209,7 +2277,6 @@
outstr = prefix + 'set_config (OFPT_SET_CONFIG)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_switch_config.show(self, prefix)
return outstr
@@ -2221,7 +2288,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_switch_config.__eq__(self, other): return False
return True
@@ -2247,6 +2313,10 @@
@arg type: The message type (OFPT_STATS_REPLY=17)
Data members inherited from ofp_stats_reply:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg stats_type
@arg flags
@@ -2254,8 +2324,8 @@
def __init__(self, **kwargs):
ofp_stats_reply.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_STATS_REPLY
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REPLY
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2270,8 +2340,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_reply.pack(self)
return packed
@@ -2285,7 +2355,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_reply.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -2299,7 +2368,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_stats_reply.__len__(self)
return length
@@ -2316,7 +2385,6 @@
outstr = prefix + 'stats_reply (OFPT_STATS_REPLY)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_reply.show(self, prefix)
return outstr
@@ -2328,7 +2396,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_stats_reply.__eq__(self, other): return False
return True
@@ -2354,6 +2421,10 @@
@arg type: The message type (OFPT_STATS_REQUEST=16)
Data members inherited from ofp_stats_request:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg stats_type
@arg flags
@@ -2361,8 +2432,8 @@
def __init__(self, **kwargs):
ofp_stats_request.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_STATS_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REQUEST
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2377,8 +2448,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_request.pack(self)
return packed
@@ -2392,7 +2463,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_request.unpack(self, binary_string)
# Fixme: If no self.data, add check for data remaining
@@ -2406,7 +2476,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_stats_request.__len__(self)
return length
@@ -2423,7 +2493,6 @@
outstr = prefix + 'stats_request (OFPT_STATS_REQUEST)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_request.show(self, prefix)
return outstr
@@ -2435,7 +2504,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_stats_request.__eq__(self, other): return False
return True
@@ -2461,6 +2529,10 @@
@arg type: The message type (OFPT_VENDOR=4)
Data members inherited from ofp_vendor_header:
+ @arg version
+ @arg type
+ @arg length
+ @arg xid
@arg vendor
@arg data: Binary string following message members
@@ -2468,8 +2540,8 @@
def __init__(self, **kwargs):
ofp_vendor_header.__init__(self)
- self.header = ofp_header()
- self.header.type = OFPT_VENDOR
+ self.version = OFP_VERSION
+ self.type = OFPT_VENDOR
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2485,8 +2557,8 @@
@return The packed string which can go on the wire
"""
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_vendor_header.pack(self)
packed += self.data
@@ -2501,7 +2573,6 @@
@return The remainder of binary_string that was not parsed.
"""
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_vendor_header.unpack(self, binary_string)
self.data = binary_string
@@ -2516,7 +2587,7 @@
string.
"""
- length = OFP_HEADER_BYTES
+ length = 0
length += ofp_vendor_header.__len__(self)
length += len(self.data)
@@ -2534,7 +2605,6 @@
outstr = prefix + 'vendor (OFPT_VENDOR)\n'
prefix += ' '
outstr += prefix + 'ofp header\n'
- outstr += self.header.show(prefix + ' ')
outstr += ofp_vendor_header.show(self, prefix)
outstr += prefix + 'data is of length ' + str(len(self.data)) + '\n'
##@todo Fix this circular reference
@@ -2554,7 +2624,6 @@
"""
if type(self) != type(other): return False
- if not self.header.__eq__(other.header): return False
if not ofp_vendor_header.__eq__(self, other): return False
if self.data != other.data: return False
@@ -2692,10 +2761,10 @@
Wrapper class for aggregate stats request message
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_aggregate_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REQUEST
self.stats_type = OFPST_AGGREGATE
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2704,14 +2773,13 @@
raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_request.pack(self)
packed += ofp_aggregate_stats_request.pack(self)
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_request.unpack(self, binary_string)
binary_string = ofp_aggregate_stats_request.unpack(self, binary_string)
if len(binary_string) != 0:
@@ -2719,21 +2787,19 @@
return binary_string
def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+ return OFP_STATS_REQUEST_BYTES + \
OFP_AGGREGATE_STATS_REQUEST_BYTES
def show(self, prefix=''):
outstr = prefix + "aggregate_stats_request\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_request.show(self)
outstr += ofp_aggregate_stats_request.show(self)
return outstr
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
+ return (ofp_stats_request.__eq__(self, other) and
ofp_aggregate_stats_request.__eq__(self, other))
def __ne__(self, other): return not self.__eq__(other)
@@ -2744,23 +2810,22 @@
Wrapper class for aggregate stats reply
"""
def __init__(self):
- self.header = ofp_header()
ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_AGGREGATE
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REPLY
+ self.stats_type = OFPST_AGGREGATE
# stats: Array of type aggregate_stats_entry
self.entries = []
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_reply.pack(self)
for obj in self.entries:
packed += obj.pack()
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_reply.unpack(self, binary_string)
dummy = aggregate_stats_entry()
while len(binary_string) >= len(dummy):
@@ -2772,7 +2837,7 @@
return binary_string
def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
+ length = OFP_STATS_REPLY_BYTES
for obj in self.entries:
length += len(obj)
return length
@@ -2780,7 +2845,6 @@
def show(self, prefix=''):
outstr = prefix + "aggregate_stats_reply\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_reply.show(self)
outstr += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
for obj in self.entries:
@@ -2789,8 +2853,7 @@
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
+ return (ofp_stats_reply.__eq__(self, other) and
self.entries == other.entries)
def __ne__(self, other): return not self.__eq__(other)
@@ -2801,10 +2864,10 @@
Wrapper class for desc stats request message
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_desc_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REQUEST
self.stats_type = OFPST_DESC
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2813,14 +2876,13 @@
raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_request.pack(self)
packed += ofp_desc_stats_request.pack(self)
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_request.unpack(self, binary_string)
binary_string = ofp_desc_stats_request.unpack(self, binary_string)
if len(binary_string) != 0:
@@ -2828,21 +2890,19 @@
return binary_string
def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+ return OFP_STATS_REQUEST_BYTES + \
OFP_DESC_STATS_REQUEST_BYTES
def show(self, prefix=''):
outstr = prefix + "desc_stats_request\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_request.show(self)
outstr += ofp_desc_stats_request.show(self)
return outstr
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
+ return (ofp_stats_request.__eq__(self, other) and
ofp_desc_stats_request.__eq__(self, other))
def __ne__(self, other): return not self.__eq__(other)
@@ -2853,23 +2913,22 @@
Wrapper class for desc stats reply
"""
def __init__(self):
- self.header = ofp_header()
ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_DESC
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REPLY
+ self.stats_type = OFPST_DESC
# stats: Array of type desc_stats_entry
self.entries = []
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_reply.pack(self)
for obj in self.entries:
packed += obj.pack()
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_reply.unpack(self, binary_string)
dummy = desc_stats_entry()
while len(binary_string) >= len(dummy):
@@ -2881,7 +2940,7 @@
return binary_string
def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
+ length = OFP_STATS_REPLY_BYTES
for obj in self.entries:
length += len(obj)
return length
@@ -2889,7 +2948,6 @@
def show(self, prefix=''):
outstr = prefix + "desc_stats_reply\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_reply.show(self)
outstr += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
for obj in self.entries:
@@ -2898,8 +2956,7 @@
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
+ return (ofp_stats_reply.__eq__(self, other) and
self.entries == other.entries)
def __ne__(self, other): return not self.__eq__(other)
@@ -2910,10 +2967,10 @@
Wrapper class for flow stats request message
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_flow_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REQUEST
self.stats_type = OFPST_FLOW
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2922,14 +2979,13 @@
raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_request.pack(self)
packed += ofp_flow_stats_request.pack(self)
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_request.unpack(self, binary_string)
binary_string = ofp_flow_stats_request.unpack(self, binary_string)
if len(binary_string) != 0:
@@ -2937,21 +2993,19 @@
return binary_string
def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+ return OFP_STATS_REQUEST_BYTES + \
OFP_FLOW_STATS_REQUEST_BYTES
def show(self, prefix=''):
outstr = prefix + "flow_stats_request\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_request.show(self)
outstr += ofp_flow_stats_request.show(self)
return outstr
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
+ return (ofp_stats_request.__eq__(self, other) and
ofp_flow_stats_request.__eq__(self, other))
def __ne__(self, other): return not self.__eq__(other)
@@ -2962,23 +3016,22 @@
Wrapper class for flow stats reply
"""
def __init__(self):
- self.header = ofp_header()
ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_FLOW
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REPLY
+ self.stats_type = OFPST_FLOW
# stats: Array of type flow_stats_entry
self.entries = []
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_reply.pack(self)
for obj in self.entries:
packed += obj.pack()
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_reply.unpack(self, binary_string)
dummy = flow_stats_entry()
while len(binary_string) >= len(dummy):
@@ -2990,7 +3043,7 @@
return binary_string
def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
+ length = OFP_STATS_REPLY_BYTES
for obj in self.entries:
length += len(obj)
return length
@@ -2998,7 +3051,6 @@
def show(self, prefix=''):
outstr = prefix + "flow_stats_reply\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_reply.show(self)
outstr += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
for obj in self.entries:
@@ -3007,8 +3059,7 @@
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
+ return (ofp_stats_reply.__eq__(self, other) and
self.entries == other.entries)
def __ne__(self, other): return not self.__eq__(other)
@@ -3019,10 +3070,10 @@
Wrapper class for port stats request message
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_port_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REQUEST
self.stats_type = OFPST_PORT
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -3031,14 +3082,13 @@
raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_request.pack(self)
packed += ofp_port_stats_request.pack(self)
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_request.unpack(self, binary_string)
binary_string = ofp_port_stats_request.unpack(self, binary_string)
if len(binary_string) != 0:
@@ -3046,21 +3096,19 @@
return binary_string
def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+ return OFP_STATS_REQUEST_BYTES + \
OFP_PORT_STATS_REQUEST_BYTES
def show(self, prefix=''):
outstr = prefix + "port_stats_request\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_request.show(self)
outstr += ofp_port_stats_request.show(self)
return outstr
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
+ return (ofp_stats_request.__eq__(self, other) and
ofp_port_stats_request.__eq__(self, other))
def __ne__(self, other): return not self.__eq__(other)
@@ -3071,23 +3119,22 @@
Wrapper class for port stats reply
"""
def __init__(self):
- self.header = ofp_header()
ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_PORT
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REPLY
+ self.stats_type = OFPST_PORT
# stats: Array of type port_stats_entry
self.entries = []
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_reply.pack(self)
for obj in self.entries:
packed += obj.pack()
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_reply.unpack(self, binary_string)
dummy = port_stats_entry()
while len(binary_string) >= len(dummy):
@@ -3099,7 +3146,7 @@
return binary_string
def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
+ length = OFP_STATS_REPLY_BYTES
for obj in self.entries:
length += len(obj)
return length
@@ -3107,7 +3154,6 @@
def show(self, prefix=''):
outstr = prefix + "port_stats_reply\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_reply.show(self)
outstr += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
for obj in self.entries:
@@ -3116,8 +3162,7 @@
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
+ return (ofp_stats_reply.__eq__(self, other) and
self.entries == other.entries)
def __ne__(self, other): return not self.__eq__(other)
@@ -3128,10 +3173,10 @@
Wrapper class for queue stats request message
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_queue_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REQUEST
self.stats_type = OFPST_QUEUE
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -3140,14 +3185,13 @@
raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_request.pack(self)
packed += ofp_queue_stats_request.pack(self)
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_request.unpack(self, binary_string)
binary_string = ofp_queue_stats_request.unpack(self, binary_string)
if len(binary_string) != 0:
@@ -3155,21 +3199,19 @@
return binary_string
def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+ return OFP_STATS_REQUEST_BYTES + \
OFP_QUEUE_STATS_REQUEST_BYTES
def show(self, prefix=''):
outstr = prefix + "queue_stats_request\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_request.show(self)
outstr += ofp_queue_stats_request.show(self)
return outstr
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
+ return (ofp_stats_request.__eq__(self, other) and
ofp_queue_stats_request.__eq__(self, other))
def __ne__(self, other): return not self.__eq__(other)
@@ -3180,23 +3222,22 @@
Wrapper class for queue stats reply
"""
def __init__(self):
- self.header = ofp_header()
ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_QUEUE
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REPLY
+ self.stats_type = OFPST_QUEUE
# stats: Array of type queue_stats_entry
self.entries = []
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_reply.pack(self)
for obj in self.entries:
packed += obj.pack()
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_reply.unpack(self, binary_string)
dummy = queue_stats_entry()
while len(binary_string) >= len(dummy):
@@ -3208,7 +3249,7 @@
return binary_string
def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
+ length = OFP_STATS_REPLY_BYTES
for obj in self.entries:
length += len(obj)
return length
@@ -3216,7 +3257,6 @@
def show(self, prefix=''):
outstr = prefix + "queue_stats_reply\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_reply.show(self)
outstr += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
for obj in self.entries:
@@ -3225,8 +3265,7 @@
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
+ return (ofp_stats_reply.__eq__(self, other) and
self.entries == other.entries)
def __ne__(self, other): return not self.__eq__(other)
@@ -3237,10 +3276,10 @@
Wrapper class for table stats request message
"""
def __init__(self, **kwargs):
- self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_table_stats_request.__init__(self)
- self.header.type = OFPT_STATS_REQUEST
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REQUEST
self.stats_type = OFPST_TABLE
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -3249,14 +3288,13 @@
raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_request.pack(self)
packed += ofp_table_stats_request.pack(self)
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_request.unpack(self, binary_string)
binary_string = ofp_table_stats_request.unpack(self, binary_string)
if len(binary_string) != 0:
@@ -3264,21 +3302,19 @@
return binary_string
def __len__(self):
- return len(self.header) + OFP_STATS_REQUEST_BYTES + \
+ return OFP_STATS_REQUEST_BYTES + \
OFP_TABLE_STATS_REQUEST_BYTES
def show(self, prefix=''):
outstr = prefix + "table_stats_request\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_request.show(self)
outstr += ofp_table_stats_request.show(self)
return outstr
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_request.__eq__(self, other) and
+ return (ofp_stats_request.__eq__(self, other) and
ofp_table_stats_request.__eq__(self, other))
def __ne__(self, other): return not self.__eq__(other)
@@ -3289,23 +3325,22 @@
Wrapper class for table stats reply
"""
def __init__(self):
- self.header = ofp_header()
ofp_stats_reply.__init__(self)
- self.header.type = OFPT_STATS_REPLY
- self.type = OFPST_TABLE
+ self.version = OFP_VERSION
+ self.type = OFPT_STATS_REPLY
+ self.stats_type = OFPST_TABLE
# stats: Array of type table_stats_entry
self.entries = []
def pack(self, assertstruct=True):
- self.header.length = len(self)
- packed = self.header.pack()
+ self.length = len(self)
+ packed = ""
packed += ofp_stats_reply.pack(self)
for obj in self.entries:
packed += obj.pack()
return packed
def unpack(self, binary_string):
- binary_string = self.header.unpack(binary_string)
binary_string = ofp_stats_reply.unpack(self, binary_string)
dummy = table_stats_entry()
while len(binary_string) >= len(dummy):
@@ -3317,7 +3352,7 @@
return binary_string
def __len__(self):
- length = len(self.header) + OFP_STATS_REPLY_BYTES
+ length = OFP_STATS_REPLY_BYTES
for obj in self.entries:
length += len(obj)
return length
@@ -3325,7 +3360,6 @@
def show(self, prefix=''):
outstr = prefix + "table_stats_reply\n"
outstr += prefix + "ofp header:\n"
- outstr += self.header.show(prefix + ' ')
outstr += ofp_stats_reply.show(self)
outstr += prefix + "Stats array of length " + str(len(self.entries)) + '\n'
for obj in self.entries:
@@ -3334,8 +3368,7 @@
def __eq__(self, other):
if type(self) != type(other): return False
- return (self.header == other.header and
- ofp_stats_reply.__eq__(self, other) and
+ return (ofp_stats_reply.__eq__(self, other) and
self.entries == other.entries)
def __ne__(self, other): return not self.__eq__(other)