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 | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 211 | class external_gateway_ip(bsn_tlv): |
| 212 | type = 26 |
| 213 | |
| 214 | def __init__(self, value=None): |
| 215 | if value != None: |
| 216 | self.value = value |
| 217 | else: |
| 218 | self.value = 0 |
| 219 | return |
| 220 | |
| 221 | def pack(self): |
| 222 | packed = [] |
| 223 | packed.append(struct.pack("!H", self.type)) |
| 224 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 225 | packed.append(struct.pack("!L", self.value)) |
| 226 | length = sum([len(x) for x in packed]) |
| 227 | packed[1] = struct.pack("!H", length) |
| 228 | return ''.join(packed) |
| 229 | |
| 230 | @staticmethod |
| 231 | def unpack(reader): |
| 232 | obj = external_gateway_ip() |
| 233 | _type = reader.read("!H")[0] |
| 234 | assert(_type == 26) |
| 235 | _length = reader.read("!H")[0] |
| 236 | orig_reader = reader |
| 237 | reader = orig_reader.slice(_length - (2 + 2)) |
| 238 | obj.value = reader.read("!L")[0] |
| 239 | return obj |
| 240 | |
| 241 | def __eq__(self, other): |
| 242 | if type(self) != type(other): return False |
| 243 | if self.value != other.value: return False |
| 244 | return True |
| 245 | |
| 246 | def pretty_print(self, q): |
| 247 | q.text("external_gateway_ip {") |
| 248 | with q.group(): |
| 249 | with q.indent(2): |
| 250 | q.breakable() |
| 251 | q.text("value = "); |
| 252 | q.text(util.pretty_ipv4(self.value)) |
| 253 | q.breakable() |
| 254 | q.text('}') |
| 255 | |
| 256 | bsn_tlv.subtypes[26] = external_gateway_ip |
| 257 | |
Rich Lane | 18ec535 | 2014-10-02 09:09:17 -0700 | [diff] [blame^] | 258 | class external_gateway_mac(bsn_tlv): |
| 259 | type = 29 |
| 260 | |
| 261 | def __init__(self, value=None): |
| 262 | if value != None: |
| 263 | self.value = value |
| 264 | else: |
| 265 | self.value = [0,0,0,0,0,0] |
| 266 | return |
| 267 | |
| 268 | def pack(self): |
| 269 | packed = [] |
| 270 | packed.append(struct.pack("!H", self.type)) |
| 271 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 272 | packed.append(struct.pack("!6B", *self.value)) |
| 273 | length = sum([len(x) for x in packed]) |
| 274 | packed[1] = struct.pack("!H", length) |
| 275 | return ''.join(packed) |
| 276 | |
| 277 | @staticmethod |
| 278 | def unpack(reader): |
| 279 | obj = external_gateway_mac() |
| 280 | _type = reader.read("!H")[0] |
| 281 | assert(_type == 29) |
| 282 | _length = reader.read("!H")[0] |
| 283 | orig_reader = reader |
| 284 | reader = orig_reader.slice(_length - (2 + 2)) |
| 285 | obj.value = list(reader.read('!6B')) |
| 286 | return obj |
| 287 | |
| 288 | def __eq__(self, other): |
| 289 | if type(self) != type(other): return False |
| 290 | if self.value != other.value: return False |
| 291 | return True |
| 292 | |
| 293 | def pretty_print(self, q): |
| 294 | q.text("external_gateway_mac {") |
| 295 | with q.group(): |
| 296 | with q.indent(2): |
| 297 | q.breakable() |
| 298 | q.text("value = "); |
| 299 | q.text(util.pretty_mac(self.value)) |
| 300 | q.breakable() |
| 301 | q.text('}') |
| 302 | |
| 303 | bsn_tlv.subtypes[29] = external_gateway_mac |
| 304 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 305 | class external_ip(bsn_tlv): |
| 306 | type = 23 |
| 307 | |
| 308 | def __init__(self, value=None): |
| 309 | if value != None: |
| 310 | self.value = value |
| 311 | else: |
| 312 | self.value = 0 |
| 313 | return |
| 314 | |
| 315 | def pack(self): |
| 316 | packed = [] |
| 317 | packed.append(struct.pack("!H", self.type)) |
| 318 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 319 | packed.append(struct.pack("!L", self.value)) |
| 320 | length = sum([len(x) for x in packed]) |
| 321 | packed[1] = struct.pack("!H", length) |
| 322 | return ''.join(packed) |
| 323 | |
| 324 | @staticmethod |
| 325 | def unpack(reader): |
| 326 | obj = external_ip() |
| 327 | _type = reader.read("!H")[0] |
| 328 | assert(_type == 23) |
| 329 | _length = reader.read("!H")[0] |
| 330 | orig_reader = reader |
| 331 | reader = orig_reader.slice(_length - (2 + 2)) |
| 332 | obj.value = reader.read("!L")[0] |
| 333 | return obj |
| 334 | |
| 335 | def __eq__(self, other): |
| 336 | if type(self) != type(other): return False |
| 337 | if self.value != other.value: return False |
| 338 | return True |
| 339 | |
| 340 | def pretty_print(self, q): |
| 341 | q.text("external_ip {") |
| 342 | with q.group(): |
| 343 | with q.indent(2): |
| 344 | q.breakable() |
| 345 | q.text("value = "); |
| 346 | q.text(util.pretty_ipv4(self.value)) |
| 347 | q.breakable() |
| 348 | q.text('}') |
| 349 | |
| 350 | bsn_tlv.subtypes[23] = external_ip |
| 351 | |
| 352 | class external_mac(bsn_tlv): |
| 353 | type = 24 |
| 354 | |
| 355 | def __init__(self, value=None): |
| 356 | if value != None: |
| 357 | self.value = value |
| 358 | else: |
| 359 | self.value = [0,0,0,0,0,0] |
| 360 | return |
| 361 | |
| 362 | def pack(self): |
| 363 | packed = [] |
| 364 | packed.append(struct.pack("!H", self.type)) |
| 365 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 366 | packed.append(struct.pack("!6B", *self.value)) |
| 367 | length = sum([len(x) for x in packed]) |
| 368 | packed[1] = struct.pack("!H", length) |
| 369 | return ''.join(packed) |
| 370 | |
| 371 | @staticmethod |
| 372 | def unpack(reader): |
| 373 | obj = external_mac() |
| 374 | _type = reader.read("!H")[0] |
| 375 | assert(_type == 24) |
| 376 | _length = reader.read("!H")[0] |
| 377 | orig_reader = reader |
| 378 | reader = orig_reader.slice(_length - (2 + 2)) |
| 379 | obj.value = list(reader.read('!6B')) |
| 380 | return obj |
| 381 | |
| 382 | def __eq__(self, other): |
| 383 | if type(self) != type(other): return False |
| 384 | if self.value != other.value: return False |
| 385 | return True |
| 386 | |
| 387 | def pretty_print(self, q): |
| 388 | q.text("external_mac {") |
| 389 | with q.group(): |
| 390 | with q.indent(2): |
| 391 | q.breakable() |
| 392 | q.text("value = "); |
| 393 | q.text(util.pretty_mac(self.value)) |
| 394 | q.breakable() |
| 395 | q.text('}') |
| 396 | |
| 397 | bsn_tlv.subtypes[24] = external_mac |
| 398 | |
| 399 | class external_netmask(bsn_tlv): |
| 400 | type = 25 |
| 401 | |
| 402 | def __init__(self, value=None): |
| 403 | if value != None: |
| 404 | self.value = value |
| 405 | else: |
| 406 | self.value = 0 |
| 407 | return |
| 408 | |
| 409 | def pack(self): |
| 410 | packed = [] |
| 411 | packed.append(struct.pack("!H", self.type)) |
| 412 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 413 | packed.append(struct.pack("!L", self.value)) |
| 414 | length = sum([len(x) for x in packed]) |
| 415 | packed[1] = struct.pack("!H", length) |
| 416 | return ''.join(packed) |
| 417 | |
| 418 | @staticmethod |
| 419 | def unpack(reader): |
| 420 | obj = external_netmask() |
| 421 | _type = reader.read("!H")[0] |
| 422 | assert(_type == 25) |
| 423 | _length = reader.read("!H")[0] |
| 424 | orig_reader = reader |
| 425 | reader = orig_reader.slice(_length - (2 + 2)) |
| 426 | obj.value = reader.read("!L")[0] |
| 427 | return obj |
| 428 | |
| 429 | def __eq__(self, other): |
| 430 | if type(self) != type(other): return False |
| 431 | if self.value != other.value: return False |
| 432 | return True |
| 433 | |
| 434 | def pretty_print(self, q): |
| 435 | q.text("external_netmask {") |
| 436 | with q.group(): |
| 437 | with q.indent(2): |
| 438 | q.breakable() |
| 439 | q.text("value = "); |
| 440 | q.text(util.pretty_ipv4(self.value)) |
| 441 | q.breakable() |
| 442 | q.text('}') |
| 443 | |
| 444 | bsn_tlv.subtypes[25] = external_netmask |
| 445 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 446 | class idle_notification(bsn_tlv): |
| 447 | type = 7 |
| 448 | |
| 449 | def __init__(self): |
| 450 | return |
| 451 | |
| 452 | def pack(self): |
| 453 | packed = [] |
| 454 | packed.append(struct.pack("!H", self.type)) |
| 455 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 456 | length = sum([len(x) for x in packed]) |
| 457 | packed[1] = struct.pack("!H", length) |
| 458 | return ''.join(packed) |
| 459 | |
| 460 | @staticmethod |
| 461 | def unpack(reader): |
| 462 | obj = idle_notification() |
| 463 | _type = reader.read("!H")[0] |
| 464 | assert(_type == 7) |
| 465 | _length = reader.read("!H")[0] |
| 466 | orig_reader = reader |
| 467 | reader = orig_reader.slice(_length - (2 + 2)) |
| 468 | return obj |
| 469 | |
| 470 | def __eq__(self, other): |
| 471 | if type(self) != type(other): return False |
| 472 | return True |
| 473 | |
| 474 | def pretty_print(self, q): |
| 475 | q.text("idle_notification {") |
| 476 | with q.group(): |
| 477 | with q.indent(2): |
| 478 | q.breakable() |
| 479 | q.breakable() |
| 480 | q.text('}') |
| 481 | |
| 482 | bsn_tlv.subtypes[7] = idle_notification |
| 483 | |
| 484 | class idle_time(bsn_tlv): |
| 485 | type = 5 |
| 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(struct.pack("!Q", 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 = idle_time() |
| 506 | _type = reader.read("!H")[0] |
| 507 | assert(_type == 5) |
| 508 | _length = reader.read("!H")[0] |
| 509 | orig_reader = reader |
| 510 | reader = orig_reader.slice(_length - (2 + 2)) |
| 511 | obj.value = reader.read("!Q")[0] |
| 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("idle_time {") |
| 521 | with q.group(): |
| 522 | with q.indent(2): |
| 523 | q.breakable() |
| 524 | q.text("value = "); |
| 525 | q.text("%#x" % self.value) |
| 526 | q.breakable() |
| 527 | q.text('}') |
| 528 | |
| 529 | bsn_tlv.subtypes[5] = idle_time |
| 530 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 531 | class idle_timeout(bsn_tlv): |
| 532 | type = 8 |
| 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 = idle_timeout() |
| 553 | _type = reader.read("!H")[0] |
| 554 | assert(_type == 8) |
| 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("idle_timeout {") |
| 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[8] = idle_timeout |
| 577 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 578 | class internal_gateway_mac(bsn_tlv): |
| 579 | type = 28 |
| 580 | |
| 581 | def __init__(self, value=None): |
| 582 | if value != None: |
| 583 | self.value = value |
| 584 | else: |
| 585 | self.value = [0,0,0,0,0,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("!6B", *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 = internal_gateway_mac() |
| 600 | _type = reader.read("!H")[0] |
| 601 | assert(_type == 28) |
| 602 | _length = reader.read("!H")[0] |
| 603 | orig_reader = reader |
| 604 | reader = orig_reader.slice(_length - (2 + 2)) |
| 605 | obj.value = list(reader.read('!6B')) |
| 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("internal_gateway_mac {") |
| 615 | with q.group(): |
| 616 | with q.indent(2): |
| 617 | q.breakable() |
| 618 | q.text("value = "); |
| 619 | q.text(util.pretty_mac(self.value)) |
| 620 | q.breakable() |
| 621 | q.text('}') |
| 622 | |
| 623 | bsn_tlv.subtypes[28] = internal_gateway_mac |
| 624 | |
| 625 | class internal_mac(bsn_tlv): |
| 626 | type = 27 |
| 627 | |
| 628 | def __init__(self, value=None): |
| 629 | if value != None: |
| 630 | self.value = value |
| 631 | else: |
| 632 | self.value = [0,0,0,0,0,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("!6B", *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 = internal_mac() |
| 647 | _type = reader.read("!H")[0] |
| 648 | assert(_type == 27) |
| 649 | _length = reader.read("!H")[0] |
| 650 | orig_reader = reader |
| 651 | reader = orig_reader.slice(_length - (2 + 2)) |
| 652 | obj.value = list(reader.read('!6B')) |
| 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("internal_mac {") |
| 662 | with q.group(): |
| 663 | with q.indent(2): |
| 664 | q.breakable() |
| 665 | q.text("value = "); |
| 666 | q.text(util.pretty_mac(self.value)) |
| 667 | q.breakable() |
| 668 | q.text('}') |
| 669 | |
| 670 | bsn_tlv.subtypes[27] = internal_mac |
| 671 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 672 | class ipv4(bsn_tlv): |
| 673 | type = 4 |
| 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("!L", 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 = ipv4() |
| 694 | _type = reader.read("!H")[0] |
| 695 | assert(_type == 4) |
| 696 | _length = reader.read("!H")[0] |
| 697 | orig_reader = reader |
| 698 | reader = orig_reader.slice(_length - (2 + 2)) |
| 699 | obj.value = reader.read("!L")[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("ipv4 {") |
| 709 | with q.group(): |
| 710 | with q.indent(2): |
| 711 | q.breakable() |
| 712 | q.text("value = "); |
| 713 | q.text(util.pretty_ipv4(self.value)) |
| 714 | q.breakable() |
| 715 | q.text('}') |
| 716 | |
| 717 | bsn_tlv.subtypes[4] = ipv4 |
| 718 | |
| 719 | class mac(bsn_tlv): |
| 720 | type = 1 |
| 721 | |
| 722 | def __init__(self, value=None): |
| 723 | if value != None: |
| 724 | self.value = value |
| 725 | else: |
| 726 | self.value = [0,0,0,0,0,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("!6B", *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 = mac() |
| 741 | _type = reader.read("!H")[0] |
| 742 | assert(_type == 1) |
| 743 | _length = reader.read("!H")[0] |
| 744 | orig_reader = reader |
| 745 | reader = orig_reader.slice(_length - (2 + 2)) |
| 746 | obj.value = list(reader.read('!6B')) |
| 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("mac {") |
| 756 | with q.group(): |
| 757 | with q.indent(2): |
| 758 | q.breakable() |
| 759 | q.text("value = "); |
| 760 | q.text(util.pretty_mac(self.value)) |
| 761 | q.breakable() |
| 762 | q.text('}') |
| 763 | |
| 764 | bsn_tlv.subtypes[1] = mac |
| 765 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 766 | class miss_packets(bsn_tlv): |
| 767 | type = 13 |
| 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 = miss_packets() |
| 788 | _type = reader.read("!H")[0] |
| 789 | assert(_type == 13) |
| 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("miss_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[13] = miss_packets |
| 812 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 813 | class port(bsn_tlv): |
| 814 | type = 0 |
| 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(util.pack_port_no(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 = port() |
| 835 | _type = reader.read("!H")[0] |
| 836 | assert(_type == 0) |
| 837 | _length = reader.read("!H")[0] |
| 838 | orig_reader = reader |
| 839 | reader = orig_reader.slice(_length - (2 + 2)) |
| 840 | obj.value = util.unpack_port_no(reader) |
| 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("port {") |
| 850 | with q.group(): |
| 851 | with q.indent(2): |
| 852 | q.breakable() |
| 853 | q.text("value = "); |
| 854 | q.text(util.pretty_port(self.value)) |
| 855 | q.breakable() |
| 856 | q.text('}') |
| 857 | |
| 858 | bsn_tlv.subtypes[0] = port |
| 859 | |
Rich Lane | 78d9bcb | 2014-05-12 13:27:44 -0700 | [diff] [blame] | 860 | class queue_id(bsn_tlv): |
| 861 | type = 20 |
| 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("!L", 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 = queue_id() |
| 882 | _type = reader.read("!H")[0] |
| 883 | assert(_type == 20) |
| 884 | _length = reader.read("!H")[0] |
| 885 | orig_reader = reader |
| 886 | reader = orig_reader.slice(_length - (2 + 2)) |
| 887 | obj.value = reader.read("!L")[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("queue_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[20] = queue_id |
| 906 | |
| 907 | class queue_weight(bsn_tlv): |
| 908 | type = 21 |
| 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("!L", 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 = queue_weight() |
| 929 | _type = reader.read("!H")[0] |
| 930 | assert(_type == 21) |
| 931 | _length = reader.read("!H")[0] |
| 932 | orig_reader = reader |
| 933 | reader = orig_reader.slice(_length - (2 + 2)) |
| 934 | obj.value = reader.read("!L")[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("queue_weight {") |
| 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[21] = queue_weight |
| 953 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 954 | class reply_packets(bsn_tlv): |
| 955 | type = 12 |
| 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("!Q", 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 = reply_packets() |
| 976 | _type = reader.read("!H")[0] |
| 977 | assert(_type == 12) |
| 978 | _length = reader.read("!H")[0] |
| 979 | orig_reader = reader |
| 980 | reader = orig_reader.slice(_length - (2 + 2)) |
| 981 | obj.value = reader.read("!Q")[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("reply_packets {") |
| 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[12] = reply_packets |
| 1000 | |
| 1001 | class request_packets(bsn_tlv): |
| 1002 | type = 11 |
| 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("!Q", 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 = request_packets() |
| 1023 | _type = reader.read("!H")[0] |
| 1024 | assert(_type == 11) |
| 1025 | _length = reader.read("!H")[0] |
| 1026 | orig_reader = reader |
| 1027 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1028 | obj.value = reader.read("!Q")[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("request_packets {") |
| 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[11] = request_packets |
| 1047 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1048 | class rx_packets(bsn_tlv): |
| 1049 | type = 2 |
| 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("!Q", 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 = rx_packets() |
| 1070 | _type = reader.read("!H")[0] |
| 1071 | assert(_type == 2) |
| 1072 | _length = reader.read("!H")[0] |
| 1073 | orig_reader = reader |
| 1074 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1075 | obj.value = reader.read("!Q")[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("rx_packets {") |
| 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[2] = rx_packets |
| 1094 | |
| 1095 | class tx_packets(bsn_tlv): |
| 1096 | type = 3 |
| 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("!Q", 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 = tx_packets() |
| 1117 | _type = reader.read("!H")[0] |
| 1118 | assert(_type == 3) |
| 1119 | _length = reader.read("!H")[0] |
| 1120 | orig_reader = reader |
| 1121 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1122 | obj.value = reader.read("!Q")[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("tx_packets {") |
| 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[3] = tx_packets |
| 1141 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 1142 | class udf_anchor(bsn_tlv): |
| 1143 | type = 16 |
| 1144 | |
| 1145 | def __init__(self, value=None): |
| 1146 | if value != None: |
| 1147 | self.value = value |
| 1148 | else: |
| 1149 | self.value = 0 |
| 1150 | return |
| 1151 | |
| 1152 | def pack(self): |
| 1153 | packed = [] |
| 1154 | packed.append(struct.pack("!H", self.type)) |
| 1155 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1156 | packed.append(struct.pack("!H", self.value)) |
| 1157 | length = sum([len(x) for x in packed]) |
| 1158 | packed[1] = struct.pack("!H", length) |
| 1159 | return ''.join(packed) |
| 1160 | |
| 1161 | @staticmethod |
| 1162 | def unpack(reader): |
| 1163 | obj = udf_anchor() |
| 1164 | _type = reader.read("!H")[0] |
| 1165 | assert(_type == 16) |
| 1166 | _length = reader.read("!H")[0] |
| 1167 | orig_reader = reader |
| 1168 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1169 | obj.value = reader.read("!H")[0] |
| 1170 | return obj |
| 1171 | |
| 1172 | def __eq__(self, other): |
| 1173 | if type(self) != type(other): return False |
| 1174 | if self.value != other.value: return False |
| 1175 | return True |
| 1176 | |
| 1177 | def pretty_print(self, q): |
| 1178 | q.text("udf_anchor {") |
| 1179 | with q.group(): |
| 1180 | with q.indent(2): |
| 1181 | q.breakable() |
| 1182 | q.text("value = "); |
| 1183 | q.text("%#x" % self.value) |
| 1184 | q.breakable() |
| 1185 | q.text('}') |
| 1186 | |
| 1187 | bsn_tlv.subtypes[16] = udf_anchor |
| 1188 | |
| 1189 | class udf_id(bsn_tlv): |
| 1190 | type = 15 |
| 1191 | |
| 1192 | def __init__(self, value=None): |
| 1193 | if value != None: |
| 1194 | self.value = value |
| 1195 | else: |
| 1196 | self.value = 0 |
| 1197 | return |
| 1198 | |
| 1199 | def pack(self): |
| 1200 | packed = [] |
| 1201 | packed.append(struct.pack("!H", self.type)) |
| 1202 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1203 | packed.append(struct.pack("!H", self.value)) |
| 1204 | length = sum([len(x) for x in packed]) |
| 1205 | packed[1] = struct.pack("!H", length) |
| 1206 | return ''.join(packed) |
| 1207 | |
| 1208 | @staticmethod |
| 1209 | def unpack(reader): |
| 1210 | obj = udf_id() |
| 1211 | _type = reader.read("!H")[0] |
| 1212 | assert(_type == 15) |
| 1213 | _length = reader.read("!H")[0] |
| 1214 | orig_reader = reader |
| 1215 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1216 | obj.value = reader.read("!H")[0] |
| 1217 | return obj |
| 1218 | |
| 1219 | def __eq__(self, other): |
| 1220 | if type(self) != type(other): return False |
| 1221 | if self.value != other.value: return False |
| 1222 | return True |
| 1223 | |
| 1224 | def pretty_print(self, q): |
| 1225 | q.text("udf_id {") |
| 1226 | with q.group(): |
| 1227 | with q.indent(2): |
| 1228 | q.breakable() |
| 1229 | q.text("value = "); |
| 1230 | q.text("%#x" % self.value) |
| 1231 | q.breakable() |
| 1232 | q.text('}') |
| 1233 | |
| 1234 | bsn_tlv.subtypes[15] = udf_id |
| 1235 | |
| 1236 | class udf_length(bsn_tlv): |
| 1237 | type = 18 |
| 1238 | |
| 1239 | def __init__(self, value=None): |
| 1240 | if value != None: |
| 1241 | self.value = value |
| 1242 | else: |
| 1243 | self.value = 0 |
| 1244 | return |
| 1245 | |
| 1246 | def pack(self): |
| 1247 | packed = [] |
| 1248 | packed.append(struct.pack("!H", self.type)) |
| 1249 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1250 | packed.append(struct.pack("!H", self.value)) |
| 1251 | length = sum([len(x) for x in packed]) |
| 1252 | packed[1] = struct.pack("!H", length) |
| 1253 | return ''.join(packed) |
| 1254 | |
| 1255 | @staticmethod |
| 1256 | def unpack(reader): |
| 1257 | obj = udf_length() |
| 1258 | _type = reader.read("!H")[0] |
| 1259 | assert(_type == 18) |
| 1260 | _length = reader.read("!H")[0] |
| 1261 | orig_reader = reader |
| 1262 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1263 | obj.value = reader.read("!H")[0] |
| 1264 | return obj |
| 1265 | |
| 1266 | def __eq__(self, other): |
| 1267 | if type(self) != type(other): return False |
| 1268 | if self.value != other.value: return False |
| 1269 | return True |
| 1270 | |
| 1271 | def pretty_print(self, q): |
| 1272 | q.text("udf_length {") |
| 1273 | with q.group(): |
| 1274 | with q.indent(2): |
| 1275 | q.breakable() |
| 1276 | q.text("value = "); |
| 1277 | q.text("%#x" % self.value) |
| 1278 | q.breakable() |
| 1279 | q.text('}') |
| 1280 | |
| 1281 | bsn_tlv.subtypes[18] = udf_length |
| 1282 | |
| 1283 | class udf_offset(bsn_tlv): |
| 1284 | type = 17 |
| 1285 | |
| 1286 | def __init__(self, value=None): |
| 1287 | if value != None: |
| 1288 | self.value = value |
| 1289 | else: |
| 1290 | self.value = 0 |
| 1291 | return |
| 1292 | |
| 1293 | def pack(self): |
| 1294 | packed = [] |
| 1295 | packed.append(struct.pack("!H", self.type)) |
| 1296 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1297 | packed.append(struct.pack("!H", self.value)) |
| 1298 | length = sum([len(x) for x in packed]) |
| 1299 | packed[1] = struct.pack("!H", length) |
| 1300 | return ''.join(packed) |
| 1301 | |
| 1302 | @staticmethod |
| 1303 | def unpack(reader): |
| 1304 | obj = udf_offset() |
| 1305 | _type = reader.read("!H")[0] |
| 1306 | assert(_type == 17) |
| 1307 | _length = reader.read("!H")[0] |
| 1308 | orig_reader = reader |
| 1309 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1310 | obj.value = reader.read("!H")[0] |
| 1311 | return obj |
| 1312 | |
| 1313 | def __eq__(self, other): |
| 1314 | if type(self) != type(other): return False |
| 1315 | if self.value != other.value: return False |
| 1316 | return True |
| 1317 | |
| 1318 | def pretty_print(self, q): |
| 1319 | q.text("udf_offset {") |
| 1320 | with q.group(): |
| 1321 | with q.indent(2): |
| 1322 | q.breakable() |
| 1323 | q.text("value = "); |
| 1324 | q.text("%#x" % self.value) |
| 1325 | q.breakable() |
| 1326 | q.text('}') |
| 1327 | |
| 1328 | bsn_tlv.subtypes[17] = udf_offset |
| 1329 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1330 | class unicast_query_timeout(bsn_tlv): |
| 1331 | type = 9 |
| 1332 | |
| 1333 | def __init__(self, value=None): |
| 1334 | if value != None: |
| 1335 | self.value = value |
| 1336 | else: |
| 1337 | self.value = 0 |
| 1338 | return |
| 1339 | |
| 1340 | def pack(self): |
| 1341 | packed = [] |
| 1342 | packed.append(struct.pack("!H", self.type)) |
| 1343 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1344 | packed.append(struct.pack("!L", self.value)) |
| 1345 | length = sum([len(x) for x in packed]) |
| 1346 | packed[1] = struct.pack("!H", length) |
| 1347 | return ''.join(packed) |
| 1348 | |
| 1349 | @staticmethod |
| 1350 | def unpack(reader): |
| 1351 | obj = unicast_query_timeout() |
| 1352 | _type = reader.read("!H")[0] |
| 1353 | assert(_type == 9) |
| 1354 | _length = reader.read("!H")[0] |
| 1355 | orig_reader = reader |
| 1356 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1357 | obj.value = reader.read("!L")[0] |
| 1358 | return obj |
| 1359 | |
| 1360 | def __eq__(self, other): |
| 1361 | if type(self) != type(other): return False |
| 1362 | if self.value != other.value: return False |
| 1363 | return True |
| 1364 | |
| 1365 | def pretty_print(self, q): |
| 1366 | q.text("unicast_query_timeout {") |
| 1367 | with q.group(): |
| 1368 | with q.indent(2): |
| 1369 | q.breakable() |
| 1370 | q.text("value = "); |
| 1371 | q.text("%#x" % self.value) |
| 1372 | q.breakable() |
| 1373 | q.text('}') |
| 1374 | |
| 1375 | bsn_tlv.subtypes[9] = unicast_query_timeout |
| 1376 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1377 | class vlan_vid(bsn_tlv): |
| 1378 | type = 6 |
| 1379 | |
| 1380 | def __init__(self, value=None): |
| 1381 | if value != None: |
| 1382 | self.value = value |
| 1383 | else: |
| 1384 | self.value = 0 |
| 1385 | return |
| 1386 | |
| 1387 | def pack(self): |
| 1388 | packed = [] |
| 1389 | packed.append(struct.pack("!H", self.type)) |
| 1390 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1391 | packed.append(struct.pack("!H", self.value)) |
| 1392 | length = sum([len(x) for x in packed]) |
| 1393 | packed[1] = struct.pack("!H", length) |
| 1394 | return ''.join(packed) |
| 1395 | |
| 1396 | @staticmethod |
| 1397 | def unpack(reader): |
| 1398 | obj = vlan_vid() |
| 1399 | _type = reader.read("!H")[0] |
| 1400 | assert(_type == 6) |
| 1401 | _length = reader.read("!H")[0] |
| 1402 | orig_reader = reader |
| 1403 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1404 | obj.value = reader.read("!H")[0] |
| 1405 | return obj |
| 1406 | |
| 1407 | def __eq__(self, other): |
| 1408 | if type(self) != type(other): return False |
| 1409 | if self.value != other.value: return False |
| 1410 | return True |
| 1411 | |
| 1412 | def pretty_print(self, q): |
| 1413 | q.text("vlan_vid {") |
| 1414 | with q.group(): |
| 1415 | with q.indent(2): |
| 1416 | q.breakable() |
| 1417 | q.text("value = "); |
| 1418 | q.text("%#x" % self.value) |
| 1419 | q.breakable() |
| 1420 | q.text('}') |
| 1421 | |
| 1422 | bsn_tlv.subtypes[6] = vlan_vid |
| 1423 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 1424 | class vrf(bsn_tlv): |
| 1425 | type = 19 |
| 1426 | |
| 1427 | def __init__(self, value=None): |
| 1428 | if value != None: |
| 1429 | self.value = value |
| 1430 | else: |
| 1431 | self.value = 0 |
| 1432 | return |
| 1433 | |
| 1434 | def pack(self): |
| 1435 | packed = [] |
| 1436 | packed.append(struct.pack("!H", self.type)) |
| 1437 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1438 | packed.append(struct.pack("!L", self.value)) |
| 1439 | length = sum([len(x) for x in packed]) |
| 1440 | packed[1] = struct.pack("!H", length) |
| 1441 | return ''.join(packed) |
| 1442 | |
| 1443 | @staticmethod |
| 1444 | def unpack(reader): |
| 1445 | obj = vrf() |
| 1446 | _type = reader.read("!H")[0] |
| 1447 | assert(_type == 19) |
| 1448 | _length = reader.read("!H")[0] |
| 1449 | orig_reader = reader |
| 1450 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1451 | obj.value = reader.read("!L")[0] |
| 1452 | return obj |
| 1453 | |
| 1454 | def __eq__(self, other): |
| 1455 | if type(self) != type(other): return False |
| 1456 | if self.value != other.value: return False |
| 1457 | return True |
| 1458 | |
| 1459 | def pretty_print(self, q): |
| 1460 | q.text("vrf {") |
| 1461 | with q.group(): |
| 1462 | with q.indent(2): |
| 1463 | q.breakable() |
| 1464 | q.text("value = "); |
| 1465 | q.text("%#x" % self.value) |
| 1466 | q.breakable() |
| 1467 | q.text('}') |
| 1468 | |
| 1469 | bsn_tlv.subtypes[19] = vrf |
| 1470 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1471 | |