loxi-prep: move header fields into the message classes
diff --git a/src/python/of10/cstruct.py b/src/python/of10/cstruct.py
index 3d2c638..ede9b31 100644
--- a/src/python/of10/cstruct.py
+++ b/src/python/of10/cstruct.py
@@ -312,6 +312,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.match = ofp_match()
self.cookie = 0
self.priority = 0
@@ -343,6 +347,7 @@
if(not self.__assert()[0]):
return None
packed = ""
+ packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
packed += self.match.pack()
packed += struct.pack("!QHBBLLH", self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout)
packed += struct.pack("!BB", self.pad2[0], self.pad2[1])
@@ -354,33 +359,41 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 80):
+ if (len(binaryString) < 88):
return binaryString
- self.match.unpack(binaryString[0:])
+ fmt = '!BBHL'
+ start = 0
+ end = start + struct.calcsize(fmt)
+ (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end])
+ self.match.unpack(binaryString[8:])
fmt = '!QHBBLLH'
- start = 40
+ start = 48
end = start + struct.calcsize(fmt)
(self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout) = struct.unpack(fmt, binaryString[start:end])
fmt = '!BB'
- start = 62
+ start = 70
end = start + struct.calcsize(fmt)
(self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end])
fmt = '!QQ'
- start = 64
+ start = 72
end = start + struct.calcsize(fmt)
(self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[80:]
+ return binaryString[88:]
def __len__(self):
"""Return length of message
"""
- l = 80
+ l = 88
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.match != other.match: return False
if self.cookie != other.cookie: return False
if self.priority != other.priority: return False
@@ -400,6 +413,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'match: \n'
outstr += self.match.show(prefix + ' ')
outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
@@ -797,6 +814,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.stats_type = 0
self.flags = 0
@@ -813,7 +834,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!HH", self.stats_type, self.flags)
+ packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.stats_type, self.flags)
return packed
def unpack(self, binaryString):
@@ -821,24 +842,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 4):
+ if (len(binaryString) < 12):
return binaryString
- fmt = '!HH'
+ fmt = '!BBHLHH'
start = 0
end = start + struct.calcsize(fmt)
- (self.stats_type, self.flags) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
+ (self.version, self.type, self.length, self.xid, self.stats_type, self.flags) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[12:]
def __len__(self):
"""Return length of message
"""
- l = 4
+ l = 12
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.stats_type != other.stats_type: return False
if self.flags != other.flags: return False
return True
@@ -849,6 +874,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'stats_type: ' + str(self.stats_type) + '\n'
outstr += prefix + 'flags: ' + str(self.flags) + '\n'
return outstr
@@ -866,6 +895,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
def __assert(self):
"""Sanity check
@@ -880,6 +913,7 @@
if(not self.__assert()[0]):
return None
packed = ""
+ packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
return packed
def unpack(self, binaryString):
@@ -887,20 +921,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 0):
+ if (len(binaryString) < 8):
return binaryString
- return binaryString[0:]
+ fmt = '!BBHL'
+ start = 0
+ end = start + struct.calcsize(fmt)
+ (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[8:]
def __len__(self):
"""Return length of message
"""
- l = 0
+ l = 8
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
return True
def __ne__(self, other): return not self.__eq__(other)
@@ -909,6 +951,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
return outstr
@@ -1003,6 +1049,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.reason = 0
self.pad= [0,0,0,0,0,0,0]
self.desc = ofp_phy_port()
@@ -1026,7 +1076,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!B", self.reason)
+ packed += struct.pack("!BBHLB", self.version, self.type, self.length, self.xid, self.reason)
packed += struct.pack("!BBBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6])
packed += self.desc.pack()
return packed
@@ -1036,29 +1086,33 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 56):
+ if (len(binaryString) < 64):
return binaryString
- fmt = '!B'
+ fmt = '!BBHLB'
start = 0
end = start + struct.calcsize(fmt)
- (self.reason,) = struct.unpack(fmt, binaryString[start:end])
+ (self.version, self.type, self.length, self.xid, self.reason) = struct.unpack(fmt, binaryString[start:end])
fmt = '!BBBBBBB'
- start = 1
+ start = 9
end = start + struct.calcsize(fmt)
(self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5], self.pad[6]) = struct.unpack(fmt, binaryString[start:end])
- self.desc.unpack(binaryString[8:])
- return binaryString[56:]
+ self.desc.unpack(binaryString[16:])
+ return binaryString[64:]
def __len__(self):
"""Return length of message
"""
- l = 56
+ l = 64
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.reason != other.reason: return False
if self.pad != other.pad: return False
if self.desc != other.desc: return False
@@ -1070,6 +1124,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'reason: ' + str(self.reason) + '\n'
outstr += prefix + 'desc: \n'
outstr += self.desc.show(prefix + ' ')
@@ -1168,6 +1226,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.port_no = 0
self.hw_addr= [0,0,0,0,0,0]
self.config = 0
@@ -1196,7 +1258,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!H", self.port_no)
+ packed += struct.pack("!BBHLH", self.version, self.type, self.length, self.xid, self.port_no)
packed += struct.pack("!BBBBBB", self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5])
packed += struct.pack("!LLL", self.config, self.mask, self.advertise)
packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3])
@@ -1207,36 +1269,40 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 24):
+ if (len(binaryString) < 32):
return binaryString
- fmt = '!H'
+ fmt = '!BBHLH'
start = 0
end = start + struct.calcsize(fmt)
- (self.port_no,) = struct.unpack(fmt, binaryString[start:end])
+ (self.version, self.type, self.length, self.xid, self.port_no) = struct.unpack(fmt, binaryString[start:end])
fmt = '!BBBBBB'
- start = 2
+ start = 10
end = start + struct.calcsize(fmt)
(self.hw_addr[0], self.hw_addr[1], self.hw_addr[2], self.hw_addr[3], self.hw_addr[4], self.hw_addr[5]) = struct.unpack(fmt, binaryString[start:end])
fmt = '!LLL'
- start = 8
+ start = 16
end = start + struct.calcsize(fmt)
(self.config, self.mask, self.advertise) = struct.unpack(fmt, binaryString[start:end])
fmt = '!BBBB'
- start = 20
+ start = 28
end = start + struct.calcsize(fmt)
(self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
+ return binaryString[32:]
def __len__(self):
"""Return length of message
"""
- l = 24
+ l = 32
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: 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
if self.config != other.config: return False
@@ -1251,6 +1317,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'port_no: ' + str(self.port_no) + '\n'
outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n'
outstr += prefix + 'config: ' + str(self.config) + '\n'
@@ -1429,6 +1499,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.flags = 0
self.miss_send_len = 128
@@ -1445,7 +1519,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!HH", self.flags, self.miss_send_len)
+ packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.flags, self.miss_send_len)
return packed
def unpack(self, binaryString):
@@ -1453,24 +1527,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 4):
+ if (len(binaryString) < 12):
return binaryString
- fmt = '!HH'
+ fmt = '!BBHLHH'
start = 0
end = start + struct.calcsize(fmt)
- (self.flags, self.miss_send_len) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
+ (self.version, self.type, self.length, self.xid, self.flags, self.miss_send_len) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[12:]
def __len__(self):
"""Return length of message
"""
- l = 4
+ l = 12
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: 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
@@ -1481,6 +1559,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'flags: ' + str(self.flags) + '\n'
outstr += prefix + 'miss_send_len: ' + str(self.miss_send_len) + '\n'
return outstr
@@ -1581,6 +1663,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.port = 0
self.pad= [0,0,0,0,0,0]
@@ -1601,7 +1687,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!H", self.port)
+ packed += struct.pack("!BBHLH", self.version, self.type, self.length, self.xid, self.port)
packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5])
return packed
@@ -1610,28 +1696,32 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 8):
+ if (len(binaryString) < 16):
return binaryString
- fmt = '!H'
+ fmt = '!BBHLH'
start = 0
end = start + struct.calcsize(fmt)
- (self.port,) = struct.unpack(fmt, binaryString[start:end])
+ (self.version, self.type, self.length, self.xid, self.port) = struct.unpack(fmt, binaryString[start:end])
fmt = '!BBBBBB'
- start = 2
+ start = 10
end = start + struct.calcsize(fmt)
(self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
+ return binaryString[16:]
def __len__(self):
"""Return length of message
"""
- l = 8
+ l = 16
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.port != other.port: return False
if self.pad != other.pad: return False
return True
@@ -1642,6 +1732,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'port: ' + str(self.port) + '\n'
return outstr
@@ -1658,6 +1752,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.buffer_id = 0
self.total_len = 0
self.in_port = 0
@@ -1677,7 +1775,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!LHHBB", self.buffer_id, self.total_len, self.in_port, self.reason, self.pad)
+ packed += struct.pack("!BBHLLHHBB", self.version, self.type, self.length, self.xid, self.buffer_id, self.total_len, self.in_port, self.reason, self.pad)
return packed
def unpack(self, binaryString):
@@ -1685,24 +1783,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 10):
+ if (len(binaryString) < 18):
return binaryString
- fmt = '!LHHBB'
+ fmt = '!BBHLLHHBB'
start = 0
end = start + struct.calcsize(fmt)
- (self.buffer_id, self.total_len, self.in_port, self.reason, self.pad) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[10:]
+ (self.version, self.type, self.length, self.xid, self.buffer_id, self.total_len, self.in_port, self.reason, self.pad) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[18:]
def __len__(self):
"""Return length of message
"""
- l = 10
+ l = 18
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: 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
if self.in_port != other.in_port: return False
@@ -1716,6 +1818,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
outstr += prefix + 'total_len: ' + str(self.total_len) + '\n'
outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
@@ -2010,6 +2116,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.stats_type = 0
self.flags = 0
@@ -2026,7 +2136,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!HH", self.stats_type, self.flags)
+ packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.stats_type, self.flags)
return packed
def unpack(self, binaryString):
@@ -2034,24 +2144,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 4):
+ if (len(binaryString) < 12):
return binaryString
- fmt = '!HH'
+ fmt = '!BBHLHH'
start = 0
end = start + struct.calcsize(fmt)
- (self.stats_type, self.flags) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
+ (self.version, self.type, self.length, self.xid, self.stats_type, self.flags) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[12:]
def __len__(self):
"""Return length of message
"""
- l = 4
+ l = 12
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.stats_type != other.stats_type: return False
if self.flags != other.flags: return False
return True
@@ -2062,6 +2176,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'stats_type: ' + str(self.stats_type) + '\n'
outstr += prefix + 'flags: ' + str(self.flags) + '\n'
return outstr
@@ -2267,6 +2385,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.port = 0
self.pad= [0,0]
@@ -2287,7 +2409,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!H", self.port)
+ packed += struct.pack("!BBHLH", self.version, self.type, self.length, self.xid, self.port)
packed += struct.pack("!BB", self.pad[0], self.pad[1])
return packed
@@ -2296,28 +2418,32 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 4):
+ if (len(binaryString) < 12):
return binaryString
- fmt = '!H'
+ fmt = '!BBHLH'
start = 0
end = start + struct.calcsize(fmt)
- (self.port,) = struct.unpack(fmt, binaryString[start:end])
+ (self.version, self.type, self.length, self.xid, self.port) = struct.unpack(fmt, binaryString[start:end])
fmt = '!BB'
- start = 2
+ start = 10
end = start + struct.calcsize(fmt)
(self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
+ return binaryString[12:]
def __len__(self):
"""Return length of message
"""
- l = 4
+ l = 12
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.port != other.port: return False
if self.pad != other.pad: return False
return True
@@ -2328,6 +2454,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'port: ' + str(self.port) + '\n'
return outstr
@@ -2772,6 +2902,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.datapath_id = 0
self.n_buffers = 0
self.n_tables = 0
@@ -2796,7 +2930,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!QLB", self.datapath_id, self.n_buffers, self.n_tables)
+ packed += struct.pack("!BBHLQLB", self.version, self.type, self.length, self.xid, self.datapath_id, self.n_buffers, self.n_tables)
packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2])
packed += struct.pack("!LL", self.capabilities, self.actions)
return packed
@@ -2806,32 +2940,36 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 24):
+ if (len(binaryString) < 32):
return binaryString
- fmt = '!QLB'
+ fmt = '!BBHLQLB'
start = 0
end = start + struct.calcsize(fmt)
- (self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt, binaryString[start:end])
+ (self.version, self.type, self.length, self.xid, self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt, binaryString[start:end])
fmt = '!BBB'
- start = 13
+ start = 21
end = start + struct.calcsize(fmt)
(self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end])
fmt = '!LL'
- start = 16
+ start = 24
end = start + struct.calcsize(fmt)
(self.capabilities, self.actions) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[24:]
+ return binaryString[32:]
def __len__(self):
"""Return length of message
"""
- l = 24
+ l = 32
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: 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
if self.n_tables != other.n_tables: return False
@@ -2846,6 +2984,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'datapath_id: ' + str(self.datapath_id) + '\n'
outstr += prefix + 'n_buffers: ' + str(self.n_buffers) + '\n'
outstr += prefix + 'n_tables: ' + str(self.n_tables) + '\n'
@@ -3086,6 +3228,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.vendor = 0
def __assert(self):
@@ -3101,7 +3247,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!L", self.vendor)
+ packed += struct.pack("!BBHLL", self.version, self.type, self.length, self.xid, self.vendor)
return packed
def unpack(self, binaryString):
@@ -3109,24 +3255,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 4):
+ if (len(binaryString) < 12):
return binaryString
- fmt = '!L'
+ fmt = '!BBHLL'
start = 0
end = start + struct.calcsize(fmt)
- (self.vendor,) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
+ (self.version, self.type, self.length, self.xid, self.vendor) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[12:]
def __len__(self):
"""Return length of message
"""
- l = 4
+ l = 12
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.vendor != other.vendor: return False
return True
@@ -3136,6 +3286,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'vendor: ' + str(self.vendor) + '\n'
return outstr
@@ -3152,6 +3306,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.buffer_id = 4294967295
self.in_port = 0
self.actions_len = 0
@@ -3169,7 +3327,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!LHH", self.buffer_id, self.in_port, self.actions_len)
+ packed += struct.pack("!BBHLLHH", self.version, self.type, self.length, self.xid, self.buffer_id, self.in_port, self.actions_len)
return packed
def unpack(self, binaryString):
@@ -3177,24 +3335,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 8):
+ if (len(binaryString) < 16):
return binaryString
- fmt = '!LHH'
+ fmt = '!BBHLLHH'
start = 0
end = start + struct.calcsize(fmt)
- (self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[8:]
+ (self.version, self.type, self.length, self.xid, self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[16:]
def __len__(self):
"""Return length of message
"""
- l = 8
+ l = 16
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: 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
if self.actions_len != other.actions_len: return False
@@ -3206,6 +3368,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n'
outstr += prefix + 'in_port: ' + str(self.in_port) + '\n'
outstr += prefix + 'actions_len: ' + str(self.actions_len) + '\n'
@@ -3379,6 +3545,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.match = ofp_match()
self.cookie = 0
self.command = 0
@@ -3404,6 +3574,7 @@
if(not self.__assert()[0]):
return None
packed = ""
+ packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid)
packed += self.match.pack()
packed += struct.pack("!QHHHHLHH", self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.flags)
return packed
@@ -3413,25 +3584,33 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 64):
+ if (len(binaryString) < 72):
return binaryString
- self.match.unpack(binaryString[0:])
+ fmt = '!BBHL'
+ start = 0
+ end = start + struct.calcsize(fmt)
+ (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end])
+ self.match.unpack(binaryString[8:])
fmt = '!QHHHHLHH'
- start = 40
+ start = 48
end = start + struct.calcsize(fmt)
(self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.flags) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[64:]
+ return binaryString[72:]
def __len__(self):
"""Return length of message
"""
- l = 64
+ l = 72
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.match != other.match: return False
if self.cookie != other.cookie: return False
if self.command != other.command: return False
@@ -3449,6 +3628,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'match: \n'
outstr += self.match.show(prefix + ' ')
outstr += prefix + 'cookie: ' + str(self.cookie) + '\n'
@@ -3474,6 +3657,10 @@
"""Initialize
Declare members and default values
"""
+ self.version = 0
+ self.type = 0
+ self.length = 0
+ self.xid = 0
self.err_type = 0
self.code = 0
@@ -3490,7 +3677,7 @@
if(not self.__assert()[0]):
return None
packed = ""
- packed += struct.pack("!HH", self.err_type, self.code)
+ packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.err_type, self.code)
return packed
def unpack(self, binaryString):
@@ -3498,24 +3685,28 @@
Do not unpack empty array used as placeholder
since they can contain heterogeneous type
"""
- if (len(binaryString) < 4):
+ if (len(binaryString) < 12):
return binaryString
- fmt = '!HH'
+ fmt = '!BBHLHH'
start = 0
end = start + struct.calcsize(fmt)
- (self.err_type, self.code) = struct.unpack(fmt, binaryString[start:end])
- return binaryString[4:]
+ (self.version, self.type, self.length, self.xid, self.err_type, self.code) = struct.unpack(fmt, binaryString[start:end])
+ return binaryString[12:]
def __len__(self):
"""Return length of message
"""
- l = 4
+ l = 12
return l
def __eq__(self, other):
"""Return True if self and other have same values
"""
if type(self) != type(other): return False
+ if self.version != other.version: return False
+ if self.type != other.type: return False
+ if self.length != other.length: return False
+ if self.xid != other.xid: return False
if self.err_type != other.err_type: return False
if self.code != other.code: return False
return True
@@ -3526,6 +3717,10 @@
"""Generate string showing basic members of structure
"""
outstr = ''
+ outstr += prefix + 'version: ' + str(self.version) + '\n'
+ outstr += prefix + 'type: ' + str(self.type) + '\n'
+ outstr += prefix + 'length: ' + str(self.length) + '\n'
+ outstr += prefix + 'xid: ' + str(self.xid) + '\n'
outstr += prefix + 'err_type: ' + str(self.err_type) + '\n'
outstr += prefix + 'code: ' + str(self.code) + '\n'
return outstr
@@ -3990,32 +4185,32 @@
OFP_AGGREGATE_STATS_REPLY_BYTES = 24
OFP_AGGREGATE_STATS_REQUEST_BYTES = 44
OFP_DESC_STATS_BYTES = 1056
-OFP_ERROR_MSG_BYTES = 4
-OFP_FLOW_MOD_BYTES = 64
-OFP_FLOW_REMOVED_BYTES = 80
+OFP_ERROR_MSG_BYTES = 12
+OFP_FLOW_MOD_BYTES = 72
+OFP_FLOW_REMOVED_BYTES = 88
OFP_FLOW_STATS_BYTES = 88
OFP_FLOW_STATS_REQUEST_BYTES = 44
OFP_HEADER_BYTES = 8
-OFP_HELLO_BYTES = 0
+OFP_HELLO_BYTES = 8
OFP_MATCH_BYTES = 40
-OFP_PACKET_IN_BYTES = 10
-OFP_PACKET_OUT_BYTES = 8
+OFP_PACKET_IN_BYTES = 18
+OFP_PACKET_OUT_BYTES = 16
OFP_PACKET_QUEUE_BYTES = 8
OFP_PHY_PORT_BYTES = 48
-OFP_PORT_MOD_BYTES = 24
+OFP_PORT_MOD_BYTES = 32
OFP_PORT_STATS_BYTES = 104
OFP_PORT_STATS_REQUEST_BYTES = 8
-OFP_PORT_STATUS_BYTES = 56
-OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 8
-OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 4
+OFP_PORT_STATUS_BYTES = 64
+OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 16
+OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 12
OFP_QUEUE_PROP_HEADER_BYTES = 8
OFP_QUEUE_PROP_MIN_RATE_BYTES = 16
OFP_QUEUE_STATS_BYTES = 32
OFP_QUEUE_STATS_REQUEST_BYTES = 8
-OFP_STATS_REPLY_BYTES = 4
-OFP_STATS_REQUEST_BYTES = 4
-OFP_SWITCH_CONFIG_BYTES = 4
-OFP_SWITCH_FEATURES_BYTES = 24
+OFP_STATS_REPLY_BYTES = 12
+OFP_STATS_REQUEST_BYTES = 12
+OFP_SWITCH_CONFIG_BYTES = 12
+OFP_SWITCH_FEATURES_BYTES = 32
OFP_TABLE_STATS_BYTES = 64
-OFP_VENDOR_HEADER_BYTES = 4
+OFP_VENDOR_HEADER_BYTES = 12