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