Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1 | import struct |
| 2 | |
| 3 | # Structure definitions |
| 4 | class ofp_phy_port: |
| 5 | """Automatically generated Python class for ofp_phy_port |
| 6 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 7 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 8 | Created by of.pythonize.pythonizer |
| 9 | Core structure: Messages do not include ofp_header |
| 10 | Does not include var-length arrays |
| 11 | """ |
| 12 | def __init__(self): |
| 13 | """Initialize |
| 14 | Declare members and default values |
| 15 | """ |
| 16 | self.port_no = 0 |
| 17 | self.hw_addr= [0,0,0,0,0,0] |
| 18 | self.name= "" |
| 19 | self.config = 0 |
| 20 | self.state = 0 |
| 21 | self.curr = 0 |
| 22 | self.advertised = 0 |
| 23 | self.supported = 0 |
| 24 | self.peer = 0 |
| 25 | |
| 26 | def __assert(self): |
| 27 | """Sanity check |
| 28 | """ |
| 29 | if(not isinstance(self.hw_addr, list)): |
| 30 | return (False, "self.hw_addr is not list as expected.") |
| 31 | if(len(self.hw_addr) != 6): |
| 32 | return (False, "self.hw_addr is not of size 6 as expected.") |
| 33 | if(not isinstance(self.name, str)): |
| 34 | return (False, "self.name is not string as expected.") |
| 35 | if(len(self.name) > 16): |
| 36 | return (False, "self.name is not of size 16 as expected.") |
| 37 | return (True, None) |
| 38 | |
| 39 | def pack(self, assertstruct=True): |
| 40 | """Pack message |
| 41 | Packs empty array used as placeholder |
| 42 | """ |
| 43 | if(assertstruct): |
| 44 | if(not self.__assert()[0]): |
| 45 | return None |
| 46 | packed = "" |
| 47 | packed += struct.pack("!H", self.port_no) |
| 48 | 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]) |
| 49 | packed += self.name.ljust(16,'\0') |
| 50 | packed += struct.pack("!LLLLLL", self.config, self.state, self.curr, self.advertised, self.supported, self.peer) |
| 51 | return packed |
| 52 | |
| 53 | def unpack(self, binaryString): |
| 54 | """Unpack message |
| 55 | Do not unpack empty array used as placeholder |
| 56 | since they can contain heterogeneous type |
| 57 | """ |
| 58 | if (len(binaryString) < 48): |
| 59 | return binaryString |
| 60 | fmt = '!H' |
| 61 | start = 0 |
| 62 | end = start + struct.calcsize(fmt) |
| 63 | (self.port_no,) = struct.unpack(fmt, binaryString[start:end]) |
| 64 | fmt = '!BBBBBB' |
| 65 | start = 2 |
| 66 | end = start + struct.calcsize(fmt) |
| 67 | (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]) |
| 68 | self.name = binaryString[8:24].replace("\0","") |
| 69 | fmt = '!LLLLLL' |
| 70 | start = 24 |
| 71 | end = start + struct.calcsize(fmt) |
| 72 | (self.config, self.state, self.curr, self.advertised, self.supported, self.peer) = struct.unpack(fmt, binaryString[start:end]) |
| 73 | return binaryString[48:] |
| 74 | |
| 75 | def __len__(self): |
| 76 | """Return length of message |
| 77 | """ |
| 78 | l = 48 |
| 79 | return l |
| 80 | |
| 81 | def __eq__(self, other): |
| 82 | """Return True if self and other have same values |
| 83 | """ |
| 84 | if type(self) != type(other): return False |
| 85 | if self.port_no != other.port_no: return False |
| 86 | if self.hw_addr != other.hw_addr: return False |
| 87 | if self.name != other.name: return False |
| 88 | if self.config != other.config: return False |
| 89 | if self.state != other.state: return False |
| 90 | if self.curr != other.curr: return False |
| 91 | if self.advertised != other.advertised: return False |
| 92 | if self.supported != other.supported: return False |
| 93 | if self.peer != other.peer: return False |
| 94 | return True |
| 95 | |
| 96 | def __ne__(self, other): return not self.__eq__(other) |
| 97 | |
| 98 | def show(self, prefix=''): |
| 99 | """Generate string showing basic members of structure |
| 100 | """ |
| 101 | outstr = '' |
| 102 | outstr += prefix + 'port_no: ' + str(self.port_no) + '\n' |
| 103 | outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n' |
| 104 | outstr += prefix + 'name: ' + str(self.name) + '\n' |
| 105 | outstr += prefix + 'config: ' + str(self.config) + '\n' |
| 106 | outstr += prefix + 'state: ' + str(self.state) + '\n' |
| 107 | outstr += prefix + 'curr: ' + str(self.curr) + '\n' |
| 108 | outstr += prefix + 'advertised: ' + str(self.advertised) + '\n' |
| 109 | outstr += prefix + 'supported: ' + str(self.supported) + '\n' |
| 110 | outstr += prefix + 'peer: ' + str(self.peer) + '\n' |
| 111 | return outstr |
| 112 | |
| 113 | |
| 114 | class ofp_aggregate_stats_reply: |
| 115 | """Automatically generated Python class for ofp_aggregate_stats_reply |
| 116 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 117 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 118 | Created by of.pythonize.pythonizer |
| 119 | Core structure: Messages do not include ofp_header |
| 120 | Does not include var-length arrays |
| 121 | """ |
| 122 | def __init__(self): |
| 123 | """Initialize |
| 124 | Declare members and default values |
| 125 | """ |
| 126 | self.packet_count = 0 |
| 127 | self.byte_count = 0 |
| 128 | self.flow_count = 0 |
| 129 | self.pad= [0,0,0,0] |
| 130 | |
| 131 | def __assert(self): |
| 132 | """Sanity check |
| 133 | """ |
| 134 | if(not isinstance(self.pad, list)): |
| 135 | return (False, "self.pad is not list as expected.") |
| 136 | if(len(self.pad) != 4): |
| 137 | return (False, "self.pad is not of size 4 as expected.") |
| 138 | return (True, None) |
| 139 | |
| 140 | def pack(self, assertstruct=True): |
| 141 | """Pack message |
| 142 | Packs empty array used as placeholder |
| 143 | """ |
| 144 | if(assertstruct): |
| 145 | if(not self.__assert()[0]): |
| 146 | return None |
| 147 | packed = "" |
| 148 | packed += struct.pack("!QQL", self.packet_count, self.byte_count, self.flow_count) |
| 149 | packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3]) |
| 150 | return packed |
| 151 | |
| 152 | def unpack(self, binaryString): |
| 153 | """Unpack message |
| 154 | Do not unpack empty array used as placeholder |
| 155 | since they can contain heterogeneous type |
| 156 | """ |
| 157 | if (len(binaryString) < 24): |
| 158 | return binaryString |
| 159 | fmt = '!QQL' |
| 160 | start = 0 |
| 161 | end = start + struct.calcsize(fmt) |
| 162 | (self.packet_count, self.byte_count, self.flow_count) = struct.unpack(fmt, binaryString[start:end]) |
| 163 | fmt = '!BBBB' |
| 164 | start = 20 |
| 165 | end = start + struct.calcsize(fmt) |
| 166 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end]) |
| 167 | return binaryString[24:] |
| 168 | |
| 169 | def __len__(self): |
| 170 | """Return length of message |
| 171 | """ |
| 172 | l = 24 |
| 173 | return l |
| 174 | |
| 175 | def __eq__(self, other): |
| 176 | """Return True if self and other have same values |
| 177 | """ |
| 178 | if type(self) != type(other): return False |
| 179 | if self.packet_count != other.packet_count: return False |
| 180 | if self.byte_count != other.byte_count: return False |
| 181 | if self.flow_count != other.flow_count: return False |
| 182 | if self.pad != other.pad: return False |
| 183 | return True |
| 184 | |
| 185 | def __ne__(self, other): return not self.__eq__(other) |
| 186 | |
| 187 | def show(self, prefix=''): |
| 188 | """Generate string showing basic members of structure |
| 189 | """ |
| 190 | outstr = '' |
| 191 | outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n' |
| 192 | outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n' |
| 193 | outstr += prefix + 'flow_count: ' + str(self.flow_count) + '\n' |
| 194 | return outstr |
| 195 | |
| 196 | |
| 197 | class ofp_table_stats: |
| 198 | """Automatically generated Python class for ofp_table_stats |
| 199 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 200 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 201 | Created by of.pythonize.pythonizer |
| 202 | Core structure: Messages do not include ofp_header |
| 203 | Does not include var-length arrays |
| 204 | """ |
| 205 | def __init__(self): |
| 206 | """Initialize |
| 207 | Declare members and default values |
| 208 | """ |
| 209 | self.table_id = 0 |
| 210 | self.pad= [0,0,0] |
| 211 | self.name= "" |
| 212 | self.wildcards = 0 |
| 213 | self.max_entries = 0 |
| 214 | self.active_count = 0 |
| 215 | self.lookup_count = 0 |
| 216 | self.matched_count = 0 |
| 217 | |
| 218 | def __assert(self): |
| 219 | """Sanity check |
| 220 | """ |
| 221 | if(not isinstance(self.pad, list)): |
| 222 | return (False, "self.pad is not list as expected.") |
| 223 | if(len(self.pad) != 3): |
| 224 | return (False, "self.pad is not of size 3 as expected.") |
| 225 | if(not isinstance(self.name, str)): |
| 226 | return (False, "self.name is not string as expected.") |
| 227 | if(len(self.name) > 32): |
| 228 | return (False, "self.name is not of size 32 as expected.") |
| 229 | return (True, None) |
| 230 | |
| 231 | def pack(self, assertstruct=True): |
| 232 | """Pack message |
| 233 | Packs empty array used as placeholder |
| 234 | """ |
| 235 | if(assertstruct): |
| 236 | if(not self.__assert()[0]): |
| 237 | return None |
| 238 | packed = "" |
| 239 | packed += struct.pack("!B", self.table_id) |
| 240 | packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2]) |
| 241 | packed += self.name.ljust(32,'\0') |
| 242 | packed += struct.pack("!LLLQQ", self.wildcards, self.max_entries, self.active_count, self.lookup_count, self.matched_count) |
| 243 | return packed |
| 244 | |
| 245 | def unpack(self, binaryString): |
| 246 | """Unpack message |
| 247 | Do not unpack empty array used as placeholder |
| 248 | since they can contain heterogeneous type |
| 249 | """ |
| 250 | if (len(binaryString) < 64): |
| 251 | return binaryString |
| 252 | fmt = '!B' |
| 253 | start = 0 |
| 254 | end = start + struct.calcsize(fmt) |
| 255 | (self.table_id,) = struct.unpack(fmt, binaryString[start:end]) |
| 256 | fmt = '!BBB' |
| 257 | start = 1 |
| 258 | end = start + struct.calcsize(fmt) |
| 259 | (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end]) |
| 260 | self.name = binaryString[4:36].replace("\0","") |
| 261 | fmt = '!LLLQQ' |
| 262 | start = 36 |
| 263 | end = start + struct.calcsize(fmt) |
| 264 | (self.wildcards, self.max_entries, self.active_count, self.lookup_count, self.matched_count) = struct.unpack(fmt, binaryString[start:end]) |
| 265 | return binaryString[64:] |
| 266 | |
| 267 | def __len__(self): |
| 268 | """Return length of message |
| 269 | """ |
| 270 | l = 64 |
| 271 | return l |
| 272 | |
| 273 | def __eq__(self, other): |
| 274 | """Return True if self and other have same values |
| 275 | """ |
| 276 | if type(self) != type(other): return False |
| 277 | if self.table_id != other.table_id: return False |
| 278 | if self.pad != other.pad: return False |
| 279 | if self.name != other.name: return False |
| 280 | if self.wildcards != other.wildcards: return False |
| 281 | if self.max_entries != other.max_entries: return False |
| 282 | if self.active_count != other.active_count: return False |
| 283 | if self.lookup_count != other.lookup_count: return False |
| 284 | if self.matched_count != other.matched_count: return False |
| 285 | return True |
| 286 | |
| 287 | def __ne__(self, other): return not self.__eq__(other) |
| 288 | |
| 289 | def show(self, prefix=''): |
| 290 | """Generate string showing basic members of structure |
| 291 | """ |
| 292 | outstr = '' |
| 293 | outstr += prefix + 'table_id: ' + str(self.table_id) + '\n' |
| 294 | outstr += prefix + 'name: ' + str(self.name) + '\n' |
| 295 | outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n' |
| 296 | outstr += prefix + 'max_entries: ' + str(self.max_entries) + '\n' |
| 297 | outstr += prefix + 'active_count: ' + str(self.active_count) + '\n' |
| 298 | outstr += prefix + 'lookup_count: ' + str(self.lookup_count) + '\n' |
| 299 | outstr += prefix + 'matched_count: ' + str(self.matched_count) + '\n' |
| 300 | return outstr |
| 301 | |
| 302 | |
| 303 | class ofp_flow_removed: |
| 304 | """Automatically generated Python class for ofp_flow_removed |
| 305 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 306 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 307 | Created by of.pythonize.pythonizer |
| 308 | Core structure: Messages do not include ofp_header |
| 309 | Does not include var-length arrays |
| 310 | """ |
| 311 | def __init__(self): |
| 312 | """Initialize |
| 313 | Declare members and default values |
| 314 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 315 | self.version = 0 |
| 316 | self.type = 0 |
| 317 | self.length = 0 |
| 318 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 319 | self.match = ofp_match() |
| 320 | self.cookie = 0 |
| 321 | self.priority = 0 |
| 322 | self.reason = 0 |
| 323 | self.pad = 0 |
| 324 | self.duration_sec = 0 |
| 325 | self.duration_nsec = 0 |
| 326 | self.idle_timeout = 0 |
| 327 | self.pad2= [0,0] |
| 328 | self.packet_count = 0 |
| 329 | self.byte_count = 0 |
| 330 | |
| 331 | def __assert(self): |
| 332 | """Sanity check |
| 333 | """ |
| 334 | if(not isinstance(self.match, ofp_match)): |
| 335 | return (False, "self.match is not class ofp_match as expected.") |
| 336 | if(not isinstance(self.pad2, list)): |
| 337 | return (False, "self.pad2 is not list as expected.") |
| 338 | if(len(self.pad2) != 2): |
| 339 | return (False, "self.pad2 is not of size 2 as expected.") |
| 340 | return (True, None) |
| 341 | |
| 342 | def pack(self, assertstruct=True): |
| 343 | """Pack message |
| 344 | Packs empty array used as placeholder |
| 345 | """ |
| 346 | if(assertstruct): |
| 347 | if(not self.__assert()[0]): |
| 348 | return None |
| 349 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 350 | packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 351 | packed += self.match.pack() |
| 352 | packed += struct.pack("!QHBBLLH", self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout) |
| 353 | packed += struct.pack("!BB", self.pad2[0], self.pad2[1]) |
| 354 | packed += struct.pack("!QQ", self.packet_count, self.byte_count) |
| 355 | return packed |
| 356 | |
| 357 | def unpack(self, binaryString): |
| 358 | """Unpack message |
| 359 | Do not unpack empty array used as placeholder |
| 360 | since they can contain heterogeneous type |
| 361 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 362 | if (len(binaryString) < 88): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 363 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 364 | fmt = '!BBHL' |
| 365 | start = 0 |
| 366 | end = start + struct.calcsize(fmt) |
| 367 | (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end]) |
| 368 | self.match.unpack(binaryString[8:]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 369 | fmt = '!QHBBLLH' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 370 | start = 48 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 371 | end = start + struct.calcsize(fmt) |
| 372 | (self.cookie, self.priority, self.reason, self.pad, self.duration_sec, self.duration_nsec, self.idle_timeout) = struct.unpack(fmt, binaryString[start:end]) |
| 373 | fmt = '!BB' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 374 | start = 70 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 375 | end = start + struct.calcsize(fmt) |
| 376 | (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end]) |
| 377 | fmt = '!QQ' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 378 | start = 72 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 379 | end = start + struct.calcsize(fmt) |
| 380 | (self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 381 | return binaryString[88:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 382 | |
| 383 | def __len__(self): |
| 384 | """Return length of message |
| 385 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 386 | l = 88 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 387 | return l |
| 388 | |
| 389 | def __eq__(self, other): |
| 390 | """Return True if self and other have same values |
| 391 | """ |
| 392 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 393 | if self.version != other.version: return False |
| 394 | if self.type != other.type: return False |
| 395 | if self.length != other.length: return False |
| 396 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 397 | if self.match != other.match: return False |
| 398 | if self.cookie != other.cookie: return False |
| 399 | if self.priority != other.priority: return False |
| 400 | if self.reason != other.reason: return False |
| 401 | if self.pad != other.pad: return False |
| 402 | if self.duration_sec != other.duration_sec: return False |
| 403 | if self.duration_nsec != other.duration_nsec: return False |
| 404 | if self.idle_timeout != other.idle_timeout: return False |
| 405 | if self.pad2 != other.pad2: return False |
| 406 | if self.packet_count != other.packet_count: return False |
| 407 | if self.byte_count != other.byte_count: return False |
| 408 | return True |
| 409 | |
| 410 | def __ne__(self, other): return not self.__eq__(other) |
| 411 | |
| 412 | def show(self, prefix=''): |
| 413 | """Generate string showing basic members of structure |
| 414 | """ |
| 415 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 416 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 417 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 418 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 419 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 420 | outstr += prefix + 'match: \n' |
| 421 | outstr += self.match.show(prefix + ' ') |
| 422 | outstr += prefix + 'cookie: ' + str(self.cookie) + '\n' |
| 423 | outstr += prefix + 'priority: ' + str(self.priority) + '\n' |
| 424 | outstr += prefix + 'reason: ' + str(self.reason) + '\n' |
| 425 | outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n' |
| 426 | outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n' |
| 427 | outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n' |
| 428 | outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n' |
| 429 | outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n' |
| 430 | return outstr |
| 431 | |
| 432 | |
| 433 | class ofp_port_stats: |
| 434 | """Automatically generated Python class for ofp_port_stats |
| 435 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 436 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 437 | Created by of.pythonize.pythonizer |
| 438 | Core structure: Messages do not include ofp_header |
| 439 | Does not include var-length arrays |
| 440 | """ |
| 441 | def __init__(self): |
| 442 | """Initialize |
| 443 | Declare members and default values |
| 444 | """ |
| 445 | self.port_no = 0 |
| 446 | self.pad= [0,0,0,0,0,0] |
| 447 | self.rx_packets = 0 |
| 448 | self.tx_packets = 0 |
| 449 | self.rx_bytes = 0 |
| 450 | self.tx_bytes = 0 |
| 451 | self.rx_dropped = 0 |
| 452 | self.tx_dropped = 0 |
| 453 | self.rx_errors = 0 |
| 454 | self.tx_errors = 0 |
| 455 | self.rx_frame_err = 0 |
| 456 | self.rx_over_err = 0 |
| 457 | self.rx_crc_err = 0 |
| 458 | self.collisions = 0 |
| 459 | |
| 460 | def __assert(self): |
| 461 | """Sanity check |
| 462 | """ |
| 463 | if(not isinstance(self.pad, list)): |
| 464 | return (False, "self.pad is not list as expected.") |
| 465 | if(len(self.pad) != 6): |
| 466 | return (False, "self.pad is not of size 6 as expected.") |
| 467 | return (True, None) |
| 468 | |
| 469 | def pack(self, assertstruct=True): |
| 470 | """Pack message |
| 471 | Packs empty array used as placeholder |
| 472 | """ |
| 473 | if(assertstruct): |
| 474 | if(not self.__assert()[0]): |
| 475 | return None |
| 476 | packed = "" |
| 477 | packed += struct.pack("!H", self.port_no) |
| 478 | packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) |
| 479 | packed += struct.pack("!QQQQQQQQQQQQ", self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions) |
| 480 | return packed |
| 481 | |
| 482 | def unpack(self, binaryString): |
| 483 | """Unpack message |
| 484 | Do not unpack empty array used as placeholder |
| 485 | since they can contain heterogeneous type |
| 486 | """ |
| 487 | if (len(binaryString) < 104): |
| 488 | return binaryString |
| 489 | fmt = '!H' |
| 490 | start = 0 |
| 491 | end = start + struct.calcsize(fmt) |
| 492 | (self.port_no,) = struct.unpack(fmt, binaryString[start:end]) |
| 493 | fmt = '!BBBBBB' |
| 494 | start = 2 |
| 495 | end = start + struct.calcsize(fmt) |
| 496 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end]) |
| 497 | fmt = '!QQQQQQQQQQQQ' |
| 498 | start = 8 |
| 499 | end = start + struct.calcsize(fmt) |
| 500 | (self.rx_packets, self.tx_packets, self.rx_bytes, self.tx_bytes, self.rx_dropped, self.tx_dropped, self.rx_errors, self.tx_errors, self.rx_frame_err, self.rx_over_err, self.rx_crc_err, self.collisions) = struct.unpack(fmt, binaryString[start:end]) |
| 501 | return binaryString[104:] |
| 502 | |
| 503 | def __len__(self): |
| 504 | """Return length of message |
| 505 | """ |
| 506 | l = 104 |
| 507 | return l |
| 508 | |
| 509 | def __eq__(self, other): |
| 510 | """Return True if self and other have same values |
| 511 | """ |
| 512 | if type(self) != type(other): return False |
| 513 | if self.port_no != other.port_no: return False |
| 514 | if self.pad != other.pad: return False |
| 515 | if self.rx_packets != other.rx_packets: return False |
| 516 | if self.tx_packets != other.tx_packets: return False |
| 517 | if self.rx_bytes != other.rx_bytes: return False |
| 518 | if self.tx_bytes != other.tx_bytes: return False |
| 519 | if self.rx_dropped != other.rx_dropped: return False |
| 520 | if self.tx_dropped != other.tx_dropped: return False |
| 521 | if self.rx_errors != other.rx_errors: return False |
| 522 | if self.tx_errors != other.tx_errors: return False |
| 523 | if self.rx_frame_err != other.rx_frame_err: return False |
| 524 | if self.rx_over_err != other.rx_over_err: return False |
| 525 | if self.rx_crc_err != other.rx_crc_err: return False |
| 526 | if self.collisions != other.collisions: return False |
| 527 | return True |
| 528 | |
| 529 | def __ne__(self, other): return not self.__eq__(other) |
| 530 | |
| 531 | def show(self, prefix=''): |
| 532 | """Generate string showing basic members of structure |
| 533 | """ |
| 534 | outstr = '' |
| 535 | outstr += prefix + 'port_no: ' + str(self.port_no) + '\n' |
| 536 | outstr += prefix + 'rx_packets: ' + str(self.rx_packets) + '\n' |
| 537 | outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n' |
| 538 | outstr += prefix + 'rx_bytes: ' + str(self.rx_bytes) + '\n' |
| 539 | outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n' |
| 540 | outstr += prefix + 'rx_dropped: ' + str(self.rx_dropped) + '\n' |
| 541 | outstr += prefix + 'tx_dropped: ' + str(self.tx_dropped) + '\n' |
| 542 | outstr += prefix + 'rx_errors: ' + str(self.rx_errors) + '\n' |
| 543 | outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n' |
| 544 | outstr += prefix + 'rx_frame_err: ' + str(self.rx_frame_err) + '\n' |
| 545 | outstr += prefix + 'rx_over_err: ' + str(self.rx_over_err) + '\n' |
| 546 | outstr += prefix + 'rx_crc_err: ' + str(self.rx_crc_err) + '\n' |
| 547 | outstr += prefix + 'collisions: ' + str(self.collisions) + '\n' |
| 548 | return outstr |
| 549 | |
| 550 | |
| 551 | class ofp_queue_stats: |
| 552 | """Automatically generated Python class for ofp_queue_stats |
| 553 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 554 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 555 | Created by of.pythonize.pythonizer |
| 556 | Core structure: Messages do not include ofp_header |
| 557 | Does not include var-length arrays |
| 558 | """ |
| 559 | def __init__(self): |
| 560 | """Initialize |
| 561 | Declare members and default values |
| 562 | """ |
| 563 | self.port_no = 0 |
| 564 | self.pad= [0,0] |
| 565 | self.queue_id = 0 |
| 566 | self.tx_bytes = 0 |
| 567 | self.tx_packets = 0 |
| 568 | self.tx_errors = 0 |
| 569 | |
| 570 | def __assert(self): |
| 571 | """Sanity check |
| 572 | """ |
| 573 | if(not isinstance(self.pad, list)): |
| 574 | return (False, "self.pad is not list as expected.") |
| 575 | if(len(self.pad) != 2): |
| 576 | return (False, "self.pad is not of size 2 as expected.") |
| 577 | return (True, None) |
| 578 | |
| 579 | def pack(self, assertstruct=True): |
| 580 | """Pack message |
| 581 | Packs empty array used as placeholder |
| 582 | """ |
| 583 | if(assertstruct): |
| 584 | if(not self.__assert()[0]): |
| 585 | return None |
| 586 | packed = "" |
| 587 | packed += struct.pack("!H", self.port_no) |
| 588 | packed += struct.pack("!BB", self.pad[0], self.pad[1]) |
| 589 | packed += struct.pack("!LQQQ", self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors) |
| 590 | return packed |
| 591 | |
| 592 | def unpack(self, binaryString): |
| 593 | """Unpack message |
| 594 | Do not unpack empty array used as placeholder |
| 595 | since they can contain heterogeneous type |
| 596 | """ |
| 597 | if (len(binaryString) < 32): |
| 598 | return binaryString |
| 599 | fmt = '!H' |
| 600 | start = 0 |
| 601 | end = start + struct.calcsize(fmt) |
| 602 | (self.port_no,) = struct.unpack(fmt, binaryString[start:end]) |
| 603 | fmt = '!BB' |
| 604 | start = 2 |
| 605 | end = start + struct.calcsize(fmt) |
| 606 | (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end]) |
| 607 | fmt = '!LQQQ' |
| 608 | start = 4 |
| 609 | end = start + struct.calcsize(fmt) |
| 610 | (self.queue_id, self.tx_bytes, self.tx_packets, self.tx_errors) = struct.unpack(fmt, binaryString[start:end]) |
| 611 | return binaryString[32:] |
| 612 | |
| 613 | def __len__(self): |
| 614 | """Return length of message |
| 615 | """ |
| 616 | l = 32 |
| 617 | return l |
| 618 | |
| 619 | def __eq__(self, other): |
| 620 | """Return True if self and other have same values |
| 621 | """ |
| 622 | if type(self) != type(other): return False |
| 623 | if self.port_no != other.port_no: return False |
| 624 | if self.pad != other.pad: return False |
| 625 | if self.queue_id != other.queue_id: return False |
| 626 | if self.tx_bytes != other.tx_bytes: return False |
| 627 | if self.tx_packets != other.tx_packets: return False |
| 628 | if self.tx_errors != other.tx_errors: return False |
| 629 | return True |
| 630 | |
| 631 | def __ne__(self, other): return not self.__eq__(other) |
| 632 | |
| 633 | def show(self, prefix=''): |
| 634 | """Generate string showing basic members of structure |
| 635 | """ |
| 636 | outstr = '' |
| 637 | outstr += prefix + 'port_no: ' + str(self.port_no) + '\n' |
| 638 | outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n' |
| 639 | outstr += prefix + 'tx_bytes: ' + str(self.tx_bytes) + '\n' |
| 640 | outstr += prefix + 'tx_packets: ' + str(self.tx_packets) + '\n' |
| 641 | outstr += prefix + 'tx_errors: ' + str(self.tx_errors) + '\n' |
| 642 | return outstr |
| 643 | |
| 644 | |
| 645 | class ofp_action_tp_port: |
| 646 | """Automatically generated Python class for ofp_action_tp_port |
| 647 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 648 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 649 | Created by of.pythonize.pythonizer |
| 650 | Core structure: Messages do not include ofp_header |
| 651 | Does not include var-length arrays |
| 652 | """ |
| 653 | def __init__(self): |
| 654 | """Initialize |
| 655 | Declare members and default values |
| 656 | """ |
| 657 | self.type = 0 |
| 658 | self.len = 0 |
| 659 | self.tp_port = 0 |
| 660 | self.pad= [0,0] |
| 661 | |
| 662 | def __assert(self): |
| 663 | """Sanity check |
| 664 | """ |
| 665 | if(not isinstance(self.pad, list)): |
| 666 | return (False, "self.pad is not list as expected.") |
| 667 | if(len(self.pad) != 2): |
| 668 | return (False, "self.pad is not of size 2 as expected.") |
| 669 | return (True, None) |
| 670 | |
| 671 | def pack(self, assertstruct=True): |
| 672 | """Pack message |
| 673 | Packs empty array used as placeholder |
| 674 | """ |
| 675 | if(assertstruct): |
| 676 | if(not self.__assert()[0]): |
| 677 | return None |
| 678 | packed = "" |
| 679 | packed += struct.pack("!HHH", self.type, self.len, self.tp_port) |
| 680 | packed += struct.pack("!BB", self.pad[0], self.pad[1]) |
| 681 | return packed |
| 682 | |
| 683 | def unpack(self, binaryString): |
| 684 | """Unpack message |
| 685 | Do not unpack empty array used as placeholder |
| 686 | since they can contain heterogeneous type |
| 687 | """ |
| 688 | if (len(binaryString) < 8): |
| 689 | return binaryString |
| 690 | fmt = '!HHH' |
| 691 | start = 0 |
| 692 | end = start + struct.calcsize(fmt) |
| 693 | (self.type, self.len, self.tp_port) = struct.unpack(fmt, binaryString[start:end]) |
| 694 | fmt = '!BB' |
| 695 | start = 6 |
| 696 | end = start + struct.calcsize(fmt) |
| 697 | (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end]) |
| 698 | return binaryString[8:] |
| 699 | |
| 700 | def __len__(self): |
| 701 | """Return length of message |
| 702 | """ |
| 703 | l = 8 |
| 704 | return l |
| 705 | |
| 706 | def __eq__(self, other): |
| 707 | """Return True if self and other have same values |
| 708 | """ |
| 709 | if type(self) != type(other): return False |
| 710 | if self.type != other.type: return False |
| 711 | if self.len != other.len: return False |
| 712 | if self.tp_port != other.tp_port: return False |
| 713 | if self.pad != other.pad: return False |
| 714 | return True |
| 715 | |
| 716 | def __ne__(self, other): return not self.__eq__(other) |
| 717 | |
| 718 | def show(self, prefix=''): |
| 719 | """Generate string showing basic members of structure |
| 720 | """ |
| 721 | outstr = '' |
| 722 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 723 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 724 | outstr += prefix + 'tp_port: ' + str(self.tp_port) + '\n' |
| 725 | return outstr |
| 726 | |
| 727 | |
| 728 | class ofp_port_stats_request: |
| 729 | """Automatically generated Python class for ofp_port_stats_request |
| 730 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 731 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 732 | Created by of.pythonize.pythonizer |
| 733 | Core structure: Messages do not include ofp_header |
| 734 | Does not include var-length arrays |
| 735 | """ |
| 736 | def __init__(self): |
| 737 | """Initialize |
| 738 | Declare members and default values |
| 739 | """ |
| 740 | self.port_no = 0 |
| 741 | self.pad= [0,0,0,0,0,0] |
| 742 | |
| 743 | def __assert(self): |
| 744 | """Sanity check |
| 745 | """ |
| 746 | if(not isinstance(self.pad, list)): |
| 747 | return (False, "self.pad is not list as expected.") |
| 748 | if(len(self.pad) != 6): |
| 749 | return (False, "self.pad is not of size 6 as expected.") |
| 750 | return (True, None) |
| 751 | |
| 752 | def pack(self, assertstruct=True): |
| 753 | """Pack message |
| 754 | Packs empty array used as placeholder |
| 755 | """ |
| 756 | if(assertstruct): |
| 757 | if(not self.__assert()[0]): |
| 758 | return None |
| 759 | packed = "" |
| 760 | packed += struct.pack("!H", self.port_no) |
| 761 | packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) |
| 762 | return packed |
| 763 | |
| 764 | def unpack(self, binaryString): |
| 765 | """Unpack message |
| 766 | Do not unpack empty array used as placeholder |
| 767 | since they can contain heterogeneous type |
| 768 | """ |
| 769 | if (len(binaryString) < 8): |
| 770 | return binaryString |
| 771 | fmt = '!H' |
| 772 | start = 0 |
| 773 | end = start + struct.calcsize(fmt) |
| 774 | (self.port_no,) = struct.unpack(fmt, binaryString[start:end]) |
| 775 | fmt = '!BBBBBB' |
| 776 | start = 2 |
| 777 | end = start + struct.calcsize(fmt) |
| 778 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end]) |
| 779 | return binaryString[8:] |
| 780 | |
| 781 | def __len__(self): |
| 782 | """Return length of message |
| 783 | """ |
| 784 | l = 8 |
| 785 | return l |
| 786 | |
| 787 | def __eq__(self, other): |
| 788 | """Return True if self and other have same values |
| 789 | """ |
| 790 | if type(self) != type(other): return False |
| 791 | if self.port_no != other.port_no: return False |
| 792 | if self.pad != other.pad: return False |
| 793 | return True |
| 794 | |
| 795 | def __ne__(self, other): return not self.__eq__(other) |
| 796 | |
| 797 | def show(self, prefix=''): |
| 798 | """Generate string showing basic members of structure |
| 799 | """ |
| 800 | outstr = '' |
| 801 | outstr += prefix + 'port_no: ' + str(self.port_no) + '\n' |
| 802 | return outstr |
| 803 | |
| 804 | |
| 805 | class ofp_stats_request: |
| 806 | """Automatically generated Python class for ofp_stats_request |
| 807 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 808 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 809 | Created by of.pythonize.pythonizer |
| 810 | Core structure: Messages do not include ofp_header |
| 811 | Does not include var-length arrays |
| 812 | """ |
| 813 | def __init__(self): |
| 814 | """Initialize |
| 815 | Declare members and default values |
| 816 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 817 | self.version = 0 |
| 818 | self.type = 0 |
| 819 | self.length = 0 |
| 820 | self.xid = 0 |
Rich Lane | 7c7342a | 2013-03-11 14:16:58 -0700 | [diff] [blame] | 821 | self.stats_type = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 822 | self.flags = 0 |
| 823 | |
| 824 | def __assert(self): |
| 825 | """Sanity check |
| 826 | """ |
| 827 | return (True, None) |
| 828 | |
| 829 | def pack(self, assertstruct=True): |
| 830 | """Pack message |
| 831 | Packs empty array used as placeholder |
| 832 | """ |
| 833 | if(assertstruct): |
| 834 | if(not self.__assert()[0]): |
| 835 | return None |
| 836 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 837 | packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.stats_type, self.flags) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 838 | return packed |
| 839 | |
| 840 | def unpack(self, binaryString): |
| 841 | """Unpack message |
| 842 | Do not unpack empty array used as placeholder |
| 843 | since they can contain heterogeneous type |
| 844 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 845 | if (len(binaryString) < 12): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 846 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 847 | fmt = '!BBHLHH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 848 | start = 0 |
| 849 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 850 | (self.version, self.type, self.length, self.xid, self.stats_type, self.flags) = struct.unpack(fmt, binaryString[start:end]) |
| 851 | return binaryString[12:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 852 | |
| 853 | def __len__(self): |
| 854 | """Return length of message |
| 855 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 856 | l = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 857 | return l |
| 858 | |
| 859 | def __eq__(self, other): |
| 860 | """Return True if self and other have same values |
| 861 | """ |
| 862 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 863 | if self.version != other.version: return False |
| 864 | if self.type != other.type: return False |
| 865 | if self.length != other.length: return False |
| 866 | if self.xid != other.xid: return False |
Rich Lane | 7c7342a | 2013-03-11 14:16:58 -0700 | [diff] [blame] | 867 | if self.stats_type != other.stats_type: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 868 | if self.flags != other.flags: return False |
| 869 | return True |
| 870 | |
| 871 | def __ne__(self, other): return not self.__eq__(other) |
| 872 | |
| 873 | def show(self, prefix=''): |
| 874 | """Generate string showing basic members of structure |
| 875 | """ |
| 876 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 877 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 878 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 879 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 880 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 7c7342a | 2013-03-11 14:16:58 -0700 | [diff] [blame] | 881 | outstr += prefix + 'stats_type: ' + str(self.stats_type) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 882 | outstr += prefix + 'flags: ' + str(self.flags) + '\n' |
| 883 | return outstr |
| 884 | |
| 885 | |
| 886 | class ofp_hello: |
| 887 | """Automatically generated Python class for ofp_hello |
| 888 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 889 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 890 | Created by of.pythonize.pythonizer |
| 891 | Core structure: Messages do not include ofp_header |
| 892 | Does not include var-length arrays |
| 893 | """ |
| 894 | def __init__(self): |
| 895 | """Initialize |
| 896 | Declare members and default values |
| 897 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 898 | self.version = 0 |
| 899 | self.type = 0 |
| 900 | self.length = 0 |
| 901 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 902 | |
| 903 | def __assert(self): |
| 904 | """Sanity check |
| 905 | """ |
| 906 | return (True, None) |
| 907 | |
| 908 | def pack(self, assertstruct=True): |
| 909 | """Pack message |
| 910 | Packs empty array used as placeholder |
| 911 | """ |
| 912 | if(assertstruct): |
| 913 | if(not self.__assert()[0]): |
| 914 | return None |
| 915 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 916 | packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 917 | return packed |
| 918 | |
| 919 | def unpack(self, binaryString): |
| 920 | """Unpack message |
| 921 | Do not unpack empty array used as placeholder |
| 922 | since they can contain heterogeneous type |
| 923 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 924 | if (len(binaryString) < 8): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 925 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 926 | fmt = '!BBHL' |
| 927 | start = 0 |
| 928 | end = start + struct.calcsize(fmt) |
| 929 | (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end]) |
| 930 | return binaryString[8:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 931 | |
| 932 | def __len__(self): |
| 933 | """Return length of message |
| 934 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 935 | l = 8 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 936 | return l |
| 937 | |
| 938 | def __eq__(self, other): |
| 939 | """Return True if self and other have same values |
| 940 | """ |
| 941 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 942 | if self.version != other.version: return False |
| 943 | if self.type != other.type: return False |
| 944 | if self.length != other.length: return False |
| 945 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 946 | return True |
| 947 | |
| 948 | def __ne__(self, other): return not self.__eq__(other) |
| 949 | |
| 950 | def show(self, prefix=''): |
| 951 | """Generate string showing basic members of structure |
| 952 | """ |
| 953 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 954 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 955 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 956 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 957 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 958 | return outstr |
| 959 | |
| 960 | |
| 961 | class ofp_aggregate_stats_request: |
| 962 | """Automatically generated Python class for ofp_aggregate_stats_request |
| 963 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 964 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 965 | Created by of.pythonize.pythonizer |
| 966 | Core structure: Messages do not include ofp_header |
| 967 | Does not include var-length arrays |
| 968 | """ |
| 969 | def __init__(self): |
| 970 | """Initialize |
| 971 | Declare members and default values |
| 972 | """ |
| 973 | self.match = ofp_match() |
| 974 | self.table_id = 0 |
| 975 | self.pad = 0 |
| 976 | self.out_port = 0 |
| 977 | |
| 978 | def __assert(self): |
| 979 | """Sanity check |
| 980 | """ |
| 981 | if(not isinstance(self.match, ofp_match)): |
| 982 | return (False, "self.match is not class ofp_match as expected.") |
| 983 | return (True, None) |
| 984 | |
| 985 | def pack(self, assertstruct=True): |
| 986 | """Pack message |
| 987 | Packs empty array used as placeholder |
| 988 | """ |
| 989 | if(assertstruct): |
| 990 | if(not self.__assert()[0]): |
| 991 | return None |
| 992 | packed = "" |
| 993 | packed += self.match.pack() |
| 994 | packed += struct.pack("!BBH", self.table_id, self.pad, self.out_port) |
| 995 | return packed |
| 996 | |
| 997 | def unpack(self, binaryString): |
| 998 | """Unpack message |
| 999 | Do not unpack empty array used as placeholder |
| 1000 | since they can contain heterogeneous type |
| 1001 | """ |
| 1002 | if (len(binaryString) < 44): |
| 1003 | return binaryString |
| 1004 | self.match.unpack(binaryString[0:]) |
| 1005 | fmt = '!BBH' |
| 1006 | start = 40 |
| 1007 | end = start + struct.calcsize(fmt) |
| 1008 | (self.table_id, self.pad, self.out_port) = struct.unpack(fmt, binaryString[start:end]) |
| 1009 | return binaryString[44:] |
| 1010 | |
| 1011 | def __len__(self): |
| 1012 | """Return length of message |
| 1013 | """ |
| 1014 | l = 44 |
| 1015 | return l |
| 1016 | |
| 1017 | def __eq__(self, other): |
| 1018 | """Return True if self and other have same values |
| 1019 | """ |
| 1020 | if type(self) != type(other): return False |
| 1021 | if self.match != other.match: return False |
| 1022 | if self.table_id != other.table_id: return False |
| 1023 | if self.pad != other.pad: return False |
| 1024 | if self.out_port != other.out_port: return False |
| 1025 | return True |
| 1026 | |
| 1027 | def __ne__(self, other): return not self.__eq__(other) |
| 1028 | |
| 1029 | def show(self, prefix=''): |
| 1030 | """Generate string showing basic members of structure |
| 1031 | """ |
| 1032 | outstr = '' |
| 1033 | outstr += prefix + 'match: \n' |
| 1034 | outstr += self.match.show(prefix + ' ') |
| 1035 | outstr += prefix + 'table_id: ' + str(self.table_id) + '\n' |
| 1036 | outstr += prefix + 'out_port: ' + str(self.out_port) + '\n' |
| 1037 | return outstr |
| 1038 | |
| 1039 | |
| 1040 | class ofp_port_status: |
| 1041 | """Automatically generated Python class for ofp_port_status |
| 1042 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1043 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1044 | Created by of.pythonize.pythonizer |
| 1045 | Core structure: Messages do not include ofp_header |
| 1046 | Does not include var-length arrays |
| 1047 | """ |
| 1048 | def __init__(self): |
| 1049 | """Initialize |
| 1050 | Declare members and default values |
| 1051 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1052 | self.version = 0 |
| 1053 | self.type = 0 |
| 1054 | self.length = 0 |
| 1055 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1056 | self.reason = 0 |
| 1057 | self.pad= [0,0,0,0,0,0,0] |
| 1058 | self.desc = ofp_phy_port() |
| 1059 | |
| 1060 | def __assert(self): |
| 1061 | """Sanity check |
| 1062 | """ |
| 1063 | if(not isinstance(self.pad, list)): |
| 1064 | return (False, "self.pad is not list as expected.") |
| 1065 | if(len(self.pad) != 7): |
| 1066 | return (False, "self.pad is not of size 7 as expected.") |
| 1067 | if(not isinstance(self.desc, ofp_phy_port)): |
| 1068 | return (False, "self.desc is not class ofp_phy_port as expected.") |
| 1069 | return (True, None) |
| 1070 | |
| 1071 | def pack(self, assertstruct=True): |
| 1072 | """Pack message |
| 1073 | Packs empty array used as placeholder |
| 1074 | """ |
| 1075 | if(assertstruct): |
| 1076 | if(not self.__assert()[0]): |
| 1077 | return None |
| 1078 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1079 | packed += struct.pack("!BBHLB", self.version, self.type, self.length, self.xid, self.reason) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1080 | 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]) |
| 1081 | packed += self.desc.pack() |
| 1082 | return packed |
| 1083 | |
| 1084 | def unpack(self, binaryString): |
| 1085 | """Unpack message |
| 1086 | Do not unpack empty array used as placeholder |
| 1087 | since they can contain heterogeneous type |
| 1088 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1089 | if (len(binaryString) < 64): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1090 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1091 | fmt = '!BBHLB' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1092 | start = 0 |
| 1093 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1094 | (self.version, self.type, self.length, self.xid, self.reason) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1095 | fmt = '!BBBBBBB' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1096 | start = 9 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1097 | end = start + struct.calcsize(fmt) |
| 1098 | (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]) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1099 | self.desc.unpack(binaryString[16:]) |
| 1100 | return binaryString[64:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1101 | |
| 1102 | def __len__(self): |
| 1103 | """Return length of message |
| 1104 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1105 | l = 64 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1106 | return l |
| 1107 | |
| 1108 | def __eq__(self, other): |
| 1109 | """Return True if self and other have same values |
| 1110 | """ |
| 1111 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1112 | if self.version != other.version: return False |
| 1113 | if self.type != other.type: return False |
| 1114 | if self.length != other.length: return False |
| 1115 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1116 | if self.reason != other.reason: return False |
| 1117 | if self.pad != other.pad: return False |
| 1118 | if self.desc != other.desc: return False |
| 1119 | return True |
| 1120 | |
| 1121 | def __ne__(self, other): return not self.__eq__(other) |
| 1122 | |
| 1123 | def show(self, prefix=''): |
| 1124 | """Generate string showing basic members of structure |
| 1125 | """ |
| 1126 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1127 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 1128 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1129 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 1130 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1131 | outstr += prefix + 'reason: ' + str(self.reason) + '\n' |
| 1132 | outstr += prefix + 'desc: \n' |
| 1133 | outstr += self.desc.show(prefix + ' ') |
| 1134 | return outstr |
| 1135 | |
| 1136 | |
| 1137 | class ofp_action_header: |
| 1138 | """Automatically generated Python class for ofp_action_header |
| 1139 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1140 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1141 | Created by of.pythonize.pythonizer |
| 1142 | Core structure: Messages do not include ofp_header |
| 1143 | Does not include var-length arrays |
| 1144 | """ |
| 1145 | def __init__(self): |
| 1146 | """Initialize |
| 1147 | Declare members and default values |
| 1148 | """ |
| 1149 | self.type = 0 |
| 1150 | self.len = 0 |
| 1151 | self.pad= [0,0,0,0] |
| 1152 | |
| 1153 | def __assert(self): |
| 1154 | """Sanity check |
| 1155 | """ |
| 1156 | if(not isinstance(self.pad, list)): |
| 1157 | return (False, "self.pad is not list as expected.") |
| 1158 | if(len(self.pad) != 4): |
| 1159 | return (False, "self.pad is not of size 4 as expected.") |
| 1160 | return (True, None) |
| 1161 | |
| 1162 | def pack(self, assertstruct=True): |
| 1163 | """Pack message |
| 1164 | Packs empty array used as placeholder |
| 1165 | """ |
| 1166 | if(assertstruct): |
| 1167 | if(not self.__assert()[0]): |
| 1168 | return None |
| 1169 | packed = "" |
| 1170 | packed += struct.pack("!HH", self.type, self.len) |
| 1171 | packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3]) |
| 1172 | return packed |
| 1173 | |
| 1174 | def unpack(self, binaryString): |
| 1175 | """Unpack message |
| 1176 | Do not unpack empty array used as placeholder |
| 1177 | since they can contain heterogeneous type |
| 1178 | """ |
| 1179 | if (len(binaryString) < 8): |
| 1180 | return binaryString |
| 1181 | fmt = '!HH' |
| 1182 | start = 0 |
| 1183 | end = start + struct.calcsize(fmt) |
| 1184 | (self.type, self.len) = struct.unpack(fmt, binaryString[start:end]) |
| 1185 | fmt = '!BBBB' |
| 1186 | start = 4 |
| 1187 | end = start + struct.calcsize(fmt) |
| 1188 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end]) |
| 1189 | return binaryString[8:] |
| 1190 | |
| 1191 | def __len__(self): |
| 1192 | """Return length of message |
| 1193 | """ |
| 1194 | l = 8 |
| 1195 | return l |
| 1196 | |
| 1197 | def __eq__(self, other): |
| 1198 | """Return True if self and other have same values |
| 1199 | """ |
| 1200 | if type(self) != type(other): return False |
| 1201 | if self.type != other.type: return False |
| 1202 | if self.len != other.len: return False |
| 1203 | if self.pad != other.pad: return False |
| 1204 | return True |
| 1205 | |
| 1206 | def __ne__(self, other): return not self.__eq__(other) |
| 1207 | |
| 1208 | def show(self, prefix=''): |
| 1209 | """Generate string showing basic members of structure |
| 1210 | """ |
| 1211 | outstr = '' |
| 1212 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1213 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 1214 | return outstr |
| 1215 | |
| 1216 | |
| 1217 | class ofp_port_mod: |
| 1218 | """Automatically generated Python class for ofp_port_mod |
| 1219 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1220 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1221 | Created by of.pythonize.pythonizer |
| 1222 | Core structure: Messages do not include ofp_header |
| 1223 | Does not include var-length arrays |
| 1224 | """ |
| 1225 | def __init__(self): |
| 1226 | """Initialize |
| 1227 | Declare members and default values |
| 1228 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1229 | self.version = 0 |
| 1230 | self.type = 0 |
| 1231 | self.length = 0 |
| 1232 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1233 | self.port_no = 0 |
| 1234 | self.hw_addr= [0,0,0,0,0,0] |
| 1235 | self.config = 0 |
| 1236 | self.mask = 0 |
| 1237 | self.advertise = 0 |
| 1238 | self.pad= [0,0,0,0] |
| 1239 | |
| 1240 | def __assert(self): |
| 1241 | """Sanity check |
| 1242 | """ |
| 1243 | if(not isinstance(self.hw_addr, list)): |
| 1244 | return (False, "self.hw_addr is not list as expected.") |
| 1245 | if(len(self.hw_addr) != 6): |
| 1246 | return (False, "self.hw_addr is not of size 6 as expected.") |
| 1247 | if(not isinstance(self.pad, list)): |
| 1248 | return (False, "self.pad is not list as expected.") |
| 1249 | if(len(self.pad) != 4): |
| 1250 | return (False, "self.pad is not of size 4 as expected.") |
| 1251 | return (True, None) |
| 1252 | |
| 1253 | def pack(self, assertstruct=True): |
| 1254 | """Pack message |
| 1255 | Packs empty array used as placeholder |
| 1256 | """ |
| 1257 | if(assertstruct): |
| 1258 | if(not self.__assert()[0]): |
| 1259 | return None |
| 1260 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1261 | packed += struct.pack("!BBHLH", self.version, self.type, self.length, self.xid, self.port_no) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1262 | 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]) |
| 1263 | packed += struct.pack("!LLL", self.config, self.mask, self.advertise) |
| 1264 | packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3]) |
| 1265 | return packed |
| 1266 | |
| 1267 | def unpack(self, binaryString): |
| 1268 | """Unpack message |
| 1269 | Do not unpack empty array used as placeholder |
| 1270 | since they can contain heterogeneous type |
| 1271 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1272 | if (len(binaryString) < 32): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1273 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1274 | fmt = '!BBHLH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1275 | start = 0 |
| 1276 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1277 | (self.version, self.type, self.length, self.xid, self.port_no) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1278 | fmt = '!BBBBBB' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1279 | start = 10 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1280 | end = start + struct.calcsize(fmt) |
| 1281 | (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]) |
| 1282 | fmt = '!LLL' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1283 | start = 16 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1284 | end = start + struct.calcsize(fmt) |
| 1285 | (self.config, self.mask, self.advertise) = struct.unpack(fmt, binaryString[start:end]) |
| 1286 | fmt = '!BBBB' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1287 | start = 28 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1288 | end = start + struct.calcsize(fmt) |
| 1289 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1290 | return binaryString[32:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1291 | |
| 1292 | def __len__(self): |
| 1293 | """Return length of message |
| 1294 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1295 | l = 32 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1296 | return l |
| 1297 | |
| 1298 | def __eq__(self, other): |
| 1299 | """Return True if self and other have same values |
| 1300 | """ |
| 1301 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1302 | if self.version != other.version: return False |
| 1303 | if self.type != other.type: return False |
| 1304 | if self.length != other.length: return False |
| 1305 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1306 | if self.port_no != other.port_no: return False |
| 1307 | if self.hw_addr != other.hw_addr: return False |
| 1308 | if self.config != other.config: return False |
| 1309 | if self.mask != other.mask: return False |
| 1310 | if self.advertise != other.advertise: return False |
| 1311 | if self.pad != other.pad: return False |
| 1312 | return True |
| 1313 | |
| 1314 | def __ne__(self, other): return not self.__eq__(other) |
| 1315 | |
| 1316 | def show(self, prefix=''): |
| 1317 | """Generate string showing basic members of structure |
| 1318 | """ |
| 1319 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1320 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 1321 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1322 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 1323 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1324 | outstr += prefix + 'port_no: ' + str(self.port_no) + '\n' |
| 1325 | outstr += prefix + 'hw_addr: ' + str(self.hw_addr) + '\n' |
| 1326 | outstr += prefix + 'config: ' + str(self.config) + '\n' |
| 1327 | outstr += prefix + 'mask: ' + str(self.mask) + '\n' |
| 1328 | outstr += prefix + 'advertise: ' + str(self.advertise) + '\n' |
| 1329 | return outstr |
| 1330 | |
| 1331 | |
| 1332 | class ofp_action_vlan_vid: |
| 1333 | """Automatically generated Python class for ofp_action_vlan_vid |
| 1334 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1335 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1336 | Created by of.pythonize.pythonizer |
| 1337 | Core structure: Messages do not include ofp_header |
| 1338 | Does not include var-length arrays |
| 1339 | """ |
| 1340 | def __init__(self): |
| 1341 | """Initialize |
| 1342 | Declare members and default values |
| 1343 | """ |
| 1344 | self.type = 0 |
| 1345 | self.len = 0 |
| 1346 | self.vlan_vid = 0 |
| 1347 | self.pad= [0,0] |
| 1348 | |
| 1349 | def __assert(self): |
| 1350 | """Sanity check |
| 1351 | """ |
| 1352 | if(not isinstance(self.pad, list)): |
| 1353 | return (False, "self.pad is not list as expected.") |
| 1354 | if(len(self.pad) != 2): |
| 1355 | return (False, "self.pad is not of size 2 as expected.") |
| 1356 | return (True, None) |
| 1357 | |
| 1358 | def pack(self, assertstruct=True): |
| 1359 | """Pack message |
| 1360 | Packs empty array used as placeholder |
| 1361 | """ |
| 1362 | if(assertstruct): |
| 1363 | if(not self.__assert()[0]): |
| 1364 | return None |
| 1365 | packed = "" |
| 1366 | packed += struct.pack("!HHH", self.type, self.len, self.vlan_vid) |
| 1367 | packed += struct.pack("!BB", self.pad[0], self.pad[1]) |
| 1368 | return packed |
| 1369 | |
| 1370 | def unpack(self, binaryString): |
| 1371 | """Unpack message |
| 1372 | Do not unpack empty array used as placeholder |
| 1373 | since they can contain heterogeneous type |
| 1374 | """ |
| 1375 | if (len(binaryString) < 8): |
| 1376 | return binaryString |
| 1377 | fmt = '!HHH' |
| 1378 | start = 0 |
| 1379 | end = start + struct.calcsize(fmt) |
| 1380 | (self.type, self.len, self.vlan_vid) = struct.unpack(fmt, binaryString[start:end]) |
| 1381 | fmt = '!BB' |
| 1382 | start = 6 |
| 1383 | end = start + struct.calcsize(fmt) |
| 1384 | (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end]) |
| 1385 | return binaryString[8:] |
| 1386 | |
| 1387 | def __len__(self): |
| 1388 | """Return length of message |
| 1389 | """ |
| 1390 | l = 8 |
| 1391 | return l |
| 1392 | |
| 1393 | def __eq__(self, other): |
| 1394 | """Return True if self and other have same values |
| 1395 | """ |
| 1396 | if type(self) != type(other): return False |
| 1397 | if self.type != other.type: return False |
| 1398 | if self.len != other.len: return False |
| 1399 | if self.vlan_vid != other.vlan_vid: return False |
| 1400 | if self.pad != other.pad: return False |
| 1401 | return True |
| 1402 | |
| 1403 | def __ne__(self, other): return not self.__eq__(other) |
| 1404 | |
| 1405 | def show(self, prefix=''): |
| 1406 | """Generate string showing basic members of structure |
| 1407 | """ |
| 1408 | outstr = '' |
| 1409 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1410 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 1411 | outstr += prefix + 'vlan_vid: ' + str(self.vlan_vid) + '\n' |
| 1412 | return outstr |
| 1413 | |
| 1414 | |
| 1415 | class ofp_action_output: |
| 1416 | """Automatically generated Python class for ofp_action_output |
| 1417 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1418 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1419 | Created by of.pythonize.pythonizer |
| 1420 | Core structure: Messages do not include ofp_header |
| 1421 | Does not include var-length arrays |
| 1422 | """ |
| 1423 | def __init__(self): |
| 1424 | """Initialize |
| 1425 | Declare members and default values |
| 1426 | """ |
| 1427 | self.type = 0 |
| 1428 | self.len = 0 |
| 1429 | self.port = 0 |
| 1430 | self.max_len = 0 |
| 1431 | |
| 1432 | def __assert(self): |
| 1433 | """Sanity check |
| 1434 | """ |
| 1435 | return (True, None) |
| 1436 | |
| 1437 | def pack(self, assertstruct=True): |
| 1438 | """Pack message |
| 1439 | Packs empty array used as placeholder |
| 1440 | """ |
| 1441 | if(assertstruct): |
| 1442 | if(not self.__assert()[0]): |
| 1443 | return None |
| 1444 | packed = "" |
| 1445 | packed += struct.pack("!HHHH", self.type, self.len, self.port, self.max_len) |
| 1446 | return packed |
| 1447 | |
| 1448 | def unpack(self, binaryString): |
| 1449 | """Unpack message |
| 1450 | Do not unpack empty array used as placeholder |
| 1451 | since they can contain heterogeneous type |
| 1452 | """ |
| 1453 | if (len(binaryString) < 8): |
| 1454 | return binaryString |
| 1455 | fmt = '!HHHH' |
| 1456 | start = 0 |
| 1457 | end = start + struct.calcsize(fmt) |
| 1458 | (self.type, self.len, self.port, self.max_len) = struct.unpack(fmt, binaryString[start:end]) |
| 1459 | return binaryString[8:] |
| 1460 | |
| 1461 | def __len__(self): |
| 1462 | """Return length of message |
| 1463 | """ |
| 1464 | l = 8 |
| 1465 | return l |
| 1466 | |
| 1467 | def __eq__(self, other): |
| 1468 | """Return True if self and other have same values |
| 1469 | """ |
| 1470 | if type(self) != type(other): return False |
| 1471 | if self.type != other.type: return False |
| 1472 | if self.len != other.len: return False |
| 1473 | if self.port != other.port: return False |
| 1474 | if self.max_len != other.max_len: return False |
| 1475 | return True |
| 1476 | |
| 1477 | def __ne__(self, other): return not self.__eq__(other) |
| 1478 | |
| 1479 | def show(self, prefix=''): |
| 1480 | """Generate string showing basic members of structure |
| 1481 | """ |
| 1482 | outstr = '' |
| 1483 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1484 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 1485 | outstr += prefix + 'port: ' + str(self.port) + '\n' |
| 1486 | outstr += prefix + 'max_len: ' + str(self.max_len) + '\n' |
| 1487 | return outstr |
| 1488 | |
| 1489 | |
| 1490 | class ofp_switch_config: |
| 1491 | """Automatically generated Python class for ofp_switch_config |
| 1492 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1493 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1494 | Created by of.pythonize.pythonizer |
| 1495 | Core structure: Messages do not include ofp_header |
| 1496 | Does not include var-length arrays |
| 1497 | """ |
| 1498 | def __init__(self): |
| 1499 | """Initialize |
| 1500 | Declare members and default values |
| 1501 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1502 | self.version = 0 |
| 1503 | self.type = 0 |
| 1504 | self.length = 0 |
| 1505 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1506 | self.flags = 0 |
| 1507 | self.miss_send_len = 128 |
| 1508 | |
| 1509 | def __assert(self): |
| 1510 | """Sanity check |
| 1511 | """ |
| 1512 | return (True, None) |
| 1513 | |
| 1514 | def pack(self, assertstruct=True): |
| 1515 | """Pack message |
| 1516 | Packs empty array used as placeholder |
| 1517 | """ |
| 1518 | if(assertstruct): |
| 1519 | if(not self.__assert()[0]): |
| 1520 | return None |
| 1521 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1522 | packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.flags, self.miss_send_len) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1523 | return packed |
| 1524 | |
| 1525 | def unpack(self, binaryString): |
| 1526 | """Unpack message |
| 1527 | Do not unpack empty array used as placeholder |
| 1528 | since they can contain heterogeneous type |
| 1529 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1530 | if (len(binaryString) < 12): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1531 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1532 | fmt = '!BBHLHH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1533 | start = 0 |
| 1534 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1535 | (self.version, self.type, self.length, self.xid, self.flags, self.miss_send_len) = struct.unpack(fmt, binaryString[start:end]) |
| 1536 | return binaryString[12:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1537 | |
| 1538 | def __len__(self): |
| 1539 | """Return length of message |
| 1540 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1541 | l = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1542 | return l |
| 1543 | |
| 1544 | def __eq__(self, other): |
| 1545 | """Return True if self and other have same values |
| 1546 | """ |
| 1547 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1548 | if self.version != other.version: return False |
| 1549 | if self.type != other.type: return False |
| 1550 | if self.length != other.length: return False |
| 1551 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1552 | if self.flags != other.flags: return False |
| 1553 | if self.miss_send_len != other.miss_send_len: return False |
| 1554 | return True |
| 1555 | |
| 1556 | def __ne__(self, other): return not self.__eq__(other) |
| 1557 | |
| 1558 | def show(self, prefix=''): |
| 1559 | """Generate string showing basic members of structure |
| 1560 | """ |
| 1561 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1562 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 1563 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1564 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 1565 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1566 | outstr += prefix + 'flags: ' + str(self.flags) + '\n' |
| 1567 | outstr += prefix + 'miss_send_len: ' + str(self.miss_send_len) + '\n' |
| 1568 | return outstr |
| 1569 | |
| 1570 | |
| 1571 | class ofp_action_nw_tos: |
| 1572 | """Automatically generated Python class for ofp_action_nw_tos |
| 1573 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1574 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1575 | Created by of.pythonize.pythonizer |
| 1576 | Core structure: Messages do not include ofp_header |
| 1577 | Does not include var-length arrays |
| 1578 | """ |
| 1579 | def __init__(self): |
| 1580 | """Initialize |
| 1581 | Declare members and default values |
| 1582 | """ |
| 1583 | self.type = 0 |
| 1584 | self.len = 0 |
| 1585 | self.nw_tos = 0 |
| 1586 | self.pad= [0,0,0] |
| 1587 | |
| 1588 | def __assert(self): |
| 1589 | """Sanity check |
| 1590 | """ |
| 1591 | if(not isinstance(self.pad, list)): |
| 1592 | return (False, "self.pad is not list as expected.") |
| 1593 | if(len(self.pad) != 3): |
| 1594 | return (False, "self.pad is not of size 3 as expected.") |
| 1595 | return (True, None) |
| 1596 | |
| 1597 | def pack(self, assertstruct=True): |
| 1598 | """Pack message |
| 1599 | Packs empty array used as placeholder |
| 1600 | """ |
| 1601 | if(assertstruct): |
| 1602 | if(not self.__assert()[0]): |
| 1603 | return None |
| 1604 | packed = "" |
| 1605 | packed += struct.pack("!HHB", self.type, self.len, self.nw_tos) |
| 1606 | packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2]) |
| 1607 | return packed |
| 1608 | |
| 1609 | def unpack(self, binaryString): |
| 1610 | """Unpack message |
| 1611 | Do not unpack empty array used as placeholder |
| 1612 | since they can contain heterogeneous type |
| 1613 | """ |
| 1614 | if (len(binaryString) < 8): |
| 1615 | return binaryString |
| 1616 | fmt = '!HHB' |
| 1617 | start = 0 |
| 1618 | end = start + struct.calcsize(fmt) |
| 1619 | (self.type, self.len, self.nw_tos) = struct.unpack(fmt, binaryString[start:end]) |
| 1620 | fmt = '!BBB' |
| 1621 | start = 5 |
| 1622 | end = start + struct.calcsize(fmt) |
| 1623 | (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end]) |
| 1624 | return binaryString[8:] |
| 1625 | |
| 1626 | def __len__(self): |
| 1627 | """Return length of message |
| 1628 | """ |
| 1629 | l = 8 |
| 1630 | return l |
| 1631 | |
| 1632 | def __eq__(self, other): |
| 1633 | """Return True if self and other have same values |
| 1634 | """ |
| 1635 | if type(self) != type(other): return False |
| 1636 | if self.type != other.type: return False |
| 1637 | if self.len != other.len: return False |
| 1638 | if self.nw_tos != other.nw_tos: return False |
| 1639 | if self.pad != other.pad: return False |
| 1640 | return True |
| 1641 | |
| 1642 | def __ne__(self, other): return not self.__eq__(other) |
| 1643 | |
| 1644 | def show(self, prefix=''): |
| 1645 | """Generate string showing basic members of structure |
| 1646 | """ |
| 1647 | outstr = '' |
| 1648 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1649 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 1650 | outstr += prefix + 'nw_tos: ' + str(self.nw_tos) + '\n' |
| 1651 | return outstr |
| 1652 | |
| 1653 | |
| 1654 | class ofp_queue_get_config_reply: |
| 1655 | """Automatically generated Python class for ofp_queue_get_config_reply |
| 1656 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1657 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1658 | Created by of.pythonize.pythonizer |
| 1659 | Core structure: Messages do not include ofp_header |
| 1660 | Does not include var-length arrays |
| 1661 | """ |
| 1662 | def __init__(self): |
| 1663 | """Initialize |
| 1664 | Declare members and default values |
| 1665 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1666 | self.version = 0 |
| 1667 | self.type = 0 |
| 1668 | self.length = 0 |
| 1669 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1670 | self.port = 0 |
| 1671 | self.pad= [0,0,0,0,0,0] |
| 1672 | |
| 1673 | def __assert(self): |
| 1674 | """Sanity check |
| 1675 | """ |
| 1676 | if(not isinstance(self.pad, list)): |
| 1677 | return (False, "self.pad is not list as expected.") |
| 1678 | if(len(self.pad) != 6): |
| 1679 | return (False, "self.pad is not of size 6 as expected.") |
| 1680 | return (True, None) |
| 1681 | |
| 1682 | def pack(self, assertstruct=True): |
| 1683 | """Pack message |
| 1684 | Packs empty array used as placeholder |
| 1685 | """ |
| 1686 | if(assertstruct): |
| 1687 | if(not self.__assert()[0]): |
| 1688 | return None |
| 1689 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1690 | packed += struct.pack("!BBHLH", self.version, self.type, self.length, self.xid, self.port) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1691 | packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) |
| 1692 | return packed |
| 1693 | |
| 1694 | def unpack(self, binaryString): |
| 1695 | """Unpack message |
| 1696 | Do not unpack empty array used as placeholder |
| 1697 | since they can contain heterogeneous type |
| 1698 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1699 | if (len(binaryString) < 16): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1700 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1701 | fmt = '!BBHLH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1702 | start = 0 |
| 1703 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1704 | (self.version, self.type, self.length, self.xid, self.port) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1705 | fmt = '!BBBBBB' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1706 | start = 10 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1707 | end = start + struct.calcsize(fmt) |
| 1708 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1709 | return binaryString[16:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1710 | |
| 1711 | def __len__(self): |
| 1712 | """Return length of message |
| 1713 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1714 | l = 16 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1715 | return l |
| 1716 | |
| 1717 | def __eq__(self, other): |
| 1718 | """Return True if self and other have same values |
| 1719 | """ |
| 1720 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1721 | if self.version != other.version: return False |
| 1722 | if self.type != other.type: return False |
| 1723 | if self.length != other.length: return False |
| 1724 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1725 | if self.port != other.port: return False |
| 1726 | if self.pad != other.pad: return False |
| 1727 | return True |
| 1728 | |
| 1729 | def __ne__(self, other): return not self.__eq__(other) |
| 1730 | |
| 1731 | def show(self, prefix=''): |
| 1732 | """Generate string showing basic members of structure |
| 1733 | """ |
| 1734 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1735 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 1736 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1737 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 1738 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1739 | outstr += prefix + 'port: ' + str(self.port) + '\n' |
| 1740 | return outstr |
| 1741 | |
| 1742 | |
| 1743 | class ofp_packet_in: |
| 1744 | """Automatically generated Python class for ofp_packet_in |
| 1745 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1746 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1747 | Created by of.pythonize.pythonizer |
| 1748 | Core structure: Messages do not include ofp_header |
| 1749 | Does not include var-length arrays |
| 1750 | """ |
| 1751 | def __init__(self): |
| 1752 | """Initialize |
| 1753 | Declare members and default values |
| 1754 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1755 | self.version = 0 |
| 1756 | self.type = 0 |
| 1757 | self.length = 0 |
| 1758 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1759 | self.buffer_id = 0 |
| 1760 | self.total_len = 0 |
| 1761 | self.in_port = 0 |
| 1762 | self.reason = 0 |
| 1763 | self.pad = 0 |
| 1764 | |
| 1765 | def __assert(self): |
| 1766 | """Sanity check |
| 1767 | """ |
| 1768 | return (True, None) |
| 1769 | |
| 1770 | def pack(self, assertstruct=True): |
| 1771 | """Pack message |
| 1772 | Packs empty array used as placeholder |
| 1773 | """ |
| 1774 | if(assertstruct): |
| 1775 | if(not self.__assert()[0]): |
| 1776 | return None |
| 1777 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1778 | 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) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1779 | return packed |
| 1780 | |
| 1781 | def unpack(self, binaryString): |
| 1782 | """Unpack message |
| 1783 | Do not unpack empty array used as placeholder |
| 1784 | since they can contain heterogeneous type |
| 1785 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1786 | if (len(binaryString) < 18): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1787 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1788 | fmt = '!BBHLLHHBB' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1789 | start = 0 |
| 1790 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1791 | (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]) |
| 1792 | return binaryString[18:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1793 | |
| 1794 | def __len__(self): |
| 1795 | """Return length of message |
| 1796 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1797 | l = 18 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1798 | return l |
| 1799 | |
| 1800 | def __eq__(self, other): |
| 1801 | """Return True if self and other have same values |
| 1802 | """ |
| 1803 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1804 | if self.version != other.version: return False |
| 1805 | if self.type != other.type: return False |
| 1806 | if self.length != other.length: return False |
| 1807 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1808 | if self.buffer_id != other.buffer_id: return False |
| 1809 | if self.total_len != other.total_len: return False |
| 1810 | if self.in_port != other.in_port: return False |
| 1811 | if self.reason != other.reason: return False |
| 1812 | if self.pad != other.pad: return False |
| 1813 | return True |
| 1814 | |
| 1815 | def __ne__(self, other): return not self.__eq__(other) |
| 1816 | |
| 1817 | def show(self, prefix=''): |
| 1818 | """Generate string showing basic members of structure |
| 1819 | """ |
| 1820 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 1821 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 1822 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 1823 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 1824 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1825 | outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n' |
| 1826 | outstr += prefix + 'total_len: ' + str(self.total_len) + '\n' |
| 1827 | outstr += prefix + 'in_port: ' + str(self.in_port) + '\n' |
| 1828 | outstr += prefix + 'reason: ' + str(self.reason) + '\n' |
| 1829 | return outstr |
| 1830 | |
| 1831 | |
| 1832 | class ofp_flow_stats: |
| 1833 | """Automatically generated Python class for ofp_flow_stats |
| 1834 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1835 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1836 | Created by of.pythonize.pythonizer |
| 1837 | Core structure: Messages do not include ofp_header |
| 1838 | Does not include var-length arrays |
| 1839 | """ |
| 1840 | def __init__(self): |
| 1841 | """Initialize |
| 1842 | Declare members and default values |
| 1843 | """ |
| 1844 | self.length = 0 |
| 1845 | self.table_id = 0 |
| 1846 | self.pad = 0 |
| 1847 | self.match = ofp_match() |
| 1848 | self.duration_sec = 0 |
| 1849 | self.duration_nsec = 0 |
| 1850 | self.priority = 0x8000 |
| 1851 | self.idle_timeout = 0 |
| 1852 | self.hard_timeout = 0 |
| 1853 | self.pad2= [0,0,0,0,0,0] |
| 1854 | self.cookie = 0 |
| 1855 | self.packet_count = 0 |
| 1856 | self.byte_count = 0 |
| 1857 | |
| 1858 | def __assert(self): |
| 1859 | """Sanity check |
| 1860 | """ |
| 1861 | if(not isinstance(self.match, ofp_match)): |
| 1862 | return (False, "self.match is not class ofp_match as expected.") |
| 1863 | if(not isinstance(self.pad2, list)): |
| 1864 | return (False, "self.pad2 is not list as expected.") |
| 1865 | if(len(self.pad2) != 6): |
| 1866 | return (False, "self.pad2 is not of size 6 as expected.") |
| 1867 | return (True, None) |
| 1868 | |
| 1869 | def pack(self, assertstruct=True): |
| 1870 | """Pack message |
| 1871 | Packs empty array used as placeholder |
| 1872 | """ |
| 1873 | if(assertstruct): |
| 1874 | if(not self.__assert()[0]): |
| 1875 | return None |
| 1876 | packed = "" |
| 1877 | packed += struct.pack("!HBB", self.length, self.table_id, self.pad) |
| 1878 | packed += self.match.pack() |
| 1879 | packed += struct.pack("!LLHHH", self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout) |
| 1880 | packed += struct.pack("!BBBBBB", self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5]) |
| 1881 | packed += struct.pack("!QQQ", self.cookie, self.packet_count, self.byte_count) |
| 1882 | return packed |
| 1883 | |
| 1884 | def unpack(self, binaryString): |
| 1885 | """Unpack message |
| 1886 | Do not unpack empty array used as placeholder |
| 1887 | since they can contain heterogeneous type |
| 1888 | """ |
| 1889 | if (len(binaryString) < 88): |
| 1890 | return binaryString |
| 1891 | fmt = '!HBB' |
| 1892 | start = 0 |
| 1893 | end = start + struct.calcsize(fmt) |
| 1894 | (self.length, self.table_id, self.pad) = struct.unpack(fmt, binaryString[start:end]) |
| 1895 | self.match.unpack(binaryString[4:]) |
| 1896 | fmt = '!LLHHH' |
| 1897 | start = 44 |
| 1898 | end = start + struct.calcsize(fmt) |
| 1899 | (self.duration_sec, self.duration_nsec, self.priority, self.idle_timeout, self.hard_timeout) = struct.unpack(fmt, binaryString[start:end]) |
| 1900 | fmt = '!BBBBBB' |
| 1901 | start = 58 |
| 1902 | end = start + struct.calcsize(fmt) |
| 1903 | (self.pad2[0], self.pad2[1], self.pad2[2], self.pad2[3], self.pad2[4], self.pad2[5]) = struct.unpack(fmt, binaryString[start:end]) |
| 1904 | fmt = '!QQQ' |
| 1905 | start = 64 |
| 1906 | end = start + struct.calcsize(fmt) |
| 1907 | (self.cookie, self.packet_count, self.byte_count) = struct.unpack(fmt, binaryString[start:end]) |
| 1908 | return binaryString[88:] |
| 1909 | |
| 1910 | def __len__(self): |
| 1911 | """Return length of message |
| 1912 | """ |
| 1913 | l = 88 |
| 1914 | return l |
| 1915 | |
| 1916 | def __eq__(self, other): |
| 1917 | """Return True if self and other have same values |
| 1918 | """ |
| 1919 | if type(self) != type(other): return False |
| 1920 | if self.length != other.length: return False |
| 1921 | if self.table_id != other.table_id: return False |
| 1922 | if self.pad != other.pad: return False |
| 1923 | if self.match != other.match: return False |
| 1924 | if self.duration_sec != other.duration_sec: return False |
| 1925 | if self.duration_nsec != other.duration_nsec: return False |
| 1926 | if self.priority != other.priority: return False |
| 1927 | if self.idle_timeout != other.idle_timeout: return False |
| 1928 | if self.hard_timeout != other.hard_timeout: return False |
| 1929 | if self.pad2 != other.pad2: return False |
| 1930 | if self.cookie != other.cookie: return False |
| 1931 | if self.packet_count != other.packet_count: return False |
| 1932 | if self.byte_count != other.byte_count: return False |
| 1933 | return True |
| 1934 | |
| 1935 | def __ne__(self, other): return not self.__eq__(other) |
| 1936 | |
| 1937 | def show(self, prefix=''): |
| 1938 | """Generate string showing basic members of structure |
| 1939 | """ |
| 1940 | outstr = '' |
| 1941 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 1942 | outstr += prefix + 'table_id: ' + str(self.table_id) + '\n' |
| 1943 | outstr += prefix + 'match: \n' |
| 1944 | outstr += self.match.show(prefix + ' ') |
| 1945 | outstr += prefix + 'duration_sec: ' + str(self.duration_sec) + '\n' |
| 1946 | outstr += prefix + 'duration_nsec: ' + str(self.duration_nsec) + '\n' |
| 1947 | outstr += prefix + 'priority: ' + str(self.priority) + '\n' |
| 1948 | outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n' |
| 1949 | outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n' |
| 1950 | outstr += prefix + 'cookie: ' + str(self.cookie) + '\n' |
| 1951 | outstr += prefix + 'packet_count: ' + str(self.packet_count) + '\n' |
| 1952 | outstr += prefix + 'byte_count: ' + str(self.byte_count) + '\n' |
| 1953 | return outstr |
| 1954 | |
| 1955 | |
| 1956 | class ofp_flow_stats_request: |
| 1957 | """Automatically generated Python class for ofp_flow_stats_request |
| 1958 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 1959 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 1960 | Created by of.pythonize.pythonizer |
| 1961 | Core structure: Messages do not include ofp_header |
| 1962 | Does not include var-length arrays |
| 1963 | """ |
| 1964 | def __init__(self): |
| 1965 | """Initialize |
| 1966 | Declare members and default values |
| 1967 | """ |
| 1968 | self.match = ofp_match() |
| 1969 | self.table_id = 0 |
| 1970 | self.pad = 0 |
| 1971 | self.out_port = 0 |
| 1972 | |
| 1973 | def __assert(self): |
| 1974 | """Sanity check |
| 1975 | """ |
| 1976 | if(not isinstance(self.match, ofp_match)): |
| 1977 | return (False, "self.match is not class ofp_match as expected.") |
| 1978 | return (True, None) |
| 1979 | |
| 1980 | def pack(self, assertstruct=True): |
| 1981 | """Pack message |
| 1982 | Packs empty array used as placeholder |
| 1983 | """ |
| 1984 | if(assertstruct): |
| 1985 | if(not self.__assert()[0]): |
| 1986 | return None |
| 1987 | packed = "" |
| 1988 | packed += self.match.pack() |
| 1989 | packed += struct.pack("!BBH", self.table_id, self.pad, self.out_port) |
| 1990 | return packed |
| 1991 | |
| 1992 | def unpack(self, binaryString): |
| 1993 | """Unpack message |
| 1994 | Do not unpack empty array used as placeholder |
| 1995 | since they can contain heterogeneous type |
| 1996 | """ |
| 1997 | if (len(binaryString) < 44): |
| 1998 | return binaryString |
| 1999 | self.match.unpack(binaryString[0:]) |
| 2000 | fmt = '!BBH' |
| 2001 | start = 40 |
| 2002 | end = start + struct.calcsize(fmt) |
| 2003 | (self.table_id, self.pad, self.out_port) = struct.unpack(fmt, binaryString[start:end]) |
| 2004 | return binaryString[44:] |
| 2005 | |
| 2006 | def __len__(self): |
| 2007 | """Return length of message |
| 2008 | """ |
| 2009 | l = 44 |
| 2010 | return l |
| 2011 | |
| 2012 | def __eq__(self, other): |
| 2013 | """Return True if self and other have same values |
| 2014 | """ |
| 2015 | if type(self) != type(other): return False |
| 2016 | if self.match != other.match: return False |
| 2017 | if self.table_id != other.table_id: return False |
| 2018 | if self.pad != other.pad: return False |
| 2019 | if self.out_port != other.out_port: return False |
| 2020 | return True |
| 2021 | |
| 2022 | def __ne__(self, other): return not self.__eq__(other) |
| 2023 | |
| 2024 | def show(self, prefix=''): |
| 2025 | """Generate string showing basic members of structure |
| 2026 | """ |
| 2027 | outstr = '' |
| 2028 | outstr += prefix + 'match: \n' |
| 2029 | outstr += self.match.show(prefix + ' ') |
| 2030 | outstr += prefix + 'table_id: ' + str(self.table_id) + '\n' |
| 2031 | outstr += prefix + 'out_port: ' + str(self.out_port) + '\n' |
| 2032 | return outstr |
| 2033 | |
| 2034 | |
| 2035 | class ofp_action_vendor_header: |
| 2036 | """Automatically generated Python class for ofp_action_vendor_header |
| 2037 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2038 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2039 | Created by of.pythonize.pythonizer |
| 2040 | Core structure: Messages do not include ofp_header |
| 2041 | Does not include var-length arrays |
| 2042 | """ |
| 2043 | def __init__(self): |
| 2044 | """Initialize |
| 2045 | Declare members and default values |
| 2046 | """ |
| 2047 | self.type = 0 |
| 2048 | self.len = 0 |
| 2049 | self.vendor = 0 |
| 2050 | |
| 2051 | def __assert(self): |
| 2052 | """Sanity check |
| 2053 | """ |
| 2054 | return (True, None) |
| 2055 | |
| 2056 | def pack(self, assertstruct=True): |
| 2057 | """Pack message |
| 2058 | Packs empty array used as placeholder |
| 2059 | """ |
| 2060 | if(assertstruct): |
| 2061 | if(not self.__assert()[0]): |
| 2062 | return None |
| 2063 | packed = "" |
| 2064 | packed += struct.pack("!HHL", self.type, self.len, self.vendor) |
| 2065 | return packed |
| 2066 | |
| 2067 | def unpack(self, binaryString): |
| 2068 | """Unpack message |
| 2069 | Do not unpack empty array used as placeholder |
| 2070 | since they can contain heterogeneous type |
| 2071 | """ |
| 2072 | if (len(binaryString) < 8): |
| 2073 | return binaryString |
| 2074 | fmt = '!HHL' |
| 2075 | start = 0 |
| 2076 | end = start + struct.calcsize(fmt) |
| 2077 | (self.type, self.len, self.vendor) = struct.unpack(fmt, binaryString[start:end]) |
| 2078 | return binaryString[8:] |
| 2079 | |
| 2080 | def __len__(self): |
| 2081 | """Return length of message |
| 2082 | """ |
| 2083 | l = 8 |
| 2084 | return l |
| 2085 | |
| 2086 | def __eq__(self, other): |
| 2087 | """Return True if self and other have same values |
| 2088 | """ |
| 2089 | if type(self) != type(other): return False |
| 2090 | if self.type != other.type: return False |
| 2091 | if self.len != other.len: return False |
| 2092 | if self.vendor != other.vendor: return False |
| 2093 | return True |
| 2094 | |
| 2095 | def __ne__(self, other): return not self.__eq__(other) |
| 2096 | |
| 2097 | def show(self, prefix=''): |
| 2098 | """Generate string showing basic members of structure |
| 2099 | """ |
| 2100 | outstr = '' |
| 2101 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 2102 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 2103 | outstr += prefix + 'vendor: ' + str(self.vendor) + '\n' |
| 2104 | return outstr |
| 2105 | |
| 2106 | |
| 2107 | class ofp_stats_reply: |
| 2108 | """Automatically generated Python class for ofp_stats_reply |
| 2109 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2110 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2111 | Created by of.pythonize.pythonizer |
| 2112 | Core structure: Messages do not include ofp_header |
| 2113 | Does not include var-length arrays |
| 2114 | """ |
| 2115 | def __init__(self): |
| 2116 | """Initialize |
| 2117 | Declare members and default values |
| 2118 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2119 | self.version = 0 |
| 2120 | self.type = 0 |
| 2121 | self.length = 0 |
| 2122 | self.xid = 0 |
Rich Lane | 7c7342a | 2013-03-11 14:16:58 -0700 | [diff] [blame] | 2123 | self.stats_type = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2124 | self.flags = 0 |
| 2125 | |
| 2126 | def __assert(self): |
| 2127 | """Sanity check |
| 2128 | """ |
| 2129 | return (True, None) |
| 2130 | |
| 2131 | def pack(self, assertstruct=True): |
| 2132 | """Pack message |
| 2133 | Packs empty array used as placeholder |
| 2134 | """ |
| 2135 | if(assertstruct): |
| 2136 | if(not self.__assert()[0]): |
| 2137 | return None |
| 2138 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2139 | packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.stats_type, self.flags) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2140 | return packed |
| 2141 | |
| 2142 | def unpack(self, binaryString): |
| 2143 | """Unpack message |
| 2144 | Do not unpack empty array used as placeholder |
| 2145 | since they can contain heterogeneous type |
| 2146 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2147 | if (len(binaryString) < 12): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2148 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2149 | fmt = '!BBHLHH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2150 | start = 0 |
| 2151 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2152 | (self.version, self.type, self.length, self.xid, self.stats_type, self.flags) = struct.unpack(fmt, binaryString[start:end]) |
| 2153 | return binaryString[12:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2154 | |
| 2155 | def __len__(self): |
| 2156 | """Return length of message |
| 2157 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2158 | l = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2159 | return l |
| 2160 | |
| 2161 | def __eq__(self, other): |
| 2162 | """Return True if self and other have same values |
| 2163 | """ |
| 2164 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2165 | if self.version != other.version: return False |
| 2166 | if self.type != other.type: return False |
| 2167 | if self.length != other.length: return False |
| 2168 | if self.xid != other.xid: return False |
Rich Lane | 7c7342a | 2013-03-11 14:16:58 -0700 | [diff] [blame] | 2169 | if self.stats_type != other.stats_type: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2170 | if self.flags != other.flags: return False |
| 2171 | return True |
| 2172 | |
| 2173 | def __ne__(self, other): return not self.__eq__(other) |
| 2174 | |
| 2175 | def show(self, prefix=''): |
| 2176 | """Generate string showing basic members of structure |
| 2177 | """ |
| 2178 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2179 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 2180 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 2181 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 2182 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 7c7342a | 2013-03-11 14:16:58 -0700 | [diff] [blame] | 2183 | outstr += prefix + 'stats_type: ' + str(self.stats_type) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2184 | outstr += prefix + 'flags: ' + str(self.flags) + '\n' |
| 2185 | return outstr |
| 2186 | |
| 2187 | |
| 2188 | class ofp_queue_stats_request: |
| 2189 | """Automatically generated Python class for ofp_queue_stats_request |
| 2190 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2191 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2192 | Created by of.pythonize.pythonizer |
| 2193 | Core structure: Messages do not include ofp_header |
| 2194 | Does not include var-length arrays |
| 2195 | """ |
| 2196 | def __init__(self): |
| 2197 | """Initialize |
| 2198 | Declare members and default values |
| 2199 | """ |
| 2200 | self.port_no = 0 |
| 2201 | self.pad= [0,0] |
| 2202 | self.queue_id = 0 |
| 2203 | |
| 2204 | def __assert(self): |
| 2205 | """Sanity check |
| 2206 | """ |
| 2207 | if(not isinstance(self.pad, list)): |
| 2208 | return (False, "self.pad is not list as expected.") |
| 2209 | if(len(self.pad) != 2): |
| 2210 | return (False, "self.pad is not of size 2 as expected.") |
| 2211 | return (True, None) |
| 2212 | |
| 2213 | def pack(self, assertstruct=True): |
| 2214 | """Pack message |
| 2215 | Packs empty array used as placeholder |
| 2216 | """ |
| 2217 | if(assertstruct): |
| 2218 | if(not self.__assert()[0]): |
| 2219 | return None |
| 2220 | packed = "" |
| 2221 | packed += struct.pack("!H", self.port_no) |
| 2222 | packed += struct.pack("!BB", self.pad[0], self.pad[1]) |
| 2223 | packed += struct.pack("!L", self.queue_id) |
| 2224 | return packed |
| 2225 | |
| 2226 | def unpack(self, binaryString): |
| 2227 | """Unpack message |
| 2228 | Do not unpack empty array used as placeholder |
| 2229 | since they can contain heterogeneous type |
| 2230 | """ |
| 2231 | if (len(binaryString) < 8): |
| 2232 | return binaryString |
| 2233 | fmt = '!H' |
| 2234 | start = 0 |
| 2235 | end = start + struct.calcsize(fmt) |
| 2236 | (self.port_no,) = struct.unpack(fmt, binaryString[start:end]) |
| 2237 | fmt = '!BB' |
| 2238 | start = 2 |
| 2239 | end = start + struct.calcsize(fmt) |
| 2240 | (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end]) |
| 2241 | fmt = '!L' |
| 2242 | start = 4 |
| 2243 | end = start + struct.calcsize(fmt) |
| 2244 | (self.queue_id,) = struct.unpack(fmt, binaryString[start:end]) |
| 2245 | return binaryString[8:] |
| 2246 | |
| 2247 | def __len__(self): |
| 2248 | """Return length of message |
| 2249 | """ |
| 2250 | l = 8 |
| 2251 | return l |
| 2252 | |
| 2253 | def __eq__(self, other): |
| 2254 | """Return True if self and other have same values |
| 2255 | """ |
| 2256 | if type(self) != type(other): return False |
| 2257 | if self.port_no != other.port_no: return False |
| 2258 | if self.pad != other.pad: return False |
| 2259 | if self.queue_id != other.queue_id: return False |
| 2260 | return True |
| 2261 | |
| 2262 | def __ne__(self, other): return not self.__eq__(other) |
| 2263 | |
| 2264 | def show(self, prefix=''): |
| 2265 | """Generate string showing basic members of structure |
| 2266 | """ |
| 2267 | outstr = '' |
| 2268 | outstr += prefix + 'port_no: ' + str(self.port_no) + '\n' |
| 2269 | outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n' |
| 2270 | return outstr |
| 2271 | |
| 2272 | |
| 2273 | class ofp_desc_stats: |
| 2274 | """Automatically generated Python class for ofp_desc_stats |
| 2275 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2276 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2277 | Created by of.pythonize.pythonizer |
| 2278 | Core structure: Messages do not include ofp_header |
| 2279 | Does not include var-length arrays |
| 2280 | """ |
| 2281 | def __init__(self): |
| 2282 | """Initialize |
| 2283 | Declare members and default values |
| 2284 | """ |
| 2285 | self.mfr_desc= "" |
| 2286 | self.hw_desc= "" |
| 2287 | self.sw_desc= "" |
| 2288 | self.serial_num= "" |
| 2289 | self.dp_desc= "" |
| 2290 | |
| 2291 | def __assert(self): |
| 2292 | """Sanity check |
| 2293 | """ |
| 2294 | if(not isinstance(self.mfr_desc, str)): |
| 2295 | return (False, "self.mfr_desc is not string as expected.") |
| 2296 | if(len(self.mfr_desc) > 256): |
| 2297 | return (False, "self.mfr_desc is not of size 256 as expected.") |
| 2298 | if(not isinstance(self.hw_desc, str)): |
| 2299 | return (False, "self.hw_desc is not string as expected.") |
| 2300 | if(len(self.hw_desc) > 256): |
| 2301 | return (False, "self.hw_desc is not of size 256 as expected.") |
| 2302 | if(not isinstance(self.sw_desc, str)): |
| 2303 | return (False, "self.sw_desc is not string as expected.") |
| 2304 | if(len(self.sw_desc) > 256): |
| 2305 | return (False, "self.sw_desc is not of size 256 as expected.") |
| 2306 | if(not isinstance(self.serial_num, str)): |
| 2307 | return (False, "self.serial_num is not string as expected.") |
| 2308 | if(len(self.serial_num) > 32): |
| 2309 | return (False, "self.serial_num is not of size 32 as expected.") |
| 2310 | if(not isinstance(self.dp_desc, str)): |
| 2311 | return (False, "self.dp_desc is not string as expected.") |
| 2312 | if(len(self.dp_desc) > 256): |
| 2313 | return (False, "self.dp_desc is not of size 256 as expected.") |
| 2314 | return (True, None) |
| 2315 | |
| 2316 | def pack(self, assertstruct=True): |
| 2317 | """Pack message |
| 2318 | Packs empty array used as placeholder |
| 2319 | """ |
| 2320 | if(assertstruct): |
| 2321 | if(not self.__assert()[0]): |
| 2322 | return None |
| 2323 | packed = "" |
| 2324 | packed += self.mfr_desc.ljust(256,'\0') |
| 2325 | packed += self.hw_desc.ljust(256,'\0') |
| 2326 | packed += self.sw_desc.ljust(256,'\0') |
| 2327 | packed += self.serial_num.ljust(32,'\0') |
| 2328 | packed += self.dp_desc.ljust(256,'\0') |
| 2329 | return packed |
| 2330 | |
| 2331 | def unpack(self, binaryString): |
| 2332 | """Unpack message |
| 2333 | Do not unpack empty array used as placeholder |
| 2334 | since they can contain heterogeneous type |
| 2335 | """ |
| 2336 | if (len(binaryString) < 1056): |
| 2337 | return binaryString |
| 2338 | self.mfr_desc = binaryString[0:256].replace("\0","") |
| 2339 | self.hw_desc = binaryString[256:512].replace("\0","") |
| 2340 | self.sw_desc = binaryString[512:768].replace("\0","") |
| 2341 | self.serial_num = binaryString[768:800].replace("\0","") |
| 2342 | self.dp_desc = binaryString[800:1056].replace("\0","") |
| 2343 | return binaryString[1056:] |
| 2344 | |
| 2345 | def __len__(self): |
| 2346 | """Return length of message |
| 2347 | """ |
| 2348 | l = 1056 |
| 2349 | return l |
| 2350 | |
| 2351 | def __eq__(self, other): |
| 2352 | """Return True if self and other have same values |
| 2353 | """ |
| 2354 | if type(self) != type(other): return False |
| 2355 | if self.mfr_desc != other.mfr_desc: return False |
| 2356 | if self.hw_desc != other.hw_desc: return False |
| 2357 | if self.sw_desc != other.sw_desc: return False |
| 2358 | if self.serial_num != other.serial_num: return False |
| 2359 | if self.dp_desc != other.dp_desc: return False |
| 2360 | return True |
| 2361 | |
| 2362 | def __ne__(self, other): return not self.__eq__(other) |
| 2363 | |
| 2364 | def show(self, prefix=''): |
| 2365 | """Generate string showing basic members of structure |
| 2366 | """ |
| 2367 | outstr = '' |
| 2368 | outstr += prefix + 'mfr_desc: ' + str(self.mfr_desc) + '\n' |
| 2369 | outstr += prefix + 'hw_desc: ' + str(self.hw_desc) + '\n' |
| 2370 | outstr += prefix + 'sw_desc: ' + str(self.sw_desc) + '\n' |
| 2371 | outstr += prefix + 'serial_num: ' + str(self.serial_num) + '\n' |
| 2372 | outstr += prefix + 'dp_desc: ' + str(self.dp_desc) + '\n' |
| 2373 | return outstr |
| 2374 | |
| 2375 | |
| 2376 | class ofp_queue_get_config_request: |
| 2377 | """Automatically generated Python class for ofp_queue_get_config_request |
| 2378 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2379 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2380 | Created by of.pythonize.pythonizer |
| 2381 | Core structure: Messages do not include ofp_header |
| 2382 | Does not include var-length arrays |
| 2383 | """ |
| 2384 | def __init__(self): |
| 2385 | """Initialize |
| 2386 | Declare members and default values |
| 2387 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2388 | self.version = 0 |
| 2389 | self.type = 0 |
| 2390 | self.length = 0 |
| 2391 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2392 | self.port = 0 |
| 2393 | self.pad= [0,0] |
| 2394 | |
| 2395 | def __assert(self): |
| 2396 | """Sanity check |
| 2397 | """ |
| 2398 | if(not isinstance(self.pad, list)): |
| 2399 | return (False, "self.pad is not list as expected.") |
| 2400 | if(len(self.pad) != 2): |
| 2401 | return (False, "self.pad is not of size 2 as expected.") |
| 2402 | return (True, None) |
| 2403 | |
| 2404 | def pack(self, assertstruct=True): |
| 2405 | """Pack message |
| 2406 | Packs empty array used as placeholder |
| 2407 | """ |
| 2408 | if(assertstruct): |
| 2409 | if(not self.__assert()[0]): |
| 2410 | return None |
| 2411 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2412 | packed += struct.pack("!BBHLH", self.version, self.type, self.length, self.xid, self.port) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2413 | packed += struct.pack("!BB", self.pad[0], self.pad[1]) |
| 2414 | return packed |
| 2415 | |
| 2416 | def unpack(self, binaryString): |
| 2417 | """Unpack message |
| 2418 | Do not unpack empty array used as placeholder |
| 2419 | since they can contain heterogeneous type |
| 2420 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2421 | if (len(binaryString) < 12): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2422 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2423 | fmt = '!BBHLH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2424 | start = 0 |
| 2425 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2426 | (self.version, self.type, self.length, self.xid, self.port) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2427 | fmt = '!BB' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2428 | start = 10 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2429 | end = start + struct.calcsize(fmt) |
| 2430 | (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2431 | return binaryString[12:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2432 | |
| 2433 | def __len__(self): |
| 2434 | """Return length of message |
| 2435 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2436 | l = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2437 | return l |
| 2438 | |
| 2439 | def __eq__(self, other): |
| 2440 | """Return True if self and other have same values |
| 2441 | """ |
| 2442 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2443 | if self.version != other.version: return False |
| 2444 | if self.type != other.type: return False |
| 2445 | if self.length != other.length: return False |
| 2446 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2447 | if self.port != other.port: return False |
| 2448 | if self.pad != other.pad: return False |
| 2449 | return True |
| 2450 | |
| 2451 | def __ne__(self, other): return not self.__eq__(other) |
| 2452 | |
| 2453 | def show(self, prefix=''): |
| 2454 | """Generate string showing basic members of structure |
| 2455 | """ |
| 2456 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2457 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 2458 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 2459 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 2460 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2461 | outstr += prefix + 'port: ' + str(self.port) + '\n' |
| 2462 | return outstr |
| 2463 | |
| 2464 | |
| 2465 | class ofp_packet_queue: |
| 2466 | """Automatically generated Python class for ofp_packet_queue |
| 2467 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2468 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2469 | Created by of.pythonize.pythonizer |
| 2470 | Core structure: Messages do not include ofp_header |
| 2471 | Does not include var-length arrays |
| 2472 | """ |
| 2473 | def __init__(self): |
| 2474 | """Initialize |
| 2475 | Declare members and default values |
| 2476 | """ |
| 2477 | self.queue_id = 0 |
| 2478 | self.len = 0 |
| 2479 | self.pad= [0,0] |
| 2480 | |
| 2481 | def __assert(self): |
| 2482 | """Sanity check |
| 2483 | """ |
| 2484 | if(not isinstance(self.pad, list)): |
| 2485 | return (False, "self.pad is not list as expected.") |
| 2486 | if(len(self.pad) != 2): |
| 2487 | return (False, "self.pad is not of size 2 as expected.") |
| 2488 | return (True, None) |
| 2489 | |
| 2490 | def pack(self, assertstruct=True): |
| 2491 | """Pack message |
| 2492 | Packs empty array used as placeholder |
| 2493 | """ |
| 2494 | if(assertstruct): |
| 2495 | if(not self.__assert()[0]): |
| 2496 | return None |
| 2497 | packed = "" |
| 2498 | packed += struct.pack("!LH", self.queue_id, self.len) |
| 2499 | packed += struct.pack("!BB", self.pad[0], self.pad[1]) |
| 2500 | return packed |
| 2501 | |
| 2502 | def unpack(self, binaryString): |
| 2503 | """Unpack message |
| 2504 | Do not unpack empty array used as placeholder |
| 2505 | since they can contain heterogeneous type |
| 2506 | """ |
| 2507 | if (len(binaryString) < 8): |
| 2508 | return binaryString |
| 2509 | fmt = '!LH' |
| 2510 | start = 0 |
| 2511 | end = start + struct.calcsize(fmt) |
| 2512 | (self.queue_id, self.len) = struct.unpack(fmt, binaryString[start:end]) |
| 2513 | fmt = '!BB' |
| 2514 | start = 6 |
| 2515 | end = start + struct.calcsize(fmt) |
| 2516 | (self.pad[0], self.pad[1]) = struct.unpack(fmt, binaryString[start:end]) |
| 2517 | return binaryString[8:] |
| 2518 | |
| 2519 | def __len__(self): |
| 2520 | """Return length of message |
| 2521 | """ |
| 2522 | l = 8 |
| 2523 | return l |
| 2524 | |
| 2525 | def __eq__(self, other): |
| 2526 | """Return True if self and other have same values |
| 2527 | """ |
| 2528 | if type(self) != type(other): return False |
| 2529 | if self.queue_id != other.queue_id: return False |
| 2530 | if self.len != other.len: return False |
| 2531 | if self.pad != other.pad: return False |
| 2532 | return True |
| 2533 | |
| 2534 | def __ne__(self, other): return not self.__eq__(other) |
| 2535 | |
| 2536 | def show(self, prefix=''): |
| 2537 | """Generate string showing basic members of structure |
| 2538 | """ |
| 2539 | outstr = '' |
| 2540 | outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n' |
| 2541 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 2542 | return outstr |
| 2543 | |
| 2544 | |
| 2545 | class ofp_action_dl_addr: |
| 2546 | """Automatically generated Python class for ofp_action_dl_addr |
| 2547 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2548 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2549 | Created by of.pythonize.pythonizer |
| 2550 | Core structure: Messages do not include ofp_header |
| 2551 | Does not include var-length arrays |
| 2552 | """ |
| 2553 | def __init__(self): |
| 2554 | """Initialize |
| 2555 | Declare members and default values |
| 2556 | """ |
| 2557 | self.type = 0 |
| 2558 | self.len = 0 |
| 2559 | self.dl_addr= [0,0,0,0,0,0] |
| 2560 | self.pad= [0,0,0,0,0,0] |
| 2561 | |
| 2562 | def __assert(self): |
| 2563 | """Sanity check |
| 2564 | """ |
| 2565 | if(not isinstance(self.dl_addr, list)): |
| 2566 | return (False, "self.dl_addr is not list as expected.") |
| 2567 | if(len(self.dl_addr) != 6): |
| 2568 | return (False, "self.dl_addr is not of size 6 as expected.") |
| 2569 | if(not isinstance(self.pad, list)): |
| 2570 | return (False, "self.pad is not list as expected.") |
| 2571 | if(len(self.pad) != 6): |
| 2572 | return (False, "self.pad is not of size 6 as expected.") |
| 2573 | return (True, None) |
| 2574 | |
| 2575 | def pack(self, assertstruct=True): |
| 2576 | """Pack message |
| 2577 | Packs empty array used as placeholder |
| 2578 | """ |
| 2579 | if(assertstruct): |
| 2580 | if(not self.__assert()[0]): |
| 2581 | return None |
| 2582 | packed = "" |
| 2583 | packed += struct.pack("!HH", self.type, self.len) |
| 2584 | packed += struct.pack("!BBBBBB", self.dl_addr[0], self.dl_addr[1], self.dl_addr[2], self.dl_addr[3], self.dl_addr[4], self.dl_addr[5]) |
| 2585 | packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) |
| 2586 | return packed |
| 2587 | |
| 2588 | def unpack(self, binaryString): |
| 2589 | """Unpack message |
| 2590 | Do not unpack empty array used as placeholder |
| 2591 | since they can contain heterogeneous type |
| 2592 | """ |
| 2593 | if (len(binaryString) < 16): |
| 2594 | return binaryString |
| 2595 | fmt = '!HH' |
| 2596 | start = 0 |
| 2597 | end = start + struct.calcsize(fmt) |
| 2598 | (self.type, self.len) = struct.unpack(fmt, binaryString[start:end]) |
| 2599 | fmt = '!BBBBBB' |
| 2600 | start = 4 |
| 2601 | end = start + struct.calcsize(fmt) |
| 2602 | (self.dl_addr[0], self.dl_addr[1], self.dl_addr[2], self.dl_addr[3], self.dl_addr[4], self.dl_addr[5]) = struct.unpack(fmt, binaryString[start:end]) |
| 2603 | fmt = '!BBBBBB' |
| 2604 | start = 10 |
| 2605 | end = start + struct.calcsize(fmt) |
| 2606 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end]) |
| 2607 | return binaryString[16:] |
| 2608 | |
| 2609 | def __len__(self): |
| 2610 | """Return length of message |
| 2611 | """ |
| 2612 | l = 16 |
| 2613 | return l |
| 2614 | |
| 2615 | def __eq__(self, other): |
| 2616 | """Return True if self and other have same values |
| 2617 | """ |
| 2618 | if type(self) != type(other): return False |
| 2619 | if self.type != other.type: return False |
| 2620 | if self.len != other.len: return False |
| 2621 | if self.dl_addr != other.dl_addr: return False |
| 2622 | if self.pad != other.pad: return False |
| 2623 | return True |
| 2624 | |
| 2625 | def __ne__(self, other): return not self.__eq__(other) |
| 2626 | |
| 2627 | def show(self, prefix=''): |
| 2628 | """Generate string showing basic members of structure |
| 2629 | """ |
| 2630 | outstr = '' |
| 2631 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 2632 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 2633 | outstr += prefix + 'dl_addr: ' + str(self.dl_addr) + '\n' |
| 2634 | return outstr |
| 2635 | |
| 2636 | |
| 2637 | class ofp_queue_prop_header: |
| 2638 | """Automatically generated Python class for ofp_queue_prop_header |
| 2639 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2640 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2641 | Created by of.pythonize.pythonizer |
| 2642 | Core structure: Messages do not include ofp_header |
| 2643 | Does not include var-length arrays |
| 2644 | """ |
| 2645 | def __init__(self): |
| 2646 | """Initialize |
| 2647 | Declare members and default values |
| 2648 | """ |
| 2649 | self.property = 0 |
| 2650 | self.len = 0 |
| 2651 | self.pad= [0,0,0,0] |
| 2652 | |
| 2653 | def __assert(self): |
| 2654 | """Sanity check |
| 2655 | """ |
| 2656 | if(not isinstance(self.pad, list)): |
| 2657 | return (False, "self.pad is not list as expected.") |
| 2658 | if(len(self.pad) != 4): |
| 2659 | return (False, "self.pad is not of size 4 as expected.") |
| 2660 | return (True, None) |
| 2661 | |
| 2662 | def pack(self, assertstruct=True): |
| 2663 | """Pack message |
| 2664 | Packs empty array used as placeholder |
| 2665 | """ |
| 2666 | if(assertstruct): |
| 2667 | if(not self.__assert()[0]): |
| 2668 | return None |
| 2669 | packed = "" |
| 2670 | packed += struct.pack("!HH", self.property, self.len) |
| 2671 | packed += struct.pack("!BBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3]) |
| 2672 | return packed |
| 2673 | |
| 2674 | def unpack(self, binaryString): |
| 2675 | """Unpack message |
| 2676 | Do not unpack empty array used as placeholder |
| 2677 | since they can contain heterogeneous type |
| 2678 | """ |
| 2679 | if (len(binaryString) < 8): |
| 2680 | return binaryString |
| 2681 | fmt = '!HH' |
| 2682 | start = 0 |
| 2683 | end = start + struct.calcsize(fmt) |
| 2684 | (self.property, self.len) = struct.unpack(fmt, binaryString[start:end]) |
| 2685 | fmt = '!BBBB' |
| 2686 | start = 4 |
| 2687 | end = start + struct.calcsize(fmt) |
| 2688 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3]) = struct.unpack(fmt, binaryString[start:end]) |
| 2689 | return binaryString[8:] |
| 2690 | |
| 2691 | def __len__(self): |
| 2692 | """Return length of message |
| 2693 | """ |
| 2694 | l = 8 |
| 2695 | return l |
| 2696 | |
| 2697 | def __eq__(self, other): |
| 2698 | """Return True if self and other have same values |
| 2699 | """ |
| 2700 | if type(self) != type(other): return False |
| 2701 | if self.property != other.property: return False |
| 2702 | if self.len != other.len: return False |
| 2703 | if self.pad != other.pad: return False |
| 2704 | return True |
| 2705 | |
| 2706 | def __ne__(self, other): return not self.__eq__(other) |
| 2707 | |
| 2708 | def show(self, prefix=''): |
| 2709 | """Generate string showing basic members of structure |
| 2710 | """ |
| 2711 | outstr = '' |
| 2712 | outstr += prefix + 'property: ' + str(self.property) + '\n' |
| 2713 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 2714 | return outstr |
| 2715 | |
| 2716 | |
| 2717 | class ofp_queue_prop_min_rate: |
| 2718 | """Automatically generated Python class for ofp_queue_prop_min_rate |
| 2719 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2720 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2721 | Created by of.pythonize.pythonizer |
| 2722 | Core structure: Messages do not include ofp_header |
| 2723 | Does not include var-length arrays |
| 2724 | """ |
| 2725 | def __init__(self): |
| 2726 | """Initialize |
| 2727 | Declare members and default values |
| 2728 | """ |
| 2729 | self.prop_header = ofp_queue_prop_header() |
| 2730 | self.rate = 0 |
| 2731 | self.pad= [0,0,0,0,0,0] |
| 2732 | |
| 2733 | def __assert(self): |
| 2734 | """Sanity check |
| 2735 | """ |
| 2736 | if(not isinstance(self.prop_header, ofp_queue_prop_header)): |
| 2737 | return (False, "self.prop_header is not class ofp_queue_prop_header as expected.") |
| 2738 | if(not isinstance(self.pad, list)): |
| 2739 | return (False, "self.pad is not list as expected.") |
| 2740 | if(len(self.pad) != 6): |
| 2741 | return (False, "self.pad is not of size 6 as expected.") |
| 2742 | return (True, None) |
| 2743 | |
| 2744 | def pack(self, assertstruct=True): |
| 2745 | """Pack message |
| 2746 | Packs empty array used as placeholder |
| 2747 | """ |
| 2748 | if(assertstruct): |
| 2749 | if(not self.__assert()[0]): |
| 2750 | return None |
| 2751 | packed = "" |
| 2752 | packed += self.prop_header.pack() |
| 2753 | packed += struct.pack("!H", self.rate) |
| 2754 | packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) |
| 2755 | return packed |
| 2756 | |
| 2757 | def unpack(self, binaryString): |
| 2758 | """Unpack message |
| 2759 | Do not unpack empty array used as placeholder |
| 2760 | since they can contain heterogeneous type |
| 2761 | """ |
| 2762 | if (len(binaryString) < 16): |
| 2763 | return binaryString |
| 2764 | self.prop_header.unpack(binaryString[0:]) |
| 2765 | fmt = '!H' |
| 2766 | start = 8 |
| 2767 | end = start + struct.calcsize(fmt) |
| 2768 | (self.rate,) = struct.unpack(fmt, binaryString[start:end]) |
| 2769 | fmt = '!BBBBBB' |
| 2770 | start = 10 |
| 2771 | end = start + struct.calcsize(fmt) |
| 2772 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end]) |
| 2773 | return binaryString[16:] |
| 2774 | |
| 2775 | def __len__(self): |
| 2776 | """Return length of message |
| 2777 | """ |
| 2778 | l = 16 |
| 2779 | return l |
| 2780 | |
| 2781 | def __eq__(self, other): |
| 2782 | """Return True if self and other have same values |
| 2783 | """ |
| 2784 | if type(self) != type(other): return False |
| 2785 | if self.prop_header != other.prop_header: return False |
| 2786 | if self.rate != other.rate: return False |
| 2787 | if self.pad != other.pad: return False |
| 2788 | return True |
| 2789 | |
| 2790 | def __ne__(self, other): return not self.__eq__(other) |
| 2791 | |
| 2792 | def show(self, prefix=''): |
| 2793 | """Generate string showing basic members of structure |
| 2794 | """ |
| 2795 | outstr = '' |
| 2796 | outstr += prefix + 'prop_header: \n' |
| 2797 | outstr += self.prop_header.show(prefix + ' ') |
| 2798 | outstr += prefix + 'rate: ' + str(self.rate) + '\n' |
| 2799 | return outstr |
| 2800 | |
| 2801 | |
| 2802 | class ofp_action_enqueue: |
| 2803 | """Automatically generated Python class for ofp_action_enqueue |
| 2804 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2805 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2806 | Created by of.pythonize.pythonizer |
| 2807 | Core structure: Messages do not include ofp_header |
| 2808 | Does not include var-length arrays |
| 2809 | """ |
| 2810 | def __init__(self): |
| 2811 | """Initialize |
| 2812 | Declare members and default values |
| 2813 | """ |
| 2814 | self.type = 0 |
| 2815 | self.len = 0 |
| 2816 | self.port = 0 |
| 2817 | self.pad= [0,0,0,0,0,0] |
| 2818 | self.queue_id = 0 |
| 2819 | |
| 2820 | def __assert(self): |
| 2821 | """Sanity check |
| 2822 | """ |
| 2823 | if(not isinstance(self.pad, list)): |
| 2824 | return (False, "self.pad is not list as expected.") |
| 2825 | if(len(self.pad) != 6): |
| 2826 | return (False, "self.pad is not of size 6 as expected.") |
| 2827 | return (True, None) |
| 2828 | |
| 2829 | def pack(self, assertstruct=True): |
| 2830 | """Pack message |
| 2831 | Packs empty array used as placeholder |
| 2832 | """ |
| 2833 | if(assertstruct): |
| 2834 | if(not self.__assert()[0]): |
| 2835 | return None |
| 2836 | packed = "" |
| 2837 | packed += struct.pack("!HHH", self.type, self.len, self.port) |
| 2838 | packed += struct.pack("!BBBBBB", self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) |
| 2839 | packed += struct.pack("!L", self.queue_id) |
| 2840 | return packed |
| 2841 | |
| 2842 | def unpack(self, binaryString): |
| 2843 | """Unpack message |
| 2844 | Do not unpack empty array used as placeholder |
| 2845 | since they can contain heterogeneous type |
| 2846 | """ |
| 2847 | if (len(binaryString) < 16): |
| 2848 | return binaryString |
| 2849 | fmt = '!HHH' |
| 2850 | start = 0 |
| 2851 | end = start + struct.calcsize(fmt) |
| 2852 | (self.type, self.len, self.port) = struct.unpack(fmt, binaryString[start:end]) |
| 2853 | fmt = '!BBBBBB' |
| 2854 | start = 6 |
| 2855 | end = start + struct.calcsize(fmt) |
| 2856 | (self.pad[0], self.pad[1], self.pad[2], self.pad[3], self.pad[4], self.pad[5]) = struct.unpack(fmt, binaryString[start:end]) |
| 2857 | fmt = '!L' |
| 2858 | start = 12 |
| 2859 | end = start + struct.calcsize(fmt) |
| 2860 | (self.queue_id,) = struct.unpack(fmt, binaryString[start:end]) |
| 2861 | return binaryString[16:] |
| 2862 | |
| 2863 | def __len__(self): |
| 2864 | """Return length of message |
| 2865 | """ |
| 2866 | l = 16 |
| 2867 | return l |
| 2868 | |
| 2869 | def __eq__(self, other): |
| 2870 | """Return True if self and other have same values |
| 2871 | """ |
| 2872 | if type(self) != type(other): return False |
| 2873 | if self.type != other.type: return False |
| 2874 | if self.len != other.len: return False |
| 2875 | if self.port != other.port: return False |
| 2876 | if self.pad != other.pad: return False |
| 2877 | if self.queue_id != other.queue_id: return False |
| 2878 | return True |
| 2879 | |
| 2880 | def __ne__(self, other): return not self.__eq__(other) |
| 2881 | |
| 2882 | def show(self, prefix=''): |
| 2883 | """Generate string showing basic members of structure |
| 2884 | """ |
| 2885 | outstr = '' |
| 2886 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 2887 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 2888 | outstr += prefix + 'port: ' + str(self.port) + '\n' |
| 2889 | outstr += prefix + 'queue_id: ' + str(self.queue_id) + '\n' |
| 2890 | return outstr |
| 2891 | |
| 2892 | |
| 2893 | class ofp_switch_features: |
| 2894 | """Automatically generated Python class for ofp_switch_features |
| 2895 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 2896 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2897 | Created by of.pythonize.pythonizer |
| 2898 | Core structure: Messages do not include ofp_header |
| 2899 | Does not include var-length arrays |
| 2900 | """ |
| 2901 | def __init__(self): |
| 2902 | """Initialize |
| 2903 | Declare members and default values |
| 2904 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2905 | self.version = 0 |
| 2906 | self.type = 0 |
| 2907 | self.length = 0 |
| 2908 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2909 | self.datapath_id = 0 |
| 2910 | self.n_buffers = 0 |
| 2911 | self.n_tables = 0 |
| 2912 | self.pad= [0,0,0] |
| 2913 | self.capabilities = 0 |
| 2914 | self.actions = 0 |
| 2915 | |
| 2916 | def __assert(self): |
| 2917 | """Sanity check |
| 2918 | """ |
| 2919 | if(not isinstance(self.pad, list)): |
| 2920 | return (False, "self.pad is not list as expected.") |
| 2921 | if(len(self.pad) != 3): |
| 2922 | return (False, "self.pad is not of size 3 as expected.") |
| 2923 | return (True, None) |
| 2924 | |
| 2925 | def pack(self, assertstruct=True): |
| 2926 | """Pack message |
| 2927 | Packs empty array used as placeholder |
| 2928 | """ |
| 2929 | if(assertstruct): |
| 2930 | if(not self.__assert()[0]): |
| 2931 | return None |
| 2932 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2933 | packed += struct.pack("!BBHLQLB", self.version, self.type, self.length, self.xid, self.datapath_id, self.n_buffers, self.n_tables) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2934 | packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2]) |
| 2935 | packed += struct.pack("!LL", self.capabilities, self.actions) |
| 2936 | return packed |
| 2937 | |
| 2938 | def unpack(self, binaryString): |
| 2939 | """Unpack message |
| 2940 | Do not unpack empty array used as placeholder |
| 2941 | since they can contain heterogeneous type |
| 2942 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2943 | if (len(binaryString) < 32): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2944 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2945 | fmt = '!BBHLQLB' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2946 | start = 0 |
| 2947 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2948 | (self.version, self.type, self.length, self.xid, self.datapath_id, self.n_buffers, self.n_tables) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2949 | fmt = '!BBB' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2950 | start = 21 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2951 | end = start + struct.calcsize(fmt) |
| 2952 | (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end]) |
| 2953 | fmt = '!LL' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2954 | start = 24 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2955 | end = start + struct.calcsize(fmt) |
| 2956 | (self.capabilities, self.actions) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2957 | return binaryString[32:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2958 | |
| 2959 | def __len__(self): |
| 2960 | """Return length of message |
| 2961 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2962 | l = 32 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2963 | return l |
| 2964 | |
| 2965 | def __eq__(self, other): |
| 2966 | """Return True if self and other have same values |
| 2967 | """ |
| 2968 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2969 | if self.version != other.version: return False |
| 2970 | if self.type != other.type: return False |
| 2971 | if self.length != other.length: return False |
| 2972 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2973 | if self.datapath_id != other.datapath_id: return False |
| 2974 | if self.n_buffers != other.n_buffers: return False |
| 2975 | if self.n_tables != other.n_tables: return False |
| 2976 | if self.pad != other.pad: return False |
| 2977 | if self.capabilities != other.capabilities: return False |
| 2978 | if self.actions != other.actions: return False |
| 2979 | return True |
| 2980 | |
| 2981 | def __ne__(self, other): return not self.__eq__(other) |
| 2982 | |
| 2983 | def show(self, prefix=''): |
| 2984 | """Generate string showing basic members of structure |
| 2985 | """ |
| 2986 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 2987 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 2988 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 2989 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 2990 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 2991 | outstr += prefix + 'datapath_id: ' + str(self.datapath_id) + '\n' |
| 2992 | outstr += prefix + 'n_buffers: ' + str(self.n_buffers) + '\n' |
| 2993 | outstr += prefix + 'n_tables: ' + str(self.n_tables) + '\n' |
| 2994 | outstr += prefix + 'capabilities: ' + str(self.capabilities) + '\n' |
| 2995 | outstr += prefix + 'actions: ' + str(self.actions) + '\n' |
| 2996 | return outstr |
| 2997 | |
| 2998 | |
| 2999 | class ofp_match: |
| 3000 | """Automatically generated Python class for ofp_match |
| 3001 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3002 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3003 | Created by of.pythonize.pythonizer |
| 3004 | Core structure: Messages do not include ofp_header |
| 3005 | Does not include var-length arrays |
| 3006 | """ |
| 3007 | def __init__(self): |
| 3008 | """Initialize |
| 3009 | Declare members and default values |
| 3010 | """ |
| 3011 | self.wildcards = 0 |
| 3012 | self.in_port = 0 |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3013 | self.eth_src= [0,0,0,0,0,0] |
| 3014 | self.eth_dst= [0,0,0,0,0,0] |
| 3015 | self.vlan_vid = 0 |
| 3016 | self.vlan_pcp = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3017 | self.pad1 = 0 |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3018 | self.eth_type = 0 |
| 3019 | self.ip_dscp = 0 |
| 3020 | self.ip_proto = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3021 | self.pad2= [0,0] |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3022 | self.ipv4_src = 0 |
| 3023 | self.ipv4_dst = 0 |
| 3024 | self.tcp_src = 0 |
| 3025 | self.tcp_dst = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3026 | |
| 3027 | def __assert(self): |
| 3028 | """Sanity check |
| 3029 | """ |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3030 | if(not isinstance(self.eth_src, list)): |
| 3031 | return (False, "self.eth_src is not list as expected.") |
| 3032 | if(len(self.eth_src) != 6): |
| 3033 | return (False, "self.eth_src is not of size 6 as expected.") |
| 3034 | if(not isinstance(self.eth_dst, list)): |
| 3035 | return (False, "self.eth_dst is not list as expected.") |
| 3036 | if(len(self.eth_dst) != 6): |
| 3037 | return (False, "self.eth_dst is not of size 6 as expected.") |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3038 | if(not isinstance(self.pad2, list)): |
| 3039 | return (False, "self.pad2 is not list as expected.") |
| 3040 | if(len(self.pad2) != 2): |
| 3041 | return (False, "self.pad2 is not of size 2 as expected.") |
| 3042 | return (True, None) |
| 3043 | |
| 3044 | def pack(self, assertstruct=True): |
| 3045 | """Pack message |
| 3046 | Packs empty array used as placeholder |
| 3047 | """ |
| 3048 | if(assertstruct): |
| 3049 | if(not self.__assert()[0]): |
| 3050 | return None |
| 3051 | packed = "" |
| 3052 | packed += struct.pack("!LH", self.wildcards, self.in_port) |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3053 | packed += struct.pack("!BBBBBB", self.eth_src[0], self.eth_src[1], self.eth_src[2], self.eth_src[3], self.eth_src[4], self.eth_src[5]) |
| 3054 | packed += struct.pack("!BBBBBB", self.eth_dst[0], self.eth_dst[1], self.eth_dst[2], self.eth_dst[3], self.eth_dst[4], self.eth_dst[5]) |
| 3055 | packed += struct.pack("!HBBHBB", self.vlan_vid, self.vlan_pcp, self.pad1, self.eth_type, self.ip_dscp, self.ip_proto) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3056 | packed += struct.pack("!BB", self.pad2[0], self.pad2[1]) |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3057 | packed += struct.pack("!LLHH", self.ipv4_src, self.ipv4_dst, self.tcp_src, self.tcp_dst) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3058 | return packed |
| 3059 | |
| 3060 | def unpack(self, binaryString): |
| 3061 | """Unpack message |
| 3062 | Do not unpack empty array used as placeholder |
| 3063 | since they can contain heterogeneous type |
| 3064 | """ |
| 3065 | if (len(binaryString) < 40): |
| 3066 | return binaryString |
| 3067 | fmt = '!LH' |
| 3068 | start = 0 |
| 3069 | end = start + struct.calcsize(fmt) |
| 3070 | (self.wildcards, self.in_port) = struct.unpack(fmt, binaryString[start:end]) |
| 3071 | fmt = '!BBBBBB' |
| 3072 | start = 6 |
| 3073 | end = start + struct.calcsize(fmt) |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3074 | (self.eth_src[0], self.eth_src[1], self.eth_src[2], self.eth_src[3], self.eth_src[4], self.eth_src[5]) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3075 | fmt = '!BBBBBB' |
| 3076 | start = 12 |
| 3077 | end = start + struct.calcsize(fmt) |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3078 | (self.eth_dst[0], self.eth_dst[1], self.eth_dst[2], self.eth_dst[3], self.eth_dst[4], self.eth_dst[5]) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3079 | fmt = '!HBBHBB' |
| 3080 | start = 18 |
| 3081 | end = start + struct.calcsize(fmt) |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3082 | (self.vlan_vid, self.vlan_pcp, self.pad1, self.eth_type, self.ip_dscp, self.ip_proto) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3083 | fmt = '!BB' |
| 3084 | start = 26 |
| 3085 | end = start + struct.calcsize(fmt) |
| 3086 | (self.pad2[0], self.pad2[1]) = struct.unpack(fmt, binaryString[start:end]) |
| 3087 | fmt = '!LLHH' |
| 3088 | start = 28 |
| 3089 | end = start + struct.calcsize(fmt) |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3090 | (self.ipv4_src, self.ipv4_dst, self.tcp_src, self.tcp_dst) = struct.unpack(fmt, binaryString[start:end]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3091 | return binaryString[40:] |
| 3092 | |
| 3093 | def __len__(self): |
| 3094 | """Return length of message |
| 3095 | """ |
| 3096 | l = 40 |
| 3097 | return l |
| 3098 | |
| 3099 | def __eq__(self, other): |
| 3100 | """Return True if self and other have same values |
| 3101 | """ |
| 3102 | if type(self) != type(other): return False |
| 3103 | if self.wildcards != other.wildcards: return False |
| 3104 | if self.in_port != other.in_port: return False |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3105 | if self.eth_src != other.eth_src: return False |
| 3106 | if self.eth_dst != other.eth_dst: return False |
| 3107 | if self.vlan_vid != other.vlan_vid: return False |
| 3108 | if self.vlan_pcp != other.vlan_pcp: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3109 | if self.pad1 != other.pad1: return False |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3110 | if self.eth_type != other.eth_type: return False |
| 3111 | if self.ip_dscp != other.ip_dscp: return False |
| 3112 | if self.ip_proto != other.ip_proto: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3113 | if self.pad2 != other.pad2: return False |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3114 | if self.ipv4_src != other.ipv4_src: return False |
| 3115 | if self.ipv4_dst != other.ipv4_dst: return False |
| 3116 | if self.tcp_src != other.tcp_src: return False |
| 3117 | if self.tcp_dst != other.tcp_dst: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3118 | return True |
| 3119 | |
| 3120 | def __ne__(self, other): return not self.__eq__(other) |
| 3121 | |
| 3122 | def show(self, prefix=''): |
| 3123 | """Generate string showing basic members of structure |
| 3124 | """ |
| 3125 | outstr = '' |
| 3126 | outstr += prefix + 'wildcards: ' + str(self.wildcards) + '\n' |
| 3127 | outstr += prefix + 'in_port: ' + str(self.in_port) + '\n' |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3128 | outstr += prefix + 'eth_src: ' + str(self.eth_src) + '\n' |
| 3129 | outstr += prefix + 'eth_dst: ' + str(self.eth_dst) + '\n' |
| 3130 | outstr += prefix + 'vlan_vid: ' + str(self.vlan_vid) + '\n' |
| 3131 | outstr += prefix + 'vlan_pcp: ' + str(self.vlan_pcp) + '\n' |
| 3132 | outstr += prefix + 'eth_type: ' + str(self.eth_type) + '\n' |
| 3133 | outstr += prefix + 'ip_dscp: ' + str(self.ip_dscp) + '\n' |
| 3134 | outstr += prefix + 'ip_proto: ' + str(self.ip_proto) + '\n' |
| 3135 | outstr += prefix + 'ipv4_src: ' + str(self.ipv4_src) + '\n' |
| 3136 | outstr += prefix + 'ipv4_dst: ' + str(self.ipv4_dst) + '\n' |
| 3137 | outstr += prefix + 'tcp_src: ' + str(self.tcp_src) + '\n' |
| 3138 | outstr += prefix + 'tcp_dst: ' + str(self.tcp_dst) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3139 | return outstr |
| 3140 | |
| 3141 | |
| 3142 | class ofp_header: |
| 3143 | """Automatically generated Python class for ofp_header |
| 3144 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3145 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3146 | Created by of.pythonize.pythonizer |
| 3147 | Core structure: Messages do not include ofp_header |
| 3148 | Does not include var-length arrays |
| 3149 | """ |
| 3150 | def __init__(self): |
| 3151 | """Initialize |
| 3152 | Declare members and default values |
| 3153 | """ |
| 3154 | self.version = 0x01 |
| 3155 | self.type = 0 |
| 3156 | self.length = 0 |
| 3157 | self.xid = 0 |
| 3158 | |
| 3159 | def __assert(self): |
| 3160 | """Sanity check |
| 3161 | """ |
| 3162 | if (not (self.type in ofp_type_map.keys())): |
| 3163 | return (False, "type must have values from ofp_type_map.keys()") |
| 3164 | return (True, None) |
| 3165 | |
| 3166 | def pack(self, assertstruct=True): |
| 3167 | """Pack message |
| 3168 | Packs empty array used as placeholder |
| 3169 | """ |
| 3170 | if(assertstruct): |
| 3171 | if(not self.__assert()[0]): |
| 3172 | return None |
| 3173 | packed = "" |
| 3174 | packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid) |
| 3175 | return packed |
| 3176 | |
| 3177 | def unpack(self, binaryString): |
| 3178 | """Unpack message |
| 3179 | Do not unpack empty array used as placeholder |
| 3180 | since they can contain heterogeneous type |
| 3181 | """ |
| 3182 | if (len(binaryString) < 8): |
| 3183 | return binaryString |
| 3184 | fmt = '!BBHL' |
| 3185 | start = 0 |
| 3186 | end = start + struct.calcsize(fmt) |
| 3187 | (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end]) |
| 3188 | return binaryString[8:] |
| 3189 | |
| 3190 | def __len__(self): |
| 3191 | """Return length of message |
| 3192 | """ |
| 3193 | l = 8 |
| 3194 | return l |
| 3195 | |
| 3196 | def __eq__(self, other): |
| 3197 | """Return True if self and other have same values |
| 3198 | """ |
| 3199 | if type(self) != type(other): return False |
| 3200 | if self.version != other.version: return False |
| 3201 | if self.type != other.type: return False |
| 3202 | if self.length != other.length: return False |
| 3203 | if self.xid != other.xid: return False |
| 3204 | return True |
| 3205 | |
| 3206 | def __ne__(self, other): return not self.__eq__(other) |
| 3207 | |
| 3208 | def show(self, prefix=''): |
| 3209 | """Generate string showing basic members of structure |
| 3210 | """ |
| 3211 | outstr = '' |
| 3212 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 3213 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 3214 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 3215 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
| 3216 | return outstr |
| 3217 | |
| 3218 | |
| 3219 | class ofp_vendor_header: |
| 3220 | """Automatically generated Python class for ofp_vendor_header |
| 3221 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3222 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3223 | Created by of.pythonize.pythonizer |
| 3224 | Core structure: Messages do not include ofp_header |
| 3225 | Does not include var-length arrays |
| 3226 | """ |
| 3227 | def __init__(self): |
| 3228 | """Initialize |
| 3229 | Declare members and default values |
| 3230 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3231 | self.version = 0 |
| 3232 | self.type = 0 |
| 3233 | self.length = 0 |
| 3234 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3235 | self.vendor = 0 |
| 3236 | |
| 3237 | def __assert(self): |
| 3238 | """Sanity check |
| 3239 | """ |
| 3240 | return (True, None) |
| 3241 | |
| 3242 | def pack(self, assertstruct=True): |
| 3243 | """Pack message |
| 3244 | Packs empty array used as placeholder |
| 3245 | """ |
| 3246 | if(assertstruct): |
| 3247 | if(not self.__assert()[0]): |
| 3248 | return None |
| 3249 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3250 | packed += struct.pack("!BBHLL", self.version, self.type, self.length, self.xid, self.vendor) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3251 | return packed |
| 3252 | |
| 3253 | def unpack(self, binaryString): |
| 3254 | """Unpack message |
| 3255 | Do not unpack empty array used as placeholder |
| 3256 | since they can contain heterogeneous type |
| 3257 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3258 | if (len(binaryString) < 12): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3259 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3260 | fmt = '!BBHLL' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3261 | start = 0 |
| 3262 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3263 | (self.version, self.type, self.length, self.xid, self.vendor) = struct.unpack(fmt, binaryString[start:end]) |
| 3264 | return binaryString[12:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3265 | |
| 3266 | def __len__(self): |
| 3267 | """Return length of message |
| 3268 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3269 | l = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3270 | return l |
| 3271 | |
| 3272 | def __eq__(self, other): |
| 3273 | """Return True if self and other have same values |
| 3274 | """ |
| 3275 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3276 | if self.version != other.version: return False |
| 3277 | if self.type != other.type: return False |
| 3278 | if self.length != other.length: return False |
| 3279 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3280 | if self.vendor != other.vendor: return False |
| 3281 | return True |
| 3282 | |
| 3283 | def __ne__(self, other): return not self.__eq__(other) |
| 3284 | |
| 3285 | def show(self, prefix=''): |
| 3286 | """Generate string showing basic members of structure |
| 3287 | """ |
| 3288 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3289 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 3290 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 3291 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 3292 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3293 | outstr += prefix + 'vendor: ' + str(self.vendor) + '\n' |
| 3294 | return outstr |
| 3295 | |
| 3296 | |
| 3297 | class ofp_packet_out: |
| 3298 | """Automatically generated Python class for ofp_packet_out |
| 3299 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3300 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3301 | Created by of.pythonize.pythonizer |
| 3302 | Core structure: Messages do not include ofp_header |
| 3303 | Does not include var-length arrays |
| 3304 | """ |
| 3305 | def __init__(self): |
| 3306 | """Initialize |
| 3307 | Declare members and default values |
| 3308 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3309 | self.version = 0 |
| 3310 | self.type = 0 |
| 3311 | self.length = 0 |
| 3312 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3313 | self.buffer_id = 4294967295 |
| 3314 | self.in_port = 0 |
| 3315 | self.actions_len = 0 |
| 3316 | |
| 3317 | def __assert(self): |
| 3318 | """Sanity check |
| 3319 | """ |
| 3320 | return (True, None) |
| 3321 | |
| 3322 | def pack(self, assertstruct=True): |
| 3323 | """Pack message |
| 3324 | Packs empty array used as placeholder |
| 3325 | """ |
| 3326 | if(assertstruct): |
| 3327 | if(not self.__assert()[0]): |
| 3328 | return None |
| 3329 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3330 | packed += struct.pack("!BBHLLHH", self.version, self.type, self.length, self.xid, self.buffer_id, self.in_port, self.actions_len) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3331 | return packed |
| 3332 | |
| 3333 | def unpack(self, binaryString): |
| 3334 | """Unpack message |
| 3335 | Do not unpack empty array used as placeholder |
| 3336 | since they can contain heterogeneous type |
| 3337 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3338 | if (len(binaryString) < 16): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3339 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3340 | fmt = '!BBHLLHH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3341 | start = 0 |
| 3342 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3343 | (self.version, self.type, self.length, self.xid, self.buffer_id, self.in_port, self.actions_len) = struct.unpack(fmt, binaryString[start:end]) |
| 3344 | return binaryString[16:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3345 | |
| 3346 | def __len__(self): |
| 3347 | """Return length of message |
| 3348 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3349 | l = 16 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3350 | return l |
| 3351 | |
| 3352 | def __eq__(self, other): |
| 3353 | """Return True if self and other have same values |
| 3354 | """ |
| 3355 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3356 | if self.version != other.version: return False |
| 3357 | if self.type != other.type: return False |
| 3358 | if self.length != other.length: return False |
| 3359 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3360 | if self.buffer_id != other.buffer_id: return False |
| 3361 | if self.in_port != other.in_port: return False |
| 3362 | if self.actions_len != other.actions_len: return False |
| 3363 | return True |
| 3364 | |
| 3365 | def __ne__(self, other): return not self.__eq__(other) |
| 3366 | |
| 3367 | def show(self, prefix=''): |
| 3368 | """Generate string showing basic members of structure |
| 3369 | """ |
| 3370 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3371 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 3372 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 3373 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 3374 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3375 | outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n' |
| 3376 | outstr += prefix + 'in_port: ' + str(self.in_port) + '\n' |
| 3377 | outstr += prefix + 'actions_len: ' + str(self.actions_len) + '\n' |
| 3378 | return outstr |
| 3379 | |
| 3380 | |
| 3381 | class ofp_action_nw_addr: |
| 3382 | """Automatically generated Python class for ofp_action_nw_addr |
| 3383 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3384 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3385 | Created by of.pythonize.pythonizer |
| 3386 | Core structure: Messages do not include ofp_header |
| 3387 | Does not include var-length arrays |
| 3388 | """ |
| 3389 | def __init__(self): |
| 3390 | """Initialize |
| 3391 | Declare members and default values |
| 3392 | """ |
| 3393 | self.type = 0 |
| 3394 | self.len = 0 |
| 3395 | self.nw_addr = 0 |
| 3396 | |
| 3397 | def __assert(self): |
| 3398 | """Sanity check |
| 3399 | """ |
| 3400 | return (True, None) |
| 3401 | |
| 3402 | def pack(self, assertstruct=True): |
| 3403 | """Pack message |
| 3404 | Packs empty array used as placeholder |
| 3405 | """ |
| 3406 | if(assertstruct): |
| 3407 | if(not self.__assert()[0]): |
| 3408 | return None |
| 3409 | packed = "" |
| 3410 | packed += struct.pack("!HHL", self.type, self.len, self.nw_addr) |
| 3411 | return packed |
| 3412 | |
| 3413 | def unpack(self, binaryString): |
| 3414 | """Unpack message |
| 3415 | Do not unpack empty array used as placeholder |
| 3416 | since they can contain heterogeneous type |
| 3417 | """ |
| 3418 | if (len(binaryString) < 8): |
| 3419 | return binaryString |
| 3420 | fmt = '!HHL' |
| 3421 | start = 0 |
| 3422 | end = start + struct.calcsize(fmt) |
| 3423 | (self.type, self.len, self.nw_addr) = struct.unpack(fmt, binaryString[start:end]) |
| 3424 | return binaryString[8:] |
| 3425 | |
| 3426 | def __len__(self): |
| 3427 | """Return length of message |
| 3428 | """ |
| 3429 | l = 8 |
| 3430 | return l |
| 3431 | |
| 3432 | def __eq__(self, other): |
| 3433 | """Return True if self and other have same values |
| 3434 | """ |
| 3435 | if type(self) != type(other): return False |
| 3436 | if self.type != other.type: return False |
| 3437 | if self.len != other.len: return False |
| 3438 | if self.nw_addr != other.nw_addr: return False |
| 3439 | return True |
| 3440 | |
| 3441 | def __ne__(self, other): return not self.__eq__(other) |
| 3442 | |
| 3443 | def show(self, prefix=''): |
| 3444 | """Generate string showing basic members of structure |
| 3445 | """ |
| 3446 | outstr = '' |
| 3447 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 3448 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 3449 | outstr += prefix + 'nw_addr: ' + str(self.nw_addr) + '\n' |
| 3450 | return outstr |
| 3451 | |
| 3452 | |
| 3453 | class ofp_action_vlan_pcp: |
| 3454 | """Automatically generated Python class for ofp_action_vlan_pcp |
| 3455 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3456 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3457 | Created by of.pythonize.pythonizer |
| 3458 | Core structure: Messages do not include ofp_header |
| 3459 | Does not include var-length arrays |
| 3460 | """ |
| 3461 | def __init__(self): |
| 3462 | """Initialize |
| 3463 | Declare members and default values |
| 3464 | """ |
| 3465 | self.type = 0 |
| 3466 | self.len = 0 |
| 3467 | self.vlan_pcp = 0 |
| 3468 | self.pad= [0,0,0] |
| 3469 | |
| 3470 | def __assert(self): |
| 3471 | """Sanity check |
| 3472 | """ |
| 3473 | if(not isinstance(self.pad, list)): |
| 3474 | return (False, "self.pad is not list as expected.") |
| 3475 | if(len(self.pad) != 3): |
| 3476 | return (False, "self.pad is not of size 3 as expected.") |
| 3477 | return (True, None) |
| 3478 | |
| 3479 | def pack(self, assertstruct=True): |
| 3480 | """Pack message |
| 3481 | Packs empty array used as placeholder |
| 3482 | """ |
| 3483 | if(assertstruct): |
| 3484 | if(not self.__assert()[0]): |
| 3485 | return None |
| 3486 | packed = "" |
| 3487 | packed += struct.pack("!HHB", self.type, self.len, self.vlan_pcp) |
| 3488 | packed += struct.pack("!BBB", self.pad[0], self.pad[1], self.pad[2]) |
| 3489 | return packed |
| 3490 | |
| 3491 | def unpack(self, binaryString): |
| 3492 | """Unpack message |
| 3493 | Do not unpack empty array used as placeholder |
| 3494 | since they can contain heterogeneous type |
| 3495 | """ |
| 3496 | if (len(binaryString) < 8): |
| 3497 | return binaryString |
| 3498 | fmt = '!HHB' |
| 3499 | start = 0 |
| 3500 | end = start + struct.calcsize(fmt) |
| 3501 | (self.type, self.len, self.vlan_pcp) = struct.unpack(fmt, binaryString[start:end]) |
| 3502 | fmt = '!BBB' |
| 3503 | start = 5 |
| 3504 | end = start + struct.calcsize(fmt) |
| 3505 | (self.pad[0], self.pad[1], self.pad[2]) = struct.unpack(fmt, binaryString[start:end]) |
| 3506 | return binaryString[8:] |
| 3507 | |
| 3508 | def __len__(self): |
| 3509 | """Return length of message |
| 3510 | """ |
| 3511 | l = 8 |
| 3512 | return l |
| 3513 | |
| 3514 | def __eq__(self, other): |
| 3515 | """Return True if self and other have same values |
| 3516 | """ |
| 3517 | if type(self) != type(other): return False |
| 3518 | if self.type != other.type: return False |
| 3519 | if self.len != other.len: return False |
| 3520 | if self.vlan_pcp != other.vlan_pcp: return False |
| 3521 | if self.pad != other.pad: return False |
| 3522 | return True |
| 3523 | |
| 3524 | def __ne__(self, other): return not self.__eq__(other) |
| 3525 | |
| 3526 | def show(self, prefix=''): |
| 3527 | """Generate string showing basic members of structure |
| 3528 | """ |
| 3529 | outstr = '' |
| 3530 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 3531 | outstr += prefix + 'len: ' + str(self.len) + '\n' |
| 3532 | outstr += prefix + 'vlan_pcp: ' + str(self.vlan_pcp) + '\n' |
| 3533 | return outstr |
| 3534 | |
| 3535 | |
| 3536 | class ofp_flow_mod: |
| 3537 | """Automatically generated Python class for ofp_flow_mod |
| 3538 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3539 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3540 | Created by of.pythonize.pythonizer |
| 3541 | Core structure: Messages do not include ofp_header |
| 3542 | Does not include var-length arrays |
| 3543 | """ |
| 3544 | def __init__(self): |
| 3545 | """Initialize |
| 3546 | Declare members and default values |
| 3547 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3548 | self.version = 0 |
| 3549 | self.type = 0 |
| 3550 | self.length = 0 |
| 3551 | self.xid = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3552 | self.match = ofp_match() |
| 3553 | self.cookie = 0 |
| 3554 | self.command = 0 |
| 3555 | self.idle_timeout = 0 |
| 3556 | self.hard_timeout = 0 |
| 3557 | self.priority = 0x8000 |
| 3558 | self.buffer_id = 0 |
| 3559 | self.out_port = 0 |
| 3560 | self.flags = 0 |
| 3561 | |
| 3562 | def __assert(self): |
| 3563 | """Sanity check |
| 3564 | """ |
| 3565 | if(not isinstance(self.match, ofp_match)): |
| 3566 | return (False, "self.match is not class ofp_match as expected.") |
| 3567 | return (True, None) |
| 3568 | |
| 3569 | def pack(self, assertstruct=True): |
| 3570 | """Pack message |
| 3571 | Packs empty array used as placeholder |
| 3572 | """ |
| 3573 | if(assertstruct): |
| 3574 | if(not self.__assert()[0]): |
| 3575 | return None |
| 3576 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3577 | packed += struct.pack("!BBHL", self.version, self.type, self.length, self.xid) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3578 | packed += self.match.pack() |
| 3579 | packed += struct.pack("!QHHHHLHH", self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, self.buffer_id, self.out_port, self.flags) |
| 3580 | return packed |
| 3581 | |
| 3582 | def unpack(self, binaryString): |
| 3583 | """Unpack message |
| 3584 | Do not unpack empty array used as placeholder |
| 3585 | since they can contain heterogeneous type |
| 3586 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3587 | if (len(binaryString) < 72): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3588 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3589 | fmt = '!BBHL' |
| 3590 | start = 0 |
| 3591 | end = start + struct.calcsize(fmt) |
| 3592 | (self.version, self.type, self.length, self.xid) = struct.unpack(fmt, binaryString[start:end]) |
| 3593 | self.match.unpack(binaryString[8:]) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3594 | fmt = '!QHHHHLHH' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3595 | start = 48 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3596 | end = start + struct.calcsize(fmt) |
| 3597 | (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]) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3598 | return binaryString[72:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3599 | |
| 3600 | def __len__(self): |
| 3601 | """Return length of message |
| 3602 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3603 | l = 72 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3604 | return l |
| 3605 | |
| 3606 | def __eq__(self, other): |
| 3607 | """Return True if self and other have same values |
| 3608 | """ |
| 3609 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3610 | if self.version != other.version: return False |
| 3611 | if self.type != other.type: return False |
| 3612 | if self.length != other.length: return False |
| 3613 | if self.xid != other.xid: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3614 | if self.match != other.match: return False |
| 3615 | if self.cookie != other.cookie: return False |
| 3616 | if self.command != other.command: return False |
| 3617 | if self.idle_timeout != other.idle_timeout: return False |
| 3618 | if self.hard_timeout != other.hard_timeout: return False |
| 3619 | if self.priority != other.priority: return False |
| 3620 | if self.buffer_id != other.buffer_id: return False |
| 3621 | if self.out_port != other.out_port: return False |
| 3622 | if self.flags != other.flags: return False |
| 3623 | return True |
| 3624 | |
| 3625 | def __ne__(self, other): return not self.__eq__(other) |
| 3626 | |
| 3627 | def show(self, prefix=''): |
| 3628 | """Generate string showing basic members of structure |
| 3629 | """ |
| 3630 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3631 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 3632 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 3633 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 3634 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3635 | outstr += prefix + 'match: \n' |
| 3636 | outstr += self.match.show(prefix + ' ') |
| 3637 | outstr += prefix + 'cookie: ' + str(self.cookie) + '\n' |
| 3638 | outstr += prefix + 'command: ' + str(self.command) + '\n' |
| 3639 | outstr += prefix + 'idle_timeout: ' + str(self.idle_timeout) + '\n' |
| 3640 | outstr += prefix + 'hard_timeout: ' + str(self.hard_timeout) + '\n' |
| 3641 | outstr += prefix + 'priority: ' + str(self.priority) + '\n' |
| 3642 | outstr += prefix + 'buffer_id: ' + str(self.buffer_id) + '\n' |
| 3643 | outstr += prefix + 'out_port: ' + str(self.out_port) + '\n' |
| 3644 | outstr += prefix + 'flags: ' + str(self.flags) + '\n' |
| 3645 | return outstr |
| 3646 | |
| 3647 | |
| 3648 | class ofp_error_msg: |
| 3649 | """Automatically generated Python class for ofp_error_msg |
| 3650 | |
Rich Lane | 5b44ab4 | 2013-03-11 12:37:45 -0700 | [diff] [blame] | 3651 | Date 2013-03-11 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3652 | Created by of.pythonize.pythonizer |
| 3653 | Core structure: Messages do not include ofp_header |
| 3654 | Does not include var-length arrays |
| 3655 | """ |
| 3656 | def __init__(self): |
| 3657 | """Initialize |
| 3658 | Declare members and default values |
| 3659 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3660 | self.version = 0 |
| 3661 | self.type = 0 |
| 3662 | self.length = 0 |
| 3663 | self.xid = 0 |
Rich Lane | 4e361bb | 2013-03-11 13:57:31 -0700 | [diff] [blame] | 3664 | self.err_type = 0 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3665 | self.code = 0 |
| 3666 | |
| 3667 | def __assert(self): |
| 3668 | """Sanity check |
| 3669 | """ |
| 3670 | return (True, None) |
| 3671 | |
| 3672 | def pack(self, assertstruct=True): |
| 3673 | """Pack message |
| 3674 | Packs empty array used as placeholder |
| 3675 | """ |
| 3676 | if(assertstruct): |
| 3677 | if(not self.__assert()[0]): |
| 3678 | return None |
| 3679 | packed = "" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3680 | packed += struct.pack("!BBHLHH", self.version, self.type, self.length, self.xid, self.err_type, self.code) |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3681 | return packed |
| 3682 | |
| 3683 | def unpack(self, binaryString): |
| 3684 | """Unpack message |
| 3685 | Do not unpack empty array used as placeholder |
| 3686 | since they can contain heterogeneous type |
| 3687 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3688 | if (len(binaryString) < 12): |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3689 | return binaryString |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3690 | fmt = '!BBHLHH' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3691 | start = 0 |
| 3692 | end = start + struct.calcsize(fmt) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3693 | (self.version, self.type, self.length, self.xid, self.err_type, self.code) = struct.unpack(fmt, binaryString[start:end]) |
| 3694 | return binaryString[12:] |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3695 | |
| 3696 | def __len__(self): |
| 3697 | """Return length of message |
| 3698 | """ |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3699 | l = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3700 | return l |
| 3701 | |
| 3702 | def __eq__(self, other): |
| 3703 | """Return True if self and other have same values |
| 3704 | """ |
| 3705 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3706 | if self.version != other.version: return False |
| 3707 | if self.type != other.type: return False |
| 3708 | if self.length != other.length: return False |
| 3709 | if self.xid != other.xid: return False |
Rich Lane | 4e361bb | 2013-03-11 13:57:31 -0700 | [diff] [blame] | 3710 | if self.err_type != other.err_type: return False |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3711 | if self.code != other.code: return False |
| 3712 | return True |
| 3713 | |
| 3714 | def __ne__(self, other): return not self.__eq__(other) |
| 3715 | |
| 3716 | def show(self, prefix=''): |
| 3717 | """Generate string showing basic members of structure |
| 3718 | """ |
| 3719 | outstr = '' |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 3720 | outstr += prefix + 'version: ' + str(self.version) + '\n' |
| 3721 | outstr += prefix + 'type: ' + str(self.type) + '\n' |
| 3722 | outstr += prefix + 'length: ' + str(self.length) + '\n' |
| 3723 | outstr += prefix + 'xid: ' + str(self.xid) + '\n' |
Rich Lane | 4e361bb | 2013-03-11 13:57:31 -0700 | [diff] [blame] | 3724 | outstr += prefix + 'err_type: ' + str(self.err_type) + '\n' |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 3725 | outstr += prefix + 'code: ' + str(self.code) + '\n' |
| 3726 | return outstr |
| 3727 | |
| 3728 | |
| 3729 | # Enumerated type definitions |
| 3730 | ofp_error_type = ['OFPET_HELLO_FAILED', 'OFPET_BAD_REQUEST', 'OFPET_BAD_ACTION', 'OFPET_FLOW_MOD_FAILED', 'OFPET_PORT_MOD_FAILED', 'OFPET_QUEUE_OP_FAILED'] |
| 3731 | OFPET_HELLO_FAILED = 0 |
| 3732 | OFPET_BAD_REQUEST = 1 |
| 3733 | OFPET_BAD_ACTION = 2 |
| 3734 | OFPET_FLOW_MOD_FAILED = 3 |
| 3735 | OFPET_PORT_MOD_FAILED = 4 |
| 3736 | OFPET_QUEUE_OP_FAILED = 5 |
| 3737 | ofp_error_type_map = { |
| 3738 | 0 : 'OFPET_HELLO_FAILED', |
| 3739 | 1 : 'OFPET_BAD_REQUEST', |
| 3740 | 2 : 'OFPET_BAD_ACTION', |
| 3741 | 3 : 'OFPET_FLOW_MOD_FAILED', |
| 3742 | 4 : 'OFPET_PORT_MOD_FAILED', |
| 3743 | 5 : 'OFPET_QUEUE_OP_FAILED' |
| 3744 | } |
| 3745 | |
| 3746 | ofp_flow_mod_flags = ['OFPFF_SEND_FLOW_REM', 'OFPFF_CHECK_OVERLAP', 'OFPFF_EMERG'] |
| 3747 | OFPFF_SEND_FLOW_REM = 1 |
| 3748 | OFPFF_CHECK_OVERLAP = 2 |
| 3749 | OFPFF_EMERG = 4 |
| 3750 | ofp_flow_mod_flags_map = { |
| 3751 | 1 : 'OFPFF_SEND_FLOW_REM', |
| 3752 | 2 : 'OFPFF_CHECK_OVERLAP', |
| 3753 | 4 : 'OFPFF_EMERG' |
| 3754 | } |
| 3755 | |
| 3756 | ofp_stats_reply_flags = ['OFPSF_REPLY_MORE'] |
| 3757 | OFPSF_REPLY_MORE = 1 |
| 3758 | ofp_stats_reply_flags_map = { |
| 3759 | 1 : 'OFPSF_REPLY_MORE' |
| 3760 | } |
| 3761 | |
| 3762 | ofp_flow_mod_failed_code = ['OFPFMFC_ALL_TABLES_FULL', 'OFPFMFC_OVERLAP', 'OFPFMFC_EPERM', 'OFPFMFC_BAD_EMERG_TIMEOUT', 'OFPFMFC_BAD_COMMAND', 'OFPFMFC_UNSUPPORTED'] |
| 3763 | OFPFMFC_ALL_TABLES_FULL = 0 |
| 3764 | OFPFMFC_OVERLAP = 1 |
| 3765 | OFPFMFC_EPERM = 2 |
| 3766 | OFPFMFC_BAD_EMERG_TIMEOUT = 3 |
| 3767 | OFPFMFC_BAD_COMMAND = 4 |
| 3768 | OFPFMFC_UNSUPPORTED = 5 |
| 3769 | ofp_flow_mod_failed_code_map = { |
| 3770 | 0 : 'OFPFMFC_ALL_TABLES_FULL', |
| 3771 | 1 : 'OFPFMFC_OVERLAP', |
| 3772 | 2 : 'OFPFMFC_EPERM', |
| 3773 | 3 : 'OFPFMFC_BAD_EMERG_TIMEOUT', |
| 3774 | 4 : 'OFPFMFC_BAD_COMMAND', |
| 3775 | 5 : 'OFPFMFC_UNSUPPORTED' |
| 3776 | } |
| 3777 | |
| 3778 | ofp_port_config = ['OFPPC_PORT_DOWN', 'OFPPC_NO_STP', 'OFPPC_NO_RECV', 'OFPPC_NO_RECV_STP', 'OFPPC_NO_FLOOD', 'OFPPC_NO_FWD', 'OFPPC_NO_PACKET_IN'] |
| 3779 | OFPPC_PORT_DOWN = 1 |
| 3780 | OFPPC_NO_STP = 2 |
| 3781 | OFPPC_NO_RECV = 4 |
| 3782 | OFPPC_NO_RECV_STP = 8 |
| 3783 | OFPPC_NO_FLOOD = 16 |
| 3784 | OFPPC_NO_FWD = 32 |
| 3785 | OFPPC_NO_PACKET_IN = 64 |
| 3786 | ofp_port_config_map = { |
| 3787 | 1 : 'OFPPC_PORT_DOWN', |
| 3788 | 2 : 'OFPPC_NO_STP', |
| 3789 | 4 : 'OFPPC_NO_RECV', |
| 3790 | 8 : 'OFPPC_NO_RECV_STP', |
| 3791 | 16 : 'OFPPC_NO_FLOOD', |
| 3792 | 32 : 'OFPPC_NO_FWD', |
| 3793 | 64 : 'OFPPC_NO_PACKET_IN' |
| 3794 | } |
| 3795 | |
| 3796 | ofp_port_state = ['OFPPS_LINK_DOWN', 'OFPPS_STP_LISTEN', 'OFPPS_STP_LEARN', 'OFPPS_STP_FORWARD', 'OFPPS_STP_BLOCK', 'OFPPS_STP_MASK'] |
| 3797 | OFPPS_LINK_DOWN = 1 |
| 3798 | OFPPS_STP_LISTEN = 0 |
| 3799 | OFPPS_STP_LEARN = 256 |
| 3800 | OFPPS_STP_FORWARD = 512 |
| 3801 | OFPPS_STP_BLOCK = 768 |
| 3802 | OFPPS_STP_MASK = 768 |
| 3803 | ofp_port_state_map = { |
| 3804 | 1 : 'OFPPS_LINK_DOWN', |
| 3805 | 0 : 'OFPPS_STP_LISTEN', |
| 3806 | 256 : 'OFPPS_STP_LEARN', |
| 3807 | 512 : 'OFPPS_STP_FORWARD', |
| 3808 | 768 : 'OFPPS_STP_BLOCK', |
| 3809 | 768 : 'OFPPS_STP_MASK' |
| 3810 | } |
| 3811 | |
| 3812 | ofp_config_flags = ['OFPC_FRAG_NORMAL', 'OFPC_FRAG_DROP', 'OFPC_FRAG_REASM', 'OFPC_FRAG_MASK'] |
| 3813 | OFPC_FRAG_NORMAL = 0 |
| 3814 | OFPC_FRAG_DROP = 1 |
| 3815 | OFPC_FRAG_REASM = 2 |
| 3816 | OFPC_FRAG_MASK = 3 |
| 3817 | ofp_config_flags_map = { |
| 3818 | 0 : 'OFPC_FRAG_NORMAL', |
| 3819 | 1 : 'OFPC_FRAG_DROP', |
| 3820 | 2 : 'OFPC_FRAG_REASM', |
| 3821 | 3 : 'OFPC_FRAG_MASK' |
| 3822 | } |
| 3823 | |
| 3824 | ofp_hello_failed_code = ['OFPHFC_INCOMPATIBLE', 'OFPHFC_EPERM'] |
| 3825 | OFPHFC_INCOMPATIBLE = 0 |
| 3826 | OFPHFC_EPERM = 1 |
| 3827 | ofp_hello_failed_code_map = { |
| 3828 | 0 : 'OFPHFC_INCOMPATIBLE', |
| 3829 | 1 : 'OFPHFC_EPERM' |
| 3830 | } |
| 3831 | |
| 3832 | ofp_capabilities = ['OFPC_FLOW_STATS', 'OFPC_TABLE_STATS', 'OFPC_PORT_STATS', 'OFPC_STP', 'OFPC_RESERVED', 'OFPC_IP_REASM', 'OFPC_QUEUE_STATS', 'OFPC_ARP_MATCH_IP'] |
| 3833 | OFPC_FLOW_STATS = 1 |
| 3834 | OFPC_TABLE_STATS = 2 |
| 3835 | OFPC_PORT_STATS = 4 |
| 3836 | OFPC_STP = 8 |
| 3837 | OFPC_RESERVED = 16 |
| 3838 | OFPC_IP_REASM = 32 |
| 3839 | OFPC_QUEUE_STATS = 64 |
| 3840 | OFPC_ARP_MATCH_IP = 128 |
| 3841 | ofp_capabilities_map = { |
| 3842 | 1 : 'OFPC_FLOW_STATS', |
| 3843 | 2 : 'OFPC_TABLE_STATS', |
| 3844 | 4 : 'OFPC_PORT_STATS', |
| 3845 | 8 : 'OFPC_STP', |
| 3846 | 16 : 'OFPC_RESERVED', |
| 3847 | 32 : 'OFPC_IP_REASM', |
| 3848 | 64 : 'OFPC_QUEUE_STATS', |
| 3849 | 128 : 'OFPC_ARP_MATCH_IP' |
| 3850 | } |
| 3851 | |
| 3852 | ofp_flow_removed_reason = ['OFPRR_IDLE_TIMEOUT', 'OFPRR_HARD_TIMEOUT', 'OFPRR_DELETE'] |
| 3853 | OFPRR_IDLE_TIMEOUT = 0 |
| 3854 | OFPRR_HARD_TIMEOUT = 1 |
| 3855 | OFPRR_DELETE = 2 |
| 3856 | ofp_flow_removed_reason_map = { |
| 3857 | 0 : 'OFPRR_IDLE_TIMEOUT', |
| 3858 | 1 : 'OFPRR_HARD_TIMEOUT', |
| 3859 | 2 : 'OFPRR_DELETE' |
| 3860 | } |
| 3861 | |
| 3862 | ofp_queue_properties = ['OFPQT_NONE', 'OFPQT_MIN_RATE'] |
| 3863 | OFPQT_NONE = 0 |
| 3864 | OFPQT_MIN_RATE = 0 |
| 3865 | ofp_queue_properties_map = { |
| 3866 | 0 : 'OFPQT_NONE', |
| 3867 | 0 : 'OFPQT_MIN_RATE' |
| 3868 | } |
| 3869 | |
| 3870 | ofp_flow_wildcards = ['OFPFW_IN_PORT', 'OFPFW_DL_VLAN', 'OFPFW_DL_SRC', 'OFPFW_DL_DST', 'OFPFW_DL_TYPE', 'OFPFW_NW_PROTO', 'OFPFW_TP_SRC', 'OFPFW_TP_DST', 'OFPFW_NW_SRC_SHIFT', 'OFPFW_NW_SRC_BITS', 'OFPFW_NW_SRC_MASK', 'OFPFW_NW_SRC_ALL', 'OFPFW_NW_DST_SHIFT', 'OFPFW_NW_DST_BITS', 'OFPFW_NW_DST_MASK', 'OFPFW_NW_DST_ALL', 'OFPFW_DL_VLAN_PCP', 'OFPFW_NW_TOS', 'OFPFW_ALL'] |
| 3871 | OFPFW_IN_PORT = 1 |
| 3872 | OFPFW_DL_VLAN = 2 |
| 3873 | OFPFW_DL_SRC = 4 |
| 3874 | OFPFW_DL_DST = 8 |
| 3875 | OFPFW_DL_TYPE = 16 |
| 3876 | OFPFW_NW_PROTO = 32 |
| 3877 | OFPFW_TP_SRC = 64 |
| 3878 | OFPFW_TP_DST = 128 |
| 3879 | OFPFW_NW_SRC_SHIFT = 8 |
| 3880 | OFPFW_NW_SRC_BITS = 6 |
| 3881 | OFPFW_NW_SRC_MASK = 16128 |
| 3882 | OFPFW_NW_SRC_ALL = 8192 |
| 3883 | OFPFW_NW_DST_SHIFT = 14 |
| 3884 | OFPFW_NW_DST_BITS = 6 |
| 3885 | OFPFW_NW_DST_MASK = 1032192 |
| 3886 | OFPFW_NW_DST_ALL = 524288 |
| 3887 | OFPFW_DL_VLAN_PCP = 1048576 |
| 3888 | OFPFW_NW_TOS = 2097152 |
| 3889 | OFPFW_ALL = 4194303 |
| 3890 | ofp_flow_wildcards_map = { |
| 3891 | 1 : 'OFPFW_IN_PORT', |
| 3892 | 2 : 'OFPFW_DL_VLAN', |
| 3893 | 4 : 'OFPFW_DL_SRC', |
| 3894 | 8 : 'OFPFW_DL_DST', |
| 3895 | 16 : 'OFPFW_DL_TYPE', |
| 3896 | 32 : 'OFPFW_NW_PROTO', |
| 3897 | 64 : 'OFPFW_TP_SRC', |
| 3898 | 128 : 'OFPFW_TP_DST', |
| 3899 | 8 : 'OFPFW_NW_SRC_SHIFT', |
| 3900 | 6 : 'OFPFW_NW_SRC_BITS', |
| 3901 | 16128 : 'OFPFW_NW_SRC_MASK', |
| 3902 | 8192 : 'OFPFW_NW_SRC_ALL', |
| 3903 | 14 : 'OFPFW_NW_DST_SHIFT', |
| 3904 | 6 : 'OFPFW_NW_DST_BITS', |
| 3905 | 1032192 : 'OFPFW_NW_DST_MASK', |
| 3906 | 524288 : 'OFPFW_NW_DST_ALL', |
| 3907 | 1048576 : 'OFPFW_DL_VLAN_PCP', |
| 3908 | 2097152 : 'OFPFW_NW_TOS', |
| 3909 | 4194303 : 'OFPFW_ALL' |
| 3910 | } |
| 3911 | |
| 3912 | ofp_port_reason = ['OFPPR_ADD', 'OFPPR_DELETE', 'OFPPR_MODIFY'] |
| 3913 | OFPPR_ADD = 0 |
| 3914 | OFPPR_DELETE = 1 |
| 3915 | OFPPR_MODIFY = 2 |
| 3916 | ofp_port_reason_map = { |
| 3917 | 0 : 'OFPPR_ADD', |
| 3918 | 1 : 'OFPPR_DELETE', |
| 3919 | 2 : 'OFPPR_MODIFY' |
| 3920 | } |
| 3921 | |
| 3922 | ofp_action_type = ['OFPAT_OUTPUT', 'OFPAT_SET_VLAN_VID', 'OFPAT_SET_VLAN_PCP', 'OFPAT_STRIP_VLAN', 'OFPAT_SET_DL_SRC', 'OFPAT_SET_DL_DST', 'OFPAT_SET_NW_SRC', 'OFPAT_SET_NW_DST', 'OFPAT_SET_NW_TOS', 'OFPAT_SET_TP_SRC', 'OFPAT_SET_TP_DST', 'OFPAT_ENQUEUE', 'OFPAT_VENDOR'] |
| 3923 | OFPAT_OUTPUT = 0 |
| 3924 | OFPAT_SET_VLAN_VID = 1 |
| 3925 | OFPAT_SET_VLAN_PCP = 2 |
| 3926 | OFPAT_STRIP_VLAN = 3 |
| 3927 | OFPAT_SET_DL_SRC = 4 |
| 3928 | OFPAT_SET_DL_DST = 5 |
| 3929 | OFPAT_SET_NW_SRC = 6 |
| 3930 | OFPAT_SET_NW_DST = 7 |
| 3931 | OFPAT_SET_NW_TOS = 8 |
| 3932 | OFPAT_SET_TP_SRC = 9 |
| 3933 | OFPAT_SET_TP_DST = 10 |
| 3934 | OFPAT_ENQUEUE = 11 |
| 3935 | OFPAT_VENDOR = 65535 |
| 3936 | ofp_action_type_map = { |
| 3937 | 0 : 'OFPAT_OUTPUT', |
| 3938 | 1 : 'OFPAT_SET_VLAN_VID', |
| 3939 | 2 : 'OFPAT_SET_VLAN_PCP', |
| 3940 | 3 : 'OFPAT_STRIP_VLAN', |
| 3941 | 4 : 'OFPAT_SET_DL_SRC', |
| 3942 | 5 : 'OFPAT_SET_DL_DST', |
| 3943 | 6 : 'OFPAT_SET_NW_SRC', |
| 3944 | 7 : 'OFPAT_SET_NW_DST', |
| 3945 | 8 : 'OFPAT_SET_NW_TOS', |
| 3946 | 9 : 'OFPAT_SET_TP_SRC', |
| 3947 | 10 : 'OFPAT_SET_TP_DST', |
| 3948 | 11 : 'OFPAT_ENQUEUE', |
| 3949 | 65535 : 'OFPAT_VENDOR' |
| 3950 | } |
| 3951 | |
| 3952 | ofp_flow_mod_command = ['OFPFC_ADD', 'OFPFC_MODIFY', 'OFPFC_MODIFY_STRICT', 'OFPFC_DELETE', 'OFPFC_DELETE_STRICT'] |
| 3953 | OFPFC_ADD = 0 |
| 3954 | OFPFC_MODIFY = 1 |
| 3955 | OFPFC_MODIFY_STRICT = 2 |
| 3956 | OFPFC_DELETE = 3 |
| 3957 | OFPFC_DELETE_STRICT = 4 |
| 3958 | ofp_flow_mod_command_map = { |
| 3959 | 0 : 'OFPFC_ADD', |
| 3960 | 1 : 'OFPFC_MODIFY', |
| 3961 | 2 : 'OFPFC_MODIFY_STRICT', |
| 3962 | 3 : 'OFPFC_DELETE', |
| 3963 | 4 : 'OFPFC_DELETE_STRICT' |
| 3964 | } |
| 3965 | |
| 3966 | ofp_queue_op_failed_code = ['OFPQOFC_BAD_PORT', 'OFPQOFC_BAD_QUEUE', 'OFPQOFC_EPERM'] |
| 3967 | OFPQOFC_BAD_PORT = 0 |
| 3968 | OFPQOFC_BAD_QUEUE = 1 |
| 3969 | OFPQOFC_EPERM = 2 |
| 3970 | ofp_queue_op_failed_code_map = { |
| 3971 | 0 : 'OFPQOFC_BAD_PORT', |
| 3972 | 1 : 'OFPQOFC_BAD_QUEUE', |
| 3973 | 2 : 'OFPQOFC_EPERM' |
| 3974 | } |
| 3975 | |
| 3976 | ofp_port = ['OFPP_MAX', 'OFPP_IN_PORT', 'OFPP_TABLE', 'OFPP_NORMAL', 'OFPP_FLOOD', 'OFPP_ALL', 'OFPP_CONTROLLER', 'OFPP_LOCAL', 'OFPP_NONE'] |
| 3977 | OFPP_MAX = 65280 |
| 3978 | OFPP_IN_PORT = 65528 |
| 3979 | OFPP_TABLE = 65529 |
| 3980 | OFPP_NORMAL = 65530 |
| 3981 | OFPP_FLOOD = 65531 |
| 3982 | OFPP_ALL = 65532 |
| 3983 | OFPP_CONTROLLER = 65533 |
| 3984 | OFPP_LOCAL = 65534 |
| 3985 | OFPP_NONE = 65535 |
| 3986 | ofp_port_map = { |
| 3987 | 65280 : 'OFPP_MAX', |
| 3988 | 65528 : 'OFPP_IN_PORT', |
| 3989 | 65529 : 'OFPP_TABLE', |
| 3990 | 65530 : 'OFPP_NORMAL', |
| 3991 | 65531 : 'OFPP_FLOOD', |
| 3992 | 65532 : 'OFPP_ALL', |
| 3993 | 65533 : 'OFPP_CONTROLLER', |
| 3994 | 65534 : 'OFPP_LOCAL', |
| 3995 | 65535 : 'OFPP_NONE' |
| 3996 | } |
| 3997 | |
| 3998 | ofp_bad_action_code = ['OFPBAC_BAD_TYPE', 'OFPBAC_BAD_LEN', 'OFPBAC_BAD_VENDOR', 'OFPBAC_BAD_VENDOR_TYPE', 'OFPBAC_BAD_OUT_PORT', 'OFPBAC_BAD_ARGUMENT', 'OFPBAC_EPERM', 'OFPBAC_TOO_MANY', 'OFPBAC_BAD_QUEUE'] |
| 3999 | OFPBAC_BAD_TYPE = 0 |
| 4000 | OFPBAC_BAD_LEN = 1 |
| 4001 | OFPBAC_BAD_VENDOR = 2 |
| 4002 | OFPBAC_BAD_VENDOR_TYPE = 3 |
| 4003 | OFPBAC_BAD_OUT_PORT = 4 |
| 4004 | OFPBAC_BAD_ARGUMENT = 5 |
| 4005 | OFPBAC_EPERM = 6 |
| 4006 | OFPBAC_TOO_MANY = 7 |
| 4007 | OFPBAC_BAD_QUEUE = 8 |
| 4008 | ofp_bad_action_code_map = { |
| 4009 | 0 : 'OFPBAC_BAD_TYPE', |
| 4010 | 1 : 'OFPBAC_BAD_LEN', |
| 4011 | 2 : 'OFPBAC_BAD_VENDOR', |
| 4012 | 3 : 'OFPBAC_BAD_VENDOR_TYPE', |
| 4013 | 4 : 'OFPBAC_BAD_OUT_PORT', |
| 4014 | 5 : 'OFPBAC_BAD_ARGUMENT', |
| 4015 | 6 : 'OFPBAC_EPERM', |
| 4016 | 7 : 'OFPBAC_TOO_MANY', |
| 4017 | 8 : 'OFPBAC_BAD_QUEUE' |
| 4018 | } |
| 4019 | |
| 4020 | ofp_bad_request_code = ['OFPBRC_BAD_VERSION', 'OFPBRC_BAD_TYPE', 'OFPBRC_BAD_STAT', 'OFPBRC_BAD_VENDOR', 'OFPBRC_BAD_SUBTYPE', 'OFPBRC_EPERM', 'OFPBRC_BAD_LEN', 'OFPBRC_BUFFER_EMPTY', 'OFPBRC_BUFFER_UNKNOWN'] |
| 4021 | OFPBRC_BAD_VERSION = 0 |
| 4022 | OFPBRC_BAD_TYPE = 1 |
| 4023 | OFPBRC_BAD_STAT = 2 |
| 4024 | OFPBRC_BAD_VENDOR = 3 |
| 4025 | OFPBRC_BAD_SUBTYPE = 4 |
| 4026 | OFPBRC_EPERM = 5 |
| 4027 | OFPBRC_BAD_LEN = 6 |
| 4028 | OFPBRC_BUFFER_EMPTY = 7 |
| 4029 | OFPBRC_BUFFER_UNKNOWN = 8 |
| 4030 | ofp_bad_request_code_map = { |
| 4031 | 0 : 'OFPBRC_BAD_VERSION', |
| 4032 | 1 : 'OFPBRC_BAD_TYPE', |
| 4033 | 2 : 'OFPBRC_BAD_STAT', |
| 4034 | 3 : 'OFPBRC_BAD_VENDOR', |
| 4035 | 4 : 'OFPBRC_BAD_SUBTYPE', |
| 4036 | 5 : 'OFPBRC_EPERM', |
| 4037 | 6 : 'OFPBRC_BAD_LEN', |
| 4038 | 7 : 'OFPBRC_BUFFER_EMPTY', |
| 4039 | 8 : 'OFPBRC_BUFFER_UNKNOWN' |
| 4040 | } |
| 4041 | |
| 4042 | ofp_port_features = ['OFPPF_10MB_HD', 'OFPPF_10MB_FD', 'OFPPF_100MB_HD', 'OFPPF_100MB_FD', 'OFPPF_1GB_HD', 'OFPPF_1GB_FD', 'OFPPF_10GB_FD', 'OFPPF_COPPER', 'OFPPF_FIBER', 'OFPPF_AUTONEG', 'OFPPF_PAUSE', 'OFPPF_PAUSE_ASYM'] |
| 4043 | OFPPF_10MB_HD = 1 |
| 4044 | OFPPF_10MB_FD = 2 |
| 4045 | OFPPF_100MB_HD = 4 |
| 4046 | OFPPF_100MB_FD = 8 |
| 4047 | OFPPF_1GB_HD = 16 |
| 4048 | OFPPF_1GB_FD = 32 |
| 4049 | OFPPF_10GB_FD = 64 |
| 4050 | OFPPF_COPPER = 128 |
| 4051 | OFPPF_FIBER = 256 |
| 4052 | OFPPF_AUTONEG = 512 |
| 4053 | OFPPF_PAUSE = 1024 |
| 4054 | OFPPF_PAUSE_ASYM = 2048 |
| 4055 | ofp_port_features_map = { |
| 4056 | 1 : 'OFPPF_10MB_HD', |
| 4057 | 2 : 'OFPPF_10MB_FD', |
| 4058 | 4 : 'OFPPF_100MB_HD', |
| 4059 | 8 : 'OFPPF_100MB_FD', |
| 4060 | 16 : 'OFPPF_1GB_HD', |
| 4061 | 32 : 'OFPPF_1GB_FD', |
| 4062 | 64 : 'OFPPF_10GB_FD', |
| 4063 | 128 : 'OFPPF_COPPER', |
| 4064 | 256 : 'OFPPF_FIBER', |
| 4065 | 512 : 'OFPPF_AUTONEG', |
| 4066 | 1024 : 'OFPPF_PAUSE', |
| 4067 | 2048 : 'OFPPF_PAUSE_ASYM' |
| 4068 | } |
| 4069 | |
| 4070 | ofp_type = ['OFPT_HELLO', 'OFPT_ERROR', 'OFPT_ECHO_REQUEST', 'OFPT_ECHO_REPLY', 'OFPT_VENDOR', 'OFPT_FEATURES_REQUEST', 'OFPT_FEATURES_REPLY', 'OFPT_GET_CONFIG_REQUEST', 'OFPT_GET_CONFIG_REPLY', 'OFPT_SET_CONFIG', 'OFPT_PACKET_IN', 'OFPT_FLOW_REMOVED', 'OFPT_PORT_STATUS', 'OFPT_PACKET_OUT', 'OFPT_FLOW_MOD', 'OFPT_PORT_MOD', 'OFPT_STATS_REQUEST', 'OFPT_STATS_REPLY', 'OFPT_BARRIER_REQUEST', 'OFPT_BARRIER_REPLY', 'OFPT_QUEUE_GET_CONFIG_REQUEST', 'OFPT_QUEUE_GET_CONFIG_REPLY'] |
| 4071 | OFPT_HELLO = 0 |
| 4072 | OFPT_ERROR = 1 |
| 4073 | OFPT_ECHO_REQUEST = 2 |
| 4074 | OFPT_ECHO_REPLY = 3 |
| 4075 | OFPT_VENDOR = 4 |
| 4076 | OFPT_FEATURES_REQUEST = 5 |
| 4077 | OFPT_FEATURES_REPLY = 6 |
| 4078 | OFPT_GET_CONFIG_REQUEST = 7 |
| 4079 | OFPT_GET_CONFIG_REPLY = 8 |
| 4080 | OFPT_SET_CONFIG = 9 |
| 4081 | OFPT_PACKET_IN = 10 |
| 4082 | OFPT_FLOW_REMOVED = 11 |
| 4083 | OFPT_PORT_STATUS = 12 |
| 4084 | OFPT_PACKET_OUT = 13 |
| 4085 | OFPT_FLOW_MOD = 14 |
| 4086 | OFPT_PORT_MOD = 15 |
| 4087 | OFPT_STATS_REQUEST = 16 |
| 4088 | OFPT_STATS_REPLY = 17 |
| 4089 | OFPT_BARRIER_REQUEST = 18 |
| 4090 | OFPT_BARRIER_REPLY = 19 |
| 4091 | OFPT_QUEUE_GET_CONFIG_REQUEST = 20 |
| 4092 | OFPT_QUEUE_GET_CONFIG_REPLY = 21 |
| 4093 | ofp_type_map = { |
| 4094 | 0 : 'OFPT_HELLO', |
| 4095 | 1 : 'OFPT_ERROR', |
| 4096 | 2 : 'OFPT_ECHO_REQUEST', |
| 4097 | 3 : 'OFPT_ECHO_REPLY', |
| 4098 | 4 : 'OFPT_VENDOR', |
| 4099 | 5 : 'OFPT_FEATURES_REQUEST', |
| 4100 | 6 : 'OFPT_FEATURES_REPLY', |
| 4101 | 7 : 'OFPT_GET_CONFIG_REQUEST', |
| 4102 | 8 : 'OFPT_GET_CONFIG_REPLY', |
| 4103 | 9 : 'OFPT_SET_CONFIG', |
| 4104 | 10 : 'OFPT_PACKET_IN', |
| 4105 | 11 : 'OFPT_FLOW_REMOVED', |
| 4106 | 12 : 'OFPT_PORT_STATUS', |
| 4107 | 13 : 'OFPT_PACKET_OUT', |
| 4108 | 14 : 'OFPT_FLOW_MOD', |
| 4109 | 15 : 'OFPT_PORT_MOD', |
| 4110 | 16 : 'OFPT_STATS_REQUEST', |
| 4111 | 17 : 'OFPT_STATS_REPLY', |
| 4112 | 18 : 'OFPT_BARRIER_REQUEST', |
| 4113 | 19 : 'OFPT_BARRIER_REPLY', |
| 4114 | 20 : 'OFPT_QUEUE_GET_CONFIG_REQUEST', |
| 4115 | 21 : 'OFPT_QUEUE_GET_CONFIG_REPLY' |
| 4116 | } |
| 4117 | |
| 4118 | ofp_packet_in_reason = ['OFPR_NO_MATCH', 'OFPR_ACTION'] |
| 4119 | OFPR_NO_MATCH = 0 |
| 4120 | OFPR_ACTION = 1 |
| 4121 | ofp_packet_in_reason_map = { |
| 4122 | 0 : 'OFPR_NO_MATCH', |
| 4123 | 1 : 'OFPR_ACTION' |
| 4124 | } |
| 4125 | |
| 4126 | ofp_stats_types = ['OFPST_DESC', 'OFPST_FLOW', 'OFPST_AGGREGATE', 'OFPST_TABLE', 'OFPST_PORT', 'OFPST_QUEUE', 'OFPST_VENDOR'] |
| 4127 | OFPST_DESC = 0 |
| 4128 | OFPST_FLOW = 1 |
| 4129 | OFPST_AGGREGATE = 2 |
| 4130 | OFPST_TABLE = 3 |
| 4131 | OFPST_PORT = 4 |
| 4132 | OFPST_QUEUE = 5 |
| 4133 | OFPST_VENDOR = 65535 |
| 4134 | ofp_stats_types_map = { |
| 4135 | 0 : 'OFPST_DESC', |
| 4136 | 1 : 'OFPST_FLOW', |
| 4137 | 2 : 'OFPST_AGGREGATE', |
| 4138 | 3 : 'OFPST_TABLE', |
| 4139 | 4 : 'OFPST_PORT', |
| 4140 | 5 : 'OFPST_QUEUE', |
| 4141 | 65535 : 'OFPST_VENDOR' |
| 4142 | } |
| 4143 | |
| 4144 | ofp_port_mod_failed_code = ['OFPPMFC_BAD_PORT', 'OFPPMFC_BAD_HW_ADDR'] |
| 4145 | OFPPMFC_BAD_PORT = 0 |
| 4146 | OFPPMFC_BAD_HW_ADDR = 1 |
| 4147 | ofp_port_mod_failed_code_map = { |
| 4148 | 0 : 'OFPPMFC_BAD_PORT', |
| 4149 | 1 : 'OFPPMFC_BAD_HW_ADDR' |
| 4150 | } |
| 4151 | |
| 4152 | # Values from macro definitions |
| 4153 | OFP_FLOW_PERMANENT = 0 |
| 4154 | OFP_DL_TYPE_ETH2_CUTOFF = 0x0600 |
| 4155 | DESC_STR_LEN = 256 |
| 4156 | OFPFW_ICMP_CODE = OFPFW_TP_DST |
| 4157 | OFPQ_MIN_RATE_UNCFG = 0xffff |
| 4158 | OFP_VERSION = 0x01 |
| 4159 | OFP_MAX_TABLE_NAME_LEN = 32 |
| 4160 | OFP_DL_TYPE_NOT_ETH_TYPE = 0x05ff |
| 4161 | OFP_DEFAULT_MISS_SEND_LEN = 128 |
| 4162 | OFP_MAX_PORT_NAME_LEN = 16 |
| 4163 | OFP_SSL_PORT = 6633 |
| 4164 | OFPFW_ICMP_TYPE = OFPFW_TP_SRC |
| 4165 | OFP_TCP_PORT = 6633 |
| 4166 | SERIAL_NUM_LEN = 32 |
| 4167 | OFP_DEFAULT_PRIORITY = 0x8000 |
| 4168 | OFP_ETH_ALEN = 6 |
| 4169 | OFP_VLAN_NONE = 0xffff |
| 4170 | OFPQ_ALL = 0xffffffff |
| 4171 | |
| 4172 | # Basic structure size definitions. |
| 4173 | # Does not include ofp_header members. |
| 4174 | # Does not include variable length arrays. |
| 4175 | OFP_ACTION_DL_ADDR_BYTES = 16 |
| 4176 | OFP_ACTION_ENQUEUE_BYTES = 16 |
| 4177 | OFP_ACTION_HEADER_BYTES = 8 |
| 4178 | OFP_ACTION_NW_ADDR_BYTES = 8 |
| 4179 | OFP_ACTION_NW_TOS_BYTES = 8 |
| 4180 | OFP_ACTION_OUTPUT_BYTES = 8 |
| 4181 | OFP_ACTION_TP_PORT_BYTES = 8 |
| 4182 | OFP_ACTION_VENDOR_HEADER_BYTES = 8 |
| 4183 | OFP_ACTION_VLAN_PCP_BYTES = 8 |
| 4184 | OFP_ACTION_VLAN_VID_BYTES = 8 |
| 4185 | OFP_AGGREGATE_STATS_REPLY_BYTES = 24 |
| 4186 | OFP_AGGREGATE_STATS_REQUEST_BYTES = 44 |
| 4187 | OFP_DESC_STATS_BYTES = 1056 |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 4188 | OFP_ERROR_MSG_BYTES = 12 |
| 4189 | OFP_FLOW_MOD_BYTES = 72 |
| 4190 | OFP_FLOW_REMOVED_BYTES = 88 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 4191 | OFP_FLOW_STATS_BYTES = 88 |
| 4192 | OFP_FLOW_STATS_REQUEST_BYTES = 44 |
| 4193 | OFP_HEADER_BYTES = 8 |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 4194 | OFP_HELLO_BYTES = 8 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 4195 | OFP_MATCH_BYTES = 40 |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 4196 | OFP_PACKET_IN_BYTES = 18 |
| 4197 | OFP_PACKET_OUT_BYTES = 16 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 4198 | OFP_PACKET_QUEUE_BYTES = 8 |
| 4199 | OFP_PHY_PORT_BYTES = 48 |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 4200 | OFP_PORT_MOD_BYTES = 32 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 4201 | OFP_PORT_STATS_BYTES = 104 |
| 4202 | OFP_PORT_STATS_REQUEST_BYTES = 8 |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 4203 | OFP_PORT_STATUS_BYTES = 64 |
| 4204 | OFP_QUEUE_GET_CONFIG_REPLY_BYTES = 16 |
| 4205 | OFP_QUEUE_GET_CONFIG_REQUEST_BYTES = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 4206 | OFP_QUEUE_PROP_HEADER_BYTES = 8 |
| 4207 | OFP_QUEUE_PROP_MIN_RATE_BYTES = 16 |
| 4208 | OFP_QUEUE_STATS_BYTES = 32 |
| 4209 | OFP_QUEUE_STATS_REQUEST_BYTES = 8 |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 4210 | OFP_STATS_REPLY_BYTES = 12 |
| 4211 | OFP_STATS_REQUEST_BYTES = 12 |
| 4212 | OFP_SWITCH_CONFIG_BYTES = 12 |
| 4213 | OFP_SWITCH_FEATURES_BYTES = 32 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 4214 | OFP_TABLE_STATS_BYTES = 64 |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 4215 | OFP_VENDOR_HEADER_BYTES = 12 |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 4216 | |