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 | |
| 212 | class actor_system_mac(bsn_tlv): |
| 213 | type = 41 |
| 214 | |
| 215 | def __init__(self, value=None): |
| 216 | if value != None: |
| 217 | self.value = value |
| 218 | else: |
| 219 | self.value = [0,0,0,0,0,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("!6B", *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_system_mac() |
| 234 | _type = reader.read("!H")[0] |
| 235 | assert(_type == 41) |
| 236 | _length = reader.read("!H")[0] |
| 237 | orig_reader = reader |
| 238 | reader = orig_reader.slice(_length - (2 + 2)) |
| 239 | obj.value = list(reader.read('!6B')) |
| 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_system_mac {") |
| 249 | with q.group(): |
| 250 | with q.indent(2): |
| 251 | q.breakable() |
| 252 | q.text("value = "); |
| 253 | q.text(util.pretty_mac(self.value)) |
| 254 | q.breakable() |
| 255 | q.text('}') |
| 256 | |
| 257 | bsn_tlv.subtypes[41] = actor_system_mac |
| 258 | |
| 259 | class actor_system_priority(bsn_tlv): |
| 260 | type = 40 |
| 261 | |
| 262 | def __init__(self, value=None): |
| 263 | if value != None: |
| 264 | self.value = value |
| 265 | else: |
| 266 | self.value = 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("!H", 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_priority() |
| 281 | _type = reader.read("!H")[0] |
| 282 | assert(_type == 40) |
| 283 | _length = reader.read("!H")[0] |
| 284 | orig_reader = reader |
| 285 | reader = orig_reader.slice(_length - (2 + 2)) |
| 286 | obj.value = reader.read("!H")[0] |
| 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_priority {") |
| 296 | with q.group(): |
| 297 | with q.indent(2): |
| 298 | q.breakable() |
| 299 | q.text("value = "); |
| 300 | q.text("%#x" % self.value) |
| 301 | q.breakable() |
| 302 | q.text('}') |
| 303 | |
| 304 | bsn_tlv.subtypes[40] = actor_system_priority |
| 305 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 306 | class broadcast_query_timeout(bsn_tlv): |
| 307 | type = 10 |
| 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("!L", 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 = broadcast_query_timeout() |
| 328 | _type = reader.read("!H")[0] |
| 329 | assert(_type == 10) |
| 330 | _length = reader.read("!H")[0] |
| 331 | orig_reader = reader |
| 332 | reader = orig_reader.slice(_length - (2 + 2)) |
| 333 | obj.value = reader.read("!L")[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("broadcast_query_timeout {") |
| 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[10] = broadcast_query_timeout |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 352 | |
Rich Lane | 1b75abf | 2014-02-05 11:23:20 -0800 | [diff] [blame] | 353 | class circuit_id(bsn_tlv): |
| 354 | type = 14 |
| 355 | |
| 356 | def __init__(self, value=None): |
| 357 | if value != None: |
| 358 | self.value = value |
| 359 | else: |
| 360 | self.value = '' |
| 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(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 = circuit_id() |
| 375 | _type = reader.read("!H")[0] |
| 376 | assert(_type == 14) |
| 377 | _length = reader.read("!H")[0] |
| 378 | orig_reader = reader |
| 379 | reader = orig_reader.slice(_length - (2 + 2)) |
| 380 | obj.value = str(reader.read_all()) |
| 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("circuit_id {") |
| 390 | with q.group(): |
| 391 | with q.indent(2): |
| 392 | q.breakable() |
| 393 | q.text("value = "); |
| 394 | q.pp(self.value) |
| 395 | q.breakable() |
| 396 | q.text('}') |
| 397 | |
| 398 | bsn_tlv.subtypes[14] = circuit_id |
| 399 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 400 | class convergence_status(bsn_tlv): |
| 401 | type = 45 |
| 402 | |
| 403 | def __init__(self, value=None): |
| 404 | if value != None: |
| 405 | self.value = value |
| 406 | else: |
| 407 | self.value = 0 |
| 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(struct.pack("!B", 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 = convergence_status() |
| 422 | _type = reader.read("!H")[0] |
| 423 | assert(_type == 45) |
| 424 | _length = reader.read("!H")[0] |
| 425 | orig_reader = reader |
| 426 | reader = orig_reader.slice(_length - (2 + 2)) |
| 427 | obj.value = reader.read("!B")[0] |
| 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("convergence_status {") |
| 437 | with q.group(): |
| 438 | with q.indent(2): |
| 439 | q.breakable() |
| 440 | q.text("value = "); |
| 441 | q.text("%#x" % self.value) |
| 442 | q.breakable() |
| 443 | q.text('}') |
| 444 | |
| 445 | bsn_tlv.subtypes[45] = convergence_status |
| 446 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 447 | class crc_enabled(bsn_tlv): |
| 448 | type = 22 |
| 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 = crc_enabled() |
| 469 | _type = reader.read("!H")[0] |
| 470 | assert(_type == 22) |
| 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("crc_enabled {") |
| 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[22] = crc_enabled |
| 493 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 494 | class eth_dst(bsn_tlv): |
| 495 | type = 33 |
| 496 | |
| 497 | def __init__(self, value=None): |
| 498 | if value != None: |
| 499 | self.value = value |
| 500 | else: |
| 501 | self.value = [0,0,0,0,0,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("!6B", *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 = eth_dst() |
| 516 | _type = reader.read("!H")[0] |
| 517 | assert(_type == 33) |
| 518 | _length = reader.read("!H")[0] |
| 519 | orig_reader = reader |
| 520 | reader = orig_reader.slice(_length - (2 + 2)) |
| 521 | obj.value = list(reader.read('!6B')) |
| 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("eth_dst {") |
| 531 | with q.group(): |
| 532 | with q.indent(2): |
| 533 | q.breakable() |
| 534 | q.text("value = "); |
| 535 | q.text(util.pretty_mac(self.value)) |
| 536 | q.breakable() |
| 537 | q.text('}') |
| 538 | |
| 539 | bsn_tlv.subtypes[33] = eth_dst |
| 540 | |
| 541 | class eth_src(bsn_tlv): |
| 542 | type = 32 |
| 543 | |
| 544 | def __init__(self, value=None): |
| 545 | if value != None: |
| 546 | self.value = value |
| 547 | else: |
| 548 | self.value = [0,0,0,0,0,0] |
| 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(struct.pack("!6B", *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 = eth_src() |
| 563 | _type = reader.read("!H")[0] |
| 564 | assert(_type == 32) |
| 565 | _length = reader.read("!H")[0] |
| 566 | orig_reader = reader |
| 567 | reader = orig_reader.slice(_length - (2 + 2)) |
| 568 | obj.value = list(reader.read('!6B')) |
| 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("eth_src {") |
| 578 | with q.group(): |
| 579 | with q.indent(2): |
| 580 | q.breakable() |
| 581 | q.text("value = "); |
| 582 | q.text(util.pretty_mac(self.value)) |
| 583 | q.breakable() |
| 584 | q.text('}') |
| 585 | |
| 586 | bsn_tlv.subtypes[32] = eth_src |
| 587 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 588 | class external_gateway_ip(bsn_tlv): |
| 589 | type = 26 |
| 590 | |
| 591 | def __init__(self, value=None): |
| 592 | if value != None: |
| 593 | self.value = value |
| 594 | else: |
| 595 | self.value = 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("!L", 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 = external_gateway_ip() |
| 610 | _type = reader.read("!H")[0] |
| 611 | assert(_type == 26) |
| 612 | _length = reader.read("!H")[0] |
| 613 | orig_reader = reader |
| 614 | reader = orig_reader.slice(_length - (2 + 2)) |
| 615 | obj.value = reader.read("!L")[0] |
| 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("external_gateway_ip {") |
| 625 | with q.group(): |
| 626 | with q.indent(2): |
| 627 | q.breakable() |
| 628 | q.text("value = "); |
| 629 | q.text(util.pretty_ipv4(self.value)) |
| 630 | q.breakable() |
| 631 | q.text('}') |
| 632 | |
| 633 | bsn_tlv.subtypes[26] = external_gateway_ip |
| 634 | |
Rich Lane | 18ec535 | 2014-10-02 09:09:17 -0700 | [diff] [blame] | 635 | class external_gateway_mac(bsn_tlv): |
| 636 | type = 29 |
| 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 = external_gateway_mac() |
| 657 | _type = reader.read("!H")[0] |
| 658 | assert(_type == 29) |
| 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("external_gateway_mac {") |
| 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[29] = external_gateway_mac |
| 681 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 682 | class external_ip(bsn_tlv): |
| 683 | type = 23 |
| 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_ip() |
| 704 | _type = reader.read("!H")[0] |
| 705 | assert(_type == 23) |
| 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_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[23] = external_ip |
| 728 | |
| 729 | class external_mac(bsn_tlv): |
| 730 | type = 24 |
| 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_mac() |
| 751 | _type = reader.read("!H")[0] |
| 752 | assert(_type == 24) |
| 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_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[24] = external_mac |
| 775 | |
| 776 | class external_netmask(bsn_tlv): |
| 777 | type = 25 |
| 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_netmask() |
| 798 | _type = reader.read("!H")[0] |
| 799 | assert(_type == 25) |
| 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_netmask {") |
| 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[25] = external_netmask |
| 822 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 823 | class header_size(bsn_tlv): |
| 824 | type = 31 |
| 825 | |
| 826 | def __init__(self, value=None): |
| 827 | if value != None: |
| 828 | self.value = value |
| 829 | else: |
| 830 | self.value = 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("!L", 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 = header_size() |
| 845 | _type = reader.read("!H")[0] |
| 846 | assert(_type == 31) |
| 847 | _length = reader.read("!H")[0] |
| 848 | orig_reader = reader |
| 849 | reader = orig_reader.slice(_length - (2 + 2)) |
| 850 | obj.value = reader.read("!L")[0] |
| 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("header_size {") |
| 860 | with q.group(): |
| 861 | with q.indent(2): |
| 862 | q.breakable() |
| 863 | q.text("value = "); |
| 864 | q.text("%#x" % self.value) |
| 865 | q.breakable() |
| 866 | q.text('}') |
| 867 | |
| 868 | bsn_tlv.subtypes[31] = header_size |
| 869 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 870 | class idle_notification(bsn_tlv): |
| 871 | type = 7 |
| 872 | |
| 873 | def __init__(self): |
| 874 | return |
| 875 | |
| 876 | def pack(self): |
| 877 | packed = [] |
| 878 | packed.append(struct.pack("!H", self.type)) |
| 879 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 880 | length = sum([len(x) for x in packed]) |
| 881 | packed[1] = struct.pack("!H", length) |
| 882 | return ''.join(packed) |
| 883 | |
| 884 | @staticmethod |
| 885 | def unpack(reader): |
| 886 | obj = idle_notification() |
| 887 | _type = reader.read("!H")[0] |
| 888 | assert(_type == 7) |
| 889 | _length = reader.read("!H")[0] |
| 890 | orig_reader = reader |
| 891 | reader = orig_reader.slice(_length - (2 + 2)) |
| 892 | return obj |
| 893 | |
| 894 | def __eq__(self, other): |
| 895 | if type(self) != type(other): return False |
| 896 | return True |
| 897 | |
| 898 | def pretty_print(self, q): |
| 899 | q.text("idle_notification {") |
| 900 | with q.group(): |
| 901 | with q.indent(2): |
| 902 | q.breakable() |
| 903 | q.breakable() |
| 904 | q.text('}') |
| 905 | |
| 906 | bsn_tlv.subtypes[7] = idle_notification |
| 907 | |
| 908 | class idle_time(bsn_tlv): |
| 909 | type = 5 |
| 910 | |
| 911 | def __init__(self, value=None): |
| 912 | if value != None: |
| 913 | self.value = value |
| 914 | else: |
| 915 | self.value = 0 |
| 916 | return |
| 917 | |
| 918 | def pack(self): |
| 919 | packed = [] |
| 920 | packed.append(struct.pack("!H", self.type)) |
| 921 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 922 | packed.append(struct.pack("!Q", self.value)) |
| 923 | length = sum([len(x) for x in packed]) |
| 924 | packed[1] = struct.pack("!H", length) |
| 925 | return ''.join(packed) |
| 926 | |
| 927 | @staticmethod |
| 928 | def unpack(reader): |
| 929 | obj = idle_time() |
| 930 | _type = reader.read("!H")[0] |
| 931 | assert(_type == 5) |
| 932 | _length = reader.read("!H")[0] |
| 933 | orig_reader = reader |
| 934 | reader = orig_reader.slice(_length - (2 + 2)) |
| 935 | obj.value = reader.read("!Q")[0] |
| 936 | return obj |
| 937 | |
| 938 | def __eq__(self, other): |
| 939 | if type(self) != type(other): return False |
| 940 | if self.value != other.value: return False |
| 941 | return True |
| 942 | |
| 943 | def pretty_print(self, q): |
| 944 | q.text("idle_time {") |
| 945 | with q.group(): |
| 946 | with q.indent(2): |
| 947 | q.breakable() |
| 948 | q.text("value = "); |
| 949 | q.text("%#x" % self.value) |
| 950 | q.breakable() |
| 951 | q.text('}') |
| 952 | |
| 953 | bsn_tlv.subtypes[5] = idle_time |
| 954 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 955 | class idle_timeout(bsn_tlv): |
| 956 | type = 8 |
| 957 | |
| 958 | def __init__(self, value=None): |
| 959 | if value != None: |
| 960 | self.value = value |
| 961 | else: |
| 962 | self.value = 0 |
| 963 | return |
| 964 | |
| 965 | def pack(self): |
| 966 | packed = [] |
| 967 | packed.append(struct.pack("!H", self.type)) |
| 968 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 969 | packed.append(struct.pack("!L", self.value)) |
| 970 | length = sum([len(x) for x in packed]) |
| 971 | packed[1] = struct.pack("!H", length) |
| 972 | return ''.join(packed) |
| 973 | |
| 974 | @staticmethod |
| 975 | def unpack(reader): |
| 976 | obj = idle_timeout() |
| 977 | _type = reader.read("!H")[0] |
| 978 | assert(_type == 8) |
| 979 | _length = reader.read("!H")[0] |
| 980 | orig_reader = reader |
| 981 | reader = orig_reader.slice(_length - (2 + 2)) |
| 982 | obj.value = reader.read("!L")[0] |
| 983 | return obj |
| 984 | |
| 985 | def __eq__(self, other): |
| 986 | if type(self) != type(other): return False |
| 987 | if self.value != other.value: return False |
| 988 | return True |
| 989 | |
| 990 | def pretty_print(self, q): |
| 991 | q.text("idle_timeout {") |
| 992 | with q.group(): |
| 993 | with q.indent(2): |
| 994 | q.breakable() |
| 995 | q.text("value = "); |
| 996 | q.text("%#x" % self.value) |
| 997 | q.breakable() |
| 998 | q.text('}') |
| 999 | |
| 1000 | bsn_tlv.subtypes[8] = idle_timeout |
| 1001 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 1002 | class internal_gateway_mac(bsn_tlv): |
| 1003 | type = 28 |
| 1004 | |
| 1005 | def __init__(self, value=None): |
| 1006 | if value != None: |
| 1007 | self.value = value |
| 1008 | else: |
| 1009 | self.value = [0,0,0,0,0,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("!6B", *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 = internal_gateway_mac() |
| 1024 | _type = reader.read("!H")[0] |
| 1025 | assert(_type == 28) |
| 1026 | _length = reader.read("!H")[0] |
| 1027 | orig_reader = reader |
| 1028 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1029 | obj.value = list(reader.read('!6B')) |
| 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("internal_gateway_mac {") |
| 1039 | with q.group(): |
| 1040 | with q.indent(2): |
| 1041 | q.breakable() |
| 1042 | q.text("value = "); |
| 1043 | q.text(util.pretty_mac(self.value)) |
| 1044 | q.breakable() |
| 1045 | q.text('}') |
| 1046 | |
| 1047 | bsn_tlv.subtypes[28] = internal_gateway_mac |
| 1048 | |
| 1049 | class internal_mac(bsn_tlv): |
| 1050 | type = 27 |
| 1051 | |
| 1052 | def __init__(self, value=None): |
| 1053 | if value != None: |
| 1054 | self.value = value |
| 1055 | else: |
| 1056 | self.value = [0,0,0,0,0,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("!6B", *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 = internal_mac() |
| 1071 | _type = reader.read("!H")[0] |
| 1072 | assert(_type == 27) |
| 1073 | _length = reader.read("!H")[0] |
| 1074 | orig_reader = reader |
| 1075 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1076 | obj.value = list(reader.read('!6B')) |
| 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("internal_mac {") |
| 1086 | with q.group(): |
| 1087 | with q.indent(2): |
| 1088 | q.breakable() |
| 1089 | q.text("value = "); |
| 1090 | q.text(util.pretty_mac(self.value)) |
| 1091 | q.breakable() |
| 1092 | q.text('}') |
| 1093 | |
| 1094 | bsn_tlv.subtypes[27] = internal_mac |
| 1095 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1096 | class ipv4(bsn_tlv): |
| 1097 | type = 4 |
| 1098 | |
| 1099 | def __init__(self, value=None): |
| 1100 | if value != None: |
| 1101 | self.value = value |
| 1102 | else: |
| 1103 | self.value = 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("!L", 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 = ipv4() |
| 1118 | _type = reader.read("!H")[0] |
| 1119 | assert(_type == 4) |
| 1120 | _length = reader.read("!H")[0] |
| 1121 | orig_reader = reader |
| 1122 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1123 | obj.value = reader.read("!L")[0] |
| 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("ipv4 {") |
| 1133 | with q.group(): |
| 1134 | with q.indent(2): |
| 1135 | q.breakable() |
| 1136 | q.text("value = "); |
| 1137 | q.text(util.pretty_ipv4(self.value)) |
| 1138 | q.breakable() |
| 1139 | q.text('}') |
| 1140 | |
| 1141 | bsn_tlv.subtypes[4] = ipv4 |
| 1142 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1143 | class ipv4_dst(bsn_tlv): |
| 1144 | type = 35 |
| 1145 | |
| 1146 | def __init__(self, value=None): |
| 1147 | if value != None: |
| 1148 | self.value = value |
| 1149 | else: |
| 1150 | self.value = 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("!L", 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 = ipv4_dst() |
| 1165 | _type = reader.read("!H")[0] |
| 1166 | assert(_type == 35) |
| 1167 | _length = reader.read("!H")[0] |
| 1168 | orig_reader = reader |
| 1169 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1170 | obj.value = reader.read("!L")[0] |
| 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("ipv4_dst {") |
| 1180 | with q.group(): |
| 1181 | with q.indent(2): |
| 1182 | q.breakable() |
| 1183 | q.text("value = "); |
| 1184 | q.text(util.pretty_ipv4(self.value)) |
| 1185 | q.breakable() |
| 1186 | q.text('}') |
| 1187 | |
| 1188 | bsn_tlv.subtypes[35] = ipv4_dst |
| 1189 | |
| 1190 | class ipv4_src(bsn_tlv): |
| 1191 | type = 34 |
| 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 = ipv4_src() |
| 1212 | _type = reader.read("!H")[0] |
| 1213 | assert(_type == 34) |
| 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("ipv4_src {") |
| 1227 | with q.group(): |
| 1228 | with q.indent(2): |
| 1229 | q.breakable() |
| 1230 | q.text("value = "); |
| 1231 | q.text(util.pretty_ipv4(self.value)) |
| 1232 | q.breakable() |
| 1233 | q.text('}') |
| 1234 | |
| 1235 | bsn_tlv.subtypes[34] = ipv4_src |
| 1236 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1237 | class mac(bsn_tlv): |
| 1238 | type = 1 |
| 1239 | |
| 1240 | def __init__(self, value=None): |
| 1241 | if value != None: |
| 1242 | self.value = value |
| 1243 | else: |
| 1244 | self.value = [0,0,0,0,0,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("!6B", *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 = mac() |
| 1259 | _type = reader.read("!H")[0] |
| 1260 | assert(_type == 1) |
| 1261 | _length = reader.read("!H")[0] |
| 1262 | orig_reader = reader |
| 1263 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1264 | obj.value = list(reader.read('!6B')) |
| 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("mac {") |
| 1274 | with q.group(): |
| 1275 | with q.indent(2): |
| 1276 | q.breakable() |
| 1277 | q.text("value = "); |
| 1278 | q.text(util.pretty_mac(self.value)) |
| 1279 | q.breakable() |
| 1280 | q.text('}') |
| 1281 | |
| 1282 | bsn_tlv.subtypes[1] = mac |
| 1283 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1284 | class miss_packets(bsn_tlv): |
| 1285 | type = 13 |
| 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("!Q", 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 = miss_packets() |
| 1306 | _type = reader.read("!H")[0] |
| 1307 | assert(_type == 13) |
| 1308 | _length = reader.read("!H")[0] |
| 1309 | orig_reader = reader |
| 1310 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1311 | obj.value = reader.read("!Q")[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("miss_packets {") |
| 1321 | with q.group(): |
| 1322 | with q.indent(2): |
| 1323 | q.breakable() |
| 1324 | q.text("value = "); |
| 1325 | q.text("%#x" % self.value) |
| 1326 | q.breakable() |
| 1327 | q.text('}') |
| 1328 | |
| 1329 | bsn_tlv.subtypes[13] = miss_packets |
| 1330 | |
Rich Lane | d0be755 | 2014-10-23 12:52:35 -0700 | [diff] [blame^] | 1331 | class name(bsn_tlv): |
| 1332 | type = 52 |
| 1333 | |
| 1334 | def __init__(self, value=None): |
| 1335 | if value != None: |
| 1336 | self.value = value |
| 1337 | else: |
| 1338 | self.value = '' |
| 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(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 = name() |
| 1353 | _type = reader.read("!H")[0] |
| 1354 | assert(_type == 52) |
| 1355 | _length = reader.read("!H")[0] |
| 1356 | orig_reader = reader |
| 1357 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1358 | obj.value = str(reader.read_all()) |
| 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("name {") |
| 1368 | with q.group(): |
| 1369 | with q.indent(2): |
| 1370 | q.breakable() |
| 1371 | q.text("value = "); |
| 1372 | q.pp(self.value) |
| 1373 | q.breakable() |
| 1374 | q.text('}') |
| 1375 | |
| 1376 | bsn_tlv.subtypes[52] = name |
| 1377 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1378 | class partner_key(bsn_tlv): |
| 1379 | type = 51 |
| 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("!H", 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 = partner_key() |
| 1400 | _type = reader.read("!H")[0] |
| 1401 | assert(_type == 51) |
| 1402 | _length = reader.read("!H")[0] |
| 1403 | orig_reader = reader |
| 1404 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1405 | obj.value = reader.read("!H")[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("partner_key {") |
| 1415 | with q.group(): |
| 1416 | with q.indent(2): |
| 1417 | q.breakable() |
| 1418 | q.text("value = "); |
| 1419 | q.text("%#x" % self.value) |
| 1420 | q.breakable() |
| 1421 | q.text('}') |
| 1422 | |
| 1423 | bsn_tlv.subtypes[51] = partner_key |
| 1424 | |
| 1425 | class partner_port_num(bsn_tlv): |
| 1426 | type = 50 |
| 1427 | |
| 1428 | def __init__(self, value=None): |
| 1429 | if value != None: |
| 1430 | self.value = value |
| 1431 | else: |
| 1432 | self.value = 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("!H", 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 = partner_port_num() |
| 1447 | _type = reader.read("!H")[0] |
| 1448 | assert(_type == 50) |
| 1449 | _length = reader.read("!H")[0] |
| 1450 | orig_reader = reader |
| 1451 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1452 | obj.value = reader.read("!H")[0] |
| 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("partner_port_num {") |
| 1462 | with q.group(): |
| 1463 | with q.indent(2): |
| 1464 | q.breakable() |
| 1465 | q.text("value = "); |
| 1466 | q.text("%#x" % self.value) |
| 1467 | q.breakable() |
| 1468 | q.text('}') |
| 1469 | |
| 1470 | bsn_tlv.subtypes[50] = partner_port_num |
| 1471 | |
| 1472 | class partner_port_priority(bsn_tlv): |
| 1473 | type = 49 |
| 1474 | |
| 1475 | def __init__(self, value=None): |
| 1476 | if value != None: |
| 1477 | self.value = value |
| 1478 | else: |
| 1479 | self.value = 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("!H", 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 = partner_port_priority() |
| 1494 | _type = reader.read("!H")[0] |
| 1495 | assert(_type == 49) |
| 1496 | _length = reader.read("!H")[0] |
| 1497 | orig_reader = reader |
| 1498 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1499 | obj.value = reader.read("!H")[0] |
| 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("partner_port_priority {") |
| 1509 | with q.group(): |
| 1510 | with q.indent(2): |
| 1511 | q.breakable() |
| 1512 | q.text("value = "); |
| 1513 | q.text("%#x" % self.value) |
| 1514 | q.breakable() |
| 1515 | q.text('}') |
| 1516 | |
| 1517 | bsn_tlv.subtypes[49] = partner_port_priority |
| 1518 | |
| 1519 | class partner_system_mac(bsn_tlv): |
| 1520 | type = 48 |
| 1521 | |
| 1522 | def __init__(self, value=None): |
| 1523 | if value != None: |
| 1524 | self.value = value |
| 1525 | else: |
| 1526 | self.value = [0,0,0,0,0,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("!6B", *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 = partner_system_mac() |
| 1541 | _type = reader.read("!H")[0] |
| 1542 | assert(_type == 48) |
| 1543 | _length = reader.read("!H")[0] |
| 1544 | orig_reader = reader |
| 1545 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1546 | obj.value = list(reader.read('!6B')) |
| 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("partner_system_mac {") |
| 1556 | with q.group(): |
| 1557 | with q.indent(2): |
| 1558 | q.breakable() |
| 1559 | q.text("value = "); |
| 1560 | q.text(util.pretty_mac(self.value)) |
| 1561 | q.breakable() |
| 1562 | q.text('}') |
| 1563 | |
| 1564 | bsn_tlv.subtypes[48] = partner_system_mac |
| 1565 | |
| 1566 | class partner_system_priority(bsn_tlv): |
| 1567 | type = 47 |
| 1568 | |
| 1569 | def __init__(self, value=None): |
| 1570 | if value != None: |
| 1571 | self.value = value |
| 1572 | else: |
| 1573 | self.value = 0 |
| 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(struct.pack("!H", 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 = partner_system_priority() |
| 1588 | _type = reader.read("!H")[0] |
| 1589 | assert(_type == 47) |
| 1590 | _length = reader.read("!H")[0] |
| 1591 | orig_reader = reader |
| 1592 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1593 | obj.value = reader.read("!H")[0] |
| 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("partner_system_priority {") |
| 1603 | with q.group(): |
| 1604 | with q.indent(2): |
| 1605 | q.breakable() |
| 1606 | q.text("value = "); |
| 1607 | q.text("%#x" % self.value) |
| 1608 | q.breakable() |
| 1609 | q.text('}') |
| 1610 | |
| 1611 | bsn_tlv.subtypes[47] = partner_system_priority |
| 1612 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1613 | class port(bsn_tlv): |
| 1614 | type = 0 |
| 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(util.pack_port_no(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 = port() |
| 1635 | _type = reader.read("!H")[0] |
| 1636 | assert(_type == 0) |
| 1637 | _length = reader.read("!H")[0] |
| 1638 | orig_reader = reader |
| 1639 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1640 | obj.value = util.unpack_port_no(reader) |
| 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("port {") |
| 1650 | with q.group(): |
| 1651 | with q.indent(2): |
| 1652 | q.breakable() |
| 1653 | q.text("value = "); |
| 1654 | q.text(util.pretty_port(self.value)) |
| 1655 | q.breakable() |
| 1656 | q.text('}') |
| 1657 | |
| 1658 | bsn_tlv.subtypes[0] = port |
| 1659 | |
Rich Lane | 78d9bcb | 2014-05-12 13:27:44 -0700 | [diff] [blame] | 1660 | class queue_id(bsn_tlv): |
| 1661 | type = 20 |
| 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("!L", 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 = queue_id() |
| 1682 | _type = reader.read("!H")[0] |
| 1683 | assert(_type == 20) |
| 1684 | _length = reader.read("!H")[0] |
| 1685 | orig_reader = reader |
| 1686 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1687 | obj.value = reader.read("!L")[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("queue_id {") |
| 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[20] = queue_id |
| 1706 | |
| 1707 | class queue_weight(bsn_tlv): |
| 1708 | type = 21 |
| 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("!L", 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 = queue_weight() |
| 1729 | _type = reader.read("!H")[0] |
| 1730 | assert(_type == 21) |
| 1731 | _length = reader.read("!H")[0] |
| 1732 | orig_reader = reader |
| 1733 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1734 | obj.value = reader.read("!L")[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("queue_weight {") |
| 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[21] = queue_weight |
| 1753 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1754 | class reply_packets(bsn_tlv): |
| 1755 | type = 12 |
| 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("!Q", 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 = reply_packets() |
| 1776 | _type = reader.read("!H")[0] |
| 1777 | assert(_type == 12) |
| 1778 | _length = reader.read("!H")[0] |
| 1779 | orig_reader = reader |
| 1780 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1781 | obj.value = reader.read("!Q")[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("reply_packets {") |
| 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[12] = reply_packets |
| 1800 | |
| 1801 | class request_packets(bsn_tlv): |
| 1802 | type = 11 |
| 1803 | |
| 1804 | def __init__(self, value=None): |
| 1805 | if value != None: |
| 1806 | self.value = value |
| 1807 | else: |
| 1808 | self.value = 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("!Q", 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 = request_packets() |
| 1823 | _type = reader.read("!H")[0] |
| 1824 | assert(_type == 11) |
| 1825 | _length = reader.read("!H")[0] |
| 1826 | orig_reader = reader |
| 1827 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1828 | obj.value = reader.read("!Q")[0] |
| 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("request_packets {") |
| 1838 | with q.group(): |
| 1839 | with q.indent(2): |
| 1840 | q.breakable() |
| 1841 | q.text("value = "); |
| 1842 | q.text("%#x" % self.value) |
| 1843 | q.breakable() |
| 1844 | q.text('}') |
| 1845 | |
| 1846 | bsn_tlv.subtypes[11] = request_packets |
| 1847 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1848 | class rx_packets(bsn_tlv): |
| 1849 | type = 2 |
| 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("!Q", 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 = rx_packets() |
| 1870 | _type = reader.read("!H")[0] |
| 1871 | assert(_type == 2) |
| 1872 | _length = reader.read("!H")[0] |
| 1873 | orig_reader = reader |
| 1874 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1875 | obj.value = reader.read("!Q")[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("rx_packets {") |
| 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[2] = rx_packets |
| 1894 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1895 | class sampling_rate(bsn_tlv): |
| 1896 | type = 30 |
| 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(struct.pack("!L", 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 = sampling_rate() |
| 1917 | _type = reader.read("!H")[0] |
| 1918 | assert(_type == 30) |
| 1919 | _length = reader.read("!H")[0] |
| 1920 | orig_reader = reader |
| 1921 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1922 | obj.value = reader.read("!L")[0] |
| 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("sampling_rate {") |
| 1932 | with q.group(): |
| 1933 | with q.indent(2): |
| 1934 | q.breakable() |
| 1935 | q.text("value = "); |
| 1936 | q.text("%#x" % self.value) |
| 1937 | q.breakable() |
| 1938 | q.text('}') |
| 1939 | |
| 1940 | bsn_tlv.subtypes[30] = sampling_rate |
| 1941 | |
| 1942 | class sub_agent_id(bsn_tlv): |
| 1943 | type = 38 |
| 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 = sub_agent_id() |
| 1964 | _type = reader.read("!H")[0] |
| 1965 | assert(_type == 38) |
| 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("sub_agent_id {") |
| 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[38] = sub_agent_id |
| 1988 | |
| 1989 | class tx_bytes(bsn_tlv): |
| 1990 | type = 39 |
| 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("!Q", 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 = tx_bytes() |
| 2011 | _type = reader.read("!H")[0] |
| 2012 | assert(_type == 39) |
| 2013 | _length = reader.read("!H")[0] |
| 2014 | orig_reader = reader |
| 2015 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2016 | obj.value = reader.read("!Q")[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("tx_bytes {") |
| 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[39] = tx_bytes |
| 2035 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2036 | class tx_packets(bsn_tlv): |
| 2037 | type = 3 |
| 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("!Q", 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 = tx_packets() |
| 2058 | _type = reader.read("!H")[0] |
| 2059 | assert(_type == 3) |
| 2060 | _length = reader.read("!H")[0] |
| 2061 | orig_reader = reader |
| 2062 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2063 | obj.value = reader.read("!Q")[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("tx_packets {") |
| 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[3] = tx_packets |
| 2082 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2083 | class udf_anchor(bsn_tlv): |
| 2084 | type = 16 |
| 2085 | |
| 2086 | def __init__(self, value=None): |
| 2087 | if value != None: |
| 2088 | self.value = value |
| 2089 | else: |
| 2090 | self.value = 0 |
| 2091 | return |
| 2092 | |
| 2093 | def pack(self): |
| 2094 | packed = [] |
| 2095 | packed.append(struct.pack("!H", self.type)) |
| 2096 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2097 | packed.append(struct.pack("!H", self.value)) |
| 2098 | length = sum([len(x) for x in packed]) |
| 2099 | packed[1] = struct.pack("!H", length) |
| 2100 | return ''.join(packed) |
| 2101 | |
| 2102 | @staticmethod |
| 2103 | def unpack(reader): |
| 2104 | obj = udf_anchor() |
| 2105 | _type = reader.read("!H")[0] |
| 2106 | assert(_type == 16) |
| 2107 | _length = reader.read("!H")[0] |
| 2108 | orig_reader = reader |
| 2109 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2110 | obj.value = reader.read("!H")[0] |
| 2111 | return obj |
| 2112 | |
| 2113 | def __eq__(self, other): |
| 2114 | if type(self) != type(other): return False |
| 2115 | if self.value != other.value: return False |
| 2116 | return True |
| 2117 | |
| 2118 | def pretty_print(self, q): |
| 2119 | q.text("udf_anchor {") |
| 2120 | with q.group(): |
| 2121 | with q.indent(2): |
| 2122 | q.breakable() |
| 2123 | q.text("value = "); |
| 2124 | q.text("%#x" % self.value) |
| 2125 | q.breakable() |
| 2126 | q.text('}') |
| 2127 | |
| 2128 | bsn_tlv.subtypes[16] = udf_anchor |
| 2129 | |
| 2130 | class udf_id(bsn_tlv): |
| 2131 | type = 15 |
| 2132 | |
| 2133 | def __init__(self, value=None): |
| 2134 | if value != None: |
| 2135 | self.value = value |
| 2136 | else: |
| 2137 | self.value = 0 |
| 2138 | return |
| 2139 | |
| 2140 | def pack(self): |
| 2141 | packed = [] |
| 2142 | packed.append(struct.pack("!H", self.type)) |
| 2143 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2144 | packed.append(struct.pack("!H", self.value)) |
| 2145 | length = sum([len(x) for x in packed]) |
| 2146 | packed[1] = struct.pack("!H", length) |
| 2147 | return ''.join(packed) |
| 2148 | |
| 2149 | @staticmethod |
| 2150 | def unpack(reader): |
| 2151 | obj = udf_id() |
| 2152 | _type = reader.read("!H")[0] |
| 2153 | assert(_type == 15) |
| 2154 | _length = reader.read("!H")[0] |
| 2155 | orig_reader = reader |
| 2156 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2157 | obj.value = reader.read("!H")[0] |
| 2158 | return obj |
| 2159 | |
| 2160 | def __eq__(self, other): |
| 2161 | if type(self) != type(other): return False |
| 2162 | if self.value != other.value: return False |
| 2163 | return True |
| 2164 | |
| 2165 | def pretty_print(self, q): |
| 2166 | q.text("udf_id {") |
| 2167 | with q.group(): |
| 2168 | with q.indent(2): |
| 2169 | q.breakable() |
| 2170 | q.text("value = "); |
| 2171 | q.text("%#x" % self.value) |
| 2172 | q.breakable() |
| 2173 | q.text('}') |
| 2174 | |
| 2175 | bsn_tlv.subtypes[15] = udf_id |
| 2176 | |
| 2177 | class udf_length(bsn_tlv): |
| 2178 | type = 18 |
| 2179 | |
| 2180 | def __init__(self, value=None): |
| 2181 | if value != None: |
| 2182 | self.value = value |
| 2183 | else: |
| 2184 | self.value = 0 |
| 2185 | return |
| 2186 | |
| 2187 | def pack(self): |
| 2188 | packed = [] |
| 2189 | packed.append(struct.pack("!H", self.type)) |
| 2190 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2191 | packed.append(struct.pack("!H", self.value)) |
| 2192 | length = sum([len(x) for x in packed]) |
| 2193 | packed[1] = struct.pack("!H", length) |
| 2194 | return ''.join(packed) |
| 2195 | |
| 2196 | @staticmethod |
| 2197 | def unpack(reader): |
| 2198 | obj = udf_length() |
| 2199 | _type = reader.read("!H")[0] |
| 2200 | assert(_type == 18) |
| 2201 | _length = reader.read("!H")[0] |
| 2202 | orig_reader = reader |
| 2203 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2204 | obj.value = reader.read("!H")[0] |
| 2205 | return obj |
| 2206 | |
| 2207 | def __eq__(self, other): |
| 2208 | if type(self) != type(other): return False |
| 2209 | if self.value != other.value: return False |
| 2210 | return True |
| 2211 | |
| 2212 | def pretty_print(self, q): |
| 2213 | q.text("udf_length {") |
| 2214 | with q.group(): |
| 2215 | with q.indent(2): |
| 2216 | q.breakable() |
| 2217 | q.text("value = "); |
| 2218 | q.text("%#x" % self.value) |
| 2219 | q.breakable() |
| 2220 | q.text('}') |
| 2221 | |
| 2222 | bsn_tlv.subtypes[18] = udf_length |
| 2223 | |
| 2224 | class udf_offset(bsn_tlv): |
| 2225 | type = 17 |
| 2226 | |
| 2227 | def __init__(self, value=None): |
| 2228 | if value != None: |
| 2229 | self.value = value |
| 2230 | else: |
| 2231 | self.value = 0 |
| 2232 | return |
| 2233 | |
| 2234 | def pack(self): |
| 2235 | packed = [] |
| 2236 | packed.append(struct.pack("!H", self.type)) |
| 2237 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2238 | packed.append(struct.pack("!H", self.value)) |
| 2239 | length = sum([len(x) for x in packed]) |
| 2240 | packed[1] = struct.pack("!H", length) |
| 2241 | return ''.join(packed) |
| 2242 | |
| 2243 | @staticmethod |
| 2244 | def unpack(reader): |
| 2245 | obj = udf_offset() |
| 2246 | _type = reader.read("!H")[0] |
| 2247 | assert(_type == 17) |
| 2248 | _length = reader.read("!H")[0] |
| 2249 | orig_reader = reader |
| 2250 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2251 | obj.value = reader.read("!H")[0] |
| 2252 | return obj |
| 2253 | |
| 2254 | def __eq__(self, other): |
| 2255 | if type(self) != type(other): return False |
| 2256 | if self.value != other.value: return False |
| 2257 | return True |
| 2258 | |
| 2259 | def pretty_print(self, q): |
| 2260 | q.text("udf_offset {") |
| 2261 | with q.group(): |
| 2262 | with q.indent(2): |
| 2263 | q.breakable() |
| 2264 | q.text("value = "); |
| 2265 | q.text("%#x" % self.value) |
| 2266 | q.breakable() |
| 2267 | q.text('}') |
| 2268 | |
| 2269 | bsn_tlv.subtypes[17] = udf_offset |
| 2270 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2271 | class udp_dst(bsn_tlv): |
| 2272 | type = 37 |
| 2273 | |
| 2274 | def __init__(self, value=None): |
| 2275 | if value != None: |
| 2276 | self.value = value |
| 2277 | else: |
| 2278 | self.value = 0 |
| 2279 | return |
| 2280 | |
| 2281 | def pack(self): |
| 2282 | packed = [] |
| 2283 | packed.append(struct.pack("!H", self.type)) |
| 2284 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2285 | packed.append(struct.pack("!H", self.value)) |
| 2286 | length = sum([len(x) for x in packed]) |
| 2287 | packed[1] = struct.pack("!H", length) |
| 2288 | return ''.join(packed) |
| 2289 | |
| 2290 | @staticmethod |
| 2291 | def unpack(reader): |
| 2292 | obj = udp_dst() |
| 2293 | _type = reader.read("!H")[0] |
| 2294 | assert(_type == 37) |
| 2295 | _length = reader.read("!H")[0] |
| 2296 | orig_reader = reader |
| 2297 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2298 | obj.value = reader.read("!H")[0] |
| 2299 | return obj |
| 2300 | |
| 2301 | def __eq__(self, other): |
| 2302 | if type(self) != type(other): return False |
| 2303 | if self.value != other.value: return False |
| 2304 | return True |
| 2305 | |
| 2306 | def pretty_print(self, q): |
| 2307 | q.text("udp_dst {") |
| 2308 | with q.group(): |
| 2309 | with q.indent(2): |
| 2310 | q.breakable() |
| 2311 | q.text("value = "); |
| 2312 | q.text("%#x" % self.value) |
| 2313 | q.breakable() |
| 2314 | q.text('}') |
| 2315 | |
| 2316 | bsn_tlv.subtypes[37] = udp_dst |
| 2317 | |
| 2318 | class udp_src(bsn_tlv): |
| 2319 | type = 36 |
| 2320 | |
| 2321 | def __init__(self, value=None): |
| 2322 | if value != None: |
| 2323 | self.value = value |
| 2324 | else: |
| 2325 | self.value = 0 |
| 2326 | return |
| 2327 | |
| 2328 | def pack(self): |
| 2329 | packed = [] |
| 2330 | packed.append(struct.pack("!H", self.type)) |
| 2331 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2332 | packed.append(struct.pack("!H", self.value)) |
| 2333 | length = sum([len(x) for x in packed]) |
| 2334 | packed[1] = struct.pack("!H", length) |
| 2335 | return ''.join(packed) |
| 2336 | |
| 2337 | @staticmethod |
| 2338 | def unpack(reader): |
| 2339 | obj = udp_src() |
| 2340 | _type = reader.read("!H")[0] |
| 2341 | assert(_type == 36) |
| 2342 | _length = reader.read("!H")[0] |
| 2343 | orig_reader = reader |
| 2344 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2345 | obj.value = reader.read("!H")[0] |
| 2346 | return obj |
| 2347 | |
| 2348 | def __eq__(self, other): |
| 2349 | if type(self) != type(other): return False |
| 2350 | if self.value != other.value: return False |
| 2351 | return True |
| 2352 | |
| 2353 | def pretty_print(self, q): |
| 2354 | q.text("udp_src {") |
| 2355 | with q.group(): |
| 2356 | with q.indent(2): |
| 2357 | q.breakable() |
| 2358 | q.text("value = "); |
| 2359 | q.text("%#x" % self.value) |
| 2360 | q.breakable() |
| 2361 | q.text('}') |
| 2362 | |
| 2363 | bsn_tlv.subtypes[36] = udp_src |
| 2364 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2365 | class unicast_query_timeout(bsn_tlv): |
| 2366 | type = 9 |
| 2367 | |
| 2368 | def __init__(self, value=None): |
| 2369 | if value != None: |
| 2370 | self.value = value |
| 2371 | else: |
| 2372 | self.value = 0 |
| 2373 | return |
| 2374 | |
| 2375 | def pack(self): |
| 2376 | packed = [] |
| 2377 | packed.append(struct.pack("!H", self.type)) |
| 2378 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2379 | packed.append(struct.pack("!L", self.value)) |
| 2380 | length = sum([len(x) for x in packed]) |
| 2381 | packed[1] = struct.pack("!H", length) |
| 2382 | return ''.join(packed) |
| 2383 | |
| 2384 | @staticmethod |
| 2385 | def unpack(reader): |
| 2386 | obj = unicast_query_timeout() |
| 2387 | _type = reader.read("!H")[0] |
| 2388 | assert(_type == 9) |
| 2389 | _length = reader.read("!H")[0] |
| 2390 | orig_reader = reader |
| 2391 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2392 | obj.value = reader.read("!L")[0] |
| 2393 | return obj |
| 2394 | |
| 2395 | def __eq__(self, other): |
| 2396 | if type(self) != type(other): return False |
| 2397 | if self.value != other.value: return False |
| 2398 | return True |
| 2399 | |
| 2400 | def pretty_print(self, q): |
| 2401 | q.text("unicast_query_timeout {") |
| 2402 | with q.group(): |
| 2403 | with q.indent(2): |
| 2404 | q.breakable() |
| 2405 | q.text("value = "); |
| 2406 | q.text("%#x" % self.value) |
| 2407 | q.breakable() |
| 2408 | q.text('}') |
| 2409 | |
| 2410 | bsn_tlv.subtypes[9] = unicast_query_timeout |
| 2411 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2412 | class vlan_vid(bsn_tlv): |
| 2413 | type = 6 |
| 2414 | |
| 2415 | def __init__(self, value=None): |
| 2416 | if value != None: |
| 2417 | self.value = value |
| 2418 | else: |
| 2419 | self.value = 0 |
| 2420 | return |
| 2421 | |
| 2422 | def pack(self): |
| 2423 | packed = [] |
| 2424 | packed.append(struct.pack("!H", self.type)) |
| 2425 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2426 | packed.append(struct.pack("!H", self.value)) |
| 2427 | length = sum([len(x) for x in packed]) |
| 2428 | packed[1] = struct.pack("!H", length) |
| 2429 | return ''.join(packed) |
| 2430 | |
| 2431 | @staticmethod |
| 2432 | def unpack(reader): |
| 2433 | obj = vlan_vid() |
| 2434 | _type = reader.read("!H")[0] |
| 2435 | assert(_type == 6) |
| 2436 | _length = reader.read("!H")[0] |
| 2437 | orig_reader = reader |
| 2438 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2439 | obj.value = reader.read("!H")[0] |
| 2440 | return obj |
| 2441 | |
| 2442 | def __eq__(self, other): |
| 2443 | if type(self) != type(other): return False |
| 2444 | if self.value != other.value: return False |
| 2445 | return True |
| 2446 | |
| 2447 | def pretty_print(self, q): |
| 2448 | q.text("vlan_vid {") |
| 2449 | with q.group(): |
| 2450 | with q.indent(2): |
| 2451 | q.breakable() |
| 2452 | q.text("value = "); |
| 2453 | q.text("%#x" % self.value) |
| 2454 | q.breakable() |
| 2455 | q.text('}') |
| 2456 | |
| 2457 | bsn_tlv.subtypes[6] = vlan_vid |
| 2458 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2459 | class vrf(bsn_tlv): |
| 2460 | type = 19 |
| 2461 | |
| 2462 | def __init__(self, value=None): |
| 2463 | if value != None: |
| 2464 | self.value = value |
| 2465 | else: |
| 2466 | self.value = 0 |
| 2467 | return |
| 2468 | |
| 2469 | def pack(self): |
| 2470 | packed = [] |
| 2471 | packed.append(struct.pack("!H", self.type)) |
| 2472 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2473 | packed.append(struct.pack("!L", self.value)) |
| 2474 | length = sum([len(x) for x in packed]) |
| 2475 | packed[1] = struct.pack("!H", length) |
| 2476 | return ''.join(packed) |
| 2477 | |
| 2478 | @staticmethod |
| 2479 | def unpack(reader): |
| 2480 | obj = vrf() |
| 2481 | _type = reader.read("!H")[0] |
| 2482 | assert(_type == 19) |
| 2483 | _length = reader.read("!H")[0] |
| 2484 | orig_reader = reader |
| 2485 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2486 | obj.value = reader.read("!L")[0] |
| 2487 | return obj |
| 2488 | |
| 2489 | def __eq__(self, other): |
| 2490 | if type(self) != type(other): return False |
| 2491 | if self.value != other.value: return False |
| 2492 | return True |
| 2493 | |
| 2494 | def pretty_print(self, q): |
| 2495 | q.text("vrf {") |
| 2496 | with q.group(): |
| 2497 | with q.indent(2): |
| 2498 | q.breakable() |
| 2499 | q.text("value = "); |
| 2500 | q.text("%#x" % self.value) |
| 2501 | q.breakable() |
| 2502 | q.text('}') |
| 2503 | |
| 2504 | bsn_tlv.subtypes[19] = vrf |
| 2505 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2506 | |