Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
| 5 | |
| 6 | # Automatically generated by LOXI from template module.py |
| 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import common |
| 13 | import action |
| 14 | import instruction |
| 15 | import oxm |
| 16 | import action_id |
| 17 | import instruction_id |
| 18 | import meter_band |
| 19 | import bsn_tlv |
| 20 | import util |
| 21 | import loxi.generic_util |
| 22 | |
| 23 | class bsn_tlv(loxi.OFObject): |
| 24 | subtypes = {} |
| 25 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 26 | |
| 27 | def __init__(self, type=None): |
| 28 | if type != None: |
| 29 | self.type = type |
| 30 | else: |
| 31 | self.type = 0 |
| 32 | return |
| 33 | |
| 34 | def pack(self): |
| 35 | packed = [] |
| 36 | packed.append(struct.pack("!H", self.type)) |
| 37 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 38 | length = sum([len(x) for x in packed]) |
| 39 | packed[1] = struct.pack("!H", length) |
| 40 | return ''.join(packed) |
| 41 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 42 | @staticmethod |
| 43 | def unpack(reader): |
| 44 | subtype, = reader.peek('!H', 0) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 45 | subclass = bsn_tlv.subtypes.get(subtype) |
| 46 | if subclass: |
| 47 | return subclass.unpack(reader) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 48 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 49 | obj = bsn_tlv() |
| 50 | obj.type = reader.read("!H")[0] |
| 51 | _length = reader.read("!H")[0] |
| 52 | orig_reader = reader |
| 53 | reader = orig_reader.slice(_length - (2 + 2)) |
| 54 | return obj |
| 55 | |
| 56 | def __eq__(self, other): |
| 57 | if type(self) != type(other): return False |
| 58 | if self.type != other.type: return False |
| 59 | return True |
| 60 | |
| 61 | def pretty_print(self, q): |
| 62 | q.text("bsn_tlv {") |
| 63 | with q.group(): |
| 64 | with q.indent(2): |
| 65 | q.breakable() |
| 66 | q.breakable() |
| 67 | q.text('}') |
| 68 | |
| 69 | |
| 70 | class broadcast_query_timeout(bsn_tlv): |
| 71 | type = 10 |
| 72 | |
| 73 | def __init__(self, value=None): |
| 74 | if value != None: |
| 75 | self.value = value |
| 76 | else: |
| 77 | self.value = 0 |
| 78 | return |
| 79 | |
| 80 | def pack(self): |
| 81 | packed = [] |
| 82 | packed.append(struct.pack("!H", self.type)) |
| 83 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 84 | packed.append(struct.pack("!L", self.value)) |
| 85 | length = sum([len(x) for x in packed]) |
| 86 | packed[1] = struct.pack("!H", length) |
| 87 | return ''.join(packed) |
| 88 | |
| 89 | @staticmethod |
| 90 | def unpack(reader): |
| 91 | obj = broadcast_query_timeout() |
| 92 | _type = reader.read("!H")[0] |
| 93 | assert(_type == 10) |
| 94 | _length = reader.read("!H")[0] |
| 95 | orig_reader = reader |
| 96 | reader = orig_reader.slice(_length - (2 + 2)) |
| 97 | obj.value = reader.read("!L")[0] |
| 98 | return obj |
| 99 | |
| 100 | def __eq__(self, other): |
| 101 | if type(self) != type(other): return False |
| 102 | if self.value != other.value: return False |
| 103 | return True |
| 104 | |
| 105 | def pretty_print(self, q): |
| 106 | q.text("broadcast_query_timeout {") |
| 107 | with q.group(): |
| 108 | with q.indent(2): |
| 109 | q.breakable() |
| 110 | q.text("value = "); |
| 111 | q.text("%#x" % self.value) |
| 112 | q.breakable() |
| 113 | q.text('}') |
| 114 | |
| 115 | bsn_tlv.subtypes[10] = broadcast_query_timeout |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 116 | |
Rich Lane | 1b75abf | 2014-02-05 11:23:20 -0800 | [diff] [blame] | 117 | class circuit_id(bsn_tlv): |
| 118 | type = 14 |
| 119 | |
| 120 | def __init__(self, value=None): |
| 121 | if value != None: |
| 122 | self.value = value |
| 123 | else: |
| 124 | self.value = '' |
| 125 | return |
| 126 | |
| 127 | def pack(self): |
| 128 | packed = [] |
| 129 | packed.append(struct.pack("!H", self.type)) |
| 130 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 131 | packed.append(self.value) |
| 132 | length = sum([len(x) for x in packed]) |
| 133 | packed[1] = struct.pack("!H", length) |
| 134 | return ''.join(packed) |
| 135 | |
| 136 | @staticmethod |
| 137 | def unpack(reader): |
| 138 | obj = circuit_id() |
| 139 | _type = reader.read("!H")[0] |
| 140 | assert(_type == 14) |
| 141 | _length = reader.read("!H")[0] |
| 142 | orig_reader = reader |
| 143 | reader = orig_reader.slice(_length - (2 + 2)) |
| 144 | obj.value = str(reader.read_all()) |
| 145 | return obj |
| 146 | |
| 147 | def __eq__(self, other): |
| 148 | if type(self) != type(other): return False |
| 149 | if self.value != other.value: return False |
| 150 | return True |
| 151 | |
| 152 | def pretty_print(self, q): |
| 153 | q.text("circuit_id {") |
| 154 | with q.group(): |
| 155 | with q.indent(2): |
| 156 | q.breakable() |
| 157 | q.text("value = "); |
| 158 | q.pp(self.value) |
| 159 | q.breakable() |
| 160 | q.text('}') |
| 161 | |
| 162 | bsn_tlv.subtypes[14] = circuit_id |
| 163 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 164 | class crc_enabled(bsn_tlv): |
| 165 | type = 22 |
| 166 | |
| 167 | def __init__(self, value=None): |
| 168 | if value != None: |
| 169 | self.value = value |
| 170 | else: |
| 171 | self.value = 0 |
| 172 | return |
| 173 | |
| 174 | def pack(self): |
| 175 | packed = [] |
| 176 | packed.append(struct.pack("!H", self.type)) |
| 177 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 178 | packed.append(struct.pack("!B", self.value)) |
| 179 | length = sum([len(x) for x in packed]) |
| 180 | packed[1] = struct.pack("!H", length) |
| 181 | return ''.join(packed) |
| 182 | |
| 183 | @staticmethod |
| 184 | def unpack(reader): |
| 185 | obj = crc_enabled() |
| 186 | _type = reader.read("!H")[0] |
| 187 | assert(_type == 22) |
| 188 | _length = reader.read("!H")[0] |
| 189 | orig_reader = reader |
| 190 | reader = orig_reader.slice(_length - (2 + 2)) |
| 191 | obj.value = reader.read("!B")[0] |
| 192 | return obj |
| 193 | |
| 194 | def __eq__(self, other): |
| 195 | if type(self) != type(other): return False |
| 196 | if self.value != other.value: return False |
| 197 | return True |
| 198 | |
| 199 | def pretty_print(self, q): |
| 200 | q.text("crc_enabled {") |
| 201 | with q.group(): |
| 202 | with q.indent(2): |
| 203 | q.breakable() |
| 204 | q.text("value = "); |
| 205 | q.text("%#x" % self.value) |
| 206 | q.breakable() |
| 207 | q.text('}') |
| 208 | |
| 209 | bsn_tlv.subtypes[22] = crc_enabled |
| 210 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 211 | class idle_notification(bsn_tlv): |
| 212 | type = 7 |
| 213 | |
| 214 | def __init__(self): |
| 215 | return |
| 216 | |
| 217 | def pack(self): |
| 218 | packed = [] |
| 219 | packed.append(struct.pack("!H", self.type)) |
| 220 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 221 | length = sum([len(x) for x in packed]) |
| 222 | packed[1] = struct.pack("!H", length) |
| 223 | return ''.join(packed) |
| 224 | |
| 225 | @staticmethod |
| 226 | def unpack(reader): |
| 227 | obj = idle_notification() |
| 228 | _type = reader.read("!H")[0] |
| 229 | assert(_type == 7) |
| 230 | _length = reader.read("!H")[0] |
| 231 | orig_reader = reader |
| 232 | reader = orig_reader.slice(_length - (2 + 2)) |
| 233 | return obj |
| 234 | |
| 235 | def __eq__(self, other): |
| 236 | if type(self) != type(other): return False |
| 237 | return True |
| 238 | |
| 239 | def pretty_print(self, q): |
| 240 | q.text("idle_notification {") |
| 241 | with q.group(): |
| 242 | with q.indent(2): |
| 243 | q.breakable() |
| 244 | q.breakable() |
| 245 | q.text('}') |
| 246 | |
| 247 | bsn_tlv.subtypes[7] = idle_notification |
| 248 | |
| 249 | class idle_time(bsn_tlv): |
| 250 | type = 5 |
| 251 | |
| 252 | def __init__(self, value=None): |
| 253 | if value != None: |
| 254 | self.value = value |
| 255 | else: |
| 256 | self.value = 0 |
| 257 | return |
| 258 | |
| 259 | def pack(self): |
| 260 | packed = [] |
| 261 | packed.append(struct.pack("!H", self.type)) |
| 262 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 263 | packed.append(struct.pack("!Q", self.value)) |
| 264 | length = sum([len(x) for x in packed]) |
| 265 | packed[1] = struct.pack("!H", length) |
| 266 | return ''.join(packed) |
| 267 | |
| 268 | @staticmethod |
| 269 | def unpack(reader): |
| 270 | obj = idle_time() |
| 271 | _type = reader.read("!H")[0] |
| 272 | assert(_type == 5) |
| 273 | _length = reader.read("!H")[0] |
| 274 | orig_reader = reader |
| 275 | reader = orig_reader.slice(_length - (2 + 2)) |
| 276 | obj.value = reader.read("!Q")[0] |
| 277 | return obj |
| 278 | |
| 279 | def __eq__(self, other): |
| 280 | if type(self) != type(other): return False |
| 281 | if self.value != other.value: return False |
| 282 | return True |
| 283 | |
| 284 | def pretty_print(self, q): |
| 285 | q.text("idle_time {") |
| 286 | with q.group(): |
| 287 | with q.indent(2): |
| 288 | q.breakable() |
| 289 | q.text("value = "); |
| 290 | q.text("%#x" % self.value) |
| 291 | q.breakable() |
| 292 | q.text('}') |
| 293 | |
| 294 | bsn_tlv.subtypes[5] = idle_time |
| 295 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 296 | class idle_timeout(bsn_tlv): |
| 297 | type = 8 |
| 298 | |
| 299 | def __init__(self, value=None): |
| 300 | if value != None: |
| 301 | self.value = value |
| 302 | else: |
| 303 | self.value = 0 |
| 304 | return |
| 305 | |
| 306 | def pack(self): |
| 307 | packed = [] |
| 308 | packed.append(struct.pack("!H", self.type)) |
| 309 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 310 | packed.append(struct.pack("!L", self.value)) |
| 311 | length = sum([len(x) for x in packed]) |
| 312 | packed[1] = struct.pack("!H", length) |
| 313 | return ''.join(packed) |
| 314 | |
| 315 | @staticmethod |
| 316 | def unpack(reader): |
| 317 | obj = idle_timeout() |
| 318 | _type = reader.read("!H")[0] |
| 319 | assert(_type == 8) |
| 320 | _length = reader.read("!H")[0] |
| 321 | orig_reader = reader |
| 322 | reader = orig_reader.slice(_length - (2 + 2)) |
| 323 | obj.value = reader.read("!L")[0] |
| 324 | return obj |
| 325 | |
| 326 | def __eq__(self, other): |
| 327 | if type(self) != type(other): return False |
| 328 | if self.value != other.value: return False |
| 329 | return True |
| 330 | |
| 331 | def pretty_print(self, q): |
| 332 | q.text("idle_timeout {") |
| 333 | with q.group(): |
| 334 | with q.indent(2): |
| 335 | q.breakable() |
| 336 | q.text("value = "); |
| 337 | q.text("%#x" % self.value) |
| 338 | q.breakable() |
| 339 | q.text('}') |
| 340 | |
| 341 | bsn_tlv.subtypes[8] = idle_timeout |
| 342 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 343 | class ipv4(bsn_tlv): |
| 344 | type = 4 |
| 345 | |
| 346 | def __init__(self, value=None): |
| 347 | if value != None: |
| 348 | self.value = value |
| 349 | else: |
| 350 | self.value = 0 |
| 351 | return |
| 352 | |
| 353 | def pack(self): |
| 354 | packed = [] |
| 355 | packed.append(struct.pack("!H", self.type)) |
| 356 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 357 | packed.append(struct.pack("!L", self.value)) |
| 358 | length = sum([len(x) for x in packed]) |
| 359 | packed[1] = struct.pack("!H", length) |
| 360 | return ''.join(packed) |
| 361 | |
| 362 | @staticmethod |
| 363 | def unpack(reader): |
| 364 | obj = ipv4() |
| 365 | _type = reader.read("!H")[0] |
| 366 | assert(_type == 4) |
| 367 | _length = reader.read("!H")[0] |
| 368 | orig_reader = reader |
| 369 | reader = orig_reader.slice(_length - (2 + 2)) |
| 370 | obj.value = reader.read("!L")[0] |
| 371 | return obj |
| 372 | |
| 373 | def __eq__(self, other): |
| 374 | if type(self) != type(other): return False |
| 375 | if self.value != other.value: return False |
| 376 | return True |
| 377 | |
| 378 | def pretty_print(self, q): |
| 379 | q.text("ipv4 {") |
| 380 | with q.group(): |
| 381 | with q.indent(2): |
| 382 | q.breakable() |
| 383 | q.text("value = "); |
| 384 | q.text(util.pretty_ipv4(self.value)) |
| 385 | q.breakable() |
| 386 | q.text('}') |
| 387 | |
| 388 | bsn_tlv.subtypes[4] = ipv4 |
| 389 | |
| 390 | class mac(bsn_tlv): |
| 391 | type = 1 |
| 392 | |
| 393 | def __init__(self, value=None): |
| 394 | if value != None: |
| 395 | self.value = value |
| 396 | else: |
| 397 | self.value = [0,0,0,0,0,0] |
| 398 | return |
| 399 | |
| 400 | def pack(self): |
| 401 | packed = [] |
| 402 | packed.append(struct.pack("!H", self.type)) |
| 403 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 404 | packed.append(struct.pack("!6B", *self.value)) |
| 405 | length = sum([len(x) for x in packed]) |
| 406 | packed[1] = struct.pack("!H", length) |
| 407 | return ''.join(packed) |
| 408 | |
| 409 | @staticmethod |
| 410 | def unpack(reader): |
| 411 | obj = mac() |
| 412 | _type = reader.read("!H")[0] |
| 413 | assert(_type == 1) |
| 414 | _length = reader.read("!H")[0] |
| 415 | orig_reader = reader |
| 416 | reader = orig_reader.slice(_length - (2 + 2)) |
| 417 | obj.value = list(reader.read('!6B')) |
| 418 | return obj |
| 419 | |
| 420 | def __eq__(self, other): |
| 421 | if type(self) != type(other): return False |
| 422 | if self.value != other.value: return False |
| 423 | return True |
| 424 | |
| 425 | def pretty_print(self, q): |
| 426 | q.text("mac {") |
| 427 | with q.group(): |
| 428 | with q.indent(2): |
| 429 | q.breakable() |
| 430 | q.text("value = "); |
| 431 | q.text(util.pretty_mac(self.value)) |
| 432 | q.breakable() |
| 433 | q.text('}') |
| 434 | |
| 435 | bsn_tlv.subtypes[1] = mac |
| 436 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 437 | class miss_packets(bsn_tlv): |
| 438 | type = 13 |
| 439 | |
| 440 | def __init__(self, value=None): |
| 441 | if value != None: |
| 442 | self.value = value |
| 443 | else: |
| 444 | self.value = 0 |
| 445 | return |
| 446 | |
| 447 | def pack(self): |
| 448 | packed = [] |
| 449 | packed.append(struct.pack("!H", self.type)) |
| 450 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 451 | packed.append(struct.pack("!Q", self.value)) |
| 452 | length = sum([len(x) for x in packed]) |
| 453 | packed[1] = struct.pack("!H", length) |
| 454 | return ''.join(packed) |
| 455 | |
| 456 | @staticmethod |
| 457 | def unpack(reader): |
| 458 | obj = miss_packets() |
| 459 | _type = reader.read("!H")[0] |
| 460 | assert(_type == 13) |
| 461 | _length = reader.read("!H")[0] |
| 462 | orig_reader = reader |
| 463 | reader = orig_reader.slice(_length - (2 + 2)) |
| 464 | obj.value = reader.read("!Q")[0] |
| 465 | return obj |
| 466 | |
| 467 | def __eq__(self, other): |
| 468 | if type(self) != type(other): return False |
| 469 | if self.value != other.value: return False |
| 470 | return True |
| 471 | |
| 472 | def pretty_print(self, q): |
| 473 | q.text("miss_packets {") |
| 474 | with q.group(): |
| 475 | with q.indent(2): |
| 476 | q.breakable() |
| 477 | q.text("value = "); |
| 478 | q.text("%#x" % self.value) |
| 479 | q.breakable() |
| 480 | q.text('}') |
| 481 | |
| 482 | bsn_tlv.subtypes[13] = miss_packets |
| 483 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 484 | class port(bsn_tlv): |
| 485 | type = 0 |
| 486 | |
| 487 | def __init__(self, value=None): |
| 488 | if value != None: |
| 489 | self.value = value |
| 490 | else: |
| 491 | self.value = 0 |
| 492 | return |
| 493 | |
| 494 | def pack(self): |
| 495 | packed = [] |
| 496 | packed.append(struct.pack("!H", self.type)) |
| 497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 498 | packed.append(util.pack_port_no(self.value)) |
| 499 | length = sum([len(x) for x in packed]) |
| 500 | packed[1] = struct.pack("!H", length) |
| 501 | return ''.join(packed) |
| 502 | |
| 503 | @staticmethod |
| 504 | def unpack(reader): |
| 505 | obj = port() |
| 506 | _type = reader.read("!H")[0] |
| 507 | assert(_type == 0) |
| 508 | _length = reader.read("!H")[0] |
| 509 | orig_reader = reader |
| 510 | reader = orig_reader.slice(_length - (2 + 2)) |
| 511 | obj.value = util.unpack_port_no(reader) |
| 512 | return obj |
| 513 | |
| 514 | def __eq__(self, other): |
| 515 | if type(self) != type(other): return False |
| 516 | if self.value != other.value: return False |
| 517 | return True |
| 518 | |
| 519 | def pretty_print(self, q): |
| 520 | q.text("port {") |
| 521 | with q.group(): |
| 522 | with q.indent(2): |
| 523 | q.breakable() |
| 524 | q.text("value = "); |
| 525 | q.text(util.pretty_port(self.value)) |
| 526 | q.breakable() |
| 527 | q.text('}') |
| 528 | |
| 529 | bsn_tlv.subtypes[0] = port |
| 530 | |
Rich Lane | 78d9bcb | 2014-05-12 13:27:44 -0700 | [diff] [blame] | 531 | class queue_id(bsn_tlv): |
| 532 | type = 20 |
| 533 | |
| 534 | def __init__(self, value=None): |
| 535 | if value != None: |
| 536 | self.value = value |
| 537 | else: |
| 538 | self.value = 0 |
| 539 | return |
| 540 | |
| 541 | def pack(self): |
| 542 | packed = [] |
| 543 | packed.append(struct.pack("!H", self.type)) |
| 544 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 545 | packed.append(struct.pack("!L", self.value)) |
| 546 | length = sum([len(x) for x in packed]) |
| 547 | packed[1] = struct.pack("!H", length) |
| 548 | return ''.join(packed) |
| 549 | |
| 550 | @staticmethod |
| 551 | def unpack(reader): |
| 552 | obj = queue_id() |
| 553 | _type = reader.read("!H")[0] |
| 554 | assert(_type == 20) |
| 555 | _length = reader.read("!H")[0] |
| 556 | orig_reader = reader |
| 557 | reader = orig_reader.slice(_length - (2 + 2)) |
| 558 | obj.value = reader.read("!L")[0] |
| 559 | return obj |
| 560 | |
| 561 | def __eq__(self, other): |
| 562 | if type(self) != type(other): return False |
| 563 | if self.value != other.value: return False |
| 564 | return True |
| 565 | |
| 566 | def pretty_print(self, q): |
| 567 | q.text("queue_id {") |
| 568 | with q.group(): |
| 569 | with q.indent(2): |
| 570 | q.breakable() |
| 571 | q.text("value = "); |
| 572 | q.text("%#x" % self.value) |
| 573 | q.breakable() |
| 574 | q.text('}') |
| 575 | |
| 576 | bsn_tlv.subtypes[20] = queue_id |
| 577 | |
| 578 | class queue_weight(bsn_tlv): |
| 579 | type = 21 |
| 580 | |
| 581 | def __init__(self, value=None): |
| 582 | if value != None: |
| 583 | self.value = value |
| 584 | else: |
| 585 | self.value = 0 |
| 586 | return |
| 587 | |
| 588 | def pack(self): |
| 589 | packed = [] |
| 590 | packed.append(struct.pack("!H", self.type)) |
| 591 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 592 | packed.append(struct.pack("!L", self.value)) |
| 593 | length = sum([len(x) for x in packed]) |
| 594 | packed[1] = struct.pack("!H", length) |
| 595 | return ''.join(packed) |
| 596 | |
| 597 | @staticmethod |
| 598 | def unpack(reader): |
| 599 | obj = queue_weight() |
| 600 | _type = reader.read("!H")[0] |
| 601 | assert(_type == 21) |
| 602 | _length = reader.read("!H")[0] |
| 603 | orig_reader = reader |
| 604 | reader = orig_reader.slice(_length - (2 + 2)) |
| 605 | obj.value = reader.read("!L")[0] |
| 606 | return obj |
| 607 | |
| 608 | def __eq__(self, other): |
| 609 | if type(self) != type(other): return False |
| 610 | if self.value != other.value: return False |
| 611 | return True |
| 612 | |
| 613 | def pretty_print(self, q): |
| 614 | q.text("queue_weight {") |
| 615 | with q.group(): |
| 616 | with q.indent(2): |
| 617 | q.breakable() |
| 618 | q.text("value = "); |
| 619 | q.text("%#x" % self.value) |
| 620 | q.breakable() |
| 621 | q.text('}') |
| 622 | |
| 623 | bsn_tlv.subtypes[21] = queue_weight |
| 624 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 625 | class reply_packets(bsn_tlv): |
| 626 | type = 12 |
| 627 | |
| 628 | def __init__(self, value=None): |
| 629 | if value != None: |
| 630 | self.value = value |
| 631 | else: |
| 632 | self.value = 0 |
| 633 | return |
| 634 | |
| 635 | def pack(self): |
| 636 | packed = [] |
| 637 | packed.append(struct.pack("!H", self.type)) |
| 638 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 639 | packed.append(struct.pack("!Q", self.value)) |
| 640 | length = sum([len(x) for x in packed]) |
| 641 | packed[1] = struct.pack("!H", length) |
| 642 | return ''.join(packed) |
| 643 | |
| 644 | @staticmethod |
| 645 | def unpack(reader): |
| 646 | obj = reply_packets() |
| 647 | _type = reader.read("!H")[0] |
| 648 | assert(_type == 12) |
| 649 | _length = reader.read("!H")[0] |
| 650 | orig_reader = reader |
| 651 | reader = orig_reader.slice(_length - (2 + 2)) |
| 652 | obj.value = reader.read("!Q")[0] |
| 653 | return obj |
| 654 | |
| 655 | def __eq__(self, other): |
| 656 | if type(self) != type(other): return False |
| 657 | if self.value != other.value: return False |
| 658 | return True |
| 659 | |
| 660 | def pretty_print(self, q): |
| 661 | q.text("reply_packets {") |
| 662 | with q.group(): |
| 663 | with q.indent(2): |
| 664 | q.breakable() |
| 665 | q.text("value = "); |
| 666 | q.text("%#x" % self.value) |
| 667 | q.breakable() |
| 668 | q.text('}') |
| 669 | |
| 670 | bsn_tlv.subtypes[12] = reply_packets |
| 671 | |
| 672 | class request_packets(bsn_tlv): |
| 673 | type = 11 |
| 674 | |
| 675 | def __init__(self, value=None): |
| 676 | if value != None: |
| 677 | self.value = value |
| 678 | else: |
| 679 | self.value = 0 |
| 680 | return |
| 681 | |
| 682 | def pack(self): |
| 683 | packed = [] |
| 684 | packed.append(struct.pack("!H", self.type)) |
| 685 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 686 | packed.append(struct.pack("!Q", self.value)) |
| 687 | length = sum([len(x) for x in packed]) |
| 688 | packed[1] = struct.pack("!H", length) |
| 689 | return ''.join(packed) |
| 690 | |
| 691 | @staticmethod |
| 692 | def unpack(reader): |
| 693 | obj = request_packets() |
| 694 | _type = reader.read("!H")[0] |
| 695 | assert(_type == 11) |
| 696 | _length = reader.read("!H")[0] |
| 697 | orig_reader = reader |
| 698 | reader = orig_reader.slice(_length - (2 + 2)) |
| 699 | obj.value = reader.read("!Q")[0] |
| 700 | return obj |
| 701 | |
| 702 | def __eq__(self, other): |
| 703 | if type(self) != type(other): return False |
| 704 | if self.value != other.value: return False |
| 705 | return True |
| 706 | |
| 707 | def pretty_print(self, q): |
| 708 | q.text("request_packets {") |
| 709 | with q.group(): |
| 710 | with q.indent(2): |
| 711 | q.breakable() |
| 712 | q.text("value = "); |
| 713 | q.text("%#x" % self.value) |
| 714 | q.breakable() |
| 715 | q.text('}') |
| 716 | |
| 717 | bsn_tlv.subtypes[11] = request_packets |
| 718 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 719 | class rx_packets(bsn_tlv): |
| 720 | type = 2 |
| 721 | |
| 722 | def __init__(self, value=None): |
| 723 | if value != None: |
| 724 | self.value = value |
| 725 | else: |
| 726 | self.value = 0 |
| 727 | return |
| 728 | |
| 729 | def pack(self): |
| 730 | packed = [] |
| 731 | packed.append(struct.pack("!H", self.type)) |
| 732 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 733 | packed.append(struct.pack("!Q", self.value)) |
| 734 | length = sum([len(x) for x in packed]) |
| 735 | packed[1] = struct.pack("!H", length) |
| 736 | return ''.join(packed) |
| 737 | |
| 738 | @staticmethod |
| 739 | def unpack(reader): |
| 740 | obj = rx_packets() |
| 741 | _type = reader.read("!H")[0] |
| 742 | assert(_type == 2) |
| 743 | _length = reader.read("!H")[0] |
| 744 | orig_reader = reader |
| 745 | reader = orig_reader.slice(_length - (2 + 2)) |
| 746 | obj.value = reader.read("!Q")[0] |
| 747 | return obj |
| 748 | |
| 749 | def __eq__(self, other): |
| 750 | if type(self) != type(other): return False |
| 751 | if self.value != other.value: return False |
| 752 | return True |
| 753 | |
| 754 | def pretty_print(self, q): |
| 755 | q.text("rx_packets {") |
| 756 | with q.group(): |
| 757 | with q.indent(2): |
| 758 | q.breakable() |
| 759 | q.text("value = "); |
| 760 | q.text("%#x" % self.value) |
| 761 | q.breakable() |
| 762 | q.text('}') |
| 763 | |
| 764 | bsn_tlv.subtypes[2] = rx_packets |
| 765 | |
| 766 | class tx_packets(bsn_tlv): |
| 767 | type = 3 |
| 768 | |
| 769 | def __init__(self, value=None): |
| 770 | if value != None: |
| 771 | self.value = value |
| 772 | else: |
| 773 | self.value = 0 |
| 774 | return |
| 775 | |
| 776 | def pack(self): |
| 777 | packed = [] |
| 778 | packed.append(struct.pack("!H", self.type)) |
| 779 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 780 | packed.append(struct.pack("!Q", self.value)) |
| 781 | length = sum([len(x) for x in packed]) |
| 782 | packed[1] = struct.pack("!H", length) |
| 783 | return ''.join(packed) |
| 784 | |
| 785 | @staticmethod |
| 786 | def unpack(reader): |
| 787 | obj = tx_packets() |
| 788 | _type = reader.read("!H")[0] |
| 789 | assert(_type == 3) |
| 790 | _length = reader.read("!H")[0] |
| 791 | orig_reader = reader |
| 792 | reader = orig_reader.slice(_length - (2 + 2)) |
| 793 | obj.value = reader.read("!Q")[0] |
| 794 | return obj |
| 795 | |
| 796 | def __eq__(self, other): |
| 797 | if type(self) != type(other): return False |
| 798 | if self.value != other.value: return False |
| 799 | return True |
| 800 | |
| 801 | def pretty_print(self, q): |
| 802 | q.text("tx_packets {") |
| 803 | with q.group(): |
| 804 | with q.indent(2): |
| 805 | q.breakable() |
| 806 | q.text("value = "); |
| 807 | q.text("%#x" % self.value) |
| 808 | q.breakable() |
| 809 | q.text('}') |
| 810 | |
| 811 | bsn_tlv.subtypes[3] = tx_packets |
| 812 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 813 | class udf_anchor(bsn_tlv): |
| 814 | type = 16 |
| 815 | |
| 816 | def __init__(self, value=None): |
| 817 | if value != None: |
| 818 | self.value = value |
| 819 | else: |
| 820 | self.value = 0 |
| 821 | return |
| 822 | |
| 823 | def pack(self): |
| 824 | packed = [] |
| 825 | packed.append(struct.pack("!H", self.type)) |
| 826 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 827 | packed.append(struct.pack("!H", self.value)) |
| 828 | length = sum([len(x) for x in packed]) |
| 829 | packed[1] = struct.pack("!H", length) |
| 830 | return ''.join(packed) |
| 831 | |
| 832 | @staticmethod |
| 833 | def unpack(reader): |
| 834 | obj = udf_anchor() |
| 835 | _type = reader.read("!H")[0] |
| 836 | assert(_type == 16) |
| 837 | _length = reader.read("!H")[0] |
| 838 | orig_reader = reader |
| 839 | reader = orig_reader.slice(_length - (2 + 2)) |
| 840 | obj.value = reader.read("!H")[0] |
| 841 | return obj |
| 842 | |
| 843 | def __eq__(self, other): |
| 844 | if type(self) != type(other): return False |
| 845 | if self.value != other.value: return False |
| 846 | return True |
| 847 | |
| 848 | def pretty_print(self, q): |
| 849 | q.text("udf_anchor {") |
| 850 | with q.group(): |
| 851 | with q.indent(2): |
| 852 | q.breakable() |
| 853 | q.text("value = "); |
| 854 | q.text("%#x" % self.value) |
| 855 | q.breakable() |
| 856 | q.text('}') |
| 857 | |
| 858 | bsn_tlv.subtypes[16] = udf_anchor |
| 859 | |
| 860 | class udf_id(bsn_tlv): |
| 861 | type = 15 |
| 862 | |
| 863 | def __init__(self, value=None): |
| 864 | if value != None: |
| 865 | self.value = value |
| 866 | else: |
| 867 | self.value = 0 |
| 868 | return |
| 869 | |
| 870 | def pack(self): |
| 871 | packed = [] |
| 872 | packed.append(struct.pack("!H", self.type)) |
| 873 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 874 | packed.append(struct.pack("!H", self.value)) |
| 875 | length = sum([len(x) for x in packed]) |
| 876 | packed[1] = struct.pack("!H", length) |
| 877 | return ''.join(packed) |
| 878 | |
| 879 | @staticmethod |
| 880 | def unpack(reader): |
| 881 | obj = udf_id() |
| 882 | _type = reader.read("!H")[0] |
| 883 | assert(_type == 15) |
| 884 | _length = reader.read("!H")[0] |
| 885 | orig_reader = reader |
| 886 | reader = orig_reader.slice(_length - (2 + 2)) |
| 887 | obj.value = reader.read("!H")[0] |
| 888 | return obj |
| 889 | |
| 890 | def __eq__(self, other): |
| 891 | if type(self) != type(other): return False |
| 892 | if self.value != other.value: return False |
| 893 | return True |
| 894 | |
| 895 | def pretty_print(self, q): |
| 896 | q.text("udf_id {") |
| 897 | with q.group(): |
| 898 | with q.indent(2): |
| 899 | q.breakable() |
| 900 | q.text("value = "); |
| 901 | q.text("%#x" % self.value) |
| 902 | q.breakable() |
| 903 | q.text('}') |
| 904 | |
| 905 | bsn_tlv.subtypes[15] = udf_id |
| 906 | |
| 907 | class udf_length(bsn_tlv): |
| 908 | type = 18 |
| 909 | |
| 910 | def __init__(self, value=None): |
| 911 | if value != None: |
| 912 | self.value = value |
| 913 | else: |
| 914 | self.value = 0 |
| 915 | return |
| 916 | |
| 917 | def pack(self): |
| 918 | packed = [] |
| 919 | packed.append(struct.pack("!H", self.type)) |
| 920 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 921 | packed.append(struct.pack("!H", self.value)) |
| 922 | length = sum([len(x) for x in packed]) |
| 923 | packed[1] = struct.pack("!H", length) |
| 924 | return ''.join(packed) |
| 925 | |
| 926 | @staticmethod |
| 927 | def unpack(reader): |
| 928 | obj = udf_length() |
| 929 | _type = reader.read("!H")[0] |
| 930 | assert(_type == 18) |
| 931 | _length = reader.read("!H")[0] |
| 932 | orig_reader = reader |
| 933 | reader = orig_reader.slice(_length - (2 + 2)) |
| 934 | obj.value = reader.read("!H")[0] |
| 935 | return obj |
| 936 | |
| 937 | def __eq__(self, other): |
| 938 | if type(self) != type(other): return False |
| 939 | if self.value != other.value: return False |
| 940 | return True |
| 941 | |
| 942 | def pretty_print(self, q): |
| 943 | q.text("udf_length {") |
| 944 | with q.group(): |
| 945 | with q.indent(2): |
| 946 | q.breakable() |
| 947 | q.text("value = "); |
| 948 | q.text("%#x" % self.value) |
| 949 | q.breakable() |
| 950 | q.text('}') |
| 951 | |
| 952 | bsn_tlv.subtypes[18] = udf_length |
| 953 | |
| 954 | class udf_offset(bsn_tlv): |
| 955 | type = 17 |
| 956 | |
| 957 | def __init__(self, value=None): |
| 958 | if value != None: |
| 959 | self.value = value |
| 960 | else: |
| 961 | self.value = 0 |
| 962 | return |
| 963 | |
| 964 | def pack(self): |
| 965 | packed = [] |
| 966 | packed.append(struct.pack("!H", self.type)) |
| 967 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 968 | packed.append(struct.pack("!H", self.value)) |
| 969 | length = sum([len(x) for x in packed]) |
| 970 | packed[1] = struct.pack("!H", length) |
| 971 | return ''.join(packed) |
| 972 | |
| 973 | @staticmethod |
| 974 | def unpack(reader): |
| 975 | obj = udf_offset() |
| 976 | _type = reader.read("!H")[0] |
| 977 | assert(_type == 17) |
| 978 | _length = reader.read("!H")[0] |
| 979 | orig_reader = reader |
| 980 | reader = orig_reader.slice(_length - (2 + 2)) |
| 981 | obj.value = reader.read("!H")[0] |
| 982 | return obj |
| 983 | |
| 984 | def __eq__(self, other): |
| 985 | if type(self) != type(other): return False |
| 986 | if self.value != other.value: return False |
| 987 | return True |
| 988 | |
| 989 | def pretty_print(self, q): |
| 990 | q.text("udf_offset {") |
| 991 | with q.group(): |
| 992 | with q.indent(2): |
| 993 | q.breakable() |
| 994 | q.text("value = "); |
| 995 | q.text("%#x" % self.value) |
| 996 | q.breakable() |
| 997 | q.text('}') |
| 998 | |
| 999 | bsn_tlv.subtypes[17] = udf_offset |
| 1000 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1001 | class unicast_query_timeout(bsn_tlv): |
| 1002 | type = 9 |
| 1003 | |
| 1004 | def __init__(self, value=None): |
| 1005 | if value != None: |
| 1006 | self.value = value |
| 1007 | else: |
| 1008 | self.value = 0 |
| 1009 | return |
| 1010 | |
| 1011 | def pack(self): |
| 1012 | packed = [] |
| 1013 | packed.append(struct.pack("!H", self.type)) |
| 1014 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1015 | packed.append(struct.pack("!L", self.value)) |
| 1016 | length = sum([len(x) for x in packed]) |
| 1017 | packed[1] = struct.pack("!H", length) |
| 1018 | return ''.join(packed) |
| 1019 | |
| 1020 | @staticmethod |
| 1021 | def unpack(reader): |
| 1022 | obj = unicast_query_timeout() |
| 1023 | _type = reader.read("!H")[0] |
| 1024 | assert(_type == 9) |
| 1025 | _length = reader.read("!H")[0] |
| 1026 | orig_reader = reader |
| 1027 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1028 | obj.value = reader.read("!L")[0] |
| 1029 | return obj |
| 1030 | |
| 1031 | def __eq__(self, other): |
| 1032 | if type(self) != type(other): return False |
| 1033 | if self.value != other.value: return False |
| 1034 | return True |
| 1035 | |
| 1036 | def pretty_print(self, q): |
| 1037 | q.text("unicast_query_timeout {") |
| 1038 | with q.group(): |
| 1039 | with q.indent(2): |
| 1040 | q.breakable() |
| 1041 | q.text("value = "); |
| 1042 | q.text("%#x" % self.value) |
| 1043 | q.breakable() |
| 1044 | q.text('}') |
| 1045 | |
| 1046 | bsn_tlv.subtypes[9] = unicast_query_timeout |
| 1047 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1048 | class vlan_vid(bsn_tlv): |
| 1049 | type = 6 |
| 1050 | |
| 1051 | def __init__(self, value=None): |
| 1052 | if value != None: |
| 1053 | self.value = value |
| 1054 | else: |
| 1055 | self.value = 0 |
| 1056 | return |
| 1057 | |
| 1058 | def pack(self): |
| 1059 | packed = [] |
| 1060 | packed.append(struct.pack("!H", self.type)) |
| 1061 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1062 | packed.append(struct.pack("!H", self.value)) |
| 1063 | length = sum([len(x) for x in packed]) |
| 1064 | packed[1] = struct.pack("!H", length) |
| 1065 | return ''.join(packed) |
| 1066 | |
| 1067 | @staticmethod |
| 1068 | def unpack(reader): |
| 1069 | obj = vlan_vid() |
| 1070 | _type = reader.read("!H")[0] |
| 1071 | assert(_type == 6) |
| 1072 | _length = reader.read("!H")[0] |
| 1073 | orig_reader = reader |
| 1074 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1075 | obj.value = reader.read("!H")[0] |
| 1076 | return obj |
| 1077 | |
| 1078 | def __eq__(self, other): |
| 1079 | if type(self) != type(other): return False |
| 1080 | if self.value != other.value: return False |
| 1081 | return True |
| 1082 | |
| 1083 | def pretty_print(self, q): |
| 1084 | q.text("vlan_vid {") |
| 1085 | with q.group(): |
| 1086 | with q.indent(2): |
| 1087 | q.breakable() |
| 1088 | q.text("value = "); |
| 1089 | q.text("%#x" % self.value) |
| 1090 | q.breakable() |
| 1091 | q.text('}') |
| 1092 | |
| 1093 | bsn_tlv.subtypes[6] = vlan_vid |
| 1094 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 1095 | class vrf(bsn_tlv): |
| 1096 | type = 19 |
| 1097 | |
| 1098 | def __init__(self, value=None): |
| 1099 | if value != None: |
| 1100 | self.value = value |
| 1101 | else: |
| 1102 | self.value = 0 |
| 1103 | return |
| 1104 | |
| 1105 | def pack(self): |
| 1106 | packed = [] |
| 1107 | packed.append(struct.pack("!H", self.type)) |
| 1108 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1109 | packed.append(struct.pack("!L", self.value)) |
| 1110 | length = sum([len(x) for x in packed]) |
| 1111 | packed[1] = struct.pack("!H", length) |
| 1112 | return ''.join(packed) |
| 1113 | |
| 1114 | @staticmethod |
| 1115 | def unpack(reader): |
| 1116 | obj = vrf() |
| 1117 | _type = reader.read("!H")[0] |
| 1118 | assert(_type == 19) |
| 1119 | _length = reader.read("!H")[0] |
| 1120 | orig_reader = reader |
| 1121 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1122 | obj.value = reader.read("!L")[0] |
| 1123 | return obj |
| 1124 | |
| 1125 | def __eq__(self, other): |
| 1126 | if type(self) != type(other): return False |
| 1127 | if self.value != other.value: return False |
| 1128 | return True |
| 1129 | |
| 1130 | def pretty_print(self, q): |
| 1131 | q.text("vrf {") |
| 1132 | with q.group(): |
| 1133 | with q.indent(2): |
| 1134 | q.breakable() |
| 1135 | q.text("value = "); |
| 1136 | q.text("%#x" % self.value) |
| 1137 | q.breakable() |
| 1138 | q.text('}') |
| 1139 | |
| 1140 | bsn_tlv.subtypes[19] = vrf |
| 1141 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1142 | |