Rich Lane | ccd32ed | 2014-11-10 17:48:24 -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 port_desc_prop |
| 13 | import bsn_tlv |
| 14 | import meter_band |
| 15 | import table_mod_prop |
| 16 | import instruction |
| 17 | import queue_desc_prop |
| 18 | import oxm |
| 19 | import bundle_prop |
| 20 | import common |
| 21 | import instruction_id |
| 22 | import action |
| 23 | import role_prop |
| 24 | import message |
| 25 | import queue_stats_prop |
| 26 | import port_stats_prop |
| 27 | import port_mod_prop |
| 28 | import async_config_prop |
| 29 | import action_id |
| 30 | import util |
| 31 | import loxi.generic_util |
| 32 | |
| 33 | class bsn_tlv(loxi.OFObject): |
| 34 | subtypes = {} |
| 35 | |
| 36 | |
| 37 | def __init__(self, type=None): |
| 38 | if type != None: |
| 39 | self.type = type |
| 40 | else: |
| 41 | self.type = 0 |
| 42 | return |
| 43 | |
| 44 | def pack(self): |
| 45 | packed = [] |
| 46 | packed.append(struct.pack("!H", self.type)) |
| 47 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 48 | length = sum([len(x) for x in packed]) |
| 49 | packed[1] = struct.pack("!H", length) |
| 50 | return ''.join(packed) |
| 51 | |
| 52 | @staticmethod |
| 53 | def unpack(reader): |
| 54 | subtype, = reader.peek('!H', 0) |
| 55 | subclass = bsn_tlv.subtypes.get(subtype) |
| 56 | if subclass: |
| 57 | return subclass.unpack(reader) |
| 58 | |
| 59 | obj = bsn_tlv() |
| 60 | obj.type = reader.read("!H")[0] |
| 61 | _length = reader.read("!H")[0] |
| 62 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 63 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 64 | return obj |
| 65 | |
| 66 | def __eq__(self, other): |
| 67 | if type(self) != type(other): return False |
| 68 | if self.type != other.type: return False |
| 69 | return True |
| 70 | |
| 71 | def pretty_print(self, q): |
| 72 | q.text("bsn_tlv {") |
| 73 | with q.group(): |
| 74 | with q.indent(2): |
| 75 | q.breakable() |
| 76 | q.breakable() |
| 77 | q.text('}') |
| 78 | |
| 79 | |
| 80 | class actor_key(bsn_tlv): |
| 81 | type = 44 |
| 82 | |
| 83 | def __init__(self, value=None): |
| 84 | if value != None: |
| 85 | self.value = value |
| 86 | else: |
| 87 | self.value = 0 |
| 88 | return |
| 89 | |
| 90 | def pack(self): |
| 91 | packed = [] |
| 92 | packed.append(struct.pack("!H", self.type)) |
| 93 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 94 | packed.append(struct.pack("!H", self.value)) |
| 95 | length = sum([len(x) for x in packed]) |
| 96 | packed[1] = struct.pack("!H", length) |
| 97 | return ''.join(packed) |
| 98 | |
| 99 | @staticmethod |
| 100 | def unpack(reader): |
| 101 | obj = actor_key() |
| 102 | _type = reader.read("!H")[0] |
| 103 | assert(_type == 44) |
| 104 | _length = reader.read("!H")[0] |
| 105 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 106 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 107 | obj.value = reader.read("!H")[0] |
| 108 | return obj |
| 109 | |
| 110 | def __eq__(self, other): |
| 111 | if type(self) != type(other): return False |
| 112 | if self.value != other.value: return False |
| 113 | return True |
| 114 | |
| 115 | def pretty_print(self, q): |
| 116 | q.text("actor_key {") |
| 117 | with q.group(): |
| 118 | with q.indent(2): |
| 119 | q.breakable() |
| 120 | q.text("value = "); |
| 121 | q.text("%#x" % self.value) |
| 122 | q.breakable() |
| 123 | q.text('}') |
| 124 | |
| 125 | bsn_tlv.subtypes[44] = actor_key |
| 126 | |
| 127 | class actor_port_num(bsn_tlv): |
| 128 | type = 43 |
| 129 | |
| 130 | def __init__(self, value=None): |
| 131 | if value != None: |
| 132 | self.value = value |
| 133 | else: |
| 134 | self.value = 0 |
| 135 | return |
| 136 | |
| 137 | def pack(self): |
| 138 | packed = [] |
| 139 | packed.append(struct.pack("!H", self.type)) |
| 140 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 141 | packed.append(struct.pack("!H", self.value)) |
| 142 | length = sum([len(x) for x in packed]) |
| 143 | packed[1] = struct.pack("!H", length) |
| 144 | return ''.join(packed) |
| 145 | |
| 146 | @staticmethod |
| 147 | def unpack(reader): |
| 148 | obj = actor_port_num() |
| 149 | _type = reader.read("!H")[0] |
| 150 | assert(_type == 43) |
| 151 | _length = reader.read("!H")[0] |
| 152 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 153 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 154 | obj.value = reader.read("!H")[0] |
| 155 | return obj |
| 156 | |
| 157 | def __eq__(self, other): |
| 158 | if type(self) != type(other): return False |
| 159 | if self.value != other.value: return False |
| 160 | return True |
| 161 | |
| 162 | def pretty_print(self, q): |
| 163 | q.text("actor_port_num {") |
| 164 | with q.group(): |
| 165 | with q.indent(2): |
| 166 | q.breakable() |
| 167 | q.text("value = "); |
| 168 | q.text("%#x" % self.value) |
| 169 | q.breakable() |
| 170 | q.text('}') |
| 171 | |
| 172 | bsn_tlv.subtypes[43] = actor_port_num |
| 173 | |
| 174 | class actor_port_priority(bsn_tlv): |
| 175 | type = 42 |
| 176 | |
| 177 | def __init__(self, value=None): |
| 178 | if value != None: |
| 179 | self.value = value |
| 180 | else: |
| 181 | self.value = 0 |
| 182 | return |
| 183 | |
| 184 | def pack(self): |
| 185 | packed = [] |
| 186 | packed.append(struct.pack("!H", self.type)) |
| 187 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 188 | packed.append(struct.pack("!H", self.value)) |
| 189 | length = sum([len(x) for x in packed]) |
| 190 | packed[1] = struct.pack("!H", length) |
| 191 | return ''.join(packed) |
| 192 | |
| 193 | @staticmethod |
| 194 | def unpack(reader): |
| 195 | obj = actor_port_priority() |
| 196 | _type = reader.read("!H")[0] |
| 197 | assert(_type == 42) |
| 198 | _length = reader.read("!H")[0] |
| 199 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 200 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 201 | obj.value = reader.read("!H")[0] |
| 202 | return obj |
| 203 | |
| 204 | def __eq__(self, other): |
| 205 | if type(self) != type(other): return False |
| 206 | if self.value != other.value: return False |
| 207 | return True |
| 208 | |
| 209 | def pretty_print(self, q): |
| 210 | q.text("actor_port_priority {") |
| 211 | with q.group(): |
| 212 | with q.indent(2): |
| 213 | q.breakable() |
| 214 | q.text("value = "); |
| 215 | q.text("%#x" % self.value) |
| 216 | q.breakable() |
| 217 | q.text('}') |
| 218 | |
| 219 | bsn_tlv.subtypes[42] = actor_port_priority |
| 220 | |
| 221 | class actor_state(bsn_tlv): |
| 222 | type = 53 |
| 223 | |
| 224 | def __init__(self, value=None): |
| 225 | if value != None: |
| 226 | self.value = value |
| 227 | else: |
| 228 | self.value = 0 |
| 229 | return |
| 230 | |
| 231 | def pack(self): |
| 232 | packed = [] |
| 233 | packed.append(struct.pack("!H", self.type)) |
| 234 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 235 | packed.append(struct.pack("!B", self.value)) |
| 236 | length = sum([len(x) for x in packed]) |
| 237 | packed[1] = struct.pack("!H", length) |
| 238 | return ''.join(packed) |
| 239 | |
| 240 | @staticmethod |
| 241 | def unpack(reader): |
| 242 | obj = actor_state() |
| 243 | _type = reader.read("!H")[0] |
| 244 | assert(_type == 53) |
| 245 | _length = reader.read("!H")[0] |
| 246 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 247 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 248 | obj.value = reader.read("!B")[0] |
| 249 | return obj |
| 250 | |
| 251 | def __eq__(self, other): |
| 252 | if type(self) != type(other): return False |
| 253 | if self.value != other.value: return False |
| 254 | return True |
| 255 | |
| 256 | def pretty_print(self, q): |
| 257 | q.text("actor_state {") |
| 258 | with q.group(): |
| 259 | with q.indent(2): |
| 260 | q.breakable() |
| 261 | q.text("value = "); |
| 262 | q.text("%#x" % self.value) |
| 263 | q.breakable() |
| 264 | q.text('}') |
| 265 | |
| 266 | bsn_tlv.subtypes[53] = actor_state |
| 267 | |
| 268 | class actor_system_mac(bsn_tlv): |
| 269 | type = 41 |
| 270 | |
| 271 | def __init__(self, value=None): |
| 272 | if value != None: |
| 273 | self.value = value |
| 274 | else: |
| 275 | self.value = [0,0,0,0,0,0] |
| 276 | return |
| 277 | |
| 278 | def pack(self): |
| 279 | packed = [] |
| 280 | packed.append(struct.pack("!H", self.type)) |
| 281 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 282 | packed.append(struct.pack("!6B", *self.value)) |
| 283 | length = sum([len(x) for x in packed]) |
| 284 | packed[1] = struct.pack("!H", length) |
| 285 | return ''.join(packed) |
| 286 | |
| 287 | @staticmethod |
| 288 | def unpack(reader): |
| 289 | obj = actor_system_mac() |
| 290 | _type = reader.read("!H")[0] |
| 291 | assert(_type == 41) |
| 292 | _length = reader.read("!H")[0] |
| 293 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 294 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 295 | obj.value = list(reader.read('!6B')) |
| 296 | return obj |
| 297 | |
| 298 | def __eq__(self, other): |
| 299 | if type(self) != type(other): return False |
| 300 | if self.value != other.value: return False |
| 301 | return True |
| 302 | |
| 303 | def pretty_print(self, q): |
| 304 | q.text("actor_system_mac {") |
| 305 | with q.group(): |
| 306 | with q.indent(2): |
| 307 | q.breakable() |
| 308 | q.text("value = "); |
| 309 | q.text(util.pretty_mac(self.value)) |
| 310 | q.breakable() |
| 311 | q.text('}') |
| 312 | |
| 313 | bsn_tlv.subtypes[41] = actor_system_mac |
| 314 | |
| 315 | class actor_system_priority(bsn_tlv): |
| 316 | type = 40 |
| 317 | |
| 318 | def __init__(self, value=None): |
| 319 | if value != None: |
| 320 | self.value = value |
| 321 | else: |
| 322 | self.value = 0 |
| 323 | return |
| 324 | |
| 325 | def pack(self): |
| 326 | packed = [] |
| 327 | packed.append(struct.pack("!H", self.type)) |
| 328 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 329 | packed.append(struct.pack("!H", self.value)) |
| 330 | length = sum([len(x) for x in packed]) |
| 331 | packed[1] = struct.pack("!H", length) |
| 332 | return ''.join(packed) |
| 333 | |
| 334 | @staticmethod |
| 335 | def unpack(reader): |
| 336 | obj = actor_system_priority() |
| 337 | _type = reader.read("!H")[0] |
| 338 | assert(_type == 40) |
| 339 | _length = reader.read("!H")[0] |
| 340 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 341 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 342 | obj.value = reader.read("!H")[0] |
| 343 | return obj |
| 344 | |
| 345 | def __eq__(self, other): |
| 346 | if type(self) != type(other): return False |
| 347 | if self.value != other.value: return False |
| 348 | return True |
| 349 | |
| 350 | def pretty_print(self, q): |
| 351 | q.text("actor_system_priority {") |
| 352 | with q.group(): |
| 353 | with q.indent(2): |
| 354 | q.breakable() |
| 355 | q.text("value = "); |
| 356 | q.text("%#x" % self.value) |
| 357 | q.breakable() |
| 358 | q.text('}') |
| 359 | |
| 360 | bsn_tlv.subtypes[40] = actor_system_priority |
| 361 | |
| 362 | class broadcast_query_timeout(bsn_tlv): |
| 363 | type = 10 |
| 364 | |
| 365 | def __init__(self, value=None): |
| 366 | if value != None: |
| 367 | self.value = value |
| 368 | else: |
| 369 | self.value = 0 |
| 370 | return |
| 371 | |
| 372 | def pack(self): |
| 373 | packed = [] |
| 374 | packed.append(struct.pack("!H", self.type)) |
| 375 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 376 | packed.append(struct.pack("!L", self.value)) |
| 377 | length = sum([len(x) for x in packed]) |
| 378 | packed[1] = struct.pack("!H", length) |
| 379 | return ''.join(packed) |
| 380 | |
| 381 | @staticmethod |
| 382 | def unpack(reader): |
| 383 | obj = broadcast_query_timeout() |
| 384 | _type = reader.read("!H")[0] |
| 385 | assert(_type == 10) |
| 386 | _length = reader.read("!H")[0] |
| 387 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 388 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 389 | obj.value = reader.read("!L")[0] |
| 390 | return obj |
| 391 | |
| 392 | def __eq__(self, other): |
| 393 | if type(self) != type(other): return False |
| 394 | if self.value != other.value: return False |
| 395 | return True |
| 396 | |
| 397 | def pretty_print(self, q): |
| 398 | q.text("broadcast_query_timeout {") |
| 399 | with q.group(): |
| 400 | with q.indent(2): |
| 401 | q.breakable() |
| 402 | q.text("value = "); |
| 403 | q.text("%#x" % self.value) |
| 404 | q.breakable() |
| 405 | q.text('}') |
| 406 | |
| 407 | bsn_tlv.subtypes[10] = broadcast_query_timeout |
| 408 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 409 | class bucket(bsn_tlv): |
| 410 | type = 64 |
| 411 | |
| 412 | def __init__(self, value=None): |
| 413 | if value != None: |
| 414 | self.value = value |
| 415 | else: |
| 416 | self.value = [] |
| 417 | return |
| 418 | |
| 419 | def pack(self): |
| 420 | packed = [] |
| 421 | packed.append(struct.pack("!H", self.type)) |
| 422 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 423 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 424 | length = sum([len(x) for x in packed]) |
| 425 | packed[1] = struct.pack("!H", length) |
| 426 | return ''.join(packed) |
| 427 | |
| 428 | @staticmethod |
| 429 | def unpack(reader): |
| 430 | obj = bucket() |
| 431 | _type = reader.read("!H")[0] |
| 432 | assert(_type == 64) |
| 433 | _length = reader.read("!H")[0] |
| 434 | orig_reader = reader |
| 435 | reader = orig_reader.slice(_length, 4) |
| 436 | obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 437 | return obj |
| 438 | |
| 439 | def __eq__(self, other): |
| 440 | if type(self) != type(other): return False |
| 441 | if self.value != other.value: return False |
| 442 | return True |
| 443 | |
| 444 | def pretty_print(self, q): |
| 445 | q.text("bucket {") |
| 446 | with q.group(): |
| 447 | with q.indent(2): |
| 448 | q.breakable() |
| 449 | q.text("value = "); |
| 450 | q.pp(self.value) |
| 451 | q.breakable() |
| 452 | q.text('}') |
| 453 | |
| 454 | bsn_tlv.subtypes[64] = bucket |
| 455 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 456 | class circuit_id(bsn_tlv): |
| 457 | type = 14 |
| 458 | |
| 459 | def __init__(self, value=None): |
| 460 | if value != None: |
| 461 | self.value = value |
| 462 | else: |
| 463 | self.value = '' |
| 464 | return |
| 465 | |
| 466 | def pack(self): |
| 467 | packed = [] |
| 468 | packed.append(struct.pack("!H", self.type)) |
| 469 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 470 | packed.append(self.value) |
| 471 | length = sum([len(x) for x in packed]) |
| 472 | packed[1] = struct.pack("!H", length) |
| 473 | return ''.join(packed) |
| 474 | |
| 475 | @staticmethod |
| 476 | def unpack(reader): |
| 477 | obj = circuit_id() |
| 478 | _type = reader.read("!H")[0] |
| 479 | assert(_type == 14) |
| 480 | _length = reader.read("!H")[0] |
| 481 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 482 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 483 | obj.value = str(reader.read_all()) |
| 484 | return obj |
| 485 | |
| 486 | def __eq__(self, other): |
| 487 | if type(self) != type(other): return False |
| 488 | if self.value != other.value: return False |
| 489 | return True |
| 490 | |
| 491 | def pretty_print(self, q): |
| 492 | q.text("circuit_id {") |
| 493 | with q.group(): |
| 494 | with q.indent(2): |
| 495 | q.breakable() |
| 496 | q.text("value = "); |
| 497 | q.pp(self.value) |
| 498 | q.breakable() |
| 499 | q.text('}') |
| 500 | |
| 501 | bsn_tlv.subtypes[14] = circuit_id |
| 502 | |
| 503 | class convergence_status(bsn_tlv): |
| 504 | type = 45 |
| 505 | |
| 506 | def __init__(self, value=None): |
| 507 | if value != None: |
| 508 | self.value = value |
| 509 | else: |
| 510 | self.value = 0 |
| 511 | return |
| 512 | |
| 513 | def pack(self): |
| 514 | packed = [] |
| 515 | packed.append(struct.pack("!H", self.type)) |
| 516 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 517 | packed.append(struct.pack("!B", self.value)) |
| 518 | length = sum([len(x) for x in packed]) |
| 519 | packed[1] = struct.pack("!H", length) |
| 520 | return ''.join(packed) |
| 521 | |
| 522 | @staticmethod |
| 523 | def unpack(reader): |
| 524 | obj = convergence_status() |
| 525 | _type = reader.read("!H")[0] |
| 526 | assert(_type == 45) |
| 527 | _length = reader.read("!H")[0] |
| 528 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 529 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 530 | obj.value = reader.read("!B")[0] |
| 531 | return obj |
| 532 | |
| 533 | def __eq__(self, other): |
| 534 | if type(self) != type(other): return False |
| 535 | if self.value != other.value: return False |
| 536 | return True |
| 537 | |
| 538 | def pretty_print(self, q): |
| 539 | q.text("convergence_status {") |
| 540 | with q.group(): |
| 541 | with q.indent(2): |
| 542 | q.breakable() |
| 543 | q.text("value = "); |
| 544 | q.text("%#x" % self.value) |
| 545 | q.breakable() |
| 546 | q.text('}') |
| 547 | |
| 548 | bsn_tlv.subtypes[45] = convergence_status |
| 549 | |
| 550 | class crc_enabled(bsn_tlv): |
| 551 | type = 22 |
| 552 | |
| 553 | def __init__(self, value=None): |
| 554 | if value != None: |
| 555 | self.value = value |
| 556 | else: |
| 557 | self.value = 0 |
| 558 | return |
| 559 | |
| 560 | def pack(self): |
| 561 | packed = [] |
| 562 | packed.append(struct.pack("!H", self.type)) |
| 563 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 564 | packed.append(struct.pack("!B", self.value)) |
| 565 | length = sum([len(x) for x in packed]) |
| 566 | packed[1] = struct.pack("!H", length) |
| 567 | return ''.join(packed) |
| 568 | |
| 569 | @staticmethod |
| 570 | def unpack(reader): |
| 571 | obj = crc_enabled() |
| 572 | _type = reader.read("!H")[0] |
| 573 | assert(_type == 22) |
| 574 | _length = reader.read("!H")[0] |
| 575 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 576 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 577 | obj.value = reader.read("!B")[0] |
| 578 | return obj |
| 579 | |
| 580 | def __eq__(self, other): |
| 581 | if type(self) != type(other): return False |
| 582 | if self.value != other.value: return False |
| 583 | return True |
| 584 | |
| 585 | def pretty_print(self, q): |
| 586 | q.text("crc_enabled {") |
| 587 | with q.group(): |
| 588 | with q.indent(2): |
| 589 | q.breakable() |
| 590 | q.text("value = "); |
| 591 | q.text("%#x" % self.value) |
| 592 | q.breakable() |
| 593 | q.text('}') |
| 594 | |
| 595 | bsn_tlv.subtypes[22] = crc_enabled |
| 596 | |
| 597 | class data(bsn_tlv): |
| 598 | type = 55 |
| 599 | |
| 600 | def __init__(self, value=None): |
| 601 | if value != None: |
| 602 | self.value = value |
| 603 | else: |
| 604 | self.value = '' |
| 605 | return |
| 606 | |
| 607 | def pack(self): |
| 608 | packed = [] |
| 609 | packed.append(struct.pack("!H", self.type)) |
| 610 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 611 | packed.append(self.value) |
| 612 | length = sum([len(x) for x in packed]) |
| 613 | packed[1] = struct.pack("!H", length) |
| 614 | return ''.join(packed) |
| 615 | |
| 616 | @staticmethod |
| 617 | def unpack(reader): |
| 618 | obj = data() |
| 619 | _type = reader.read("!H")[0] |
| 620 | assert(_type == 55) |
| 621 | _length = reader.read("!H")[0] |
| 622 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 623 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 624 | obj.value = str(reader.read_all()) |
| 625 | return obj |
| 626 | |
| 627 | def __eq__(self, other): |
| 628 | if type(self) != type(other): return False |
| 629 | if self.value != other.value: return False |
| 630 | return True |
| 631 | |
| 632 | def pretty_print(self, q): |
| 633 | q.text("data {") |
| 634 | with q.group(): |
| 635 | with q.indent(2): |
| 636 | q.breakable() |
| 637 | q.text("value = "); |
| 638 | q.pp(self.value) |
| 639 | q.breakable() |
| 640 | q.text('}') |
| 641 | |
| 642 | bsn_tlv.subtypes[55] = data |
| 643 | |
| 644 | class eth_dst(bsn_tlv): |
| 645 | type = 33 |
| 646 | |
| 647 | def __init__(self, value=None): |
| 648 | if value != None: |
| 649 | self.value = value |
| 650 | else: |
| 651 | self.value = [0,0,0,0,0,0] |
| 652 | return |
| 653 | |
| 654 | def pack(self): |
| 655 | packed = [] |
| 656 | packed.append(struct.pack("!H", self.type)) |
| 657 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 658 | packed.append(struct.pack("!6B", *self.value)) |
| 659 | length = sum([len(x) for x in packed]) |
| 660 | packed[1] = struct.pack("!H", length) |
| 661 | return ''.join(packed) |
| 662 | |
| 663 | @staticmethod |
| 664 | def unpack(reader): |
| 665 | obj = eth_dst() |
| 666 | _type = reader.read("!H")[0] |
| 667 | assert(_type == 33) |
| 668 | _length = reader.read("!H")[0] |
| 669 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 670 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 671 | obj.value = list(reader.read('!6B')) |
| 672 | return obj |
| 673 | |
| 674 | def __eq__(self, other): |
| 675 | if type(self) != type(other): return False |
| 676 | if self.value != other.value: return False |
| 677 | return True |
| 678 | |
| 679 | def pretty_print(self, q): |
| 680 | q.text("eth_dst {") |
| 681 | with q.group(): |
| 682 | with q.indent(2): |
| 683 | q.breakable() |
| 684 | q.text("value = "); |
| 685 | q.text(util.pretty_mac(self.value)) |
| 686 | q.breakable() |
| 687 | q.text('}') |
| 688 | |
| 689 | bsn_tlv.subtypes[33] = eth_dst |
| 690 | |
| 691 | class eth_src(bsn_tlv): |
| 692 | type = 32 |
| 693 | |
| 694 | def __init__(self, value=None): |
| 695 | if value != None: |
| 696 | self.value = value |
| 697 | else: |
| 698 | self.value = [0,0,0,0,0,0] |
| 699 | return |
| 700 | |
| 701 | def pack(self): |
| 702 | packed = [] |
| 703 | packed.append(struct.pack("!H", self.type)) |
| 704 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 705 | packed.append(struct.pack("!6B", *self.value)) |
| 706 | length = sum([len(x) for x in packed]) |
| 707 | packed[1] = struct.pack("!H", length) |
| 708 | return ''.join(packed) |
| 709 | |
| 710 | @staticmethod |
| 711 | def unpack(reader): |
| 712 | obj = eth_src() |
| 713 | _type = reader.read("!H")[0] |
| 714 | assert(_type == 32) |
| 715 | _length = reader.read("!H")[0] |
| 716 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 717 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 718 | obj.value = list(reader.read('!6B')) |
| 719 | return obj |
| 720 | |
| 721 | def __eq__(self, other): |
| 722 | if type(self) != type(other): return False |
| 723 | if self.value != other.value: return False |
| 724 | return True |
| 725 | |
| 726 | def pretty_print(self, q): |
| 727 | q.text("eth_src {") |
| 728 | with q.group(): |
| 729 | with q.indent(2): |
| 730 | q.breakable() |
| 731 | q.text("value = "); |
| 732 | q.text(util.pretty_mac(self.value)) |
| 733 | q.breakable() |
| 734 | q.text('}') |
| 735 | |
| 736 | bsn_tlv.subtypes[32] = eth_src |
| 737 | |
| 738 | class external_gateway_ip(bsn_tlv): |
| 739 | type = 26 |
| 740 | |
| 741 | def __init__(self, value=None): |
| 742 | if value != None: |
| 743 | self.value = value |
| 744 | else: |
| 745 | self.value = 0 |
| 746 | return |
| 747 | |
| 748 | def pack(self): |
| 749 | packed = [] |
| 750 | packed.append(struct.pack("!H", self.type)) |
| 751 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 752 | packed.append(struct.pack("!L", self.value)) |
| 753 | length = sum([len(x) for x in packed]) |
| 754 | packed[1] = struct.pack("!H", length) |
| 755 | return ''.join(packed) |
| 756 | |
| 757 | @staticmethod |
| 758 | def unpack(reader): |
| 759 | obj = external_gateway_ip() |
| 760 | _type = reader.read("!H")[0] |
| 761 | assert(_type == 26) |
| 762 | _length = reader.read("!H")[0] |
| 763 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 764 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 765 | obj.value = reader.read("!L")[0] |
| 766 | return obj |
| 767 | |
| 768 | def __eq__(self, other): |
| 769 | if type(self) != type(other): return False |
| 770 | if self.value != other.value: return False |
| 771 | return True |
| 772 | |
| 773 | def pretty_print(self, q): |
| 774 | q.text("external_gateway_ip {") |
| 775 | with q.group(): |
| 776 | with q.indent(2): |
| 777 | q.breakable() |
| 778 | q.text("value = "); |
| 779 | q.text(util.pretty_ipv4(self.value)) |
| 780 | q.breakable() |
| 781 | q.text('}') |
| 782 | |
| 783 | bsn_tlv.subtypes[26] = external_gateway_ip |
| 784 | |
| 785 | class external_gateway_mac(bsn_tlv): |
| 786 | type = 29 |
| 787 | |
| 788 | def __init__(self, value=None): |
| 789 | if value != None: |
| 790 | self.value = value |
| 791 | else: |
| 792 | self.value = [0,0,0,0,0,0] |
| 793 | return |
| 794 | |
| 795 | def pack(self): |
| 796 | packed = [] |
| 797 | packed.append(struct.pack("!H", self.type)) |
| 798 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 799 | packed.append(struct.pack("!6B", *self.value)) |
| 800 | length = sum([len(x) for x in packed]) |
| 801 | packed[1] = struct.pack("!H", length) |
| 802 | return ''.join(packed) |
| 803 | |
| 804 | @staticmethod |
| 805 | def unpack(reader): |
| 806 | obj = external_gateway_mac() |
| 807 | _type = reader.read("!H")[0] |
| 808 | assert(_type == 29) |
| 809 | _length = reader.read("!H")[0] |
| 810 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 811 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 812 | obj.value = list(reader.read('!6B')) |
| 813 | return obj |
| 814 | |
| 815 | def __eq__(self, other): |
| 816 | if type(self) != type(other): return False |
| 817 | if self.value != other.value: return False |
| 818 | return True |
| 819 | |
| 820 | def pretty_print(self, q): |
| 821 | q.text("external_gateway_mac {") |
| 822 | with q.group(): |
| 823 | with q.indent(2): |
| 824 | q.breakable() |
| 825 | q.text("value = "); |
| 826 | q.text(util.pretty_mac(self.value)) |
| 827 | q.breakable() |
| 828 | q.text('}') |
| 829 | |
| 830 | bsn_tlv.subtypes[29] = external_gateway_mac |
| 831 | |
| 832 | class external_ip(bsn_tlv): |
| 833 | type = 23 |
| 834 | |
| 835 | def __init__(self, value=None): |
| 836 | if value != None: |
| 837 | self.value = value |
| 838 | else: |
| 839 | self.value = 0 |
| 840 | return |
| 841 | |
| 842 | def pack(self): |
| 843 | packed = [] |
| 844 | packed.append(struct.pack("!H", self.type)) |
| 845 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 846 | packed.append(struct.pack("!L", self.value)) |
| 847 | length = sum([len(x) for x in packed]) |
| 848 | packed[1] = struct.pack("!H", length) |
| 849 | return ''.join(packed) |
| 850 | |
| 851 | @staticmethod |
| 852 | def unpack(reader): |
| 853 | obj = external_ip() |
| 854 | _type = reader.read("!H")[0] |
| 855 | assert(_type == 23) |
| 856 | _length = reader.read("!H")[0] |
| 857 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 858 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 859 | obj.value = reader.read("!L")[0] |
| 860 | return obj |
| 861 | |
| 862 | def __eq__(self, other): |
| 863 | if type(self) != type(other): return False |
| 864 | if self.value != other.value: return False |
| 865 | return True |
| 866 | |
| 867 | def pretty_print(self, q): |
| 868 | q.text("external_ip {") |
| 869 | with q.group(): |
| 870 | with q.indent(2): |
| 871 | q.breakable() |
| 872 | q.text("value = "); |
| 873 | q.text(util.pretty_ipv4(self.value)) |
| 874 | q.breakable() |
| 875 | q.text('}') |
| 876 | |
| 877 | bsn_tlv.subtypes[23] = external_ip |
| 878 | |
| 879 | class external_mac(bsn_tlv): |
| 880 | type = 24 |
| 881 | |
| 882 | def __init__(self, value=None): |
| 883 | if value != None: |
| 884 | self.value = value |
| 885 | else: |
| 886 | self.value = [0,0,0,0,0,0] |
| 887 | return |
| 888 | |
| 889 | def pack(self): |
| 890 | packed = [] |
| 891 | packed.append(struct.pack("!H", self.type)) |
| 892 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 893 | packed.append(struct.pack("!6B", *self.value)) |
| 894 | length = sum([len(x) for x in packed]) |
| 895 | packed[1] = struct.pack("!H", length) |
| 896 | return ''.join(packed) |
| 897 | |
| 898 | @staticmethod |
| 899 | def unpack(reader): |
| 900 | obj = external_mac() |
| 901 | _type = reader.read("!H")[0] |
| 902 | assert(_type == 24) |
| 903 | _length = reader.read("!H")[0] |
| 904 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 905 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 906 | obj.value = list(reader.read('!6B')) |
| 907 | return obj |
| 908 | |
| 909 | def __eq__(self, other): |
| 910 | if type(self) != type(other): return False |
| 911 | if self.value != other.value: return False |
| 912 | return True |
| 913 | |
| 914 | def pretty_print(self, q): |
| 915 | q.text("external_mac {") |
| 916 | with q.group(): |
| 917 | with q.indent(2): |
| 918 | q.breakable() |
| 919 | q.text("value = "); |
| 920 | q.text(util.pretty_mac(self.value)) |
| 921 | q.breakable() |
| 922 | q.text('}') |
| 923 | |
| 924 | bsn_tlv.subtypes[24] = external_mac |
| 925 | |
| 926 | class external_netmask(bsn_tlv): |
| 927 | type = 25 |
| 928 | |
| 929 | def __init__(self, value=None): |
| 930 | if value != None: |
| 931 | self.value = value |
| 932 | else: |
| 933 | self.value = 0 |
| 934 | return |
| 935 | |
| 936 | def pack(self): |
| 937 | packed = [] |
| 938 | packed.append(struct.pack("!H", self.type)) |
| 939 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 940 | packed.append(struct.pack("!L", self.value)) |
| 941 | length = sum([len(x) for x in packed]) |
| 942 | packed[1] = struct.pack("!H", length) |
| 943 | return ''.join(packed) |
| 944 | |
| 945 | @staticmethod |
| 946 | def unpack(reader): |
| 947 | obj = external_netmask() |
| 948 | _type = reader.read("!H")[0] |
| 949 | assert(_type == 25) |
| 950 | _length = reader.read("!H")[0] |
| 951 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 952 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 953 | obj.value = reader.read("!L")[0] |
| 954 | return obj |
| 955 | |
| 956 | def __eq__(self, other): |
| 957 | if type(self) != type(other): return False |
| 958 | if self.value != other.value: return False |
| 959 | return True |
| 960 | |
| 961 | def pretty_print(self, q): |
| 962 | q.text("external_netmask {") |
| 963 | with q.group(): |
| 964 | with q.indent(2): |
| 965 | q.breakable() |
| 966 | q.text("value = "); |
| 967 | q.text(util.pretty_ipv4(self.value)) |
| 968 | q.breakable() |
| 969 | q.text('}') |
| 970 | |
| 971 | bsn_tlv.subtypes[25] = external_netmask |
| 972 | |
| 973 | class header_size(bsn_tlv): |
| 974 | type = 31 |
| 975 | |
| 976 | def __init__(self, value=None): |
| 977 | if value != None: |
| 978 | self.value = value |
| 979 | else: |
| 980 | self.value = 0 |
| 981 | return |
| 982 | |
| 983 | def pack(self): |
| 984 | packed = [] |
| 985 | packed.append(struct.pack("!H", self.type)) |
| 986 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 987 | packed.append(struct.pack("!L", self.value)) |
| 988 | length = sum([len(x) for x in packed]) |
| 989 | packed[1] = struct.pack("!H", length) |
| 990 | return ''.join(packed) |
| 991 | |
| 992 | @staticmethod |
| 993 | def unpack(reader): |
| 994 | obj = header_size() |
| 995 | _type = reader.read("!H")[0] |
| 996 | assert(_type == 31) |
| 997 | _length = reader.read("!H")[0] |
| 998 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 999 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1000 | obj.value = reader.read("!L")[0] |
| 1001 | return obj |
| 1002 | |
| 1003 | def __eq__(self, other): |
| 1004 | if type(self) != type(other): return False |
| 1005 | if self.value != other.value: return False |
| 1006 | return True |
| 1007 | |
| 1008 | def pretty_print(self, q): |
| 1009 | q.text("header_size {") |
| 1010 | with q.group(): |
| 1011 | with q.indent(2): |
| 1012 | q.breakable() |
| 1013 | q.text("value = "); |
| 1014 | q.text("%#x" % self.value) |
| 1015 | q.breakable() |
| 1016 | q.text('}') |
| 1017 | |
| 1018 | bsn_tlv.subtypes[31] = header_size |
| 1019 | |
| 1020 | class idle_notification(bsn_tlv): |
| 1021 | type = 7 |
| 1022 | |
| 1023 | def __init__(self): |
| 1024 | return |
| 1025 | |
| 1026 | def pack(self): |
| 1027 | packed = [] |
| 1028 | packed.append(struct.pack("!H", self.type)) |
| 1029 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1030 | length = sum([len(x) for x in packed]) |
| 1031 | packed[1] = struct.pack("!H", length) |
| 1032 | return ''.join(packed) |
| 1033 | |
| 1034 | @staticmethod |
| 1035 | def unpack(reader): |
| 1036 | obj = idle_notification() |
| 1037 | _type = reader.read("!H")[0] |
| 1038 | assert(_type == 7) |
| 1039 | _length = reader.read("!H")[0] |
| 1040 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1041 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1042 | return obj |
| 1043 | |
| 1044 | def __eq__(self, other): |
| 1045 | if type(self) != type(other): return False |
| 1046 | return True |
| 1047 | |
| 1048 | def pretty_print(self, q): |
| 1049 | q.text("idle_notification {") |
| 1050 | with q.group(): |
| 1051 | with q.indent(2): |
| 1052 | q.breakable() |
| 1053 | q.breakable() |
| 1054 | q.text('}') |
| 1055 | |
| 1056 | bsn_tlv.subtypes[7] = idle_notification |
| 1057 | |
| 1058 | class idle_time(bsn_tlv): |
| 1059 | type = 5 |
| 1060 | |
| 1061 | def __init__(self, value=None): |
| 1062 | if value != None: |
| 1063 | self.value = value |
| 1064 | else: |
| 1065 | self.value = 0 |
| 1066 | return |
| 1067 | |
| 1068 | def pack(self): |
| 1069 | packed = [] |
| 1070 | packed.append(struct.pack("!H", self.type)) |
| 1071 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1072 | packed.append(struct.pack("!Q", self.value)) |
| 1073 | length = sum([len(x) for x in packed]) |
| 1074 | packed[1] = struct.pack("!H", length) |
| 1075 | return ''.join(packed) |
| 1076 | |
| 1077 | @staticmethod |
| 1078 | def unpack(reader): |
| 1079 | obj = idle_time() |
| 1080 | _type = reader.read("!H")[0] |
| 1081 | assert(_type == 5) |
| 1082 | _length = reader.read("!H")[0] |
| 1083 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1084 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1085 | obj.value = reader.read("!Q")[0] |
| 1086 | return obj |
| 1087 | |
| 1088 | def __eq__(self, other): |
| 1089 | if type(self) != type(other): return False |
| 1090 | if self.value != other.value: return False |
| 1091 | return True |
| 1092 | |
| 1093 | def pretty_print(self, q): |
| 1094 | q.text("idle_time {") |
| 1095 | with q.group(): |
| 1096 | with q.indent(2): |
| 1097 | q.breakable() |
| 1098 | q.text("value = "); |
| 1099 | q.text("%#x" % self.value) |
| 1100 | q.breakable() |
| 1101 | q.text('}') |
| 1102 | |
| 1103 | bsn_tlv.subtypes[5] = idle_time |
| 1104 | |
| 1105 | class idle_timeout(bsn_tlv): |
| 1106 | type = 8 |
| 1107 | |
| 1108 | def __init__(self, value=None): |
| 1109 | if value != None: |
| 1110 | self.value = value |
| 1111 | else: |
| 1112 | self.value = 0 |
| 1113 | return |
| 1114 | |
| 1115 | def pack(self): |
| 1116 | packed = [] |
| 1117 | packed.append(struct.pack("!H", self.type)) |
| 1118 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1119 | packed.append(struct.pack("!L", self.value)) |
| 1120 | length = sum([len(x) for x in packed]) |
| 1121 | packed[1] = struct.pack("!H", length) |
| 1122 | return ''.join(packed) |
| 1123 | |
| 1124 | @staticmethod |
| 1125 | def unpack(reader): |
| 1126 | obj = idle_timeout() |
| 1127 | _type = reader.read("!H")[0] |
| 1128 | assert(_type == 8) |
| 1129 | _length = reader.read("!H")[0] |
| 1130 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1131 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1132 | obj.value = reader.read("!L")[0] |
| 1133 | return obj |
| 1134 | |
| 1135 | def __eq__(self, other): |
| 1136 | if type(self) != type(other): return False |
| 1137 | if self.value != other.value: return False |
| 1138 | return True |
| 1139 | |
| 1140 | def pretty_print(self, q): |
| 1141 | q.text("idle_timeout {") |
| 1142 | with q.group(): |
| 1143 | with q.indent(2): |
| 1144 | q.breakable() |
| 1145 | q.text("value = "); |
| 1146 | q.text("%#x" % self.value) |
| 1147 | q.breakable() |
| 1148 | q.text('}') |
| 1149 | |
| 1150 | bsn_tlv.subtypes[8] = idle_timeout |
| 1151 | |
| 1152 | class internal_gateway_mac(bsn_tlv): |
| 1153 | type = 28 |
| 1154 | |
| 1155 | def __init__(self, value=None): |
| 1156 | if value != None: |
| 1157 | self.value = value |
| 1158 | else: |
| 1159 | self.value = [0,0,0,0,0,0] |
| 1160 | return |
| 1161 | |
| 1162 | def pack(self): |
| 1163 | packed = [] |
| 1164 | packed.append(struct.pack("!H", self.type)) |
| 1165 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1166 | packed.append(struct.pack("!6B", *self.value)) |
| 1167 | length = sum([len(x) for x in packed]) |
| 1168 | packed[1] = struct.pack("!H", length) |
| 1169 | return ''.join(packed) |
| 1170 | |
| 1171 | @staticmethod |
| 1172 | def unpack(reader): |
| 1173 | obj = internal_gateway_mac() |
| 1174 | _type = reader.read("!H")[0] |
| 1175 | assert(_type == 28) |
| 1176 | _length = reader.read("!H")[0] |
| 1177 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1178 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1179 | obj.value = list(reader.read('!6B')) |
| 1180 | return obj |
| 1181 | |
| 1182 | def __eq__(self, other): |
| 1183 | if type(self) != type(other): return False |
| 1184 | if self.value != other.value: return False |
| 1185 | return True |
| 1186 | |
| 1187 | def pretty_print(self, q): |
| 1188 | q.text("internal_gateway_mac {") |
| 1189 | with q.group(): |
| 1190 | with q.indent(2): |
| 1191 | q.breakable() |
| 1192 | q.text("value = "); |
| 1193 | q.text(util.pretty_mac(self.value)) |
| 1194 | q.breakable() |
| 1195 | q.text('}') |
| 1196 | |
| 1197 | bsn_tlv.subtypes[28] = internal_gateway_mac |
| 1198 | |
| 1199 | class internal_mac(bsn_tlv): |
| 1200 | type = 27 |
| 1201 | |
| 1202 | def __init__(self, value=None): |
| 1203 | if value != None: |
| 1204 | self.value = value |
| 1205 | else: |
| 1206 | self.value = [0,0,0,0,0,0] |
| 1207 | return |
| 1208 | |
| 1209 | def pack(self): |
| 1210 | packed = [] |
| 1211 | packed.append(struct.pack("!H", self.type)) |
| 1212 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1213 | packed.append(struct.pack("!6B", *self.value)) |
| 1214 | length = sum([len(x) for x in packed]) |
| 1215 | packed[1] = struct.pack("!H", length) |
| 1216 | return ''.join(packed) |
| 1217 | |
| 1218 | @staticmethod |
| 1219 | def unpack(reader): |
| 1220 | obj = internal_mac() |
| 1221 | _type = reader.read("!H")[0] |
| 1222 | assert(_type == 27) |
| 1223 | _length = reader.read("!H")[0] |
| 1224 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1225 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1226 | obj.value = list(reader.read('!6B')) |
| 1227 | return obj |
| 1228 | |
| 1229 | def __eq__(self, other): |
| 1230 | if type(self) != type(other): return False |
| 1231 | if self.value != other.value: return False |
| 1232 | return True |
| 1233 | |
| 1234 | def pretty_print(self, q): |
| 1235 | q.text("internal_mac {") |
| 1236 | with q.group(): |
| 1237 | with q.indent(2): |
| 1238 | q.breakable() |
| 1239 | q.text("value = "); |
| 1240 | q.text(util.pretty_mac(self.value)) |
| 1241 | q.breakable() |
| 1242 | q.text('}') |
| 1243 | |
| 1244 | bsn_tlv.subtypes[27] = internal_mac |
| 1245 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1246 | class interval(bsn_tlv): |
| 1247 | type = 58 |
| 1248 | |
| 1249 | def __init__(self, value=None): |
| 1250 | if value != None: |
| 1251 | self.value = value |
| 1252 | else: |
| 1253 | self.value = 0 |
| 1254 | return |
| 1255 | |
| 1256 | def pack(self): |
| 1257 | packed = [] |
| 1258 | packed.append(struct.pack("!H", self.type)) |
| 1259 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1260 | packed.append(struct.pack("!L", self.value)) |
| 1261 | length = sum([len(x) for x in packed]) |
| 1262 | packed[1] = struct.pack("!H", length) |
| 1263 | return ''.join(packed) |
| 1264 | |
| 1265 | @staticmethod |
| 1266 | def unpack(reader): |
| 1267 | obj = interval() |
| 1268 | _type = reader.read("!H")[0] |
| 1269 | assert(_type == 58) |
| 1270 | _length = reader.read("!H")[0] |
| 1271 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1272 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1273 | obj.value = reader.read("!L")[0] |
| 1274 | return obj |
| 1275 | |
| 1276 | def __eq__(self, other): |
| 1277 | if type(self) != type(other): return False |
| 1278 | if self.value != other.value: return False |
| 1279 | return True |
| 1280 | |
| 1281 | def pretty_print(self, q): |
| 1282 | q.text("interval {") |
| 1283 | with q.group(): |
| 1284 | with q.indent(2): |
| 1285 | q.breakable() |
| 1286 | q.text("value = "); |
| 1287 | q.text("%#x" % self.value) |
| 1288 | q.breakable() |
| 1289 | q.text('}') |
| 1290 | |
| 1291 | bsn_tlv.subtypes[58] = interval |
| 1292 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1293 | class ipv4(bsn_tlv): |
| 1294 | type = 4 |
| 1295 | |
| 1296 | def __init__(self, value=None): |
| 1297 | if value != None: |
| 1298 | self.value = value |
| 1299 | else: |
| 1300 | self.value = 0 |
| 1301 | return |
| 1302 | |
| 1303 | def pack(self): |
| 1304 | packed = [] |
| 1305 | packed.append(struct.pack("!H", self.type)) |
| 1306 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1307 | packed.append(struct.pack("!L", self.value)) |
| 1308 | length = sum([len(x) for x in packed]) |
| 1309 | packed[1] = struct.pack("!H", length) |
| 1310 | return ''.join(packed) |
| 1311 | |
| 1312 | @staticmethod |
| 1313 | def unpack(reader): |
| 1314 | obj = ipv4() |
| 1315 | _type = reader.read("!H")[0] |
| 1316 | assert(_type == 4) |
| 1317 | _length = reader.read("!H")[0] |
| 1318 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1319 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1320 | obj.value = reader.read("!L")[0] |
| 1321 | return obj |
| 1322 | |
| 1323 | def __eq__(self, other): |
| 1324 | if type(self) != type(other): return False |
| 1325 | if self.value != other.value: return False |
| 1326 | return True |
| 1327 | |
| 1328 | def pretty_print(self, q): |
| 1329 | q.text("ipv4 {") |
| 1330 | with q.group(): |
| 1331 | with q.indent(2): |
| 1332 | q.breakable() |
| 1333 | q.text("value = "); |
| 1334 | q.text(util.pretty_ipv4(self.value)) |
| 1335 | q.breakable() |
| 1336 | q.text('}') |
| 1337 | |
| 1338 | bsn_tlv.subtypes[4] = ipv4 |
| 1339 | |
| 1340 | class ipv4_dst(bsn_tlv): |
| 1341 | type = 35 |
| 1342 | |
| 1343 | def __init__(self, value=None): |
| 1344 | if value != None: |
| 1345 | self.value = value |
| 1346 | else: |
| 1347 | self.value = 0 |
| 1348 | return |
| 1349 | |
| 1350 | def pack(self): |
| 1351 | packed = [] |
| 1352 | packed.append(struct.pack("!H", self.type)) |
| 1353 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1354 | packed.append(struct.pack("!L", self.value)) |
| 1355 | length = sum([len(x) for x in packed]) |
| 1356 | packed[1] = struct.pack("!H", length) |
| 1357 | return ''.join(packed) |
| 1358 | |
| 1359 | @staticmethod |
| 1360 | def unpack(reader): |
| 1361 | obj = ipv4_dst() |
| 1362 | _type = reader.read("!H")[0] |
| 1363 | assert(_type == 35) |
| 1364 | _length = reader.read("!H")[0] |
| 1365 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1366 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1367 | obj.value = reader.read("!L")[0] |
| 1368 | return obj |
| 1369 | |
| 1370 | def __eq__(self, other): |
| 1371 | if type(self) != type(other): return False |
| 1372 | if self.value != other.value: return False |
| 1373 | return True |
| 1374 | |
| 1375 | def pretty_print(self, q): |
| 1376 | q.text("ipv4_dst {") |
| 1377 | with q.group(): |
| 1378 | with q.indent(2): |
| 1379 | q.breakable() |
| 1380 | q.text("value = "); |
| 1381 | q.text(util.pretty_ipv4(self.value)) |
| 1382 | q.breakable() |
| 1383 | q.text('}') |
| 1384 | |
| 1385 | bsn_tlv.subtypes[35] = ipv4_dst |
| 1386 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1387 | class ipv4_netmask(bsn_tlv): |
| 1388 | type = 60 |
| 1389 | |
| 1390 | def __init__(self, value=None): |
| 1391 | if value != None: |
| 1392 | self.value = value |
| 1393 | else: |
| 1394 | self.value = 0 |
| 1395 | return |
| 1396 | |
| 1397 | def pack(self): |
| 1398 | packed = [] |
| 1399 | packed.append(struct.pack("!H", self.type)) |
| 1400 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1401 | packed.append(struct.pack("!L", self.value)) |
| 1402 | length = sum([len(x) for x in packed]) |
| 1403 | packed[1] = struct.pack("!H", length) |
| 1404 | return ''.join(packed) |
| 1405 | |
| 1406 | @staticmethod |
| 1407 | def unpack(reader): |
| 1408 | obj = ipv4_netmask() |
| 1409 | _type = reader.read("!H")[0] |
| 1410 | assert(_type == 60) |
| 1411 | _length = reader.read("!H")[0] |
| 1412 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1413 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1414 | obj.value = reader.read("!L")[0] |
| 1415 | return obj |
| 1416 | |
| 1417 | def __eq__(self, other): |
| 1418 | if type(self) != type(other): return False |
| 1419 | if self.value != other.value: return False |
| 1420 | return True |
| 1421 | |
| 1422 | def pretty_print(self, q): |
| 1423 | q.text("ipv4_netmask {") |
| 1424 | with q.group(): |
| 1425 | with q.indent(2): |
| 1426 | q.breakable() |
| 1427 | q.text("value = "); |
| 1428 | q.text(util.pretty_ipv4(self.value)) |
| 1429 | q.breakable() |
| 1430 | q.text('}') |
| 1431 | |
| 1432 | bsn_tlv.subtypes[60] = ipv4_netmask |
| 1433 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1434 | class ipv4_src(bsn_tlv): |
| 1435 | type = 34 |
| 1436 | |
| 1437 | def __init__(self, value=None): |
| 1438 | if value != None: |
| 1439 | self.value = value |
| 1440 | else: |
| 1441 | self.value = 0 |
| 1442 | return |
| 1443 | |
| 1444 | def pack(self): |
| 1445 | packed = [] |
| 1446 | packed.append(struct.pack("!H", self.type)) |
| 1447 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1448 | packed.append(struct.pack("!L", self.value)) |
| 1449 | length = sum([len(x) for x in packed]) |
| 1450 | packed[1] = struct.pack("!H", length) |
| 1451 | return ''.join(packed) |
| 1452 | |
| 1453 | @staticmethod |
| 1454 | def unpack(reader): |
| 1455 | obj = ipv4_src() |
| 1456 | _type = reader.read("!H")[0] |
| 1457 | assert(_type == 34) |
| 1458 | _length = reader.read("!H")[0] |
| 1459 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1460 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1461 | obj.value = reader.read("!L")[0] |
| 1462 | return obj |
| 1463 | |
| 1464 | def __eq__(self, other): |
| 1465 | if type(self) != type(other): return False |
| 1466 | if self.value != other.value: return False |
| 1467 | return True |
| 1468 | |
| 1469 | def pretty_print(self, q): |
| 1470 | q.text("ipv4_src {") |
| 1471 | with q.group(): |
| 1472 | with q.indent(2): |
| 1473 | q.breakable() |
| 1474 | q.text("value = "); |
| 1475 | q.text(util.pretty_ipv4(self.value)) |
| 1476 | q.breakable() |
| 1477 | q.text('}') |
| 1478 | |
| 1479 | bsn_tlv.subtypes[34] = ipv4_src |
| 1480 | |
| 1481 | class mac(bsn_tlv): |
| 1482 | type = 1 |
| 1483 | |
| 1484 | def __init__(self, value=None): |
| 1485 | if value != None: |
| 1486 | self.value = value |
| 1487 | else: |
| 1488 | self.value = [0,0,0,0,0,0] |
| 1489 | return |
| 1490 | |
| 1491 | def pack(self): |
| 1492 | packed = [] |
| 1493 | packed.append(struct.pack("!H", self.type)) |
| 1494 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1495 | packed.append(struct.pack("!6B", *self.value)) |
| 1496 | length = sum([len(x) for x in packed]) |
| 1497 | packed[1] = struct.pack("!H", length) |
| 1498 | return ''.join(packed) |
| 1499 | |
| 1500 | @staticmethod |
| 1501 | def unpack(reader): |
| 1502 | obj = mac() |
| 1503 | _type = reader.read("!H")[0] |
| 1504 | assert(_type == 1) |
| 1505 | _length = reader.read("!H")[0] |
| 1506 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1507 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1508 | obj.value = list(reader.read('!6B')) |
| 1509 | return obj |
| 1510 | |
| 1511 | def __eq__(self, other): |
| 1512 | if type(self) != type(other): return False |
| 1513 | if self.value != other.value: return False |
| 1514 | return True |
| 1515 | |
| 1516 | def pretty_print(self, q): |
| 1517 | q.text("mac {") |
| 1518 | with q.group(): |
| 1519 | with q.indent(2): |
| 1520 | q.breakable() |
| 1521 | q.text("value = "); |
| 1522 | q.text(util.pretty_mac(self.value)) |
| 1523 | q.breakable() |
| 1524 | q.text('}') |
| 1525 | |
| 1526 | bsn_tlv.subtypes[1] = mac |
| 1527 | |
| 1528 | class mac_mask(bsn_tlv): |
| 1529 | type = 56 |
| 1530 | |
| 1531 | def __init__(self, value=None): |
| 1532 | if value != None: |
| 1533 | self.value = value |
| 1534 | else: |
| 1535 | self.value = [0,0,0,0,0,0] |
| 1536 | return |
| 1537 | |
| 1538 | def pack(self): |
| 1539 | packed = [] |
| 1540 | packed.append(struct.pack("!H", self.type)) |
| 1541 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1542 | packed.append(struct.pack("!6B", *self.value)) |
| 1543 | length = sum([len(x) for x in packed]) |
| 1544 | packed[1] = struct.pack("!H", length) |
| 1545 | return ''.join(packed) |
| 1546 | |
| 1547 | @staticmethod |
| 1548 | def unpack(reader): |
| 1549 | obj = mac_mask() |
| 1550 | _type = reader.read("!H")[0] |
| 1551 | assert(_type == 56) |
| 1552 | _length = reader.read("!H")[0] |
| 1553 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1554 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1555 | obj.value = list(reader.read('!6B')) |
| 1556 | return obj |
| 1557 | |
| 1558 | def __eq__(self, other): |
| 1559 | if type(self) != type(other): return False |
| 1560 | if self.value != other.value: return False |
| 1561 | return True |
| 1562 | |
| 1563 | def pretty_print(self, q): |
| 1564 | q.text("mac_mask {") |
| 1565 | with q.group(): |
| 1566 | with q.indent(2): |
| 1567 | q.breakable() |
| 1568 | q.text("value = "); |
| 1569 | q.text(util.pretty_mac(self.value)) |
| 1570 | q.breakable() |
| 1571 | q.text('}') |
| 1572 | |
| 1573 | bsn_tlv.subtypes[56] = mac_mask |
| 1574 | |
| 1575 | class miss_packets(bsn_tlv): |
| 1576 | type = 13 |
| 1577 | |
| 1578 | def __init__(self, value=None): |
| 1579 | if value != None: |
| 1580 | self.value = value |
| 1581 | else: |
| 1582 | self.value = 0 |
| 1583 | return |
| 1584 | |
| 1585 | def pack(self): |
| 1586 | packed = [] |
| 1587 | packed.append(struct.pack("!H", self.type)) |
| 1588 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1589 | packed.append(struct.pack("!Q", self.value)) |
| 1590 | length = sum([len(x) for x in packed]) |
| 1591 | packed[1] = struct.pack("!H", length) |
| 1592 | return ''.join(packed) |
| 1593 | |
| 1594 | @staticmethod |
| 1595 | def unpack(reader): |
| 1596 | obj = miss_packets() |
| 1597 | _type = reader.read("!H")[0] |
| 1598 | assert(_type == 13) |
| 1599 | _length = reader.read("!H")[0] |
| 1600 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1601 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1602 | obj.value = reader.read("!Q")[0] |
| 1603 | return obj |
| 1604 | |
| 1605 | def __eq__(self, other): |
| 1606 | if type(self) != type(other): return False |
| 1607 | if self.value != other.value: return False |
| 1608 | return True |
| 1609 | |
| 1610 | def pretty_print(self, q): |
| 1611 | q.text("miss_packets {") |
| 1612 | with q.group(): |
| 1613 | with q.indent(2): |
| 1614 | q.breakable() |
| 1615 | q.text("value = "); |
| 1616 | q.text("%#x" % self.value) |
| 1617 | q.breakable() |
| 1618 | q.text('}') |
| 1619 | |
| 1620 | bsn_tlv.subtypes[13] = miss_packets |
| 1621 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1622 | class mpls_control_word(bsn_tlv): |
| 1623 | type = 62 |
| 1624 | |
| 1625 | def __init__(self, value=None): |
| 1626 | if value != None: |
| 1627 | self.value = value |
| 1628 | else: |
| 1629 | self.value = 0 |
| 1630 | return |
| 1631 | |
| 1632 | def pack(self): |
| 1633 | packed = [] |
| 1634 | packed.append(struct.pack("!H", self.type)) |
| 1635 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1636 | packed.append(struct.pack("!B", self.value)) |
| 1637 | length = sum([len(x) for x in packed]) |
| 1638 | packed[1] = struct.pack("!H", length) |
| 1639 | return ''.join(packed) |
| 1640 | |
| 1641 | @staticmethod |
| 1642 | def unpack(reader): |
| 1643 | obj = mpls_control_word() |
| 1644 | _type = reader.read("!H")[0] |
| 1645 | assert(_type == 62) |
| 1646 | _length = reader.read("!H")[0] |
| 1647 | orig_reader = reader |
| 1648 | reader = orig_reader.slice(_length, 4) |
| 1649 | obj.value = reader.read("!B")[0] |
| 1650 | return obj |
| 1651 | |
| 1652 | def __eq__(self, other): |
| 1653 | if type(self) != type(other): return False |
| 1654 | if self.value != other.value: return False |
| 1655 | return True |
| 1656 | |
| 1657 | def pretty_print(self, q): |
| 1658 | q.text("mpls_control_word {") |
| 1659 | with q.group(): |
| 1660 | with q.indent(2): |
| 1661 | q.breakable() |
| 1662 | q.text("value = "); |
| 1663 | q.text("%#x" % self.value) |
| 1664 | q.breakable() |
| 1665 | q.text('}') |
| 1666 | |
| 1667 | bsn_tlv.subtypes[62] = mpls_control_word |
| 1668 | |
| 1669 | class mpls_label(bsn_tlv): |
| 1670 | type = 61 |
| 1671 | |
| 1672 | def __init__(self, value=None): |
| 1673 | if value != None: |
| 1674 | self.value = value |
| 1675 | else: |
| 1676 | self.value = 0 |
| 1677 | return |
| 1678 | |
| 1679 | def pack(self): |
| 1680 | packed = [] |
| 1681 | packed.append(struct.pack("!H", self.type)) |
| 1682 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1683 | packed.append(struct.pack("!L", self.value)) |
| 1684 | length = sum([len(x) for x in packed]) |
| 1685 | packed[1] = struct.pack("!H", length) |
| 1686 | return ''.join(packed) |
| 1687 | |
| 1688 | @staticmethod |
| 1689 | def unpack(reader): |
| 1690 | obj = mpls_label() |
| 1691 | _type = reader.read("!H")[0] |
| 1692 | assert(_type == 61) |
| 1693 | _length = reader.read("!H")[0] |
| 1694 | orig_reader = reader |
| 1695 | reader = orig_reader.slice(_length, 4) |
| 1696 | obj.value = reader.read("!L")[0] |
| 1697 | return obj |
| 1698 | |
| 1699 | def __eq__(self, other): |
| 1700 | if type(self) != type(other): return False |
| 1701 | if self.value != other.value: return False |
| 1702 | return True |
| 1703 | |
| 1704 | def pretty_print(self, q): |
| 1705 | q.text("mpls_label {") |
| 1706 | with q.group(): |
| 1707 | with q.indent(2): |
| 1708 | q.breakable() |
| 1709 | q.text("value = "); |
| 1710 | q.text("%#x" % self.value) |
| 1711 | q.breakable() |
| 1712 | q.text('}') |
| 1713 | |
| 1714 | bsn_tlv.subtypes[61] = mpls_label |
| 1715 | |
| 1716 | class mpls_sequenced(bsn_tlv): |
| 1717 | type = 63 |
| 1718 | |
| 1719 | def __init__(self, value=None): |
| 1720 | if value != None: |
| 1721 | self.value = value |
| 1722 | else: |
| 1723 | self.value = 0 |
| 1724 | return |
| 1725 | |
| 1726 | def pack(self): |
| 1727 | packed = [] |
| 1728 | packed.append(struct.pack("!H", self.type)) |
| 1729 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1730 | packed.append(struct.pack("!B", self.value)) |
| 1731 | length = sum([len(x) for x in packed]) |
| 1732 | packed[1] = struct.pack("!H", length) |
| 1733 | return ''.join(packed) |
| 1734 | |
| 1735 | @staticmethod |
| 1736 | def unpack(reader): |
| 1737 | obj = mpls_sequenced() |
| 1738 | _type = reader.read("!H")[0] |
| 1739 | assert(_type == 63) |
| 1740 | _length = reader.read("!H")[0] |
| 1741 | orig_reader = reader |
| 1742 | reader = orig_reader.slice(_length, 4) |
| 1743 | obj.value = reader.read("!B")[0] |
| 1744 | return obj |
| 1745 | |
| 1746 | def __eq__(self, other): |
| 1747 | if type(self) != type(other): return False |
| 1748 | if self.value != other.value: return False |
| 1749 | return True |
| 1750 | |
| 1751 | def pretty_print(self, q): |
| 1752 | q.text("mpls_sequenced {") |
| 1753 | with q.group(): |
| 1754 | with q.indent(2): |
| 1755 | q.breakable() |
| 1756 | q.text("value = "); |
| 1757 | q.text("%#x" % self.value) |
| 1758 | q.breakable() |
| 1759 | q.text('}') |
| 1760 | |
| 1761 | bsn_tlv.subtypes[63] = mpls_sequenced |
| 1762 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1763 | class name(bsn_tlv): |
| 1764 | type = 52 |
| 1765 | |
| 1766 | def __init__(self, value=None): |
| 1767 | if value != None: |
| 1768 | self.value = value |
| 1769 | else: |
| 1770 | self.value = '' |
| 1771 | return |
| 1772 | |
| 1773 | def pack(self): |
| 1774 | packed = [] |
| 1775 | packed.append(struct.pack("!H", self.type)) |
| 1776 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1777 | packed.append(self.value) |
| 1778 | length = sum([len(x) for x in packed]) |
| 1779 | packed[1] = struct.pack("!H", length) |
| 1780 | return ''.join(packed) |
| 1781 | |
| 1782 | @staticmethod |
| 1783 | def unpack(reader): |
| 1784 | obj = name() |
| 1785 | _type = reader.read("!H")[0] |
| 1786 | assert(_type == 52) |
| 1787 | _length = reader.read("!H")[0] |
| 1788 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1789 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1790 | obj.value = str(reader.read_all()) |
| 1791 | return obj |
| 1792 | |
| 1793 | def __eq__(self, other): |
| 1794 | if type(self) != type(other): return False |
| 1795 | if self.value != other.value: return False |
| 1796 | return True |
| 1797 | |
| 1798 | def pretty_print(self, q): |
| 1799 | q.text("name {") |
| 1800 | with q.group(): |
| 1801 | with q.indent(2): |
| 1802 | q.breakable() |
| 1803 | q.text("value = "); |
| 1804 | q.pp(self.value) |
| 1805 | q.breakable() |
| 1806 | q.text('}') |
| 1807 | |
| 1808 | bsn_tlv.subtypes[52] = name |
| 1809 | |
| 1810 | class partner_key(bsn_tlv): |
| 1811 | type = 51 |
| 1812 | |
| 1813 | def __init__(self, value=None): |
| 1814 | if value != None: |
| 1815 | self.value = value |
| 1816 | else: |
| 1817 | self.value = 0 |
| 1818 | return |
| 1819 | |
| 1820 | def pack(self): |
| 1821 | packed = [] |
| 1822 | packed.append(struct.pack("!H", self.type)) |
| 1823 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1824 | packed.append(struct.pack("!H", self.value)) |
| 1825 | length = sum([len(x) for x in packed]) |
| 1826 | packed[1] = struct.pack("!H", length) |
| 1827 | return ''.join(packed) |
| 1828 | |
| 1829 | @staticmethod |
| 1830 | def unpack(reader): |
| 1831 | obj = partner_key() |
| 1832 | _type = reader.read("!H")[0] |
| 1833 | assert(_type == 51) |
| 1834 | _length = reader.read("!H")[0] |
| 1835 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1836 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1837 | obj.value = reader.read("!H")[0] |
| 1838 | return obj |
| 1839 | |
| 1840 | def __eq__(self, other): |
| 1841 | if type(self) != type(other): return False |
| 1842 | if self.value != other.value: return False |
| 1843 | return True |
| 1844 | |
| 1845 | def pretty_print(self, q): |
| 1846 | q.text("partner_key {") |
| 1847 | with q.group(): |
| 1848 | with q.indent(2): |
| 1849 | q.breakable() |
| 1850 | q.text("value = "); |
| 1851 | q.text("%#x" % self.value) |
| 1852 | q.breakable() |
| 1853 | q.text('}') |
| 1854 | |
| 1855 | bsn_tlv.subtypes[51] = partner_key |
| 1856 | |
| 1857 | class partner_port_num(bsn_tlv): |
| 1858 | type = 50 |
| 1859 | |
| 1860 | def __init__(self, value=None): |
| 1861 | if value != None: |
| 1862 | self.value = value |
| 1863 | else: |
| 1864 | self.value = 0 |
| 1865 | return |
| 1866 | |
| 1867 | def pack(self): |
| 1868 | packed = [] |
| 1869 | packed.append(struct.pack("!H", self.type)) |
| 1870 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1871 | packed.append(struct.pack("!H", self.value)) |
| 1872 | length = sum([len(x) for x in packed]) |
| 1873 | packed[1] = struct.pack("!H", length) |
| 1874 | return ''.join(packed) |
| 1875 | |
| 1876 | @staticmethod |
| 1877 | def unpack(reader): |
| 1878 | obj = partner_port_num() |
| 1879 | _type = reader.read("!H")[0] |
| 1880 | assert(_type == 50) |
| 1881 | _length = reader.read("!H")[0] |
| 1882 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1883 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1884 | obj.value = reader.read("!H")[0] |
| 1885 | return obj |
| 1886 | |
| 1887 | def __eq__(self, other): |
| 1888 | if type(self) != type(other): return False |
| 1889 | if self.value != other.value: return False |
| 1890 | return True |
| 1891 | |
| 1892 | def pretty_print(self, q): |
| 1893 | q.text("partner_port_num {") |
| 1894 | with q.group(): |
| 1895 | with q.indent(2): |
| 1896 | q.breakable() |
| 1897 | q.text("value = "); |
| 1898 | q.text("%#x" % self.value) |
| 1899 | q.breakable() |
| 1900 | q.text('}') |
| 1901 | |
| 1902 | bsn_tlv.subtypes[50] = partner_port_num |
| 1903 | |
| 1904 | class partner_port_priority(bsn_tlv): |
| 1905 | type = 49 |
| 1906 | |
| 1907 | def __init__(self, value=None): |
| 1908 | if value != None: |
| 1909 | self.value = value |
| 1910 | else: |
| 1911 | self.value = 0 |
| 1912 | return |
| 1913 | |
| 1914 | def pack(self): |
| 1915 | packed = [] |
| 1916 | packed.append(struct.pack("!H", self.type)) |
| 1917 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1918 | packed.append(struct.pack("!H", self.value)) |
| 1919 | length = sum([len(x) for x in packed]) |
| 1920 | packed[1] = struct.pack("!H", length) |
| 1921 | return ''.join(packed) |
| 1922 | |
| 1923 | @staticmethod |
| 1924 | def unpack(reader): |
| 1925 | obj = partner_port_priority() |
| 1926 | _type = reader.read("!H")[0] |
| 1927 | assert(_type == 49) |
| 1928 | _length = reader.read("!H")[0] |
| 1929 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1930 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1931 | obj.value = reader.read("!H")[0] |
| 1932 | return obj |
| 1933 | |
| 1934 | def __eq__(self, other): |
| 1935 | if type(self) != type(other): return False |
| 1936 | if self.value != other.value: return False |
| 1937 | return True |
| 1938 | |
| 1939 | def pretty_print(self, q): |
| 1940 | q.text("partner_port_priority {") |
| 1941 | with q.group(): |
| 1942 | with q.indent(2): |
| 1943 | q.breakable() |
| 1944 | q.text("value = "); |
| 1945 | q.text("%#x" % self.value) |
| 1946 | q.breakable() |
| 1947 | q.text('}') |
| 1948 | |
| 1949 | bsn_tlv.subtypes[49] = partner_port_priority |
| 1950 | |
| 1951 | class partner_state(bsn_tlv): |
| 1952 | type = 54 |
| 1953 | |
| 1954 | def __init__(self, value=None): |
| 1955 | if value != None: |
| 1956 | self.value = value |
| 1957 | else: |
| 1958 | self.value = 0 |
| 1959 | return |
| 1960 | |
| 1961 | def pack(self): |
| 1962 | packed = [] |
| 1963 | packed.append(struct.pack("!H", self.type)) |
| 1964 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1965 | packed.append(struct.pack("!B", self.value)) |
| 1966 | length = sum([len(x) for x in packed]) |
| 1967 | packed[1] = struct.pack("!H", length) |
| 1968 | return ''.join(packed) |
| 1969 | |
| 1970 | @staticmethod |
| 1971 | def unpack(reader): |
| 1972 | obj = partner_state() |
| 1973 | _type = reader.read("!H")[0] |
| 1974 | assert(_type == 54) |
| 1975 | _length = reader.read("!H")[0] |
| 1976 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1977 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1978 | obj.value = reader.read("!B")[0] |
| 1979 | return obj |
| 1980 | |
| 1981 | def __eq__(self, other): |
| 1982 | if type(self) != type(other): return False |
| 1983 | if self.value != other.value: return False |
| 1984 | return True |
| 1985 | |
| 1986 | def pretty_print(self, q): |
| 1987 | q.text("partner_state {") |
| 1988 | with q.group(): |
| 1989 | with q.indent(2): |
| 1990 | q.breakable() |
| 1991 | q.text("value = "); |
| 1992 | q.text("%#x" % self.value) |
| 1993 | q.breakable() |
| 1994 | q.text('}') |
| 1995 | |
| 1996 | bsn_tlv.subtypes[54] = partner_state |
| 1997 | |
| 1998 | class partner_system_mac(bsn_tlv): |
| 1999 | type = 48 |
| 2000 | |
| 2001 | def __init__(self, value=None): |
| 2002 | if value != None: |
| 2003 | self.value = value |
| 2004 | else: |
| 2005 | self.value = [0,0,0,0,0,0] |
| 2006 | return |
| 2007 | |
| 2008 | def pack(self): |
| 2009 | packed = [] |
| 2010 | packed.append(struct.pack("!H", self.type)) |
| 2011 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2012 | packed.append(struct.pack("!6B", *self.value)) |
| 2013 | length = sum([len(x) for x in packed]) |
| 2014 | packed[1] = struct.pack("!H", length) |
| 2015 | return ''.join(packed) |
| 2016 | |
| 2017 | @staticmethod |
| 2018 | def unpack(reader): |
| 2019 | obj = partner_system_mac() |
| 2020 | _type = reader.read("!H")[0] |
| 2021 | assert(_type == 48) |
| 2022 | _length = reader.read("!H")[0] |
| 2023 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2024 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2025 | obj.value = list(reader.read('!6B')) |
| 2026 | return obj |
| 2027 | |
| 2028 | def __eq__(self, other): |
| 2029 | if type(self) != type(other): return False |
| 2030 | if self.value != other.value: return False |
| 2031 | return True |
| 2032 | |
| 2033 | def pretty_print(self, q): |
| 2034 | q.text("partner_system_mac {") |
| 2035 | with q.group(): |
| 2036 | with q.indent(2): |
| 2037 | q.breakable() |
| 2038 | q.text("value = "); |
| 2039 | q.text(util.pretty_mac(self.value)) |
| 2040 | q.breakable() |
| 2041 | q.text('}') |
| 2042 | |
| 2043 | bsn_tlv.subtypes[48] = partner_system_mac |
| 2044 | |
| 2045 | class partner_system_priority(bsn_tlv): |
| 2046 | type = 47 |
| 2047 | |
| 2048 | def __init__(self, value=None): |
| 2049 | if value != None: |
| 2050 | self.value = value |
| 2051 | else: |
| 2052 | self.value = 0 |
| 2053 | return |
| 2054 | |
| 2055 | def pack(self): |
| 2056 | packed = [] |
| 2057 | packed.append(struct.pack("!H", self.type)) |
| 2058 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2059 | packed.append(struct.pack("!H", self.value)) |
| 2060 | length = sum([len(x) for x in packed]) |
| 2061 | packed[1] = struct.pack("!H", length) |
| 2062 | return ''.join(packed) |
| 2063 | |
| 2064 | @staticmethod |
| 2065 | def unpack(reader): |
| 2066 | obj = partner_system_priority() |
| 2067 | _type = reader.read("!H")[0] |
| 2068 | assert(_type == 47) |
| 2069 | _length = reader.read("!H")[0] |
| 2070 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2071 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2072 | obj.value = reader.read("!H")[0] |
| 2073 | return obj |
| 2074 | |
| 2075 | def __eq__(self, other): |
| 2076 | if type(self) != type(other): return False |
| 2077 | if self.value != other.value: return False |
| 2078 | return True |
| 2079 | |
| 2080 | def pretty_print(self, q): |
| 2081 | q.text("partner_system_priority {") |
| 2082 | with q.group(): |
| 2083 | with q.indent(2): |
| 2084 | q.breakable() |
| 2085 | q.text("value = "); |
| 2086 | q.text("%#x" % self.value) |
| 2087 | q.breakable() |
| 2088 | q.text('}') |
| 2089 | |
| 2090 | bsn_tlv.subtypes[47] = partner_system_priority |
| 2091 | |
| 2092 | class port(bsn_tlv): |
| 2093 | type = 0 |
| 2094 | |
| 2095 | def __init__(self, value=None): |
| 2096 | if value != None: |
| 2097 | self.value = value |
| 2098 | else: |
| 2099 | self.value = 0 |
| 2100 | return |
| 2101 | |
| 2102 | def pack(self): |
| 2103 | packed = [] |
| 2104 | packed.append(struct.pack("!H", self.type)) |
| 2105 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2106 | packed.append(util.pack_port_no(self.value)) |
| 2107 | length = sum([len(x) for x in packed]) |
| 2108 | packed[1] = struct.pack("!H", length) |
| 2109 | return ''.join(packed) |
| 2110 | |
| 2111 | @staticmethod |
| 2112 | def unpack(reader): |
| 2113 | obj = port() |
| 2114 | _type = reader.read("!H")[0] |
| 2115 | assert(_type == 0) |
| 2116 | _length = reader.read("!H")[0] |
| 2117 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2118 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2119 | obj.value = util.unpack_port_no(reader) |
| 2120 | return obj |
| 2121 | |
| 2122 | def __eq__(self, other): |
| 2123 | if type(self) != type(other): return False |
| 2124 | if self.value != other.value: return False |
| 2125 | return True |
| 2126 | |
| 2127 | def pretty_print(self, q): |
| 2128 | q.text("port {") |
| 2129 | with q.group(): |
| 2130 | with q.indent(2): |
| 2131 | q.breakable() |
| 2132 | q.text("value = "); |
| 2133 | q.text(util.pretty_port(self.value)) |
| 2134 | q.breakable() |
| 2135 | q.text('}') |
| 2136 | |
| 2137 | bsn_tlv.subtypes[0] = port |
| 2138 | |
| 2139 | class priority(bsn_tlv): |
| 2140 | type = 57 |
| 2141 | |
| 2142 | def __init__(self, value=None): |
| 2143 | if value != None: |
| 2144 | self.value = value |
| 2145 | else: |
| 2146 | self.value = 0 |
| 2147 | return |
| 2148 | |
| 2149 | def pack(self): |
| 2150 | packed = [] |
| 2151 | packed.append(struct.pack("!H", self.type)) |
| 2152 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2153 | packed.append(struct.pack("!L", self.value)) |
| 2154 | length = sum([len(x) for x in packed]) |
| 2155 | packed[1] = struct.pack("!H", length) |
| 2156 | return ''.join(packed) |
| 2157 | |
| 2158 | @staticmethod |
| 2159 | def unpack(reader): |
| 2160 | obj = priority() |
| 2161 | _type = reader.read("!H")[0] |
| 2162 | assert(_type == 57) |
| 2163 | _length = reader.read("!H")[0] |
| 2164 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2165 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2166 | obj.value = reader.read("!L")[0] |
| 2167 | return obj |
| 2168 | |
| 2169 | def __eq__(self, other): |
| 2170 | if type(self) != type(other): return False |
| 2171 | if self.value != other.value: return False |
| 2172 | return True |
| 2173 | |
| 2174 | def pretty_print(self, q): |
| 2175 | q.text("priority {") |
| 2176 | with q.group(): |
| 2177 | with q.indent(2): |
| 2178 | q.breakable() |
| 2179 | q.text("value = "); |
| 2180 | q.text("%#x" % self.value) |
| 2181 | q.breakable() |
| 2182 | q.text('}') |
| 2183 | |
| 2184 | bsn_tlv.subtypes[57] = priority |
| 2185 | |
| 2186 | class queue_id(bsn_tlv): |
| 2187 | type = 20 |
| 2188 | |
| 2189 | def __init__(self, value=None): |
| 2190 | if value != None: |
| 2191 | self.value = value |
| 2192 | else: |
| 2193 | self.value = 0 |
| 2194 | return |
| 2195 | |
| 2196 | def pack(self): |
| 2197 | packed = [] |
| 2198 | packed.append(struct.pack("!H", self.type)) |
| 2199 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2200 | packed.append(struct.pack("!L", self.value)) |
| 2201 | length = sum([len(x) for x in packed]) |
| 2202 | packed[1] = struct.pack("!H", length) |
| 2203 | return ''.join(packed) |
| 2204 | |
| 2205 | @staticmethod |
| 2206 | def unpack(reader): |
| 2207 | obj = queue_id() |
| 2208 | _type = reader.read("!H")[0] |
| 2209 | assert(_type == 20) |
| 2210 | _length = reader.read("!H")[0] |
| 2211 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2212 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2213 | obj.value = reader.read("!L")[0] |
| 2214 | return obj |
| 2215 | |
| 2216 | def __eq__(self, other): |
| 2217 | if type(self) != type(other): return False |
| 2218 | if self.value != other.value: return False |
| 2219 | return True |
| 2220 | |
| 2221 | def pretty_print(self, q): |
| 2222 | q.text("queue_id {") |
| 2223 | with q.group(): |
| 2224 | with q.indent(2): |
| 2225 | q.breakable() |
| 2226 | q.text("value = "); |
| 2227 | q.text("%#x" % self.value) |
| 2228 | q.breakable() |
| 2229 | q.text('}') |
| 2230 | |
| 2231 | bsn_tlv.subtypes[20] = queue_id |
| 2232 | |
| 2233 | class queue_weight(bsn_tlv): |
| 2234 | type = 21 |
| 2235 | |
| 2236 | def __init__(self, value=None): |
| 2237 | if value != None: |
| 2238 | self.value = value |
| 2239 | else: |
| 2240 | self.value = 0 |
| 2241 | return |
| 2242 | |
| 2243 | def pack(self): |
| 2244 | packed = [] |
| 2245 | packed.append(struct.pack("!H", self.type)) |
| 2246 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2247 | packed.append(struct.pack("!L", self.value)) |
| 2248 | length = sum([len(x) for x in packed]) |
| 2249 | packed[1] = struct.pack("!H", length) |
| 2250 | return ''.join(packed) |
| 2251 | |
| 2252 | @staticmethod |
| 2253 | def unpack(reader): |
| 2254 | obj = queue_weight() |
| 2255 | _type = reader.read("!H")[0] |
| 2256 | assert(_type == 21) |
| 2257 | _length = reader.read("!H")[0] |
| 2258 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2259 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2260 | obj.value = reader.read("!L")[0] |
| 2261 | return obj |
| 2262 | |
| 2263 | def __eq__(self, other): |
| 2264 | if type(self) != type(other): return False |
| 2265 | if self.value != other.value: return False |
| 2266 | return True |
| 2267 | |
| 2268 | def pretty_print(self, q): |
| 2269 | q.text("queue_weight {") |
| 2270 | with q.group(): |
| 2271 | with q.indent(2): |
| 2272 | q.breakable() |
| 2273 | q.text("value = "); |
| 2274 | q.text("%#x" % self.value) |
| 2275 | q.breakable() |
| 2276 | q.text('}') |
| 2277 | |
| 2278 | bsn_tlv.subtypes[21] = queue_weight |
| 2279 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 2280 | class reference(bsn_tlv): |
| 2281 | type = 59 |
| 2282 | |
| 2283 | def __init__(self, table_id=None, key=None): |
| 2284 | if table_id != None: |
| 2285 | self.table_id = table_id |
| 2286 | else: |
| 2287 | self.table_id = 0 |
| 2288 | if key != None: |
| 2289 | self.key = key |
| 2290 | else: |
| 2291 | self.key = [] |
| 2292 | return |
| 2293 | |
| 2294 | def pack(self): |
| 2295 | packed = [] |
| 2296 | packed.append(struct.pack("!H", self.type)) |
| 2297 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2298 | packed.append(struct.pack("!H", self.table_id)) |
| 2299 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 2300 | length = sum([len(x) for x in packed]) |
| 2301 | packed[1] = struct.pack("!H", length) |
| 2302 | return ''.join(packed) |
| 2303 | |
| 2304 | @staticmethod |
| 2305 | def unpack(reader): |
| 2306 | obj = reference() |
| 2307 | _type = reader.read("!H")[0] |
| 2308 | assert(_type == 59) |
| 2309 | _length = reader.read("!H")[0] |
| 2310 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2311 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 2312 | obj.table_id = reader.read("!H")[0] |
| 2313 | obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 2314 | return obj |
| 2315 | |
| 2316 | def __eq__(self, other): |
| 2317 | if type(self) != type(other): return False |
| 2318 | if self.table_id != other.table_id: return False |
| 2319 | if self.key != other.key: return False |
| 2320 | return True |
| 2321 | |
| 2322 | def pretty_print(self, q): |
| 2323 | q.text("reference {") |
| 2324 | with q.group(): |
| 2325 | with q.indent(2): |
| 2326 | q.breakable() |
| 2327 | q.text("table_id = "); |
| 2328 | q.text("%#x" % self.table_id) |
| 2329 | q.text(","); q.breakable() |
| 2330 | q.text("key = "); |
| 2331 | q.pp(self.key) |
| 2332 | q.breakable() |
| 2333 | q.text('}') |
| 2334 | |
| 2335 | bsn_tlv.subtypes[59] = reference |
| 2336 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2337 | class reply_packets(bsn_tlv): |
| 2338 | type = 12 |
| 2339 | |
| 2340 | def __init__(self, value=None): |
| 2341 | if value != None: |
| 2342 | self.value = value |
| 2343 | else: |
| 2344 | self.value = 0 |
| 2345 | return |
| 2346 | |
| 2347 | def pack(self): |
| 2348 | packed = [] |
| 2349 | packed.append(struct.pack("!H", self.type)) |
| 2350 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2351 | packed.append(struct.pack("!Q", self.value)) |
| 2352 | length = sum([len(x) for x in packed]) |
| 2353 | packed[1] = struct.pack("!H", length) |
| 2354 | return ''.join(packed) |
| 2355 | |
| 2356 | @staticmethod |
| 2357 | def unpack(reader): |
| 2358 | obj = reply_packets() |
| 2359 | _type = reader.read("!H")[0] |
| 2360 | assert(_type == 12) |
| 2361 | _length = reader.read("!H")[0] |
| 2362 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2363 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2364 | obj.value = reader.read("!Q")[0] |
| 2365 | return obj |
| 2366 | |
| 2367 | def __eq__(self, other): |
| 2368 | if type(self) != type(other): return False |
| 2369 | if self.value != other.value: return False |
| 2370 | return True |
| 2371 | |
| 2372 | def pretty_print(self, q): |
| 2373 | q.text("reply_packets {") |
| 2374 | with q.group(): |
| 2375 | with q.indent(2): |
| 2376 | q.breakable() |
| 2377 | q.text("value = "); |
| 2378 | q.text("%#x" % self.value) |
| 2379 | q.breakable() |
| 2380 | q.text('}') |
| 2381 | |
| 2382 | bsn_tlv.subtypes[12] = reply_packets |
| 2383 | |
| 2384 | class request_packets(bsn_tlv): |
| 2385 | type = 11 |
| 2386 | |
| 2387 | def __init__(self, value=None): |
| 2388 | if value != None: |
| 2389 | self.value = value |
| 2390 | else: |
| 2391 | self.value = 0 |
| 2392 | return |
| 2393 | |
| 2394 | def pack(self): |
| 2395 | packed = [] |
| 2396 | packed.append(struct.pack("!H", self.type)) |
| 2397 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2398 | packed.append(struct.pack("!Q", self.value)) |
| 2399 | length = sum([len(x) for x in packed]) |
| 2400 | packed[1] = struct.pack("!H", length) |
| 2401 | return ''.join(packed) |
| 2402 | |
| 2403 | @staticmethod |
| 2404 | def unpack(reader): |
| 2405 | obj = request_packets() |
| 2406 | _type = reader.read("!H")[0] |
| 2407 | assert(_type == 11) |
| 2408 | _length = reader.read("!H")[0] |
| 2409 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2410 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2411 | obj.value = reader.read("!Q")[0] |
| 2412 | return obj |
| 2413 | |
| 2414 | def __eq__(self, other): |
| 2415 | if type(self) != type(other): return False |
| 2416 | if self.value != other.value: return False |
| 2417 | return True |
| 2418 | |
| 2419 | def pretty_print(self, q): |
| 2420 | q.text("request_packets {") |
| 2421 | with q.group(): |
| 2422 | with q.indent(2): |
| 2423 | q.breakable() |
| 2424 | q.text("value = "); |
| 2425 | q.text("%#x" % self.value) |
| 2426 | q.breakable() |
| 2427 | q.text('}') |
| 2428 | |
| 2429 | bsn_tlv.subtypes[11] = request_packets |
| 2430 | |
| 2431 | class rx_packets(bsn_tlv): |
| 2432 | type = 2 |
| 2433 | |
| 2434 | def __init__(self, value=None): |
| 2435 | if value != None: |
| 2436 | self.value = value |
| 2437 | else: |
| 2438 | self.value = 0 |
| 2439 | return |
| 2440 | |
| 2441 | def pack(self): |
| 2442 | packed = [] |
| 2443 | packed.append(struct.pack("!H", self.type)) |
| 2444 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2445 | packed.append(struct.pack("!Q", self.value)) |
| 2446 | length = sum([len(x) for x in packed]) |
| 2447 | packed[1] = struct.pack("!H", length) |
| 2448 | return ''.join(packed) |
| 2449 | |
| 2450 | @staticmethod |
| 2451 | def unpack(reader): |
| 2452 | obj = rx_packets() |
| 2453 | _type = reader.read("!H")[0] |
| 2454 | assert(_type == 2) |
| 2455 | _length = reader.read("!H")[0] |
| 2456 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2457 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2458 | obj.value = reader.read("!Q")[0] |
| 2459 | return obj |
| 2460 | |
| 2461 | def __eq__(self, other): |
| 2462 | if type(self) != type(other): return False |
| 2463 | if self.value != other.value: return False |
| 2464 | return True |
| 2465 | |
| 2466 | def pretty_print(self, q): |
| 2467 | q.text("rx_packets {") |
| 2468 | with q.group(): |
| 2469 | with q.indent(2): |
| 2470 | q.breakable() |
| 2471 | q.text("value = "); |
| 2472 | q.text("%#x" % self.value) |
| 2473 | q.breakable() |
| 2474 | q.text('}') |
| 2475 | |
| 2476 | bsn_tlv.subtypes[2] = rx_packets |
| 2477 | |
| 2478 | class sampling_rate(bsn_tlv): |
| 2479 | type = 30 |
| 2480 | |
| 2481 | def __init__(self, value=None): |
| 2482 | if value != None: |
| 2483 | self.value = value |
| 2484 | else: |
| 2485 | self.value = 0 |
| 2486 | return |
| 2487 | |
| 2488 | def pack(self): |
| 2489 | packed = [] |
| 2490 | packed.append(struct.pack("!H", self.type)) |
| 2491 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2492 | packed.append(struct.pack("!L", self.value)) |
| 2493 | length = sum([len(x) for x in packed]) |
| 2494 | packed[1] = struct.pack("!H", length) |
| 2495 | return ''.join(packed) |
| 2496 | |
| 2497 | @staticmethod |
| 2498 | def unpack(reader): |
| 2499 | obj = sampling_rate() |
| 2500 | _type = reader.read("!H")[0] |
| 2501 | assert(_type == 30) |
| 2502 | _length = reader.read("!H")[0] |
| 2503 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2504 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2505 | obj.value = reader.read("!L")[0] |
| 2506 | return obj |
| 2507 | |
| 2508 | def __eq__(self, other): |
| 2509 | if type(self) != type(other): return False |
| 2510 | if self.value != other.value: return False |
| 2511 | return True |
| 2512 | |
| 2513 | def pretty_print(self, q): |
| 2514 | q.text("sampling_rate {") |
| 2515 | with q.group(): |
| 2516 | with q.indent(2): |
| 2517 | q.breakable() |
| 2518 | q.text("value = "); |
| 2519 | q.text("%#x" % self.value) |
| 2520 | q.breakable() |
| 2521 | q.text('}') |
| 2522 | |
| 2523 | bsn_tlv.subtypes[30] = sampling_rate |
| 2524 | |
| 2525 | class sub_agent_id(bsn_tlv): |
| 2526 | type = 38 |
| 2527 | |
| 2528 | def __init__(self, value=None): |
| 2529 | if value != None: |
| 2530 | self.value = value |
| 2531 | else: |
| 2532 | self.value = 0 |
| 2533 | return |
| 2534 | |
| 2535 | def pack(self): |
| 2536 | packed = [] |
| 2537 | packed.append(struct.pack("!H", self.type)) |
| 2538 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2539 | packed.append(struct.pack("!L", self.value)) |
| 2540 | length = sum([len(x) for x in packed]) |
| 2541 | packed[1] = struct.pack("!H", length) |
| 2542 | return ''.join(packed) |
| 2543 | |
| 2544 | @staticmethod |
| 2545 | def unpack(reader): |
| 2546 | obj = sub_agent_id() |
| 2547 | _type = reader.read("!H")[0] |
| 2548 | assert(_type == 38) |
| 2549 | _length = reader.read("!H")[0] |
| 2550 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2551 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2552 | obj.value = reader.read("!L")[0] |
| 2553 | return obj |
| 2554 | |
| 2555 | def __eq__(self, other): |
| 2556 | if type(self) != type(other): return False |
| 2557 | if self.value != other.value: return False |
| 2558 | return True |
| 2559 | |
| 2560 | def pretty_print(self, q): |
| 2561 | q.text("sub_agent_id {") |
| 2562 | with q.group(): |
| 2563 | with q.indent(2): |
| 2564 | q.breakable() |
| 2565 | q.text("value = "); |
| 2566 | q.text("%#x" % self.value) |
| 2567 | q.breakable() |
| 2568 | q.text('}') |
| 2569 | |
| 2570 | bsn_tlv.subtypes[38] = sub_agent_id |
| 2571 | |
| 2572 | class tx_bytes(bsn_tlv): |
| 2573 | type = 39 |
| 2574 | |
| 2575 | def __init__(self, value=None): |
| 2576 | if value != None: |
| 2577 | self.value = value |
| 2578 | else: |
| 2579 | self.value = 0 |
| 2580 | return |
| 2581 | |
| 2582 | def pack(self): |
| 2583 | packed = [] |
| 2584 | packed.append(struct.pack("!H", self.type)) |
| 2585 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2586 | packed.append(struct.pack("!Q", self.value)) |
| 2587 | length = sum([len(x) for x in packed]) |
| 2588 | packed[1] = struct.pack("!H", length) |
| 2589 | return ''.join(packed) |
| 2590 | |
| 2591 | @staticmethod |
| 2592 | def unpack(reader): |
| 2593 | obj = tx_bytes() |
| 2594 | _type = reader.read("!H")[0] |
| 2595 | assert(_type == 39) |
| 2596 | _length = reader.read("!H")[0] |
| 2597 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2598 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2599 | obj.value = reader.read("!Q")[0] |
| 2600 | return obj |
| 2601 | |
| 2602 | def __eq__(self, other): |
| 2603 | if type(self) != type(other): return False |
| 2604 | if self.value != other.value: return False |
| 2605 | return True |
| 2606 | |
| 2607 | def pretty_print(self, q): |
| 2608 | q.text("tx_bytes {") |
| 2609 | with q.group(): |
| 2610 | with q.indent(2): |
| 2611 | q.breakable() |
| 2612 | q.text("value = "); |
| 2613 | q.text("%#x" % self.value) |
| 2614 | q.breakable() |
| 2615 | q.text('}') |
| 2616 | |
| 2617 | bsn_tlv.subtypes[39] = tx_bytes |
| 2618 | |
| 2619 | class tx_packets(bsn_tlv): |
| 2620 | type = 3 |
| 2621 | |
| 2622 | def __init__(self, value=None): |
| 2623 | if value != None: |
| 2624 | self.value = value |
| 2625 | else: |
| 2626 | self.value = 0 |
| 2627 | return |
| 2628 | |
| 2629 | def pack(self): |
| 2630 | packed = [] |
| 2631 | packed.append(struct.pack("!H", self.type)) |
| 2632 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2633 | packed.append(struct.pack("!Q", self.value)) |
| 2634 | length = sum([len(x) for x in packed]) |
| 2635 | packed[1] = struct.pack("!H", length) |
| 2636 | return ''.join(packed) |
| 2637 | |
| 2638 | @staticmethod |
| 2639 | def unpack(reader): |
| 2640 | obj = tx_packets() |
| 2641 | _type = reader.read("!H")[0] |
| 2642 | assert(_type == 3) |
| 2643 | _length = reader.read("!H")[0] |
| 2644 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2645 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2646 | obj.value = reader.read("!Q")[0] |
| 2647 | return obj |
| 2648 | |
| 2649 | def __eq__(self, other): |
| 2650 | if type(self) != type(other): return False |
| 2651 | if self.value != other.value: return False |
| 2652 | return True |
| 2653 | |
| 2654 | def pretty_print(self, q): |
| 2655 | q.text("tx_packets {") |
| 2656 | with q.group(): |
| 2657 | with q.indent(2): |
| 2658 | q.breakable() |
| 2659 | q.text("value = "); |
| 2660 | q.text("%#x" % self.value) |
| 2661 | q.breakable() |
| 2662 | q.text('}') |
| 2663 | |
| 2664 | bsn_tlv.subtypes[3] = tx_packets |
| 2665 | |
| 2666 | class udf_anchor(bsn_tlv): |
| 2667 | type = 16 |
| 2668 | |
| 2669 | def __init__(self, value=None): |
| 2670 | if value != None: |
| 2671 | self.value = value |
| 2672 | else: |
| 2673 | self.value = 0 |
| 2674 | return |
| 2675 | |
| 2676 | def pack(self): |
| 2677 | packed = [] |
| 2678 | packed.append(struct.pack("!H", self.type)) |
| 2679 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2680 | packed.append(struct.pack("!H", self.value)) |
| 2681 | length = sum([len(x) for x in packed]) |
| 2682 | packed[1] = struct.pack("!H", length) |
| 2683 | return ''.join(packed) |
| 2684 | |
| 2685 | @staticmethod |
| 2686 | def unpack(reader): |
| 2687 | obj = udf_anchor() |
| 2688 | _type = reader.read("!H")[0] |
| 2689 | assert(_type == 16) |
| 2690 | _length = reader.read("!H")[0] |
| 2691 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2692 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2693 | obj.value = reader.read("!H")[0] |
| 2694 | return obj |
| 2695 | |
| 2696 | def __eq__(self, other): |
| 2697 | if type(self) != type(other): return False |
| 2698 | if self.value != other.value: return False |
| 2699 | return True |
| 2700 | |
| 2701 | def pretty_print(self, q): |
| 2702 | q.text("udf_anchor {") |
| 2703 | with q.group(): |
| 2704 | with q.indent(2): |
| 2705 | q.breakable() |
| 2706 | q.text("value = "); |
| 2707 | q.text("%#x" % self.value) |
| 2708 | q.breakable() |
| 2709 | q.text('}') |
| 2710 | |
| 2711 | bsn_tlv.subtypes[16] = udf_anchor |
| 2712 | |
| 2713 | class udf_id(bsn_tlv): |
| 2714 | type = 15 |
| 2715 | |
| 2716 | def __init__(self, value=None): |
| 2717 | if value != None: |
| 2718 | self.value = value |
| 2719 | else: |
| 2720 | self.value = 0 |
| 2721 | return |
| 2722 | |
| 2723 | def pack(self): |
| 2724 | packed = [] |
| 2725 | packed.append(struct.pack("!H", self.type)) |
| 2726 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2727 | packed.append(struct.pack("!H", self.value)) |
| 2728 | length = sum([len(x) for x in packed]) |
| 2729 | packed[1] = struct.pack("!H", length) |
| 2730 | return ''.join(packed) |
| 2731 | |
| 2732 | @staticmethod |
| 2733 | def unpack(reader): |
| 2734 | obj = udf_id() |
| 2735 | _type = reader.read("!H")[0] |
| 2736 | assert(_type == 15) |
| 2737 | _length = reader.read("!H")[0] |
| 2738 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2739 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2740 | obj.value = reader.read("!H")[0] |
| 2741 | return obj |
| 2742 | |
| 2743 | def __eq__(self, other): |
| 2744 | if type(self) != type(other): return False |
| 2745 | if self.value != other.value: return False |
| 2746 | return True |
| 2747 | |
| 2748 | def pretty_print(self, q): |
| 2749 | q.text("udf_id {") |
| 2750 | with q.group(): |
| 2751 | with q.indent(2): |
| 2752 | q.breakable() |
| 2753 | q.text("value = "); |
| 2754 | q.text("%#x" % self.value) |
| 2755 | q.breakable() |
| 2756 | q.text('}') |
| 2757 | |
| 2758 | bsn_tlv.subtypes[15] = udf_id |
| 2759 | |
| 2760 | class udf_length(bsn_tlv): |
| 2761 | type = 18 |
| 2762 | |
| 2763 | def __init__(self, value=None): |
| 2764 | if value != None: |
| 2765 | self.value = value |
| 2766 | else: |
| 2767 | self.value = 0 |
| 2768 | return |
| 2769 | |
| 2770 | def pack(self): |
| 2771 | packed = [] |
| 2772 | packed.append(struct.pack("!H", self.type)) |
| 2773 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2774 | packed.append(struct.pack("!H", self.value)) |
| 2775 | length = sum([len(x) for x in packed]) |
| 2776 | packed[1] = struct.pack("!H", length) |
| 2777 | return ''.join(packed) |
| 2778 | |
| 2779 | @staticmethod |
| 2780 | def unpack(reader): |
| 2781 | obj = udf_length() |
| 2782 | _type = reader.read("!H")[0] |
| 2783 | assert(_type == 18) |
| 2784 | _length = reader.read("!H")[0] |
| 2785 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2786 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2787 | obj.value = reader.read("!H")[0] |
| 2788 | return obj |
| 2789 | |
| 2790 | def __eq__(self, other): |
| 2791 | if type(self) != type(other): return False |
| 2792 | if self.value != other.value: return False |
| 2793 | return True |
| 2794 | |
| 2795 | def pretty_print(self, q): |
| 2796 | q.text("udf_length {") |
| 2797 | with q.group(): |
| 2798 | with q.indent(2): |
| 2799 | q.breakable() |
| 2800 | q.text("value = "); |
| 2801 | q.text("%#x" % self.value) |
| 2802 | q.breakable() |
| 2803 | q.text('}') |
| 2804 | |
| 2805 | bsn_tlv.subtypes[18] = udf_length |
| 2806 | |
| 2807 | class udf_offset(bsn_tlv): |
| 2808 | type = 17 |
| 2809 | |
| 2810 | def __init__(self, value=None): |
| 2811 | if value != None: |
| 2812 | self.value = value |
| 2813 | else: |
| 2814 | self.value = 0 |
| 2815 | return |
| 2816 | |
| 2817 | def pack(self): |
| 2818 | packed = [] |
| 2819 | packed.append(struct.pack("!H", self.type)) |
| 2820 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2821 | packed.append(struct.pack("!H", self.value)) |
| 2822 | length = sum([len(x) for x in packed]) |
| 2823 | packed[1] = struct.pack("!H", length) |
| 2824 | return ''.join(packed) |
| 2825 | |
| 2826 | @staticmethod |
| 2827 | def unpack(reader): |
| 2828 | obj = udf_offset() |
| 2829 | _type = reader.read("!H")[0] |
| 2830 | assert(_type == 17) |
| 2831 | _length = reader.read("!H")[0] |
| 2832 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2833 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2834 | obj.value = reader.read("!H")[0] |
| 2835 | return obj |
| 2836 | |
| 2837 | def __eq__(self, other): |
| 2838 | if type(self) != type(other): return False |
| 2839 | if self.value != other.value: return False |
| 2840 | return True |
| 2841 | |
| 2842 | def pretty_print(self, q): |
| 2843 | q.text("udf_offset {") |
| 2844 | with q.group(): |
| 2845 | with q.indent(2): |
| 2846 | q.breakable() |
| 2847 | q.text("value = "); |
| 2848 | q.text("%#x" % self.value) |
| 2849 | q.breakable() |
| 2850 | q.text('}') |
| 2851 | |
| 2852 | bsn_tlv.subtypes[17] = udf_offset |
| 2853 | |
| 2854 | class udp_dst(bsn_tlv): |
| 2855 | type = 37 |
| 2856 | |
| 2857 | def __init__(self, value=None): |
| 2858 | if value != None: |
| 2859 | self.value = value |
| 2860 | else: |
| 2861 | self.value = 0 |
| 2862 | return |
| 2863 | |
| 2864 | def pack(self): |
| 2865 | packed = [] |
| 2866 | packed.append(struct.pack("!H", self.type)) |
| 2867 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2868 | packed.append(struct.pack("!H", self.value)) |
| 2869 | length = sum([len(x) for x in packed]) |
| 2870 | packed[1] = struct.pack("!H", length) |
| 2871 | return ''.join(packed) |
| 2872 | |
| 2873 | @staticmethod |
| 2874 | def unpack(reader): |
| 2875 | obj = udp_dst() |
| 2876 | _type = reader.read("!H")[0] |
| 2877 | assert(_type == 37) |
| 2878 | _length = reader.read("!H")[0] |
| 2879 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2880 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2881 | obj.value = reader.read("!H")[0] |
| 2882 | return obj |
| 2883 | |
| 2884 | def __eq__(self, other): |
| 2885 | if type(self) != type(other): return False |
| 2886 | if self.value != other.value: return False |
| 2887 | return True |
| 2888 | |
| 2889 | def pretty_print(self, q): |
| 2890 | q.text("udp_dst {") |
| 2891 | with q.group(): |
| 2892 | with q.indent(2): |
| 2893 | q.breakable() |
| 2894 | q.text("value = "); |
| 2895 | q.text("%#x" % self.value) |
| 2896 | q.breakable() |
| 2897 | q.text('}') |
| 2898 | |
| 2899 | bsn_tlv.subtypes[37] = udp_dst |
| 2900 | |
| 2901 | class udp_src(bsn_tlv): |
| 2902 | type = 36 |
| 2903 | |
| 2904 | def __init__(self, value=None): |
| 2905 | if value != None: |
| 2906 | self.value = value |
| 2907 | else: |
| 2908 | self.value = 0 |
| 2909 | return |
| 2910 | |
| 2911 | def pack(self): |
| 2912 | packed = [] |
| 2913 | packed.append(struct.pack("!H", self.type)) |
| 2914 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2915 | packed.append(struct.pack("!H", self.value)) |
| 2916 | length = sum([len(x) for x in packed]) |
| 2917 | packed[1] = struct.pack("!H", length) |
| 2918 | return ''.join(packed) |
| 2919 | |
| 2920 | @staticmethod |
| 2921 | def unpack(reader): |
| 2922 | obj = udp_src() |
| 2923 | _type = reader.read("!H")[0] |
| 2924 | assert(_type == 36) |
| 2925 | _length = reader.read("!H")[0] |
| 2926 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2927 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2928 | obj.value = reader.read("!H")[0] |
| 2929 | return obj |
| 2930 | |
| 2931 | def __eq__(self, other): |
| 2932 | if type(self) != type(other): return False |
| 2933 | if self.value != other.value: return False |
| 2934 | return True |
| 2935 | |
| 2936 | def pretty_print(self, q): |
| 2937 | q.text("udp_src {") |
| 2938 | with q.group(): |
| 2939 | with q.indent(2): |
| 2940 | q.breakable() |
| 2941 | q.text("value = "); |
| 2942 | q.text("%#x" % self.value) |
| 2943 | q.breakable() |
| 2944 | q.text('}') |
| 2945 | |
| 2946 | bsn_tlv.subtypes[36] = udp_src |
| 2947 | |
| 2948 | class unicast_query_timeout(bsn_tlv): |
| 2949 | type = 9 |
| 2950 | |
| 2951 | def __init__(self, value=None): |
| 2952 | if value != None: |
| 2953 | self.value = value |
| 2954 | else: |
| 2955 | self.value = 0 |
| 2956 | return |
| 2957 | |
| 2958 | def pack(self): |
| 2959 | packed = [] |
| 2960 | packed.append(struct.pack("!H", self.type)) |
| 2961 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2962 | packed.append(struct.pack("!L", self.value)) |
| 2963 | length = sum([len(x) for x in packed]) |
| 2964 | packed[1] = struct.pack("!H", length) |
| 2965 | return ''.join(packed) |
| 2966 | |
| 2967 | @staticmethod |
| 2968 | def unpack(reader): |
| 2969 | obj = unicast_query_timeout() |
| 2970 | _type = reader.read("!H")[0] |
| 2971 | assert(_type == 9) |
| 2972 | _length = reader.read("!H")[0] |
| 2973 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2974 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2975 | obj.value = reader.read("!L")[0] |
| 2976 | return obj |
| 2977 | |
| 2978 | def __eq__(self, other): |
| 2979 | if type(self) != type(other): return False |
| 2980 | if self.value != other.value: return False |
| 2981 | return True |
| 2982 | |
| 2983 | def pretty_print(self, q): |
| 2984 | q.text("unicast_query_timeout {") |
| 2985 | with q.group(): |
| 2986 | with q.indent(2): |
| 2987 | q.breakable() |
| 2988 | q.text("value = "); |
| 2989 | q.text("%#x" % self.value) |
| 2990 | q.breakable() |
| 2991 | q.text('}') |
| 2992 | |
| 2993 | bsn_tlv.subtypes[9] = unicast_query_timeout |
| 2994 | |
| 2995 | class vlan_vid(bsn_tlv): |
| 2996 | type = 6 |
| 2997 | |
| 2998 | def __init__(self, value=None): |
| 2999 | if value != None: |
| 3000 | self.value = value |
| 3001 | else: |
| 3002 | self.value = 0 |
| 3003 | return |
| 3004 | |
| 3005 | def pack(self): |
| 3006 | packed = [] |
| 3007 | packed.append(struct.pack("!H", self.type)) |
| 3008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3009 | packed.append(struct.pack("!H", self.value)) |
| 3010 | length = sum([len(x) for x in packed]) |
| 3011 | packed[1] = struct.pack("!H", length) |
| 3012 | return ''.join(packed) |
| 3013 | |
| 3014 | @staticmethod |
| 3015 | def unpack(reader): |
| 3016 | obj = vlan_vid() |
| 3017 | _type = reader.read("!H")[0] |
| 3018 | assert(_type == 6) |
| 3019 | _length = reader.read("!H")[0] |
| 3020 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3021 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3022 | obj.value = reader.read("!H")[0] |
| 3023 | return obj |
| 3024 | |
| 3025 | def __eq__(self, other): |
| 3026 | if type(self) != type(other): return False |
| 3027 | if self.value != other.value: return False |
| 3028 | return True |
| 3029 | |
| 3030 | def pretty_print(self, q): |
| 3031 | q.text("vlan_vid {") |
| 3032 | with q.group(): |
| 3033 | with q.indent(2): |
| 3034 | q.breakable() |
| 3035 | q.text("value = "); |
| 3036 | q.text("%#x" % self.value) |
| 3037 | q.breakable() |
| 3038 | q.text('}') |
| 3039 | |
| 3040 | bsn_tlv.subtypes[6] = vlan_vid |
| 3041 | |
| 3042 | class vrf(bsn_tlv): |
| 3043 | type = 19 |
| 3044 | |
| 3045 | def __init__(self, value=None): |
| 3046 | if value != None: |
| 3047 | self.value = value |
| 3048 | else: |
| 3049 | self.value = 0 |
| 3050 | return |
| 3051 | |
| 3052 | def pack(self): |
| 3053 | packed = [] |
| 3054 | packed.append(struct.pack("!H", self.type)) |
| 3055 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3056 | packed.append(struct.pack("!L", self.value)) |
| 3057 | length = sum([len(x) for x in packed]) |
| 3058 | packed[1] = struct.pack("!H", length) |
| 3059 | return ''.join(packed) |
| 3060 | |
| 3061 | @staticmethod |
| 3062 | def unpack(reader): |
| 3063 | obj = vrf() |
| 3064 | _type = reader.read("!H")[0] |
| 3065 | assert(_type == 19) |
| 3066 | _length = reader.read("!H")[0] |
| 3067 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3068 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3069 | obj.value = reader.read("!L")[0] |
| 3070 | return obj |
| 3071 | |
| 3072 | def __eq__(self, other): |
| 3073 | if type(self) != type(other): return False |
| 3074 | if self.value != other.value: return False |
| 3075 | return True |
| 3076 | |
| 3077 | def pretty_print(self, q): |
| 3078 | q.text("vrf {") |
| 3079 | with q.group(): |
| 3080 | with q.indent(2): |
| 3081 | q.breakable() |
| 3082 | q.text("value = "); |
| 3083 | q.text("%#x" % self.value) |
| 3084 | q.breakable() |
| 3085 | q.text('}') |
| 3086 | |
| 3087 | bsn_tlv.subtypes[19] = vrf |
| 3088 | |
| 3089 | |