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