Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
| 5 | |
| 6 | # Automatically generated by LOXI from template module.py |
| 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 11 | import util |
| 12 | import loxi.generic_util |
| 13 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14 | import sys |
| 15 | ofp = sys.modules['loxi.of14'] |
| 16 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 17 | class bsn_tlv(loxi.OFObject): |
| 18 | subtypes = {} |
| 19 | |
| 20 | |
| 21 | def __init__(self, type=None): |
| 22 | if type != None: |
| 23 | self.type = type |
| 24 | else: |
| 25 | self.type = 0 |
| 26 | return |
| 27 | |
| 28 | def pack(self): |
| 29 | packed = [] |
| 30 | packed.append(struct.pack("!H", self.type)) |
| 31 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 32 | length = sum([len(x) for x in packed]) |
| 33 | packed[1] = struct.pack("!H", length) |
| 34 | return ''.join(packed) |
| 35 | |
| 36 | @staticmethod |
| 37 | def unpack(reader): |
| 38 | subtype, = reader.peek('!H', 0) |
| 39 | subclass = bsn_tlv.subtypes.get(subtype) |
| 40 | if subclass: |
| 41 | return subclass.unpack(reader) |
| 42 | |
| 43 | obj = bsn_tlv() |
| 44 | obj.type = reader.read("!H")[0] |
| 45 | _length = reader.read("!H")[0] |
| 46 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 47 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 48 | return obj |
| 49 | |
| 50 | def __eq__(self, other): |
| 51 | if type(self) != type(other): return False |
| 52 | if self.type != other.type: return False |
| 53 | return True |
| 54 | |
| 55 | def pretty_print(self, q): |
| 56 | q.text("bsn_tlv {") |
| 57 | with q.group(): |
| 58 | with q.indent(2): |
| 59 | q.breakable() |
| 60 | q.breakable() |
| 61 | q.text('}') |
| 62 | |
| 63 | |
| 64 | class actor_key(bsn_tlv): |
| 65 | type = 44 |
| 66 | |
| 67 | def __init__(self, value=None): |
| 68 | if value != None: |
| 69 | self.value = value |
| 70 | else: |
| 71 | self.value = 0 |
| 72 | return |
| 73 | |
| 74 | def pack(self): |
| 75 | packed = [] |
| 76 | packed.append(struct.pack("!H", self.type)) |
| 77 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 78 | packed.append(struct.pack("!H", self.value)) |
| 79 | length = sum([len(x) for x in packed]) |
| 80 | packed[1] = struct.pack("!H", length) |
| 81 | return ''.join(packed) |
| 82 | |
| 83 | @staticmethod |
| 84 | def unpack(reader): |
| 85 | obj = actor_key() |
| 86 | _type = reader.read("!H")[0] |
| 87 | assert(_type == 44) |
| 88 | _length = reader.read("!H")[0] |
| 89 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 90 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 91 | obj.value = reader.read("!H")[0] |
| 92 | return obj |
| 93 | |
| 94 | def __eq__(self, other): |
| 95 | if type(self) != type(other): return False |
| 96 | if self.value != other.value: return False |
| 97 | return True |
| 98 | |
| 99 | def pretty_print(self, q): |
| 100 | q.text("actor_key {") |
| 101 | with q.group(): |
| 102 | with q.indent(2): |
| 103 | q.breakable() |
| 104 | q.text("value = "); |
| 105 | q.text("%#x" % self.value) |
| 106 | q.breakable() |
| 107 | q.text('}') |
| 108 | |
| 109 | bsn_tlv.subtypes[44] = actor_key |
| 110 | |
| 111 | class actor_port_num(bsn_tlv): |
| 112 | type = 43 |
| 113 | |
| 114 | def __init__(self, value=None): |
| 115 | if value != None: |
| 116 | self.value = value |
| 117 | else: |
| 118 | self.value = 0 |
| 119 | return |
| 120 | |
| 121 | def pack(self): |
| 122 | packed = [] |
| 123 | packed.append(struct.pack("!H", self.type)) |
| 124 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 125 | packed.append(struct.pack("!H", self.value)) |
| 126 | length = sum([len(x) for x in packed]) |
| 127 | packed[1] = struct.pack("!H", length) |
| 128 | return ''.join(packed) |
| 129 | |
| 130 | @staticmethod |
| 131 | def unpack(reader): |
| 132 | obj = actor_port_num() |
| 133 | _type = reader.read("!H")[0] |
| 134 | assert(_type == 43) |
| 135 | _length = reader.read("!H")[0] |
| 136 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 137 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 138 | obj.value = reader.read("!H")[0] |
| 139 | return obj |
| 140 | |
| 141 | def __eq__(self, other): |
| 142 | if type(self) != type(other): return False |
| 143 | if self.value != other.value: return False |
| 144 | return True |
| 145 | |
| 146 | def pretty_print(self, q): |
| 147 | q.text("actor_port_num {") |
| 148 | with q.group(): |
| 149 | with q.indent(2): |
| 150 | q.breakable() |
| 151 | q.text("value = "); |
| 152 | q.text("%#x" % self.value) |
| 153 | q.breakable() |
| 154 | q.text('}') |
| 155 | |
| 156 | bsn_tlv.subtypes[43] = actor_port_num |
| 157 | |
| 158 | class actor_port_priority(bsn_tlv): |
| 159 | type = 42 |
| 160 | |
| 161 | def __init__(self, value=None): |
| 162 | if value != None: |
| 163 | self.value = value |
| 164 | else: |
| 165 | self.value = 0 |
| 166 | return |
| 167 | |
| 168 | def pack(self): |
| 169 | packed = [] |
| 170 | packed.append(struct.pack("!H", self.type)) |
| 171 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 172 | packed.append(struct.pack("!H", self.value)) |
| 173 | length = sum([len(x) for x in packed]) |
| 174 | packed[1] = struct.pack("!H", length) |
| 175 | return ''.join(packed) |
| 176 | |
| 177 | @staticmethod |
| 178 | def unpack(reader): |
| 179 | obj = actor_port_priority() |
| 180 | _type = reader.read("!H")[0] |
| 181 | assert(_type == 42) |
| 182 | _length = reader.read("!H")[0] |
| 183 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 184 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 185 | obj.value = reader.read("!H")[0] |
| 186 | return obj |
| 187 | |
| 188 | def __eq__(self, other): |
| 189 | if type(self) != type(other): return False |
| 190 | if self.value != other.value: return False |
| 191 | return True |
| 192 | |
| 193 | def pretty_print(self, q): |
| 194 | q.text("actor_port_priority {") |
| 195 | with q.group(): |
| 196 | with q.indent(2): |
| 197 | q.breakable() |
| 198 | q.text("value = "); |
| 199 | q.text("%#x" % self.value) |
| 200 | q.breakable() |
| 201 | q.text('}') |
| 202 | |
| 203 | bsn_tlv.subtypes[42] = actor_port_priority |
| 204 | |
| 205 | class actor_state(bsn_tlv): |
| 206 | type = 53 |
| 207 | |
| 208 | def __init__(self, value=None): |
| 209 | if value != None: |
| 210 | self.value = value |
| 211 | else: |
| 212 | self.value = 0 |
| 213 | return |
| 214 | |
| 215 | def pack(self): |
| 216 | packed = [] |
| 217 | packed.append(struct.pack("!H", self.type)) |
| 218 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 219 | packed.append(struct.pack("!B", self.value)) |
| 220 | length = sum([len(x) for x in packed]) |
| 221 | packed[1] = struct.pack("!H", length) |
| 222 | return ''.join(packed) |
| 223 | |
| 224 | @staticmethod |
| 225 | def unpack(reader): |
| 226 | obj = actor_state() |
| 227 | _type = reader.read("!H")[0] |
| 228 | assert(_type == 53) |
| 229 | _length = reader.read("!H")[0] |
| 230 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 231 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 232 | obj.value = reader.read("!B")[0] |
| 233 | return obj |
| 234 | |
| 235 | def __eq__(self, other): |
| 236 | if type(self) != type(other): return False |
| 237 | if self.value != other.value: return False |
| 238 | return True |
| 239 | |
| 240 | def pretty_print(self, q): |
| 241 | q.text("actor_state {") |
| 242 | with q.group(): |
| 243 | with q.indent(2): |
| 244 | q.breakable() |
| 245 | q.text("value = "); |
| 246 | q.text("%#x" % self.value) |
| 247 | q.breakable() |
| 248 | q.text('}') |
| 249 | |
| 250 | bsn_tlv.subtypes[53] = actor_state |
| 251 | |
| 252 | class actor_system_mac(bsn_tlv): |
| 253 | type = 41 |
| 254 | |
| 255 | def __init__(self, value=None): |
| 256 | if value != None: |
| 257 | self.value = value |
| 258 | else: |
| 259 | self.value = [0,0,0,0,0,0] |
| 260 | return |
| 261 | |
| 262 | def pack(self): |
| 263 | packed = [] |
| 264 | packed.append(struct.pack("!H", self.type)) |
| 265 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 266 | packed.append(struct.pack("!6B", *self.value)) |
| 267 | length = sum([len(x) for x in packed]) |
| 268 | packed[1] = struct.pack("!H", length) |
| 269 | return ''.join(packed) |
| 270 | |
| 271 | @staticmethod |
| 272 | def unpack(reader): |
| 273 | obj = actor_system_mac() |
| 274 | _type = reader.read("!H")[0] |
| 275 | assert(_type == 41) |
| 276 | _length = reader.read("!H")[0] |
| 277 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 278 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 279 | obj.value = list(reader.read('!6B')) |
| 280 | return obj |
| 281 | |
| 282 | def __eq__(self, other): |
| 283 | if type(self) != type(other): return False |
| 284 | if self.value != other.value: return False |
| 285 | return True |
| 286 | |
| 287 | def pretty_print(self, q): |
| 288 | q.text("actor_system_mac {") |
| 289 | with q.group(): |
| 290 | with q.indent(2): |
| 291 | q.breakable() |
| 292 | q.text("value = "); |
| 293 | q.text(util.pretty_mac(self.value)) |
| 294 | q.breakable() |
| 295 | q.text('}') |
| 296 | |
| 297 | bsn_tlv.subtypes[41] = actor_system_mac |
| 298 | |
| 299 | class actor_system_priority(bsn_tlv): |
| 300 | type = 40 |
| 301 | |
| 302 | def __init__(self, value=None): |
| 303 | if value != None: |
| 304 | self.value = value |
| 305 | else: |
| 306 | self.value = 0 |
| 307 | return |
| 308 | |
| 309 | def pack(self): |
| 310 | packed = [] |
| 311 | packed.append(struct.pack("!H", self.type)) |
| 312 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 313 | packed.append(struct.pack("!H", self.value)) |
| 314 | length = sum([len(x) for x in packed]) |
| 315 | packed[1] = struct.pack("!H", length) |
| 316 | return ''.join(packed) |
| 317 | |
| 318 | @staticmethod |
| 319 | def unpack(reader): |
| 320 | obj = actor_system_priority() |
| 321 | _type = reader.read("!H")[0] |
| 322 | assert(_type == 40) |
| 323 | _length = reader.read("!H")[0] |
| 324 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 325 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 326 | obj.value = reader.read("!H")[0] |
| 327 | return obj |
| 328 | |
| 329 | def __eq__(self, other): |
| 330 | if type(self) != type(other): return False |
| 331 | if self.value != other.value: return False |
| 332 | return True |
| 333 | |
| 334 | def pretty_print(self, q): |
| 335 | q.text("actor_system_priority {") |
| 336 | with q.group(): |
| 337 | with q.indent(2): |
| 338 | q.breakable() |
| 339 | q.text("value = "); |
| 340 | q.text("%#x" % self.value) |
| 341 | q.breakable() |
| 342 | q.text('}') |
| 343 | |
| 344 | bsn_tlv.subtypes[40] = actor_system_priority |
| 345 | |
Rich Lane | b41363b | 2015-07-08 15:42:38 -0700 | [diff] [blame] | 346 | class anchor(bsn_tlv): |
| 347 | type = 81 |
| 348 | |
| 349 | def __init__(self, value=None): |
| 350 | if value != None: |
| 351 | self.value = value |
| 352 | else: |
| 353 | self.value = 0 |
| 354 | return |
| 355 | |
| 356 | def pack(self): |
| 357 | packed = [] |
| 358 | packed.append(struct.pack("!H", self.type)) |
| 359 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 360 | packed.append(struct.pack("!H", self.value)) |
| 361 | length = sum([len(x) for x in packed]) |
| 362 | packed[1] = struct.pack("!H", length) |
| 363 | return ''.join(packed) |
| 364 | |
| 365 | @staticmethod |
| 366 | def unpack(reader): |
| 367 | obj = anchor() |
| 368 | _type = reader.read("!H")[0] |
| 369 | assert(_type == 81) |
| 370 | _length = reader.read("!H")[0] |
| 371 | orig_reader = reader |
| 372 | reader = orig_reader.slice(_length, 4) |
| 373 | obj.value = reader.read("!H")[0] |
| 374 | return obj |
| 375 | |
| 376 | def __eq__(self, other): |
| 377 | if type(self) != type(other): return False |
| 378 | if self.value != other.value: return False |
| 379 | return True |
| 380 | |
| 381 | def pretty_print(self, q): |
| 382 | q.text("anchor {") |
| 383 | with q.group(): |
| 384 | with q.indent(2): |
| 385 | q.breakable() |
| 386 | q.text("value = "); |
| 387 | q.text("%#x" % self.value) |
| 388 | q.breakable() |
| 389 | q.text('}') |
| 390 | |
| 391 | bsn_tlv.subtypes[81] = anchor |
| 392 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 393 | class broadcast_query_timeout(bsn_tlv): |
| 394 | type = 10 |
| 395 | |
| 396 | def __init__(self, value=None): |
| 397 | if value != None: |
| 398 | self.value = value |
| 399 | else: |
| 400 | self.value = 0 |
| 401 | return |
| 402 | |
| 403 | def pack(self): |
| 404 | packed = [] |
| 405 | packed.append(struct.pack("!H", self.type)) |
| 406 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 407 | packed.append(struct.pack("!L", self.value)) |
| 408 | length = sum([len(x) for x in packed]) |
| 409 | packed[1] = struct.pack("!H", length) |
| 410 | return ''.join(packed) |
| 411 | |
| 412 | @staticmethod |
| 413 | def unpack(reader): |
| 414 | obj = broadcast_query_timeout() |
| 415 | _type = reader.read("!H")[0] |
| 416 | assert(_type == 10) |
| 417 | _length = reader.read("!H")[0] |
| 418 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 419 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 420 | obj.value = reader.read("!L")[0] |
| 421 | return obj |
| 422 | |
| 423 | def __eq__(self, other): |
| 424 | if type(self) != type(other): return False |
| 425 | if self.value != other.value: return False |
| 426 | return True |
| 427 | |
| 428 | def pretty_print(self, q): |
| 429 | q.text("broadcast_query_timeout {") |
| 430 | with q.group(): |
| 431 | with q.indent(2): |
| 432 | q.breakable() |
| 433 | q.text("value = "); |
| 434 | q.text("%#x" % self.value) |
| 435 | q.breakable() |
| 436 | q.text('}') |
| 437 | |
| 438 | bsn_tlv.subtypes[10] = broadcast_query_timeout |
| 439 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 440 | class bucket(bsn_tlv): |
| 441 | type = 64 |
| 442 | |
| 443 | def __init__(self, value=None): |
| 444 | if value != None: |
| 445 | self.value = value |
| 446 | else: |
| 447 | self.value = [] |
| 448 | return |
| 449 | |
| 450 | def pack(self): |
| 451 | packed = [] |
| 452 | packed.append(struct.pack("!H", self.type)) |
| 453 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 454 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 455 | length = sum([len(x) for x in packed]) |
| 456 | packed[1] = struct.pack("!H", length) |
| 457 | return ''.join(packed) |
| 458 | |
| 459 | @staticmethod |
| 460 | def unpack(reader): |
| 461 | obj = bucket() |
| 462 | _type = reader.read("!H")[0] |
| 463 | assert(_type == 64) |
| 464 | _length = reader.read("!H")[0] |
| 465 | orig_reader = reader |
| 466 | reader = orig_reader.slice(_length, 4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 467 | obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 468 | return obj |
| 469 | |
| 470 | def __eq__(self, other): |
| 471 | if type(self) != type(other): return False |
| 472 | if self.value != other.value: return False |
| 473 | return True |
| 474 | |
| 475 | def pretty_print(self, q): |
| 476 | q.text("bucket {") |
| 477 | with q.group(): |
| 478 | with q.indent(2): |
| 479 | q.breakable() |
| 480 | q.text("value = "); |
| 481 | q.pp(self.value) |
| 482 | q.breakable() |
| 483 | q.text('}') |
| 484 | |
| 485 | bsn_tlv.subtypes[64] = bucket |
| 486 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 487 | class circuit_id(bsn_tlv): |
| 488 | type = 14 |
| 489 | |
| 490 | def __init__(self, value=None): |
| 491 | if value != None: |
| 492 | self.value = value |
| 493 | else: |
| 494 | self.value = '' |
| 495 | return |
| 496 | |
| 497 | def pack(self): |
| 498 | packed = [] |
| 499 | packed.append(struct.pack("!H", self.type)) |
| 500 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 501 | packed.append(self.value) |
| 502 | length = sum([len(x) for x in packed]) |
| 503 | packed[1] = struct.pack("!H", length) |
| 504 | return ''.join(packed) |
| 505 | |
| 506 | @staticmethod |
| 507 | def unpack(reader): |
| 508 | obj = circuit_id() |
| 509 | _type = reader.read("!H")[0] |
| 510 | assert(_type == 14) |
| 511 | _length = reader.read("!H")[0] |
| 512 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 513 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 514 | obj.value = str(reader.read_all()) |
| 515 | return obj |
| 516 | |
| 517 | def __eq__(self, other): |
| 518 | if type(self) != type(other): return False |
| 519 | if self.value != other.value: return False |
| 520 | return True |
| 521 | |
| 522 | def pretty_print(self, q): |
| 523 | q.text("circuit_id {") |
| 524 | with q.group(): |
| 525 | with q.indent(2): |
| 526 | q.breakable() |
| 527 | q.text("value = "); |
| 528 | q.pp(self.value) |
| 529 | q.breakable() |
| 530 | q.text('}') |
| 531 | |
| 532 | bsn_tlv.subtypes[14] = circuit_id |
| 533 | |
| 534 | class convergence_status(bsn_tlv): |
| 535 | type = 45 |
| 536 | |
| 537 | def __init__(self, value=None): |
| 538 | if value != None: |
| 539 | self.value = value |
| 540 | else: |
| 541 | self.value = 0 |
| 542 | return |
| 543 | |
| 544 | def pack(self): |
| 545 | packed = [] |
| 546 | packed.append(struct.pack("!H", self.type)) |
| 547 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 548 | packed.append(struct.pack("!B", self.value)) |
| 549 | length = sum([len(x) for x in packed]) |
| 550 | packed[1] = struct.pack("!H", length) |
| 551 | return ''.join(packed) |
| 552 | |
| 553 | @staticmethod |
| 554 | def unpack(reader): |
| 555 | obj = convergence_status() |
| 556 | _type = reader.read("!H")[0] |
| 557 | assert(_type == 45) |
| 558 | _length = reader.read("!H")[0] |
| 559 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 560 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 561 | obj.value = reader.read("!B")[0] |
| 562 | return obj |
| 563 | |
| 564 | def __eq__(self, other): |
| 565 | if type(self) != type(other): return False |
| 566 | if self.value != other.value: return False |
| 567 | return True |
| 568 | |
| 569 | def pretty_print(self, q): |
| 570 | q.text("convergence_status {") |
| 571 | with q.group(): |
| 572 | with q.indent(2): |
| 573 | q.breakable() |
| 574 | q.text("value = "); |
| 575 | q.text("%#x" % self.value) |
| 576 | q.breakable() |
| 577 | q.text('}') |
| 578 | |
| 579 | bsn_tlv.subtypes[45] = convergence_status |
| 580 | |
| 581 | class crc_enabled(bsn_tlv): |
| 582 | type = 22 |
| 583 | |
| 584 | def __init__(self, value=None): |
| 585 | if value != None: |
| 586 | self.value = value |
| 587 | else: |
| 588 | self.value = 0 |
| 589 | return |
| 590 | |
| 591 | def pack(self): |
| 592 | packed = [] |
| 593 | packed.append(struct.pack("!H", self.type)) |
| 594 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 595 | packed.append(struct.pack("!B", self.value)) |
| 596 | length = sum([len(x) for x in packed]) |
| 597 | packed[1] = struct.pack("!H", length) |
| 598 | return ''.join(packed) |
| 599 | |
| 600 | @staticmethod |
| 601 | def unpack(reader): |
| 602 | obj = crc_enabled() |
| 603 | _type = reader.read("!H")[0] |
| 604 | assert(_type == 22) |
| 605 | _length = reader.read("!H")[0] |
| 606 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 607 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 608 | obj.value = reader.read("!B")[0] |
| 609 | return obj |
| 610 | |
| 611 | def __eq__(self, other): |
| 612 | if type(self) != type(other): return False |
| 613 | if self.value != other.value: return False |
| 614 | return True |
| 615 | |
| 616 | def pretty_print(self, q): |
| 617 | q.text("crc_enabled {") |
| 618 | with q.group(): |
| 619 | with q.indent(2): |
| 620 | q.breakable() |
| 621 | q.text("value = "); |
| 622 | q.text("%#x" % self.value) |
| 623 | q.breakable() |
| 624 | q.text('}') |
| 625 | |
| 626 | bsn_tlv.subtypes[22] = crc_enabled |
| 627 | |
| 628 | class data(bsn_tlv): |
| 629 | type = 55 |
| 630 | |
| 631 | def __init__(self, value=None): |
| 632 | if value != None: |
| 633 | self.value = value |
| 634 | else: |
| 635 | self.value = '' |
| 636 | return |
| 637 | |
| 638 | def pack(self): |
| 639 | packed = [] |
| 640 | packed.append(struct.pack("!H", self.type)) |
| 641 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 642 | packed.append(self.value) |
| 643 | length = sum([len(x) for x in packed]) |
| 644 | packed[1] = struct.pack("!H", length) |
| 645 | return ''.join(packed) |
| 646 | |
| 647 | @staticmethod |
| 648 | def unpack(reader): |
| 649 | obj = data() |
| 650 | _type = reader.read("!H")[0] |
| 651 | assert(_type == 55) |
| 652 | _length = reader.read("!H")[0] |
| 653 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 654 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 655 | obj.value = str(reader.read_all()) |
| 656 | return obj |
| 657 | |
| 658 | def __eq__(self, other): |
| 659 | if type(self) != type(other): return False |
| 660 | if self.value != other.value: return False |
| 661 | return True |
| 662 | |
| 663 | def pretty_print(self, q): |
| 664 | q.text("data {") |
| 665 | with q.group(): |
| 666 | with q.indent(2): |
| 667 | q.breakable() |
| 668 | q.text("value = "); |
| 669 | q.pp(self.value) |
| 670 | q.breakable() |
| 671 | q.text('}') |
| 672 | |
| 673 | bsn_tlv.subtypes[55] = data |
| 674 | |
| 675 | class eth_dst(bsn_tlv): |
| 676 | type = 33 |
| 677 | |
| 678 | def __init__(self, value=None): |
| 679 | if value != None: |
| 680 | self.value = value |
| 681 | else: |
| 682 | self.value = [0,0,0,0,0,0] |
| 683 | return |
| 684 | |
| 685 | def pack(self): |
| 686 | packed = [] |
| 687 | packed.append(struct.pack("!H", self.type)) |
| 688 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 689 | packed.append(struct.pack("!6B", *self.value)) |
| 690 | length = sum([len(x) for x in packed]) |
| 691 | packed[1] = struct.pack("!H", length) |
| 692 | return ''.join(packed) |
| 693 | |
| 694 | @staticmethod |
| 695 | def unpack(reader): |
| 696 | obj = eth_dst() |
| 697 | _type = reader.read("!H")[0] |
| 698 | assert(_type == 33) |
| 699 | _length = reader.read("!H")[0] |
| 700 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 701 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 702 | obj.value = list(reader.read('!6B')) |
| 703 | return obj |
| 704 | |
| 705 | def __eq__(self, other): |
| 706 | if type(self) != type(other): return False |
| 707 | if self.value != other.value: return False |
| 708 | return True |
| 709 | |
| 710 | def pretty_print(self, q): |
| 711 | q.text("eth_dst {") |
| 712 | with q.group(): |
| 713 | with q.indent(2): |
| 714 | q.breakable() |
| 715 | q.text("value = "); |
| 716 | q.text(util.pretty_mac(self.value)) |
| 717 | q.breakable() |
| 718 | q.text('}') |
| 719 | |
| 720 | bsn_tlv.subtypes[33] = eth_dst |
| 721 | |
| 722 | class eth_src(bsn_tlv): |
| 723 | type = 32 |
| 724 | |
| 725 | def __init__(self, value=None): |
| 726 | if value != None: |
| 727 | self.value = value |
| 728 | else: |
| 729 | self.value = [0,0,0,0,0,0] |
| 730 | return |
| 731 | |
| 732 | def pack(self): |
| 733 | packed = [] |
| 734 | packed.append(struct.pack("!H", self.type)) |
| 735 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 736 | packed.append(struct.pack("!6B", *self.value)) |
| 737 | length = sum([len(x) for x in packed]) |
| 738 | packed[1] = struct.pack("!H", length) |
| 739 | return ''.join(packed) |
| 740 | |
| 741 | @staticmethod |
| 742 | def unpack(reader): |
| 743 | obj = eth_src() |
| 744 | _type = reader.read("!H")[0] |
| 745 | assert(_type == 32) |
| 746 | _length = reader.read("!H")[0] |
| 747 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 748 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 749 | obj.value = list(reader.read('!6B')) |
| 750 | return obj |
| 751 | |
| 752 | def __eq__(self, other): |
| 753 | if type(self) != type(other): return False |
| 754 | if self.value != other.value: return False |
| 755 | return True |
| 756 | |
| 757 | def pretty_print(self, q): |
| 758 | q.text("eth_src {") |
| 759 | with q.group(): |
| 760 | with q.indent(2): |
| 761 | q.breakable() |
| 762 | q.text("value = "); |
| 763 | q.text(util.pretty_mac(self.value)) |
| 764 | q.breakable() |
| 765 | q.text('}') |
| 766 | |
| 767 | bsn_tlv.subtypes[32] = eth_src |
| 768 | |
| 769 | class external_gateway_ip(bsn_tlv): |
| 770 | type = 26 |
| 771 | |
| 772 | def __init__(self, value=None): |
| 773 | if value != None: |
| 774 | self.value = value |
| 775 | else: |
| 776 | self.value = 0 |
| 777 | return |
| 778 | |
| 779 | def pack(self): |
| 780 | packed = [] |
| 781 | packed.append(struct.pack("!H", self.type)) |
| 782 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 783 | packed.append(struct.pack("!L", self.value)) |
| 784 | length = sum([len(x) for x in packed]) |
| 785 | packed[1] = struct.pack("!H", length) |
| 786 | return ''.join(packed) |
| 787 | |
| 788 | @staticmethod |
| 789 | def unpack(reader): |
| 790 | obj = external_gateway_ip() |
| 791 | _type = reader.read("!H")[0] |
| 792 | assert(_type == 26) |
| 793 | _length = reader.read("!H")[0] |
| 794 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 795 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 796 | obj.value = reader.read("!L")[0] |
| 797 | return obj |
| 798 | |
| 799 | def __eq__(self, other): |
| 800 | if type(self) != type(other): return False |
| 801 | if self.value != other.value: return False |
| 802 | return True |
| 803 | |
| 804 | def pretty_print(self, q): |
| 805 | q.text("external_gateway_ip {") |
| 806 | with q.group(): |
| 807 | with q.indent(2): |
| 808 | q.breakable() |
| 809 | q.text("value = "); |
| 810 | q.text(util.pretty_ipv4(self.value)) |
| 811 | q.breakable() |
| 812 | q.text('}') |
| 813 | |
| 814 | bsn_tlv.subtypes[26] = external_gateway_ip |
| 815 | |
| 816 | class external_gateway_mac(bsn_tlv): |
| 817 | type = 29 |
| 818 | |
| 819 | def __init__(self, value=None): |
| 820 | if value != None: |
| 821 | self.value = value |
| 822 | else: |
| 823 | self.value = [0,0,0,0,0,0] |
| 824 | return |
| 825 | |
| 826 | def pack(self): |
| 827 | packed = [] |
| 828 | packed.append(struct.pack("!H", self.type)) |
| 829 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 830 | packed.append(struct.pack("!6B", *self.value)) |
| 831 | length = sum([len(x) for x in packed]) |
| 832 | packed[1] = struct.pack("!H", length) |
| 833 | return ''.join(packed) |
| 834 | |
| 835 | @staticmethod |
| 836 | def unpack(reader): |
| 837 | obj = external_gateway_mac() |
| 838 | _type = reader.read("!H")[0] |
| 839 | assert(_type == 29) |
| 840 | _length = reader.read("!H")[0] |
| 841 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 842 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 843 | obj.value = list(reader.read('!6B')) |
| 844 | return obj |
| 845 | |
| 846 | def __eq__(self, other): |
| 847 | if type(self) != type(other): return False |
| 848 | if self.value != other.value: return False |
| 849 | return True |
| 850 | |
| 851 | def pretty_print(self, q): |
| 852 | q.text("external_gateway_mac {") |
| 853 | with q.group(): |
| 854 | with q.indent(2): |
| 855 | q.breakable() |
| 856 | q.text("value = "); |
| 857 | q.text(util.pretty_mac(self.value)) |
| 858 | q.breakable() |
| 859 | q.text('}') |
| 860 | |
| 861 | bsn_tlv.subtypes[29] = external_gateway_mac |
| 862 | |
| 863 | class external_ip(bsn_tlv): |
| 864 | type = 23 |
| 865 | |
| 866 | def __init__(self, value=None): |
| 867 | if value != None: |
| 868 | self.value = value |
| 869 | else: |
| 870 | self.value = 0 |
| 871 | return |
| 872 | |
| 873 | def pack(self): |
| 874 | packed = [] |
| 875 | packed.append(struct.pack("!H", self.type)) |
| 876 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 877 | packed.append(struct.pack("!L", self.value)) |
| 878 | length = sum([len(x) for x in packed]) |
| 879 | packed[1] = struct.pack("!H", length) |
| 880 | return ''.join(packed) |
| 881 | |
| 882 | @staticmethod |
| 883 | def unpack(reader): |
| 884 | obj = external_ip() |
| 885 | _type = reader.read("!H")[0] |
| 886 | assert(_type == 23) |
| 887 | _length = reader.read("!H")[0] |
| 888 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 889 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 890 | obj.value = reader.read("!L")[0] |
| 891 | return obj |
| 892 | |
| 893 | def __eq__(self, other): |
| 894 | if type(self) != type(other): return False |
| 895 | if self.value != other.value: return False |
| 896 | return True |
| 897 | |
| 898 | def pretty_print(self, q): |
| 899 | q.text("external_ip {") |
| 900 | with q.group(): |
| 901 | with q.indent(2): |
| 902 | q.breakable() |
| 903 | q.text("value = "); |
| 904 | q.text(util.pretty_ipv4(self.value)) |
| 905 | q.breakable() |
| 906 | q.text('}') |
| 907 | |
| 908 | bsn_tlv.subtypes[23] = external_ip |
| 909 | |
| 910 | class external_mac(bsn_tlv): |
| 911 | type = 24 |
| 912 | |
| 913 | def __init__(self, value=None): |
| 914 | if value != None: |
| 915 | self.value = value |
| 916 | else: |
| 917 | self.value = [0,0,0,0,0,0] |
| 918 | return |
| 919 | |
| 920 | def pack(self): |
| 921 | packed = [] |
| 922 | packed.append(struct.pack("!H", self.type)) |
| 923 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 924 | packed.append(struct.pack("!6B", *self.value)) |
| 925 | length = sum([len(x) for x in packed]) |
| 926 | packed[1] = struct.pack("!H", length) |
| 927 | return ''.join(packed) |
| 928 | |
| 929 | @staticmethod |
| 930 | def unpack(reader): |
| 931 | obj = external_mac() |
| 932 | _type = reader.read("!H")[0] |
| 933 | assert(_type == 24) |
| 934 | _length = reader.read("!H")[0] |
| 935 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 936 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 937 | obj.value = list(reader.read('!6B')) |
| 938 | return obj |
| 939 | |
| 940 | def __eq__(self, other): |
| 941 | if type(self) != type(other): return False |
| 942 | if self.value != other.value: return False |
| 943 | return True |
| 944 | |
| 945 | def pretty_print(self, q): |
| 946 | q.text("external_mac {") |
| 947 | with q.group(): |
| 948 | with q.indent(2): |
| 949 | q.breakable() |
| 950 | q.text("value = "); |
| 951 | q.text(util.pretty_mac(self.value)) |
| 952 | q.breakable() |
| 953 | q.text('}') |
| 954 | |
| 955 | bsn_tlv.subtypes[24] = external_mac |
| 956 | |
| 957 | class external_netmask(bsn_tlv): |
| 958 | type = 25 |
| 959 | |
| 960 | def __init__(self, value=None): |
| 961 | if value != None: |
| 962 | self.value = value |
| 963 | else: |
| 964 | self.value = 0 |
| 965 | return |
| 966 | |
| 967 | def pack(self): |
| 968 | packed = [] |
| 969 | packed.append(struct.pack("!H", self.type)) |
| 970 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 971 | packed.append(struct.pack("!L", self.value)) |
| 972 | length = sum([len(x) for x in packed]) |
| 973 | packed[1] = struct.pack("!H", length) |
| 974 | return ''.join(packed) |
| 975 | |
| 976 | @staticmethod |
| 977 | def unpack(reader): |
| 978 | obj = external_netmask() |
| 979 | _type = reader.read("!H")[0] |
| 980 | assert(_type == 25) |
| 981 | _length = reader.read("!H")[0] |
| 982 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 983 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 984 | obj.value = reader.read("!L")[0] |
| 985 | return obj |
| 986 | |
| 987 | def __eq__(self, other): |
| 988 | if type(self) != type(other): return False |
| 989 | if self.value != other.value: return False |
| 990 | return True |
| 991 | |
| 992 | def pretty_print(self, q): |
| 993 | q.text("external_netmask {") |
| 994 | with q.group(): |
| 995 | with q.indent(2): |
| 996 | q.breakable() |
| 997 | q.text("value = "); |
| 998 | q.text(util.pretty_ipv4(self.value)) |
| 999 | q.breakable() |
| 1000 | q.text('}') |
| 1001 | |
| 1002 | bsn_tlv.subtypes[25] = external_netmask |
| 1003 | |
Rich Lane | b41363b | 2015-07-08 15:42:38 -0700 | [diff] [blame] | 1004 | class generation_id(bsn_tlv): |
| 1005 | type = 80 |
| 1006 | |
| 1007 | def __init__(self, value=None): |
| 1008 | if value != None: |
| 1009 | self.value = value |
| 1010 | else: |
| 1011 | self.value = 0 |
| 1012 | return |
| 1013 | |
| 1014 | def pack(self): |
| 1015 | packed = [] |
| 1016 | packed.append(struct.pack("!H", self.type)) |
| 1017 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1018 | packed.append(struct.pack("!Q", self.value)) |
| 1019 | length = sum([len(x) for x in packed]) |
| 1020 | packed[1] = struct.pack("!H", length) |
| 1021 | return ''.join(packed) |
| 1022 | |
| 1023 | @staticmethod |
| 1024 | def unpack(reader): |
| 1025 | obj = generation_id() |
| 1026 | _type = reader.read("!H")[0] |
| 1027 | assert(_type == 80) |
| 1028 | _length = reader.read("!H")[0] |
| 1029 | orig_reader = reader |
| 1030 | reader = orig_reader.slice(_length, 4) |
| 1031 | obj.value = reader.read("!Q")[0] |
| 1032 | return obj |
| 1033 | |
| 1034 | def __eq__(self, other): |
| 1035 | if type(self) != type(other): return False |
| 1036 | if self.value != other.value: return False |
| 1037 | return True |
| 1038 | |
| 1039 | def pretty_print(self, q): |
| 1040 | q.text("generation_id {") |
| 1041 | with q.group(): |
| 1042 | with q.indent(2): |
| 1043 | q.breakable() |
| 1044 | q.text("value = "); |
| 1045 | q.text("%#x" % self.value) |
| 1046 | q.breakable() |
| 1047 | q.text('}') |
| 1048 | |
| 1049 | bsn_tlv.subtypes[80] = generation_id |
| 1050 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1051 | class header_size(bsn_tlv): |
| 1052 | type = 31 |
| 1053 | |
| 1054 | def __init__(self, value=None): |
| 1055 | if value != None: |
| 1056 | self.value = value |
| 1057 | else: |
| 1058 | self.value = 0 |
| 1059 | return |
| 1060 | |
| 1061 | def pack(self): |
| 1062 | packed = [] |
| 1063 | packed.append(struct.pack("!H", self.type)) |
| 1064 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1065 | packed.append(struct.pack("!L", self.value)) |
| 1066 | length = sum([len(x) for x in packed]) |
| 1067 | packed[1] = struct.pack("!H", length) |
| 1068 | return ''.join(packed) |
| 1069 | |
| 1070 | @staticmethod |
| 1071 | def unpack(reader): |
| 1072 | obj = header_size() |
| 1073 | _type = reader.read("!H")[0] |
| 1074 | assert(_type == 31) |
| 1075 | _length = reader.read("!H")[0] |
| 1076 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1077 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1078 | obj.value = reader.read("!L")[0] |
| 1079 | return obj |
| 1080 | |
| 1081 | def __eq__(self, other): |
| 1082 | if type(self) != type(other): return False |
| 1083 | if self.value != other.value: return False |
| 1084 | return True |
| 1085 | |
| 1086 | def pretty_print(self, q): |
| 1087 | q.text("header_size {") |
| 1088 | with q.group(): |
| 1089 | with q.indent(2): |
| 1090 | q.breakable() |
| 1091 | q.text("value = "); |
| 1092 | q.text("%#x" % self.value) |
| 1093 | q.breakable() |
| 1094 | q.text('}') |
| 1095 | |
| 1096 | bsn_tlv.subtypes[31] = header_size |
| 1097 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 1098 | class icmp_code(bsn_tlv): |
| 1099 | type = 69 |
| 1100 | |
| 1101 | def __init__(self, value=None): |
| 1102 | if value != None: |
| 1103 | self.value = value |
| 1104 | else: |
| 1105 | self.value = 0 |
| 1106 | return |
| 1107 | |
| 1108 | def pack(self): |
| 1109 | packed = [] |
| 1110 | packed.append(struct.pack("!H", self.type)) |
| 1111 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1112 | packed.append(struct.pack("!B", self.value)) |
| 1113 | length = sum([len(x) for x in packed]) |
| 1114 | packed[1] = struct.pack("!H", length) |
| 1115 | return ''.join(packed) |
| 1116 | |
| 1117 | @staticmethod |
| 1118 | def unpack(reader): |
| 1119 | obj = icmp_code() |
| 1120 | _type = reader.read("!H")[0] |
| 1121 | assert(_type == 69) |
| 1122 | _length = reader.read("!H")[0] |
| 1123 | orig_reader = reader |
| 1124 | reader = orig_reader.slice(_length, 4) |
| 1125 | obj.value = reader.read("!B")[0] |
| 1126 | return obj |
| 1127 | |
| 1128 | def __eq__(self, other): |
| 1129 | if type(self) != type(other): return False |
| 1130 | if self.value != other.value: return False |
| 1131 | return True |
| 1132 | |
| 1133 | def pretty_print(self, q): |
| 1134 | q.text("icmp_code {") |
| 1135 | with q.group(): |
| 1136 | with q.indent(2): |
| 1137 | q.breakable() |
| 1138 | q.text("value = "); |
| 1139 | q.text("%#x" % self.value) |
| 1140 | q.breakable() |
| 1141 | q.text('}') |
| 1142 | |
| 1143 | bsn_tlv.subtypes[69] = icmp_code |
| 1144 | |
| 1145 | class icmp_id(bsn_tlv): |
| 1146 | type = 70 |
| 1147 | |
| 1148 | def __init__(self, value=None): |
| 1149 | if value != None: |
| 1150 | self.value = value |
| 1151 | else: |
| 1152 | self.value = 0 |
| 1153 | return |
| 1154 | |
| 1155 | def pack(self): |
| 1156 | packed = [] |
| 1157 | packed.append(struct.pack("!H", self.type)) |
| 1158 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1159 | packed.append(struct.pack("!H", self.value)) |
| 1160 | length = sum([len(x) for x in packed]) |
| 1161 | packed[1] = struct.pack("!H", length) |
| 1162 | return ''.join(packed) |
| 1163 | |
| 1164 | @staticmethod |
| 1165 | def unpack(reader): |
| 1166 | obj = icmp_id() |
| 1167 | _type = reader.read("!H")[0] |
| 1168 | assert(_type == 70) |
| 1169 | _length = reader.read("!H")[0] |
| 1170 | orig_reader = reader |
| 1171 | reader = orig_reader.slice(_length, 4) |
| 1172 | obj.value = reader.read("!H")[0] |
| 1173 | return obj |
| 1174 | |
| 1175 | def __eq__(self, other): |
| 1176 | if type(self) != type(other): return False |
| 1177 | if self.value != other.value: return False |
| 1178 | return True |
| 1179 | |
| 1180 | def pretty_print(self, q): |
| 1181 | q.text("icmp_id {") |
| 1182 | with q.group(): |
| 1183 | with q.indent(2): |
| 1184 | q.breakable() |
| 1185 | q.text("value = "); |
| 1186 | q.text("%#x" % self.value) |
| 1187 | q.breakable() |
| 1188 | q.text('}') |
| 1189 | |
| 1190 | bsn_tlv.subtypes[70] = icmp_id |
| 1191 | |
| 1192 | class icmp_type(bsn_tlv): |
| 1193 | type = 68 |
| 1194 | |
| 1195 | def __init__(self, value=None): |
| 1196 | if value != None: |
| 1197 | self.value = value |
| 1198 | else: |
| 1199 | self.value = 0 |
| 1200 | return |
| 1201 | |
| 1202 | def pack(self): |
| 1203 | packed = [] |
| 1204 | packed.append(struct.pack("!H", self.type)) |
| 1205 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1206 | packed.append(struct.pack("!B", self.value)) |
| 1207 | length = sum([len(x) for x in packed]) |
| 1208 | packed[1] = struct.pack("!H", length) |
| 1209 | return ''.join(packed) |
| 1210 | |
| 1211 | @staticmethod |
| 1212 | def unpack(reader): |
| 1213 | obj = icmp_type() |
| 1214 | _type = reader.read("!H")[0] |
| 1215 | assert(_type == 68) |
| 1216 | _length = reader.read("!H")[0] |
| 1217 | orig_reader = reader |
| 1218 | reader = orig_reader.slice(_length, 4) |
| 1219 | obj.value = reader.read("!B")[0] |
| 1220 | return obj |
| 1221 | |
| 1222 | def __eq__(self, other): |
| 1223 | if type(self) != type(other): return False |
| 1224 | if self.value != other.value: return False |
| 1225 | return True |
| 1226 | |
| 1227 | def pretty_print(self, q): |
| 1228 | q.text("icmp_type {") |
| 1229 | with q.group(): |
| 1230 | with q.indent(2): |
| 1231 | q.breakable() |
| 1232 | q.text("value = "); |
| 1233 | q.text("%#x" % self.value) |
| 1234 | q.breakable() |
| 1235 | q.text('}') |
| 1236 | |
| 1237 | bsn_tlv.subtypes[68] = icmp_type |
| 1238 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1239 | class idle_notification(bsn_tlv): |
| 1240 | type = 7 |
| 1241 | |
| 1242 | def __init__(self): |
| 1243 | return |
| 1244 | |
| 1245 | def pack(self): |
| 1246 | packed = [] |
| 1247 | packed.append(struct.pack("!H", self.type)) |
| 1248 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1249 | length = sum([len(x) for x in packed]) |
| 1250 | packed[1] = struct.pack("!H", length) |
| 1251 | return ''.join(packed) |
| 1252 | |
| 1253 | @staticmethod |
| 1254 | def unpack(reader): |
| 1255 | obj = idle_notification() |
| 1256 | _type = reader.read("!H")[0] |
| 1257 | assert(_type == 7) |
| 1258 | _length = reader.read("!H")[0] |
| 1259 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1260 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1261 | return obj |
| 1262 | |
| 1263 | def __eq__(self, other): |
| 1264 | if type(self) != type(other): return False |
| 1265 | return True |
| 1266 | |
| 1267 | def pretty_print(self, q): |
| 1268 | q.text("idle_notification {") |
| 1269 | with q.group(): |
| 1270 | with q.indent(2): |
| 1271 | q.breakable() |
| 1272 | q.breakable() |
| 1273 | q.text('}') |
| 1274 | |
| 1275 | bsn_tlv.subtypes[7] = idle_notification |
| 1276 | |
| 1277 | class idle_time(bsn_tlv): |
| 1278 | type = 5 |
| 1279 | |
| 1280 | def __init__(self, value=None): |
| 1281 | if value != None: |
| 1282 | self.value = value |
| 1283 | else: |
| 1284 | self.value = 0 |
| 1285 | return |
| 1286 | |
| 1287 | def pack(self): |
| 1288 | packed = [] |
| 1289 | packed.append(struct.pack("!H", self.type)) |
| 1290 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1291 | packed.append(struct.pack("!Q", self.value)) |
| 1292 | length = sum([len(x) for x in packed]) |
| 1293 | packed[1] = struct.pack("!H", length) |
| 1294 | return ''.join(packed) |
| 1295 | |
| 1296 | @staticmethod |
| 1297 | def unpack(reader): |
| 1298 | obj = idle_time() |
| 1299 | _type = reader.read("!H")[0] |
| 1300 | assert(_type == 5) |
| 1301 | _length = reader.read("!H")[0] |
| 1302 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1303 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1304 | obj.value = reader.read("!Q")[0] |
| 1305 | return obj |
| 1306 | |
| 1307 | def __eq__(self, other): |
| 1308 | if type(self) != type(other): return False |
| 1309 | if self.value != other.value: return False |
| 1310 | return True |
| 1311 | |
| 1312 | def pretty_print(self, q): |
| 1313 | q.text("idle_time {") |
| 1314 | with q.group(): |
| 1315 | with q.indent(2): |
| 1316 | q.breakable() |
| 1317 | q.text("value = "); |
| 1318 | q.text("%#x" % self.value) |
| 1319 | q.breakable() |
| 1320 | q.text('}') |
| 1321 | |
| 1322 | bsn_tlv.subtypes[5] = idle_time |
| 1323 | |
| 1324 | class idle_timeout(bsn_tlv): |
| 1325 | type = 8 |
| 1326 | |
| 1327 | def __init__(self, value=None): |
| 1328 | if value != None: |
| 1329 | self.value = value |
| 1330 | else: |
| 1331 | self.value = 0 |
| 1332 | return |
| 1333 | |
| 1334 | def pack(self): |
| 1335 | packed = [] |
| 1336 | packed.append(struct.pack("!H", self.type)) |
| 1337 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1338 | packed.append(struct.pack("!L", self.value)) |
| 1339 | length = sum([len(x) for x in packed]) |
| 1340 | packed[1] = struct.pack("!H", length) |
| 1341 | return ''.join(packed) |
| 1342 | |
| 1343 | @staticmethod |
| 1344 | def unpack(reader): |
| 1345 | obj = idle_timeout() |
| 1346 | _type = reader.read("!H")[0] |
| 1347 | assert(_type == 8) |
| 1348 | _length = reader.read("!H")[0] |
| 1349 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1350 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1351 | obj.value = reader.read("!L")[0] |
| 1352 | return obj |
| 1353 | |
| 1354 | def __eq__(self, other): |
| 1355 | if type(self) != type(other): return False |
| 1356 | if self.value != other.value: return False |
| 1357 | return True |
| 1358 | |
| 1359 | def pretty_print(self, q): |
| 1360 | q.text("idle_timeout {") |
| 1361 | with q.group(): |
| 1362 | with q.indent(2): |
| 1363 | q.breakable() |
| 1364 | q.text("value = "); |
| 1365 | q.text("%#x" % self.value) |
| 1366 | q.breakable() |
| 1367 | q.text('}') |
| 1368 | |
| 1369 | bsn_tlv.subtypes[8] = idle_timeout |
| 1370 | |
Rich Lane | b41363b | 2015-07-08 15:42:38 -0700 | [diff] [blame] | 1371 | class igmp_snooping(bsn_tlv): |
| 1372 | type = 78 |
| 1373 | |
| 1374 | def __init__(self): |
| 1375 | return |
| 1376 | |
| 1377 | def pack(self): |
| 1378 | packed = [] |
| 1379 | packed.append(struct.pack("!H", self.type)) |
| 1380 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1381 | length = sum([len(x) for x in packed]) |
| 1382 | packed[1] = struct.pack("!H", length) |
| 1383 | return ''.join(packed) |
| 1384 | |
| 1385 | @staticmethod |
| 1386 | def unpack(reader): |
| 1387 | obj = igmp_snooping() |
| 1388 | _type = reader.read("!H")[0] |
| 1389 | assert(_type == 78) |
| 1390 | _length = reader.read("!H")[0] |
| 1391 | orig_reader = reader |
| 1392 | reader = orig_reader.slice(_length, 4) |
| 1393 | return obj |
| 1394 | |
| 1395 | def __eq__(self, other): |
| 1396 | if type(self) != type(other): return False |
| 1397 | return True |
| 1398 | |
| 1399 | def pretty_print(self, q): |
| 1400 | q.text("igmp_snooping {") |
| 1401 | with q.group(): |
| 1402 | with q.indent(2): |
| 1403 | q.breakable() |
| 1404 | q.breakable() |
| 1405 | q.text('}') |
| 1406 | |
| 1407 | bsn_tlv.subtypes[78] = igmp_snooping |
| 1408 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1409 | class internal_gateway_mac(bsn_tlv): |
| 1410 | type = 28 |
| 1411 | |
| 1412 | def __init__(self, value=None): |
| 1413 | if value != None: |
| 1414 | self.value = value |
| 1415 | else: |
| 1416 | self.value = [0,0,0,0,0,0] |
| 1417 | return |
| 1418 | |
| 1419 | def pack(self): |
| 1420 | packed = [] |
| 1421 | packed.append(struct.pack("!H", self.type)) |
| 1422 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1423 | packed.append(struct.pack("!6B", *self.value)) |
| 1424 | length = sum([len(x) for x in packed]) |
| 1425 | packed[1] = struct.pack("!H", length) |
| 1426 | return ''.join(packed) |
| 1427 | |
| 1428 | @staticmethod |
| 1429 | def unpack(reader): |
| 1430 | obj = internal_gateway_mac() |
| 1431 | _type = reader.read("!H")[0] |
| 1432 | assert(_type == 28) |
| 1433 | _length = reader.read("!H")[0] |
| 1434 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1435 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1436 | obj.value = list(reader.read('!6B')) |
| 1437 | return obj |
| 1438 | |
| 1439 | def __eq__(self, other): |
| 1440 | if type(self) != type(other): return False |
| 1441 | if self.value != other.value: return False |
| 1442 | return True |
| 1443 | |
| 1444 | def pretty_print(self, q): |
| 1445 | q.text("internal_gateway_mac {") |
| 1446 | with q.group(): |
| 1447 | with q.indent(2): |
| 1448 | q.breakable() |
| 1449 | q.text("value = "); |
| 1450 | q.text(util.pretty_mac(self.value)) |
| 1451 | q.breakable() |
| 1452 | q.text('}') |
| 1453 | |
| 1454 | bsn_tlv.subtypes[28] = internal_gateway_mac |
| 1455 | |
| 1456 | class internal_mac(bsn_tlv): |
| 1457 | type = 27 |
| 1458 | |
| 1459 | def __init__(self, value=None): |
| 1460 | if value != None: |
| 1461 | self.value = value |
| 1462 | else: |
| 1463 | self.value = [0,0,0,0,0,0] |
| 1464 | return |
| 1465 | |
| 1466 | def pack(self): |
| 1467 | packed = [] |
| 1468 | packed.append(struct.pack("!H", self.type)) |
| 1469 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1470 | packed.append(struct.pack("!6B", *self.value)) |
| 1471 | length = sum([len(x) for x in packed]) |
| 1472 | packed[1] = struct.pack("!H", length) |
| 1473 | return ''.join(packed) |
| 1474 | |
| 1475 | @staticmethod |
| 1476 | def unpack(reader): |
| 1477 | obj = internal_mac() |
| 1478 | _type = reader.read("!H")[0] |
| 1479 | assert(_type == 27) |
| 1480 | _length = reader.read("!H")[0] |
| 1481 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1482 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1483 | obj.value = list(reader.read('!6B')) |
| 1484 | return obj |
| 1485 | |
| 1486 | def __eq__(self, other): |
| 1487 | if type(self) != type(other): return False |
| 1488 | if self.value != other.value: return False |
| 1489 | return True |
| 1490 | |
| 1491 | def pretty_print(self, q): |
| 1492 | q.text("internal_mac {") |
| 1493 | with q.group(): |
| 1494 | with q.indent(2): |
| 1495 | q.breakable() |
| 1496 | q.text("value = "); |
| 1497 | q.text(util.pretty_mac(self.value)) |
| 1498 | q.breakable() |
| 1499 | q.text('}') |
| 1500 | |
| 1501 | bsn_tlv.subtypes[27] = internal_mac |
| 1502 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1503 | class interval(bsn_tlv): |
| 1504 | type = 58 |
| 1505 | |
| 1506 | def __init__(self, value=None): |
| 1507 | if value != None: |
| 1508 | self.value = value |
| 1509 | else: |
| 1510 | self.value = 0 |
| 1511 | return |
| 1512 | |
| 1513 | def pack(self): |
| 1514 | packed = [] |
| 1515 | packed.append(struct.pack("!H", self.type)) |
| 1516 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1517 | packed.append(struct.pack("!L", self.value)) |
| 1518 | length = sum([len(x) for x in packed]) |
| 1519 | packed[1] = struct.pack("!H", length) |
| 1520 | return ''.join(packed) |
| 1521 | |
| 1522 | @staticmethod |
| 1523 | def unpack(reader): |
| 1524 | obj = interval() |
| 1525 | _type = reader.read("!H")[0] |
| 1526 | assert(_type == 58) |
| 1527 | _length = reader.read("!H")[0] |
| 1528 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1529 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1530 | obj.value = reader.read("!L")[0] |
| 1531 | return obj |
| 1532 | |
| 1533 | def __eq__(self, other): |
| 1534 | if type(self) != type(other): return False |
| 1535 | if self.value != other.value: return False |
| 1536 | return True |
| 1537 | |
| 1538 | def pretty_print(self, q): |
| 1539 | q.text("interval {") |
| 1540 | with q.group(): |
| 1541 | with q.indent(2): |
| 1542 | q.breakable() |
| 1543 | q.text("value = "); |
| 1544 | q.text("%#x" % self.value) |
| 1545 | q.breakable() |
| 1546 | q.text('}') |
| 1547 | |
| 1548 | bsn_tlv.subtypes[58] = interval |
| 1549 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 1550 | class ip_proto(bsn_tlv): |
| 1551 | type = 67 |
| 1552 | |
| 1553 | def __init__(self, value=None): |
| 1554 | if value != None: |
| 1555 | self.value = value |
| 1556 | else: |
| 1557 | self.value = 0 |
| 1558 | return |
| 1559 | |
| 1560 | def pack(self): |
| 1561 | packed = [] |
| 1562 | packed.append(struct.pack("!H", self.type)) |
| 1563 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1564 | packed.append(struct.pack("!B", self.value)) |
| 1565 | length = sum([len(x) for x in packed]) |
| 1566 | packed[1] = struct.pack("!H", length) |
| 1567 | return ''.join(packed) |
| 1568 | |
| 1569 | @staticmethod |
| 1570 | def unpack(reader): |
| 1571 | obj = ip_proto() |
| 1572 | _type = reader.read("!H")[0] |
| 1573 | assert(_type == 67) |
| 1574 | _length = reader.read("!H")[0] |
| 1575 | orig_reader = reader |
| 1576 | reader = orig_reader.slice(_length, 4) |
| 1577 | obj.value = reader.read("!B")[0] |
| 1578 | return obj |
| 1579 | |
| 1580 | def __eq__(self, other): |
| 1581 | if type(self) != type(other): return False |
| 1582 | if self.value != other.value: return False |
| 1583 | return True |
| 1584 | |
| 1585 | def pretty_print(self, q): |
| 1586 | q.text("ip_proto {") |
| 1587 | with q.group(): |
| 1588 | with q.indent(2): |
| 1589 | q.breakable() |
| 1590 | q.text("value = "); |
| 1591 | q.text("%#x" % self.value) |
| 1592 | q.breakable() |
| 1593 | q.text('}') |
| 1594 | |
| 1595 | bsn_tlv.subtypes[67] = ip_proto |
| 1596 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1597 | class ipv4(bsn_tlv): |
| 1598 | type = 4 |
| 1599 | |
| 1600 | def __init__(self, value=None): |
| 1601 | if value != None: |
| 1602 | self.value = value |
| 1603 | else: |
| 1604 | self.value = 0 |
| 1605 | return |
| 1606 | |
| 1607 | def pack(self): |
| 1608 | packed = [] |
| 1609 | packed.append(struct.pack("!H", self.type)) |
| 1610 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1611 | packed.append(struct.pack("!L", self.value)) |
| 1612 | length = sum([len(x) for x in packed]) |
| 1613 | packed[1] = struct.pack("!H", length) |
| 1614 | return ''.join(packed) |
| 1615 | |
| 1616 | @staticmethod |
| 1617 | def unpack(reader): |
| 1618 | obj = ipv4() |
| 1619 | _type = reader.read("!H")[0] |
| 1620 | assert(_type == 4) |
| 1621 | _length = reader.read("!H")[0] |
| 1622 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1623 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1624 | obj.value = reader.read("!L")[0] |
| 1625 | return obj |
| 1626 | |
| 1627 | def __eq__(self, other): |
| 1628 | if type(self) != type(other): return False |
| 1629 | if self.value != other.value: return False |
| 1630 | return True |
| 1631 | |
| 1632 | def pretty_print(self, q): |
| 1633 | q.text("ipv4 {") |
| 1634 | with q.group(): |
| 1635 | with q.indent(2): |
| 1636 | q.breakable() |
| 1637 | q.text("value = "); |
| 1638 | q.text(util.pretty_ipv4(self.value)) |
| 1639 | q.breakable() |
| 1640 | q.text('}') |
| 1641 | |
| 1642 | bsn_tlv.subtypes[4] = ipv4 |
| 1643 | |
| 1644 | class ipv4_dst(bsn_tlv): |
| 1645 | type = 35 |
| 1646 | |
| 1647 | def __init__(self, value=None): |
| 1648 | if value != None: |
| 1649 | self.value = value |
| 1650 | else: |
| 1651 | self.value = 0 |
| 1652 | return |
| 1653 | |
| 1654 | def pack(self): |
| 1655 | packed = [] |
| 1656 | packed.append(struct.pack("!H", self.type)) |
| 1657 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1658 | packed.append(struct.pack("!L", self.value)) |
| 1659 | length = sum([len(x) for x in packed]) |
| 1660 | packed[1] = struct.pack("!H", length) |
| 1661 | return ''.join(packed) |
| 1662 | |
| 1663 | @staticmethod |
| 1664 | def unpack(reader): |
| 1665 | obj = ipv4_dst() |
| 1666 | _type = reader.read("!H")[0] |
| 1667 | assert(_type == 35) |
| 1668 | _length = reader.read("!H")[0] |
| 1669 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1670 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1671 | obj.value = reader.read("!L")[0] |
| 1672 | return obj |
| 1673 | |
| 1674 | def __eq__(self, other): |
| 1675 | if type(self) != type(other): return False |
| 1676 | if self.value != other.value: return False |
| 1677 | return True |
| 1678 | |
| 1679 | def pretty_print(self, q): |
| 1680 | q.text("ipv4_dst {") |
| 1681 | with q.group(): |
| 1682 | with q.indent(2): |
| 1683 | q.breakable() |
| 1684 | q.text("value = "); |
| 1685 | q.text(util.pretty_ipv4(self.value)) |
| 1686 | q.breakable() |
| 1687 | q.text('}') |
| 1688 | |
| 1689 | bsn_tlv.subtypes[35] = ipv4_dst |
| 1690 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1691 | class ipv4_netmask(bsn_tlv): |
| 1692 | type = 60 |
| 1693 | |
| 1694 | def __init__(self, value=None): |
| 1695 | if value != None: |
| 1696 | self.value = value |
| 1697 | else: |
| 1698 | self.value = 0 |
| 1699 | return |
| 1700 | |
| 1701 | def pack(self): |
| 1702 | packed = [] |
| 1703 | packed.append(struct.pack("!H", self.type)) |
| 1704 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1705 | packed.append(struct.pack("!L", self.value)) |
| 1706 | length = sum([len(x) for x in packed]) |
| 1707 | packed[1] = struct.pack("!H", length) |
| 1708 | return ''.join(packed) |
| 1709 | |
| 1710 | @staticmethod |
| 1711 | def unpack(reader): |
| 1712 | obj = ipv4_netmask() |
| 1713 | _type = reader.read("!H")[0] |
| 1714 | assert(_type == 60) |
| 1715 | _length = reader.read("!H")[0] |
| 1716 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1717 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1718 | obj.value = reader.read("!L")[0] |
| 1719 | return obj |
| 1720 | |
| 1721 | def __eq__(self, other): |
| 1722 | if type(self) != type(other): return False |
| 1723 | if self.value != other.value: return False |
| 1724 | return True |
| 1725 | |
| 1726 | def pretty_print(self, q): |
| 1727 | q.text("ipv4_netmask {") |
| 1728 | with q.group(): |
| 1729 | with q.indent(2): |
| 1730 | q.breakable() |
| 1731 | q.text("value = "); |
| 1732 | q.text(util.pretty_ipv4(self.value)) |
| 1733 | q.breakable() |
| 1734 | q.text('}') |
| 1735 | |
| 1736 | bsn_tlv.subtypes[60] = ipv4_netmask |
| 1737 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1738 | class ipv4_src(bsn_tlv): |
| 1739 | type = 34 |
| 1740 | |
| 1741 | def __init__(self, value=None): |
| 1742 | if value != None: |
| 1743 | self.value = value |
| 1744 | else: |
| 1745 | self.value = 0 |
| 1746 | return |
| 1747 | |
| 1748 | def pack(self): |
| 1749 | packed = [] |
| 1750 | packed.append(struct.pack("!H", self.type)) |
| 1751 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1752 | packed.append(struct.pack("!L", self.value)) |
| 1753 | length = sum([len(x) for x in packed]) |
| 1754 | packed[1] = struct.pack("!H", length) |
| 1755 | return ''.join(packed) |
| 1756 | |
| 1757 | @staticmethod |
| 1758 | def unpack(reader): |
| 1759 | obj = ipv4_src() |
| 1760 | _type = reader.read("!H")[0] |
| 1761 | assert(_type == 34) |
| 1762 | _length = reader.read("!H")[0] |
| 1763 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1764 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1765 | obj.value = reader.read("!L")[0] |
| 1766 | return obj |
| 1767 | |
| 1768 | def __eq__(self, other): |
| 1769 | if type(self) != type(other): return False |
| 1770 | if self.value != other.value: return False |
| 1771 | return True |
| 1772 | |
| 1773 | def pretty_print(self, q): |
| 1774 | q.text("ipv4_src {") |
| 1775 | with q.group(): |
| 1776 | with q.indent(2): |
| 1777 | q.breakable() |
| 1778 | q.text("value = "); |
| 1779 | q.text(util.pretty_ipv4(self.value)) |
| 1780 | q.breakable() |
| 1781 | q.text('}') |
| 1782 | |
| 1783 | bsn_tlv.subtypes[34] = ipv4_src |
| 1784 | |
Rich Lane | b41363b | 2015-07-08 15:42:38 -0700 | [diff] [blame] | 1785 | class l2_multicast_lookup(bsn_tlv): |
| 1786 | type = 79 |
| 1787 | |
| 1788 | def __init__(self): |
| 1789 | return |
| 1790 | |
| 1791 | def pack(self): |
| 1792 | packed = [] |
| 1793 | packed.append(struct.pack("!H", self.type)) |
| 1794 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1795 | length = sum([len(x) for x in packed]) |
| 1796 | packed[1] = struct.pack("!H", length) |
| 1797 | return ''.join(packed) |
| 1798 | |
| 1799 | @staticmethod |
| 1800 | def unpack(reader): |
| 1801 | obj = l2_multicast_lookup() |
| 1802 | _type = reader.read("!H")[0] |
| 1803 | assert(_type == 79) |
| 1804 | _length = reader.read("!H")[0] |
| 1805 | orig_reader = reader |
| 1806 | reader = orig_reader.slice(_length, 4) |
| 1807 | return obj |
| 1808 | |
| 1809 | def __eq__(self, other): |
| 1810 | if type(self) != type(other): return False |
| 1811 | return True |
| 1812 | |
| 1813 | def pretty_print(self, q): |
| 1814 | q.text("l2_multicast_lookup {") |
| 1815 | with q.group(): |
| 1816 | with q.indent(2): |
| 1817 | q.breakable() |
| 1818 | q.breakable() |
| 1819 | q.text('}') |
| 1820 | |
| 1821 | bsn_tlv.subtypes[79] = l2_multicast_lookup |
| 1822 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1823 | class mac(bsn_tlv): |
| 1824 | type = 1 |
| 1825 | |
| 1826 | def __init__(self, value=None): |
| 1827 | if value != None: |
| 1828 | self.value = value |
| 1829 | else: |
| 1830 | self.value = [0,0,0,0,0,0] |
| 1831 | return |
| 1832 | |
| 1833 | def pack(self): |
| 1834 | packed = [] |
| 1835 | packed.append(struct.pack("!H", self.type)) |
| 1836 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1837 | packed.append(struct.pack("!6B", *self.value)) |
| 1838 | length = sum([len(x) for x in packed]) |
| 1839 | packed[1] = struct.pack("!H", length) |
| 1840 | return ''.join(packed) |
| 1841 | |
| 1842 | @staticmethod |
| 1843 | def unpack(reader): |
| 1844 | obj = mac() |
| 1845 | _type = reader.read("!H")[0] |
| 1846 | assert(_type == 1) |
| 1847 | _length = reader.read("!H")[0] |
| 1848 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1849 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1850 | obj.value = list(reader.read('!6B')) |
| 1851 | return obj |
| 1852 | |
| 1853 | def __eq__(self, other): |
| 1854 | if type(self) != type(other): return False |
| 1855 | if self.value != other.value: return False |
| 1856 | return True |
| 1857 | |
| 1858 | def pretty_print(self, q): |
| 1859 | q.text("mac {") |
| 1860 | with q.group(): |
| 1861 | with q.indent(2): |
| 1862 | q.breakable() |
| 1863 | q.text("value = "); |
| 1864 | q.text(util.pretty_mac(self.value)) |
| 1865 | q.breakable() |
| 1866 | q.text('}') |
| 1867 | |
| 1868 | bsn_tlv.subtypes[1] = mac |
| 1869 | |
| 1870 | class mac_mask(bsn_tlv): |
| 1871 | type = 56 |
| 1872 | |
| 1873 | def __init__(self, value=None): |
| 1874 | if value != None: |
| 1875 | self.value = value |
| 1876 | else: |
| 1877 | self.value = [0,0,0,0,0,0] |
| 1878 | return |
| 1879 | |
| 1880 | def pack(self): |
| 1881 | packed = [] |
| 1882 | packed.append(struct.pack("!H", self.type)) |
| 1883 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1884 | packed.append(struct.pack("!6B", *self.value)) |
| 1885 | length = sum([len(x) for x in packed]) |
| 1886 | packed[1] = struct.pack("!H", length) |
| 1887 | return ''.join(packed) |
| 1888 | |
| 1889 | @staticmethod |
| 1890 | def unpack(reader): |
| 1891 | obj = mac_mask() |
| 1892 | _type = reader.read("!H")[0] |
| 1893 | assert(_type == 56) |
| 1894 | _length = reader.read("!H")[0] |
| 1895 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1896 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1897 | obj.value = list(reader.read('!6B')) |
| 1898 | return obj |
| 1899 | |
| 1900 | def __eq__(self, other): |
| 1901 | if type(self) != type(other): return False |
| 1902 | if self.value != other.value: return False |
| 1903 | return True |
| 1904 | |
| 1905 | def pretty_print(self, q): |
| 1906 | q.text("mac_mask {") |
| 1907 | with q.group(): |
| 1908 | with q.indent(2): |
| 1909 | q.breakable() |
| 1910 | q.text("value = "); |
| 1911 | q.text(util.pretty_mac(self.value)) |
| 1912 | q.breakable() |
| 1913 | q.text('}') |
| 1914 | |
| 1915 | bsn_tlv.subtypes[56] = mac_mask |
| 1916 | |
| 1917 | class miss_packets(bsn_tlv): |
| 1918 | type = 13 |
| 1919 | |
| 1920 | def __init__(self, value=None): |
| 1921 | if value != None: |
| 1922 | self.value = value |
| 1923 | else: |
| 1924 | self.value = 0 |
| 1925 | return |
| 1926 | |
| 1927 | def pack(self): |
| 1928 | packed = [] |
| 1929 | packed.append(struct.pack("!H", self.type)) |
| 1930 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1931 | packed.append(struct.pack("!Q", self.value)) |
| 1932 | length = sum([len(x) for x in packed]) |
| 1933 | packed[1] = struct.pack("!H", length) |
| 1934 | return ''.join(packed) |
| 1935 | |
| 1936 | @staticmethod |
| 1937 | def unpack(reader): |
| 1938 | obj = miss_packets() |
| 1939 | _type = reader.read("!H")[0] |
| 1940 | assert(_type == 13) |
| 1941 | _length = reader.read("!H")[0] |
| 1942 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1943 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1944 | obj.value = reader.read("!Q")[0] |
| 1945 | return obj |
| 1946 | |
| 1947 | def __eq__(self, other): |
| 1948 | if type(self) != type(other): return False |
| 1949 | if self.value != other.value: return False |
| 1950 | return True |
| 1951 | |
| 1952 | def pretty_print(self, q): |
| 1953 | q.text("miss_packets {") |
| 1954 | with q.group(): |
| 1955 | with q.indent(2): |
| 1956 | q.breakable() |
| 1957 | q.text("value = "); |
| 1958 | q.text("%#x" % self.value) |
| 1959 | q.breakable() |
| 1960 | q.text('}') |
| 1961 | |
| 1962 | bsn_tlv.subtypes[13] = miss_packets |
| 1963 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1964 | class mpls_control_word(bsn_tlv): |
| 1965 | type = 62 |
| 1966 | |
| 1967 | def __init__(self, value=None): |
| 1968 | if value != None: |
| 1969 | self.value = value |
| 1970 | else: |
| 1971 | self.value = 0 |
| 1972 | return |
| 1973 | |
| 1974 | def pack(self): |
| 1975 | packed = [] |
| 1976 | packed.append(struct.pack("!H", self.type)) |
| 1977 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1978 | packed.append(struct.pack("!B", self.value)) |
| 1979 | length = sum([len(x) for x in packed]) |
| 1980 | packed[1] = struct.pack("!H", length) |
| 1981 | return ''.join(packed) |
| 1982 | |
| 1983 | @staticmethod |
| 1984 | def unpack(reader): |
| 1985 | obj = mpls_control_word() |
| 1986 | _type = reader.read("!H")[0] |
| 1987 | assert(_type == 62) |
| 1988 | _length = reader.read("!H")[0] |
| 1989 | orig_reader = reader |
| 1990 | reader = orig_reader.slice(_length, 4) |
| 1991 | obj.value = reader.read("!B")[0] |
| 1992 | return obj |
| 1993 | |
| 1994 | def __eq__(self, other): |
| 1995 | if type(self) != type(other): return False |
| 1996 | if self.value != other.value: return False |
| 1997 | return True |
| 1998 | |
| 1999 | def pretty_print(self, q): |
| 2000 | q.text("mpls_control_word {") |
| 2001 | with q.group(): |
| 2002 | with q.indent(2): |
| 2003 | q.breakable() |
| 2004 | q.text("value = "); |
| 2005 | q.text("%#x" % self.value) |
| 2006 | q.breakable() |
| 2007 | q.text('}') |
| 2008 | |
| 2009 | bsn_tlv.subtypes[62] = mpls_control_word |
| 2010 | |
| 2011 | class mpls_label(bsn_tlv): |
| 2012 | type = 61 |
| 2013 | |
| 2014 | def __init__(self, value=None): |
| 2015 | if value != None: |
| 2016 | self.value = value |
| 2017 | else: |
| 2018 | self.value = 0 |
| 2019 | return |
| 2020 | |
| 2021 | def pack(self): |
| 2022 | packed = [] |
| 2023 | packed.append(struct.pack("!H", self.type)) |
| 2024 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2025 | packed.append(struct.pack("!L", self.value)) |
| 2026 | length = sum([len(x) for x in packed]) |
| 2027 | packed[1] = struct.pack("!H", length) |
| 2028 | return ''.join(packed) |
| 2029 | |
| 2030 | @staticmethod |
| 2031 | def unpack(reader): |
| 2032 | obj = mpls_label() |
| 2033 | _type = reader.read("!H")[0] |
| 2034 | assert(_type == 61) |
| 2035 | _length = reader.read("!H")[0] |
| 2036 | orig_reader = reader |
| 2037 | reader = orig_reader.slice(_length, 4) |
| 2038 | obj.value = reader.read("!L")[0] |
| 2039 | return obj |
| 2040 | |
| 2041 | def __eq__(self, other): |
| 2042 | if type(self) != type(other): return False |
| 2043 | if self.value != other.value: return False |
| 2044 | return True |
| 2045 | |
| 2046 | def pretty_print(self, q): |
| 2047 | q.text("mpls_label {") |
| 2048 | with q.group(): |
| 2049 | with q.indent(2): |
| 2050 | q.breakable() |
| 2051 | q.text("value = "); |
| 2052 | q.text("%#x" % self.value) |
| 2053 | q.breakable() |
| 2054 | q.text('}') |
| 2055 | |
| 2056 | bsn_tlv.subtypes[61] = mpls_label |
| 2057 | |
| 2058 | class mpls_sequenced(bsn_tlv): |
| 2059 | type = 63 |
| 2060 | |
| 2061 | def __init__(self, value=None): |
| 2062 | if value != None: |
| 2063 | self.value = value |
| 2064 | else: |
| 2065 | self.value = 0 |
| 2066 | return |
| 2067 | |
| 2068 | def pack(self): |
| 2069 | packed = [] |
| 2070 | packed.append(struct.pack("!H", self.type)) |
| 2071 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2072 | packed.append(struct.pack("!B", self.value)) |
| 2073 | length = sum([len(x) for x in packed]) |
| 2074 | packed[1] = struct.pack("!H", length) |
| 2075 | return ''.join(packed) |
| 2076 | |
| 2077 | @staticmethod |
| 2078 | def unpack(reader): |
| 2079 | obj = mpls_sequenced() |
| 2080 | _type = reader.read("!H")[0] |
| 2081 | assert(_type == 63) |
| 2082 | _length = reader.read("!H")[0] |
| 2083 | orig_reader = reader |
| 2084 | reader = orig_reader.slice(_length, 4) |
| 2085 | obj.value = reader.read("!B")[0] |
| 2086 | return obj |
| 2087 | |
| 2088 | def __eq__(self, other): |
| 2089 | if type(self) != type(other): return False |
| 2090 | if self.value != other.value: return False |
| 2091 | return True |
| 2092 | |
| 2093 | def pretty_print(self, q): |
| 2094 | q.text("mpls_sequenced {") |
| 2095 | with q.group(): |
| 2096 | with q.indent(2): |
| 2097 | q.breakable() |
| 2098 | q.text("value = "); |
| 2099 | q.text("%#x" % self.value) |
| 2100 | q.breakable() |
| 2101 | q.text('}') |
| 2102 | |
| 2103 | bsn_tlv.subtypes[63] = mpls_sequenced |
| 2104 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2105 | class name(bsn_tlv): |
| 2106 | type = 52 |
| 2107 | |
| 2108 | def __init__(self, value=None): |
| 2109 | if value != None: |
| 2110 | self.value = value |
| 2111 | else: |
| 2112 | self.value = '' |
| 2113 | return |
| 2114 | |
| 2115 | def pack(self): |
| 2116 | packed = [] |
| 2117 | packed.append(struct.pack("!H", self.type)) |
| 2118 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2119 | packed.append(self.value) |
| 2120 | length = sum([len(x) for x in packed]) |
| 2121 | packed[1] = struct.pack("!H", length) |
| 2122 | return ''.join(packed) |
| 2123 | |
| 2124 | @staticmethod |
| 2125 | def unpack(reader): |
| 2126 | obj = name() |
| 2127 | _type = reader.read("!H")[0] |
| 2128 | assert(_type == 52) |
| 2129 | _length = reader.read("!H")[0] |
| 2130 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2131 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2132 | obj.value = str(reader.read_all()) |
| 2133 | return obj |
| 2134 | |
| 2135 | def __eq__(self, other): |
| 2136 | if type(self) != type(other): return False |
| 2137 | if self.value != other.value: return False |
| 2138 | return True |
| 2139 | |
| 2140 | def pretty_print(self, q): |
| 2141 | q.text("name {") |
| 2142 | with q.group(): |
| 2143 | with q.indent(2): |
| 2144 | q.breakable() |
| 2145 | q.text("value = "); |
| 2146 | q.pp(self.value) |
| 2147 | q.breakable() |
| 2148 | q.text('}') |
| 2149 | |
| 2150 | bsn_tlv.subtypes[52] = name |
| 2151 | |
Rich Lane | b41363b | 2015-07-08 15:42:38 -0700 | [diff] [blame] | 2152 | class offset(bsn_tlv): |
| 2153 | type = 82 |
| 2154 | |
| 2155 | def __init__(self, value=None): |
| 2156 | if value != None: |
| 2157 | self.value = value |
| 2158 | else: |
| 2159 | self.value = 0 |
| 2160 | return |
| 2161 | |
| 2162 | def pack(self): |
| 2163 | packed = [] |
| 2164 | packed.append(struct.pack("!H", self.type)) |
| 2165 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2166 | packed.append(struct.pack("!H", self.value)) |
| 2167 | length = sum([len(x) for x in packed]) |
| 2168 | packed[1] = struct.pack("!H", length) |
| 2169 | return ''.join(packed) |
| 2170 | |
| 2171 | @staticmethod |
| 2172 | def unpack(reader): |
| 2173 | obj = offset() |
| 2174 | _type = reader.read("!H")[0] |
| 2175 | assert(_type == 82) |
| 2176 | _length = reader.read("!H")[0] |
| 2177 | orig_reader = reader |
| 2178 | reader = orig_reader.slice(_length, 4) |
| 2179 | obj.value = reader.read("!H")[0] |
| 2180 | return obj |
| 2181 | |
| 2182 | def __eq__(self, other): |
| 2183 | if type(self) != type(other): return False |
| 2184 | if self.value != other.value: return False |
| 2185 | return True |
| 2186 | |
| 2187 | def pretty_print(self, q): |
| 2188 | q.text("offset {") |
| 2189 | with q.group(): |
| 2190 | with q.indent(2): |
| 2191 | q.breakable() |
| 2192 | q.text("value = "); |
| 2193 | q.text("%#x" % self.value) |
| 2194 | q.breakable() |
| 2195 | q.text('}') |
| 2196 | |
| 2197 | bsn_tlv.subtypes[82] = offset |
| 2198 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2199 | class partner_key(bsn_tlv): |
| 2200 | type = 51 |
| 2201 | |
| 2202 | def __init__(self, value=None): |
| 2203 | if value != None: |
| 2204 | self.value = value |
| 2205 | else: |
| 2206 | self.value = 0 |
| 2207 | return |
| 2208 | |
| 2209 | def pack(self): |
| 2210 | packed = [] |
| 2211 | packed.append(struct.pack("!H", self.type)) |
| 2212 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2213 | packed.append(struct.pack("!H", self.value)) |
| 2214 | length = sum([len(x) for x in packed]) |
| 2215 | packed[1] = struct.pack("!H", length) |
| 2216 | return ''.join(packed) |
| 2217 | |
| 2218 | @staticmethod |
| 2219 | def unpack(reader): |
| 2220 | obj = partner_key() |
| 2221 | _type = reader.read("!H")[0] |
| 2222 | assert(_type == 51) |
| 2223 | _length = reader.read("!H")[0] |
| 2224 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2225 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2226 | obj.value = reader.read("!H")[0] |
| 2227 | return obj |
| 2228 | |
| 2229 | def __eq__(self, other): |
| 2230 | if type(self) != type(other): return False |
| 2231 | if self.value != other.value: return False |
| 2232 | return True |
| 2233 | |
| 2234 | def pretty_print(self, q): |
| 2235 | q.text("partner_key {") |
| 2236 | with q.group(): |
| 2237 | with q.indent(2): |
| 2238 | q.breakable() |
| 2239 | q.text("value = "); |
| 2240 | q.text("%#x" % self.value) |
| 2241 | q.breakable() |
| 2242 | q.text('}') |
| 2243 | |
| 2244 | bsn_tlv.subtypes[51] = partner_key |
| 2245 | |
| 2246 | class partner_port_num(bsn_tlv): |
| 2247 | type = 50 |
| 2248 | |
| 2249 | def __init__(self, value=None): |
| 2250 | if value != None: |
| 2251 | self.value = value |
| 2252 | else: |
| 2253 | self.value = 0 |
| 2254 | return |
| 2255 | |
| 2256 | def pack(self): |
| 2257 | packed = [] |
| 2258 | packed.append(struct.pack("!H", self.type)) |
| 2259 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2260 | packed.append(struct.pack("!H", self.value)) |
| 2261 | length = sum([len(x) for x in packed]) |
| 2262 | packed[1] = struct.pack("!H", length) |
| 2263 | return ''.join(packed) |
| 2264 | |
| 2265 | @staticmethod |
| 2266 | def unpack(reader): |
| 2267 | obj = partner_port_num() |
| 2268 | _type = reader.read("!H")[0] |
| 2269 | assert(_type == 50) |
| 2270 | _length = reader.read("!H")[0] |
| 2271 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2272 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2273 | obj.value = reader.read("!H")[0] |
| 2274 | return obj |
| 2275 | |
| 2276 | def __eq__(self, other): |
| 2277 | if type(self) != type(other): return False |
| 2278 | if self.value != other.value: return False |
| 2279 | return True |
| 2280 | |
| 2281 | def pretty_print(self, q): |
| 2282 | q.text("partner_port_num {") |
| 2283 | with q.group(): |
| 2284 | with q.indent(2): |
| 2285 | q.breakable() |
| 2286 | q.text("value = "); |
| 2287 | q.text("%#x" % self.value) |
| 2288 | q.breakable() |
| 2289 | q.text('}') |
| 2290 | |
| 2291 | bsn_tlv.subtypes[50] = partner_port_num |
| 2292 | |
| 2293 | class partner_port_priority(bsn_tlv): |
| 2294 | type = 49 |
| 2295 | |
| 2296 | def __init__(self, value=None): |
| 2297 | if value != None: |
| 2298 | self.value = value |
| 2299 | else: |
| 2300 | self.value = 0 |
| 2301 | return |
| 2302 | |
| 2303 | def pack(self): |
| 2304 | packed = [] |
| 2305 | packed.append(struct.pack("!H", self.type)) |
| 2306 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2307 | packed.append(struct.pack("!H", self.value)) |
| 2308 | length = sum([len(x) for x in packed]) |
| 2309 | packed[1] = struct.pack("!H", length) |
| 2310 | return ''.join(packed) |
| 2311 | |
| 2312 | @staticmethod |
| 2313 | def unpack(reader): |
| 2314 | obj = partner_port_priority() |
| 2315 | _type = reader.read("!H")[0] |
| 2316 | assert(_type == 49) |
| 2317 | _length = reader.read("!H")[0] |
| 2318 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2319 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2320 | obj.value = reader.read("!H")[0] |
| 2321 | return obj |
| 2322 | |
| 2323 | def __eq__(self, other): |
| 2324 | if type(self) != type(other): return False |
| 2325 | if self.value != other.value: return False |
| 2326 | return True |
| 2327 | |
| 2328 | def pretty_print(self, q): |
| 2329 | q.text("partner_port_priority {") |
| 2330 | with q.group(): |
| 2331 | with q.indent(2): |
| 2332 | q.breakable() |
| 2333 | q.text("value = "); |
| 2334 | q.text("%#x" % self.value) |
| 2335 | q.breakable() |
| 2336 | q.text('}') |
| 2337 | |
| 2338 | bsn_tlv.subtypes[49] = partner_port_priority |
| 2339 | |
| 2340 | class partner_state(bsn_tlv): |
| 2341 | type = 54 |
| 2342 | |
| 2343 | def __init__(self, value=None): |
| 2344 | if value != None: |
| 2345 | self.value = value |
| 2346 | else: |
| 2347 | self.value = 0 |
| 2348 | return |
| 2349 | |
| 2350 | def pack(self): |
| 2351 | packed = [] |
| 2352 | packed.append(struct.pack("!H", self.type)) |
| 2353 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2354 | packed.append(struct.pack("!B", self.value)) |
| 2355 | length = sum([len(x) for x in packed]) |
| 2356 | packed[1] = struct.pack("!H", length) |
| 2357 | return ''.join(packed) |
| 2358 | |
| 2359 | @staticmethod |
| 2360 | def unpack(reader): |
| 2361 | obj = partner_state() |
| 2362 | _type = reader.read("!H")[0] |
| 2363 | assert(_type == 54) |
| 2364 | _length = reader.read("!H")[0] |
| 2365 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2366 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2367 | obj.value = reader.read("!B")[0] |
| 2368 | return obj |
| 2369 | |
| 2370 | def __eq__(self, other): |
| 2371 | if type(self) != type(other): return False |
| 2372 | if self.value != other.value: return False |
| 2373 | return True |
| 2374 | |
| 2375 | def pretty_print(self, q): |
| 2376 | q.text("partner_state {") |
| 2377 | with q.group(): |
| 2378 | with q.indent(2): |
| 2379 | q.breakable() |
| 2380 | q.text("value = "); |
| 2381 | q.text("%#x" % self.value) |
| 2382 | q.breakable() |
| 2383 | q.text('}') |
| 2384 | |
| 2385 | bsn_tlv.subtypes[54] = partner_state |
| 2386 | |
| 2387 | class partner_system_mac(bsn_tlv): |
| 2388 | type = 48 |
| 2389 | |
| 2390 | def __init__(self, value=None): |
| 2391 | if value != None: |
| 2392 | self.value = value |
| 2393 | else: |
| 2394 | self.value = [0,0,0,0,0,0] |
| 2395 | return |
| 2396 | |
| 2397 | def pack(self): |
| 2398 | packed = [] |
| 2399 | packed.append(struct.pack("!H", self.type)) |
| 2400 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2401 | packed.append(struct.pack("!6B", *self.value)) |
| 2402 | length = sum([len(x) for x in packed]) |
| 2403 | packed[1] = struct.pack("!H", length) |
| 2404 | return ''.join(packed) |
| 2405 | |
| 2406 | @staticmethod |
| 2407 | def unpack(reader): |
| 2408 | obj = partner_system_mac() |
| 2409 | _type = reader.read("!H")[0] |
| 2410 | assert(_type == 48) |
| 2411 | _length = reader.read("!H")[0] |
| 2412 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2413 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2414 | obj.value = list(reader.read('!6B')) |
| 2415 | return obj |
| 2416 | |
| 2417 | def __eq__(self, other): |
| 2418 | if type(self) != type(other): return False |
| 2419 | if self.value != other.value: return False |
| 2420 | return True |
| 2421 | |
| 2422 | def pretty_print(self, q): |
| 2423 | q.text("partner_system_mac {") |
| 2424 | with q.group(): |
| 2425 | with q.indent(2): |
| 2426 | q.breakable() |
| 2427 | q.text("value = "); |
| 2428 | q.text(util.pretty_mac(self.value)) |
| 2429 | q.breakable() |
| 2430 | q.text('}') |
| 2431 | |
| 2432 | bsn_tlv.subtypes[48] = partner_system_mac |
| 2433 | |
| 2434 | class partner_system_priority(bsn_tlv): |
| 2435 | type = 47 |
| 2436 | |
| 2437 | def __init__(self, value=None): |
| 2438 | if value != None: |
| 2439 | self.value = value |
| 2440 | else: |
| 2441 | self.value = 0 |
| 2442 | return |
| 2443 | |
| 2444 | def pack(self): |
| 2445 | packed = [] |
| 2446 | packed.append(struct.pack("!H", self.type)) |
| 2447 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2448 | packed.append(struct.pack("!H", self.value)) |
| 2449 | length = sum([len(x) for x in packed]) |
| 2450 | packed[1] = struct.pack("!H", length) |
| 2451 | return ''.join(packed) |
| 2452 | |
| 2453 | @staticmethod |
| 2454 | def unpack(reader): |
| 2455 | obj = partner_system_priority() |
| 2456 | _type = reader.read("!H")[0] |
| 2457 | assert(_type == 47) |
| 2458 | _length = reader.read("!H")[0] |
| 2459 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2460 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2461 | obj.value = reader.read("!H")[0] |
| 2462 | return obj |
| 2463 | |
| 2464 | def __eq__(self, other): |
| 2465 | if type(self) != type(other): return False |
| 2466 | if self.value != other.value: return False |
| 2467 | return True |
| 2468 | |
| 2469 | def pretty_print(self, q): |
| 2470 | q.text("partner_system_priority {") |
| 2471 | with q.group(): |
| 2472 | with q.indent(2): |
| 2473 | q.breakable() |
| 2474 | q.text("value = "); |
| 2475 | q.text("%#x" % self.value) |
| 2476 | q.breakable() |
| 2477 | q.text('}') |
| 2478 | |
| 2479 | bsn_tlv.subtypes[47] = partner_system_priority |
| 2480 | |
| 2481 | class port(bsn_tlv): |
| 2482 | type = 0 |
| 2483 | |
| 2484 | def __init__(self, value=None): |
| 2485 | if value != None: |
| 2486 | self.value = value |
| 2487 | else: |
| 2488 | self.value = 0 |
| 2489 | return |
| 2490 | |
| 2491 | def pack(self): |
| 2492 | packed = [] |
| 2493 | packed.append(struct.pack("!H", self.type)) |
| 2494 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2495 | packed.append(util.pack_port_no(self.value)) |
| 2496 | length = sum([len(x) for x in packed]) |
| 2497 | packed[1] = struct.pack("!H", length) |
| 2498 | return ''.join(packed) |
| 2499 | |
| 2500 | @staticmethod |
| 2501 | def unpack(reader): |
| 2502 | obj = port() |
| 2503 | _type = reader.read("!H")[0] |
| 2504 | assert(_type == 0) |
| 2505 | _length = reader.read("!H")[0] |
| 2506 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2507 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2508 | obj.value = util.unpack_port_no(reader) |
| 2509 | return obj |
| 2510 | |
| 2511 | def __eq__(self, other): |
| 2512 | if type(self) != type(other): return False |
| 2513 | if self.value != other.value: return False |
| 2514 | return True |
| 2515 | |
| 2516 | def pretty_print(self, q): |
| 2517 | q.text("port {") |
| 2518 | with q.group(): |
| 2519 | with q.indent(2): |
| 2520 | q.breakable() |
| 2521 | q.text("value = "); |
| 2522 | q.text(util.pretty_port(self.value)) |
| 2523 | q.breakable() |
| 2524 | q.text('}') |
| 2525 | |
| 2526 | bsn_tlv.subtypes[0] = port |
| 2527 | |
| 2528 | class priority(bsn_tlv): |
| 2529 | type = 57 |
| 2530 | |
| 2531 | def __init__(self, value=None): |
| 2532 | if value != None: |
| 2533 | self.value = value |
| 2534 | else: |
| 2535 | self.value = 0 |
| 2536 | return |
| 2537 | |
| 2538 | def pack(self): |
| 2539 | packed = [] |
| 2540 | packed.append(struct.pack("!H", self.type)) |
| 2541 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2542 | packed.append(struct.pack("!L", self.value)) |
| 2543 | length = sum([len(x) for x in packed]) |
| 2544 | packed[1] = struct.pack("!H", length) |
| 2545 | return ''.join(packed) |
| 2546 | |
| 2547 | @staticmethod |
| 2548 | def unpack(reader): |
| 2549 | obj = priority() |
| 2550 | _type = reader.read("!H")[0] |
| 2551 | assert(_type == 57) |
| 2552 | _length = reader.read("!H")[0] |
| 2553 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2554 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2555 | obj.value = reader.read("!L")[0] |
| 2556 | return obj |
| 2557 | |
| 2558 | def __eq__(self, other): |
| 2559 | if type(self) != type(other): return False |
| 2560 | if self.value != other.value: return False |
| 2561 | return True |
| 2562 | |
| 2563 | def pretty_print(self, q): |
| 2564 | q.text("priority {") |
| 2565 | with q.group(): |
| 2566 | with q.indent(2): |
| 2567 | q.breakable() |
| 2568 | q.text("value = "); |
| 2569 | q.text("%#x" % self.value) |
| 2570 | q.breakable() |
| 2571 | q.text('}') |
| 2572 | |
| 2573 | bsn_tlv.subtypes[57] = priority |
| 2574 | |
| 2575 | class queue_id(bsn_tlv): |
| 2576 | type = 20 |
| 2577 | |
| 2578 | def __init__(self, value=None): |
| 2579 | if value != None: |
| 2580 | self.value = value |
| 2581 | else: |
| 2582 | self.value = 0 |
| 2583 | return |
| 2584 | |
| 2585 | def pack(self): |
| 2586 | packed = [] |
| 2587 | packed.append(struct.pack("!H", self.type)) |
| 2588 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2589 | packed.append(struct.pack("!L", self.value)) |
| 2590 | length = sum([len(x) for x in packed]) |
| 2591 | packed[1] = struct.pack("!H", length) |
| 2592 | return ''.join(packed) |
| 2593 | |
| 2594 | @staticmethod |
| 2595 | def unpack(reader): |
| 2596 | obj = queue_id() |
| 2597 | _type = reader.read("!H")[0] |
| 2598 | assert(_type == 20) |
| 2599 | _length = reader.read("!H")[0] |
| 2600 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2601 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2602 | obj.value = reader.read("!L")[0] |
| 2603 | return obj |
| 2604 | |
| 2605 | def __eq__(self, other): |
| 2606 | if type(self) != type(other): return False |
| 2607 | if self.value != other.value: return False |
| 2608 | return True |
| 2609 | |
| 2610 | def pretty_print(self, q): |
| 2611 | q.text("queue_id {") |
| 2612 | with q.group(): |
| 2613 | with q.indent(2): |
| 2614 | q.breakable() |
| 2615 | q.text("value = "); |
| 2616 | q.text("%#x" % self.value) |
| 2617 | q.breakable() |
| 2618 | q.text('}') |
| 2619 | |
| 2620 | bsn_tlv.subtypes[20] = queue_id |
| 2621 | |
| 2622 | class queue_weight(bsn_tlv): |
| 2623 | type = 21 |
| 2624 | |
| 2625 | def __init__(self, value=None): |
| 2626 | if value != None: |
| 2627 | self.value = value |
| 2628 | else: |
| 2629 | self.value = 0 |
| 2630 | return |
| 2631 | |
| 2632 | def pack(self): |
| 2633 | packed = [] |
| 2634 | packed.append(struct.pack("!H", self.type)) |
| 2635 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2636 | packed.append(struct.pack("!L", self.value)) |
| 2637 | length = sum([len(x) for x in packed]) |
| 2638 | packed[1] = struct.pack("!H", length) |
| 2639 | return ''.join(packed) |
| 2640 | |
| 2641 | @staticmethod |
| 2642 | def unpack(reader): |
| 2643 | obj = queue_weight() |
| 2644 | _type = reader.read("!H")[0] |
| 2645 | assert(_type == 21) |
| 2646 | _length = reader.read("!H")[0] |
| 2647 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2648 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2649 | obj.value = reader.read("!L")[0] |
| 2650 | return obj |
| 2651 | |
| 2652 | def __eq__(self, other): |
| 2653 | if type(self) != type(other): return False |
| 2654 | if self.value != other.value: return False |
| 2655 | return True |
| 2656 | |
| 2657 | def pretty_print(self, q): |
| 2658 | q.text("queue_weight {") |
| 2659 | with q.group(): |
| 2660 | with q.indent(2): |
| 2661 | q.breakable() |
| 2662 | q.text("value = "); |
| 2663 | q.text("%#x" % self.value) |
| 2664 | q.breakable() |
| 2665 | q.text('}') |
| 2666 | |
| 2667 | bsn_tlv.subtypes[21] = queue_weight |
| 2668 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 2669 | class reference(bsn_tlv): |
| 2670 | type = 59 |
| 2671 | |
| 2672 | def __init__(self, table_id=None, key=None): |
| 2673 | if table_id != None: |
| 2674 | self.table_id = table_id |
| 2675 | else: |
| 2676 | self.table_id = 0 |
| 2677 | if key != None: |
| 2678 | self.key = key |
| 2679 | else: |
| 2680 | self.key = [] |
| 2681 | return |
| 2682 | |
| 2683 | def pack(self): |
| 2684 | packed = [] |
| 2685 | packed.append(struct.pack("!H", self.type)) |
| 2686 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2687 | packed.append(struct.pack("!H", self.table_id)) |
| 2688 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 2689 | length = sum([len(x) for x in packed]) |
| 2690 | packed[1] = struct.pack("!H", length) |
| 2691 | return ''.join(packed) |
| 2692 | |
| 2693 | @staticmethod |
| 2694 | def unpack(reader): |
| 2695 | obj = reference() |
| 2696 | _type = reader.read("!H")[0] |
| 2697 | assert(_type == 59) |
| 2698 | _length = reader.read("!H")[0] |
| 2699 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2700 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 2701 | obj.table_id = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2702 | obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 2703 | return obj |
| 2704 | |
| 2705 | def __eq__(self, other): |
| 2706 | if type(self) != type(other): return False |
| 2707 | if self.table_id != other.table_id: return False |
| 2708 | if self.key != other.key: return False |
| 2709 | return True |
| 2710 | |
| 2711 | def pretty_print(self, q): |
| 2712 | q.text("reference {") |
| 2713 | with q.group(): |
| 2714 | with q.indent(2): |
| 2715 | q.breakable() |
| 2716 | q.text("table_id = "); |
| 2717 | q.text("%#x" % self.table_id) |
| 2718 | q.text(","); q.breakable() |
| 2719 | q.text("key = "); |
| 2720 | q.pp(self.key) |
| 2721 | q.breakable() |
| 2722 | q.text('}') |
| 2723 | |
| 2724 | bsn_tlv.subtypes[59] = reference |
| 2725 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2726 | class reply_packets(bsn_tlv): |
| 2727 | type = 12 |
| 2728 | |
| 2729 | def __init__(self, value=None): |
| 2730 | if value != None: |
| 2731 | self.value = value |
| 2732 | else: |
| 2733 | self.value = 0 |
| 2734 | return |
| 2735 | |
| 2736 | def pack(self): |
| 2737 | packed = [] |
| 2738 | packed.append(struct.pack("!H", self.type)) |
| 2739 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2740 | packed.append(struct.pack("!Q", self.value)) |
| 2741 | length = sum([len(x) for x in packed]) |
| 2742 | packed[1] = struct.pack("!H", length) |
| 2743 | return ''.join(packed) |
| 2744 | |
| 2745 | @staticmethod |
| 2746 | def unpack(reader): |
| 2747 | obj = reply_packets() |
| 2748 | _type = reader.read("!H")[0] |
| 2749 | assert(_type == 12) |
| 2750 | _length = reader.read("!H")[0] |
| 2751 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2752 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2753 | obj.value = reader.read("!Q")[0] |
| 2754 | return obj |
| 2755 | |
| 2756 | def __eq__(self, other): |
| 2757 | if type(self) != type(other): return False |
| 2758 | if self.value != other.value: return False |
| 2759 | return True |
| 2760 | |
| 2761 | def pretty_print(self, q): |
| 2762 | q.text("reply_packets {") |
| 2763 | with q.group(): |
| 2764 | with q.indent(2): |
| 2765 | q.breakable() |
| 2766 | q.text("value = "); |
| 2767 | q.text("%#x" % self.value) |
| 2768 | q.breakable() |
| 2769 | q.text('}') |
| 2770 | |
| 2771 | bsn_tlv.subtypes[12] = reply_packets |
| 2772 | |
| 2773 | class request_packets(bsn_tlv): |
| 2774 | type = 11 |
| 2775 | |
| 2776 | def __init__(self, value=None): |
| 2777 | if value != None: |
| 2778 | self.value = value |
| 2779 | else: |
| 2780 | self.value = 0 |
| 2781 | return |
| 2782 | |
| 2783 | def pack(self): |
| 2784 | packed = [] |
| 2785 | packed.append(struct.pack("!H", self.type)) |
| 2786 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2787 | packed.append(struct.pack("!Q", self.value)) |
| 2788 | length = sum([len(x) for x in packed]) |
| 2789 | packed[1] = struct.pack("!H", length) |
| 2790 | return ''.join(packed) |
| 2791 | |
| 2792 | @staticmethod |
| 2793 | def unpack(reader): |
| 2794 | obj = request_packets() |
| 2795 | _type = reader.read("!H")[0] |
| 2796 | assert(_type == 11) |
| 2797 | _length = reader.read("!H")[0] |
| 2798 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2799 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2800 | obj.value = reader.read("!Q")[0] |
| 2801 | return obj |
| 2802 | |
| 2803 | def __eq__(self, other): |
| 2804 | if type(self) != type(other): return False |
| 2805 | if self.value != other.value: return False |
| 2806 | return True |
| 2807 | |
| 2808 | def pretty_print(self, q): |
| 2809 | q.text("request_packets {") |
| 2810 | with q.group(): |
| 2811 | with q.indent(2): |
| 2812 | q.breakable() |
| 2813 | q.text("value = "); |
| 2814 | q.text("%#x" % self.value) |
| 2815 | q.breakable() |
| 2816 | q.text('}') |
| 2817 | |
| 2818 | bsn_tlv.subtypes[11] = request_packets |
| 2819 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2820 | class rx_bytes(bsn_tlv): |
| 2821 | type = 71 |
| 2822 | |
| 2823 | def __init__(self, value=None): |
| 2824 | if value != None: |
| 2825 | self.value = value |
| 2826 | else: |
| 2827 | self.value = 0 |
| 2828 | return |
| 2829 | |
| 2830 | def pack(self): |
| 2831 | packed = [] |
| 2832 | packed.append(struct.pack("!H", self.type)) |
| 2833 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2834 | packed.append(struct.pack("!Q", self.value)) |
| 2835 | length = sum([len(x) for x in packed]) |
| 2836 | packed[1] = struct.pack("!H", length) |
| 2837 | return ''.join(packed) |
| 2838 | |
| 2839 | @staticmethod |
| 2840 | def unpack(reader): |
| 2841 | obj = rx_bytes() |
| 2842 | _type = reader.read("!H")[0] |
| 2843 | assert(_type == 71) |
| 2844 | _length = reader.read("!H")[0] |
| 2845 | orig_reader = reader |
| 2846 | reader = orig_reader.slice(_length, 4) |
| 2847 | obj.value = reader.read("!Q")[0] |
| 2848 | return obj |
| 2849 | |
| 2850 | def __eq__(self, other): |
| 2851 | if type(self) != type(other): return False |
| 2852 | if self.value != other.value: return False |
| 2853 | return True |
| 2854 | |
| 2855 | def pretty_print(self, q): |
| 2856 | q.text("rx_bytes {") |
| 2857 | with q.group(): |
| 2858 | with q.indent(2): |
| 2859 | q.breakable() |
| 2860 | q.text("value = "); |
| 2861 | q.text("%#x" % self.value) |
| 2862 | q.breakable() |
| 2863 | q.text('}') |
| 2864 | |
| 2865 | bsn_tlv.subtypes[71] = rx_bytes |
| 2866 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2867 | class rx_packets(bsn_tlv): |
| 2868 | type = 2 |
| 2869 | |
| 2870 | def __init__(self, value=None): |
| 2871 | if value != None: |
| 2872 | self.value = value |
| 2873 | else: |
| 2874 | self.value = 0 |
| 2875 | return |
| 2876 | |
| 2877 | def pack(self): |
| 2878 | packed = [] |
| 2879 | packed.append(struct.pack("!H", self.type)) |
| 2880 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2881 | packed.append(struct.pack("!Q", self.value)) |
| 2882 | length = sum([len(x) for x in packed]) |
| 2883 | packed[1] = struct.pack("!H", length) |
| 2884 | return ''.join(packed) |
| 2885 | |
| 2886 | @staticmethod |
| 2887 | def unpack(reader): |
| 2888 | obj = rx_packets() |
| 2889 | _type = reader.read("!H")[0] |
| 2890 | assert(_type == 2) |
| 2891 | _length = reader.read("!H")[0] |
| 2892 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2893 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2894 | obj.value = reader.read("!Q")[0] |
| 2895 | return obj |
| 2896 | |
| 2897 | def __eq__(self, other): |
| 2898 | if type(self) != type(other): return False |
| 2899 | if self.value != other.value: return False |
| 2900 | return True |
| 2901 | |
| 2902 | def pretty_print(self, q): |
| 2903 | q.text("rx_packets {") |
| 2904 | with q.group(): |
| 2905 | with q.indent(2): |
| 2906 | q.breakable() |
| 2907 | q.text("value = "); |
| 2908 | q.text("%#x" % self.value) |
| 2909 | q.breakable() |
| 2910 | q.text('}') |
| 2911 | |
| 2912 | bsn_tlv.subtypes[2] = rx_packets |
| 2913 | |
| 2914 | class sampling_rate(bsn_tlv): |
| 2915 | type = 30 |
| 2916 | |
| 2917 | def __init__(self, value=None): |
| 2918 | if value != None: |
| 2919 | self.value = value |
| 2920 | else: |
| 2921 | self.value = 0 |
| 2922 | return |
| 2923 | |
| 2924 | def pack(self): |
| 2925 | packed = [] |
| 2926 | packed.append(struct.pack("!H", self.type)) |
| 2927 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2928 | packed.append(struct.pack("!L", self.value)) |
| 2929 | length = sum([len(x) for x in packed]) |
| 2930 | packed[1] = struct.pack("!H", length) |
| 2931 | return ''.join(packed) |
| 2932 | |
| 2933 | @staticmethod |
| 2934 | def unpack(reader): |
| 2935 | obj = sampling_rate() |
| 2936 | _type = reader.read("!H")[0] |
| 2937 | assert(_type == 30) |
| 2938 | _length = reader.read("!H")[0] |
| 2939 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2940 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2941 | obj.value = reader.read("!L")[0] |
| 2942 | return obj |
| 2943 | |
| 2944 | def __eq__(self, other): |
| 2945 | if type(self) != type(other): return False |
| 2946 | if self.value != other.value: return False |
| 2947 | return True |
| 2948 | |
| 2949 | def pretty_print(self, q): |
| 2950 | q.text("sampling_rate {") |
| 2951 | with q.group(): |
| 2952 | with q.indent(2): |
| 2953 | q.breakable() |
| 2954 | q.text("value = "); |
| 2955 | q.text("%#x" % self.value) |
| 2956 | q.breakable() |
| 2957 | q.text('}') |
| 2958 | |
| 2959 | bsn_tlv.subtypes[30] = sampling_rate |
| 2960 | |
Kiran Poola | 36a302c | 2015-04-22 11:20:16 -0700 | [diff] [blame] | 2961 | class set_loopback_mode(bsn_tlv): |
| 2962 | type = 74 |
| 2963 | |
| 2964 | def __init__(self): |
| 2965 | return |
| 2966 | |
| 2967 | def pack(self): |
| 2968 | packed = [] |
| 2969 | packed.append(struct.pack("!H", self.type)) |
| 2970 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2971 | length = sum([len(x) for x in packed]) |
| 2972 | packed[1] = struct.pack("!H", length) |
| 2973 | return ''.join(packed) |
| 2974 | |
| 2975 | @staticmethod |
| 2976 | def unpack(reader): |
| 2977 | obj = set_loopback_mode() |
| 2978 | _type = reader.read("!H")[0] |
| 2979 | assert(_type == 74) |
| 2980 | _length = reader.read("!H")[0] |
| 2981 | orig_reader = reader |
| 2982 | reader = orig_reader.slice(_length, 4) |
| 2983 | return obj |
| 2984 | |
| 2985 | def __eq__(self, other): |
| 2986 | if type(self) != type(other): return False |
| 2987 | return True |
| 2988 | |
| 2989 | def pretty_print(self, q): |
| 2990 | q.text("set_loopback_mode {") |
| 2991 | with q.group(): |
| 2992 | with q.indent(2): |
| 2993 | q.breakable() |
| 2994 | q.breakable() |
| 2995 | q.text('}') |
| 2996 | |
| 2997 | bsn_tlv.subtypes[74] = set_loopback_mode |
| 2998 | |
| 2999 | class strip_mpls_l2_on_ingress(bsn_tlv): |
| 3000 | type = 75 |
| 3001 | |
| 3002 | def __init__(self): |
| 3003 | return |
| 3004 | |
| 3005 | def pack(self): |
| 3006 | packed = [] |
| 3007 | packed.append(struct.pack("!H", self.type)) |
| 3008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3009 | length = sum([len(x) for x in packed]) |
| 3010 | packed[1] = struct.pack("!H", length) |
| 3011 | return ''.join(packed) |
| 3012 | |
| 3013 | @staticmethod |
| 3014 | def unpack(reader): |
| 3015 | obj = strip_mpls_l2_on_ingress() |
| 3016 | _type = reader.read("!H")[0] |
| 3017 | assert(_type == 75) |
| 3018 | _length = reader.read("!H")[0] |
| 3019 | orig_reader = reader |
| 3020 | reader = orig_reader.slice(_length, 4) |
| 3021 | return obj |
| 3022 | |
| 3023 | def __eq__(self, other): |
| 3024 | if type(self) != type(other): return False |
| 3025 | return True |
| 3026 | |
| 3027 | def pretty_print(self, q): |
| 3028 | q.text("strip_mpls_l2_on_ingress {") |
| 3029 | with q.group(): |
| 3030 | with q.indent(2): |
| 3031 | q.breakable() |
| 3032 | q.breakable() |
| 3033 | q.text('}') |
| 3034 | |
| 3035 | bsn_tlv.subtypes[75] = strip_mpls_l2_on_ingress |
| 3036 | |
| 3037 | class strip_mpls_l3_on_ingress(bsn_tlv): |
| 3038 | type = 76 |
| 3039 | |
| 3040 | def __init__(self): |
| 3041 | return |
| 3042 | |
| 3043 | def pack(self): |
| 3044 | packed = [] |
| 3045 | packed.append(struct.pack("!H", self.type)) |
| 3046 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3047 | length = sum([len(x) for x in packed]) |
| 3048 | packed[1] = struct.pack("!H", length) |
| 3049 | return ''.join(packed) |
| 3050 | |
| 3051 | @staticmethod |
| 3052 | def unpack(reader): |
| 3053 | obj = strip_mpls_l3_on_ingress() |
| 3054 | _type = reader.read("!H")[0] |
| 3055 | assert(_type == 76) |
| 3056 | _length = reader.read("!H")[0] |
| 3057 | orig_reader = reader |
| 3058 | reader = orig_reader.slice(_length, 4) |
| 3059 | return obj |
| 3060 | |
| 3061 | def __eq__(self, other): |
| 3062 | if type(self) != type(other): return False |
| 3063 | return True |
| 3064 | |
| 3065 | def pretty_print(self, q): |
| 3066 | q.text("strip_mpls_l3_on_ingress {") |
| 3067 | with q.group(): |
| 3068 | with q.indent(2): |
| 3069 | q.breakable() |
| 3070 | q.breakable() |
| 3071 | q.text('}') |
| 3072 | |
| 3073 | bsn_tlv.subtypes[76] = strip_mpls_l3_on_ingress |
| 3074 | |
| 3075 | class strip_vlan_on_egress(bsn_tlv): |
| 3076 | type = 73 |
| 3077 | |
| 3078 | def __init__(self): |
| 3079 | return |
| 3080 | |
| 3081 | def pack(self): |
| 3082 | packed = [] |
| 3083 | packed.append(struct.pack("!H", self.type)) |
| 3084 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3085 | length = sum([len(x) for x in packed]) |
| 3086 | packed[1] = struct.pack("!H", length) |
| 3087 | return ''.join(packed) |
| 3088 | |
| 3089 | @staticmethod |
| 3090 | def unpack(reader): |
| 3091 | obj = strip_vlan_on_egress() |
| 3092 | _type = reader.read("!H")[0] |
| 3093 | assert(_type == 73) |
| 3094 | _length = reader.read("!H")[0] |
| 3095 | orig_reader = reader |
| 3096 | reader = orig_reader.slice(_length, 4) |
| 3097 | return obj |
| 3098 | |
| 3099 | def __eq__(self, other): |
| 3100 | if type(self) != type(other): return False |
| 3101 | return True |
| 3102 | |
| 3103 | def pretty_print(self, q): |
| 3104 | q.text("strip_vlan_on_egress {") |
| 3105 | with q.group(): |
| 3106 | with q.indent(2): |
| 3107 | q.breakable() |
| 3108 | q.breakable() |
| 3109 | q.text('}') |
| 3110 | |
| 3111 | bsn_tlv.subtypes[73] = strip_vlan_on_egress |
| 3112 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3113 | class sub_agent_id(bsn_tlv): |
| 3114 | type = 38 |
| 3115 | |
| 3116 | def __init__(self, value=None): |
| 3117 | if value != None: |
| 3118 | self.value = value |
| 3119 | else: |
| 3120 | self.value = 0 |
| 3121 | return |
| 3122 | |
| 3123 | def pack(self): |
| 3124 | packed = [] |
| 3125 | packed.append(struct.pack("!H", self.type)) |
| 3126 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3127 | packed.append(struct.pack("!L", self.value)) |
| 3128 | length = sum([len(x) for x in packed]) |
| 3129 | packed[1] = struct.pack("!H", length) |
| 3130 | return ''.join(packed) |
| 3131 | |
| 3132 | @staticmethod |
| 3133 | def unpack(reader): |
| 3134 | obj = sub_agent_id() |
| 3135 | _type = reader.read("!H")[0] |
| 3136 | assert(_type == 38) |
| 3137 | _length = reader.read("!H")[0] |
| 3138 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3139 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3140 | obj.value = reader.read("!L")[0] |
| 3141 | return obj |
| 3142 | |
| 3143 | def __eq__(self, other): |
| 3144 | if type(self) != type(other): return False |
| 3145 | if self.value != other.value: return False |
| 3146 | return True |
| 3147 | |
| 3148 | def pretty_print(self, q): |
| 3149 | q.text("sub_agent_id {") |
| 3150 | with q.group(): |
| 3151 | with q.indent(2): |
| 3152 | q.breakable() |
| 3153 | q.text("value = "); |
| 3154 | q.text("%#x" % self.value) |
| 3155 | q.breakable() |
| 3156 | q.text('}') |
| 3157 | |
| 3158 | bsn_tlv.subtypes[38] = sub_agent_id |
| 3159 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 3160 | class tcp_dst(bsn_tlv): |
| 3161 | type = 66 |
| 3162 | |
| 3163 | def __init__(self, value=None): |
| 3164 | if value != None: |
| 3165 | self.value = value |
| 3166 | else: |
| 3167 | self.value = 0 |
| 3168 | return |
| 3169 | |
| 3170 | def pack(self): |
| 3171 | packed = [] |
| 3172 | packed.append(struct.pack("!H", self.type)) |
| 3173 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3174 | packed.append(struct.pack("!H", self.value)) |
| 3175 | length = sum([len(x) for x in packed]) |
| 3176 | packed[1] = struct.pack("!H", length) |
| 3177 | return ''.join(packed) |
| 3178 | |
| 3179 | @staticmethod |
| 3180 | def unpack(reader): |
| 3181 | obj = tcp_dst() |
| 3182 | _type = reader.read("!H")[0] |
| 3183 | assert(_type == 66) |
| 3184 | _length = reader.read("!H")[0] |
| 3185 | orig_reader = reader |
| 3186 | reader = orig_reader.slice(_length, 4) |
| 3187 | obj.value = reader.read("!H")[0] |
| 3188 | return obj |
| 3189 | |
| 3190 | def __eq__(self, other): |
| 3191 | if type(self) != type(other): return False |
| 3192 | if self.value != other.value: return False |
| 3193 | return True |
| 3194 | |
| 3195 | def pretty_print(self, q): |
| 3196 | q.text("tcp_dst {") |
| 3197 | with q.group(): |
| 3198 | with q.indent(2): |
| 3199 | q.breakable() |
| 3200 | q.text("value = "); |
| 3201 | q.text("%#x" % self.value) |
| 3202 | q.breakable() |
| 3203 | q.text('}') |
| 3204 | |
| 3205 | bsn_tlv.subtypes[66] = tcp_dst |
| 3206 | |
| 3207 | class tcp_src(bsn_tlv): |
| 3208 | type = 65 |
| 3209 | |
| 3210 | def __init__(self, value=None): |
| 3211 | if value != None: |
| 3212 | self.value = value |
| 3213 | else: |
| 3214 | self.value = 0 |
| 3215 | return |
| 3216 | |
| 3217 | def pack(self): |
| 3218 | packed = [] |
| 3219 | packed.append(struct.pack("!H", self.type)) |
| 3220 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3221 | packed.append(struct.pack("!H", self.value)) |
| 3222 | length = sum([len(x) for x in packed]) |
| 3223 | packed[1] = struct.pack("!H", length) |
| 3224 | return ''.join(packed) |
| 3225 | |
| 3226 | @staticmethod |
| 3227 | def unpack(reader): |
| 3228 | obj = tcp_src() |
| 3229 | _type = reader.read("!H")[0] |
| 3230 | assert(_type == 65) |
| 3231 | _length = reader.read("!H")[0] |
| 3232 | orig_reader = reader |
| 3233 | reader = orig_reader.slice(_length, 4) |
| 3234 | obj.value = reader.read("!H")[0] |
| 3235 | return obj |
| 3236 | |
| 3237 | def __eq__(self, other): |
| 3238 | if type(self) != type(other): return False |
| 3239 | if self.value != other.value: return False |
| 3240 | return True |
| 3241 | |
| 3242 | def pretty_print(self, q): |
| 3243 | q.text("tcp_src {") |
| 3244 | with q.group(): |
| 3245 | with q.indent(2): |
| 3246 | q.breakable() |
| 3247 | q.text("value = "); |
| 3248 | q.text("%#x" % self.value) |
| 3249 | q.breakable() |
| 3250 | q.text('}') |
| 3251 | |
| 3252 | bsn_tlv.subtypes[65] = tcp_src |
| 3253 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3254 | class tx_bytes(bsn_tlv): |
| 3255 | type = 39 |
| 3256 | |
| 3257 | def __init__(self, value=None): |
| 3258 | if value != None: |
| 3259 | self.value = value |
| 3260 | else: |
| 3261 | self.value = 0 |
| 3262 | return |
| 3263 | |
| 3264 | def pack(self): |
| 3265 | packed = [] |
| 3266 | packed.append(struct.pack("!H", self.type)) |
| 3267 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3268 | packed.append(struct.pack("!Q", self.value)) |
| 3269 | length = sum([len(x) for x in packed]) |
| 3270 | packed[1] = struct.pack("!H", length) |
| 3271 | return ''.join(packed) |
| 3272 | |
| 3273 | @staticmethod |
| 3274 | def unpack(reader): |
| 3275 | obj = tx_bytes() |
| 3276 | _type = reader.read("!H")[0] |
| 3277 | assert(_type == 39) |
| 3278 | _length = reader.read("!H")[0] |
| 3279 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3280 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3281 | obj.value = reader.read("!Q")[0] |
| 3282 | return obj |
| 3283 | |
| 3284 | def __eq__(self, other): |
| 3285 | if type(self) != type(other): return False |
| 3286 | if self.value != other.value: return False |
| 3287 | return True |
| 3288 | |
| 3289 | def pretty_print(self, q): |
| 3290 | q.text("tx_bytes {") |
| 3291 | with q.group(): |
| 3292 | with q.indent(2): |
| 3293 | q.breakable() |
| 3294 | q.text("value = "); |
| 3295 | q.text("%#x" % self.value) |
| 3296 | q.breakable() |
| 3297 | q.text('}') |
| 3298 | |
| 3299 | bsn_tlv.subtypes[39] = tx_bytes |
| 3300 | |
| 3301 | class tx_packets(bsn_tlv): |
| 3302 | type = 3 |
| 3303 | |
| 3304 | def __init__(self, value=None): |
| 3305 | if value != None: |
| 3306 | self.value = value |
| 3307 | else: |
| 3308 | self.value = 0 |
| 3309 | return |
| 3310 | |
| 3311 | def pack(self): |
| 3312 | packed = [] |
| 3313 | packed.append(struct.pack("!H", self.type)) |
| 3314 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3315 | packed.append(struct.pack("!Q", self.value)) |
| 3316 | length = sum([len(x) for x in packed]) |
| 3317 | packed[1] = struct.pack("!H", length) |
| 3318 | return ''.join(packed) |
| 3319 | |
| 3320 | @staticmethod |
| 3321 | def unpack(reader): |
| 3322 | obj = tx_packets() |
| 3323 | _type = reader.read("!H")[0] |
| 3324 | assert(_type == 3) |
| 3325 | _length = reader.read("!H")[0] |
| 3326 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3327 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3328 | obj.value = reader.read("!Q")[0] |
| 3329 | return obj |
| 3330 | |
| 3331 | def __eq__(self, other): |
| 3332 | if type(self) != type(other): return False |
| 3333 | if self.value != other.value: return False |
| 3334 | return True |
| 3335 | |
| 3336 | def pretty_print(self, q): |
| 3337 | q.text("tx_packets {") |
| 3338 | with q.group(): |
| 3339 | with q.indent(2): |
| 3340 | q.breakable() |
| 3341 | q.text("value = "); |
| 3342 | q.text("%#x" % self.value) |
| 3343 | q.breakable() |
| 3344 | q.text('}') |
| 3345 | |
| 3346 | bsn_tlv.subtypes[3] = tx_packets |
| 3347 | |
| 3348 | class udf_anchor(bsn_tlv): |
| 3349 | type = 16 |
| 3350 | |
| 3351 | def __init__(self, value=None): |
| 3352 | if value != None: |
| 3353 | self.value = value |
| 3354 | else: |
| 3355 | self.value = 0 |
| 3356 | return |
| 3357 | |
| 3358 | def pack(self): |
| 3359 | packed = [] |
| 3360 | packed.append(struct.pack("!H", self.type)) |
| 3361 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3362 | packed.append(struct.pack("!H", self.value)) |
| 3363 | length = sum([len(x) for x in packed]) |
| 3364 | packed[1] = struct.pack("!H", length) |
| 3365 | return ''.join(packed) |
| 3366 | |
| 3367 | @staticmethod |
| 3368 | def unpack(reader): |
| 3369 | obj = udf_anchor() |
| 3370 | _type = reader.read("!H")[0] |
| 3371 | assert(_type == 16) |
| 3372 | _length = reader.read("!H")[0] |
| 3373 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3374 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3375 | obj.value = reader.read("!H")[0] |
| 3376 | return obj |
| 3377 | |
| 3378 | def __eq__(self, other): |
| 3379 | if type(self) != type(other): return False |
| 3380 | if self.value != other.value: return False |
| 3381 | return True |
| 3382 | |
| 3383 | def pretty_print(self, q): |
| 3384 | q.text("udf_anchor {") |
| 3385 | with q.group(): |
| 3386 | with q.indent(2): |
| 3387 | q.breakable() |
| 3388 | q.text("value = "); |
| 3389 | q.text("%#x" % self.value) |
| 3390 | q.breakable() |
| 3391 | q.text('}') |
| 3392 | |
| 3393 | bsn_tlv.subtypes[16] = udf_anchor |
| 3394 | |
| 3395 | class udf_id(bsn_tlv): |
| 3396 | type = 15 |
| 3397 | |
| 3398 | def __init__(self, value=None): |
| 3399 | if value != None: |
| 3400 | self.value = value |
| 3401 | else: |
| 3402 | self.value = 0 |
| 3403 | return |
| 3404 | |
| 3405 | def pack(self): |
| 3406 | packed = [] |
| 3407 | packed.append(struct.pack("!H", self.type)) |
| 3408 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3409 | packed.append(struct.pack("!H", self.value)) |
| 3410 | length = sum([len(x) for x in packed]) |
| 3411 | packed[1] = struct.pack("!H", length) |
| 3412 | return ''.join(packed) |
| 3413 | |
| 3414 | @staticmethod |
| 3415 | def unpack(reader): |
| 3416 | obj = udf_id() |
| 3417 | _type = reader.read("!H")[0] |
| 3418 | assert(_type == 15) |
| 3419 | _length = reader.read("!H")[0] |
| 3420 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3421 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3422 | obj.value = reader.read("!H")[0] |
| 3423 | return obj |
| 3424 | |
| 3425 | def __eq__(self, other): |
| 3426 | if type(self) != type(other): return False |
| 3427 | if self.value != other.value: return False |
| 3428 | return True |
| 3429 | |
| 3430 | def pretty_print(self, q): |
| 3431 | q.text("udf_id {") |
| 3432 | with q.group(): |
| 3433 | with q.indent(2): |
| 3434 | q.breakable() |
| 3435 | q.text("value = "); |
| 3436 | q.text("%#x" % self.value) |
| 3437 | q.breakable() |
| 3438 | q.text('}') |
| 3439 | |
| 3440 | bsn_tlv.subtypes[15] = udf_id |
| 3441 | |
| 3442 | class udf_length(bsn_tlv): |
| 3443 | type = 18 |
| 3444 | |
| 3445 | def __init__(self, value=None): |
| 3446 | if value != None: |
| 3447 | self.value = value |
| 3448 | else: |
| 3449 | self.value = 0 |
| 3450 | return |
| 3451 | |
| 3452 | def pack(self): |
| 3453 | packed = [] |
| 3454 | packed.append(struct.pack("!H", self.type)) |
| 3455 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3456 | packed.append(struct.pack("!H", self.value)) |
| 3457 | length = sum([len(x) for x in packed]) |
| 3458 | packed[1] = struct.pack("!H", length) |
| 3459 | return ''.join(packed) |
| 3460 | |
| 3461 | @staticmethod |
| 3462 | def unpack(reader): |
| 3463 | obj = udf_length() |
| 3464 | _type = reader.read("!H")[0] |
| 3465 | assert(_type == 18) |
| 3466 | _length = reader.read("!H")[0] |
| 3467 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3468 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3469 | obj.value = reader.read("!H")[0] |
| 3470 | return obj |
| 3471 | |
| 3472 | def __eq__(self, other): |
| 3473 | if type(self) != type(other): return False |
| 3474 | if self.value != other.value: return False |
| 3475 | return True |
| 3476 | |
| 3477 | def pretty_print(self, q): |
| 3478 | q.text("udf_length {") |
| 3479 | with q.group(): |
| 3480 | with q.indent(2): |
| 3481 | q.breakable() |
| 3482 | q.text("value = "); |
| 3483 | q.text("%#x" % self.value) |
| 3484 | q.breakable() |
| 3485 | q.text('}') |
| 3486 | |
| 3487 | bsn_tlv.subtypes[18] = udf_length |
| 3488 | |
| 3489 | class udf_offset(bsn_tlv): |
| 3490 | type = 17 |
| 3491 | |
| 3492 | def __init__(self, value=None): |
| 3493 | if value != None: |
| 3494 | self.value = value |
| 3495 | else: |
| 3496 | self.value = 0 |
| 3497 | return |
| 3498 | |
| 3499 | def pack(self): |
| 3500 | packed = [] |
| 3501 | packed.append(struct.pack("!H", self.type)) |
| 3502 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3503 | packed.append(struct.pack("!H", self.value)) |
| 3504 | length = sum([len(x) for x in packed]) |
| 3505 | packed[1] = struct.pack("!H", length) |
| 3506 | return ''.join(packed) |
| 3507 | |
| 3508 | @staticmethod |
| 3509 | def unpack(reader): |
| 3510 | obj = udf_offset() |
| 3511 | _type = reader.read("!H")[0] |
| 3512 | assert(_type == 17) |
| 3513 | _length = reader.read("!H")[0] |
| 3514 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3515 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3516 | obj.value = reader.read("!H")[0] |
| 3517 | return obj |
| 3518 | |
| 3519 | def __eq__(self, other): |
| 3520 | if type(self) != type(other): return False |
| 3521 | if self.value != other.value: return False |
| 3522 | return True |
| 3523 | |
| 3524 | def pretty_print(self, q): |
| 3525 | q.text("udf_offset {") |
| 3526 | with q.group(): |
| 3527 | with q.indent(2): |
| 3528 | q.breakable() |
| 3529 | q.text("value = "); |
| 3530 | q.text("%#x" % self.value) |
| 3531 | q.breakable() |
| 3532 | q.text('}') |
| 3533 | |
| 3534 | bsn_tlv.subtypes[17] = udf_offset |
| 3535 | |
| 3536 | class udp_dst(bsn_tlv): |
| 3537 | type = 37 |
| 3538 | |
| 3539 | def __init__(self, value=None): |
| 3540 | if value != None: |
| 3541 | self.value = value |
| 3542 | else: |
| 3543 | self.value = 0 |
| 3544 | return |
| 3545 | |
| 3546 | def pack(self): |
| 3547 | packed = [] |
| 3548 | packed.append(struct.pack("!H", self.type)) |
| 3549 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3550 | packed.append(struct.pack("!H", self.value)) |
| 3551 | length = sum([len(x) for x in packed]) |
| 3552 | packed[1] = struct.pack("!H", length) |
| 3553 | return ''.join(packed) |
| 3554 | |
| 3555 | @staticmethod |
| 3556 | def unpack(reader): |
| 3557 | obj = udp_dst() |
| 3558 | _type = reader.read("!H")[0] |
| 3559 | assert(_type == 37) |
| 3560 | _length = reader.read("!H")[0] |
| 3561 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3562 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3563 | obj.value = reader.read("!H")[0] |
| 3564 | return obj |
| 3565 | |
| 3566 | def __eq__(self, other): |
| 3567 | if type(self) != type(other): return False |
| 3568 | if self.value != other.value: return False |
| 3569 | return True |
| 3570 | |
| 3571 | def pretty_print(self, q): |
| 3572 | q.text("udp_dst {") |
| 3573 | with q.group(): |
| 3574 | with q.indent(2): |
| 3575 | q.breakable() |
| 3576 | q.text("value = "); |
| 3577 | q.text("%#x" % self.value) |
| 3578 | q.breakable() |
| 3579 | q.text('}') |
| 3580 | |
| 3581 | bsn_tlv.subtypes[37] = udp_dst |
| 3582 | |
| 3583 | class udp_src(bsn_tlv): |
| 3584 | type = 36 |
| 3585 | |
| 3586 | def __init__(self, value=None): |
| 3587 | if value != None: |
| 3588 | self.value = value |
| 3589 | else: |
| 3590 | self.value = 0 |
| 3591 | return |
| 3592 | |
| 3593 | def pack(self): |
| 3594 | packed = [] |
| 3595 | packed.append(struct.pack("!H", self.type)) |
| 3596 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3597 | packed.append(struct.pack("!H", self.value)) |
| 3598 | length = sum([len(x) for x in packed]) |
| 3599 | packed[1] = struct.pack("!H", length) |
| 3600 | return ''.join(packed) |
| 3601 | |
| 3602 | @staticmethod |
| 3603 | def unpack(reader): |
| 3604 | obj = udp_src() |
| 3605 | _type = reader.read("!H")[0] |
| 3606 | assert(_type == 36) |
| 3607 | _length = reader.read("!H")[0] |
| 3608 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3609 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3610 | obj.value = reader.read("!H")[0] |
| 3611 | return obj |
| 3612 | |
| 3613 | def __eq__(self, other): |
| 3614 | if type(self) != type(other): return False |
| 3615 | if self.value != other.value: return False |
| 3616 | return True |
| 3617 | |
| 3618 | def pretty_print(self, q): |
| 3619 | q.text("udp_src {") |
| 3620 | with q.group(): |
| 3621 | with q.indent(2): |
| 3622 | q.breakable() |
| 3623 | q.text("value = "); |
| 3624 | q.text("%#x" % self.value) |
| 3625 | q.breakable() |
| 3626 | q.text('}') |
| 3627 | |
| 3628 | bsn_tlv.subtypes[36] = udp_src |
| 3629 | |
| 3630 | class unicast_query_timeout(bsn_tlv): |
| 3631 | type = 9 |
| 3632 | |
| 3633 | def __init__(self, value=None): |
| 3634 | if value != None: |
| 3635 | self.value = value |
| 3636 | else: |
| 3637 | self.value = 0 |
| 3638 | return |
| 3639 | |
| 3640 | def pack(self): |
| 3641 | packed = [] |
| 3642 | packed.append(struct.pack("!H", self.type)) |
| 3643 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3644 | packed.append(struct.pack("!L", self.value)) |
| 3645 | length = sum([len(x) for x in packed]) |
| 3646 | packed[1] = struct.pack("!H", length) |
| 3647 | return ''.join(packed) |
| 3648 | |
| 3649 | @staticmethod |
| 3650 | def unpack(reader): |
| 3651 | obj = unicast_query_timeout() |
| 3652 | _type = reader.read("!H")[0] |
| 3653 | assert(_type == 9) |
| 3654 | _length = reader.read("!H")[0] |
| 3655 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3656 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3657 | obj.value = reader.read("!L")[0] |
| 3658 | return obj |
| 3659 | |
| 3660 | def __eq__(self, other): |
| 3661 | if type(self) != type(other): return False |
| 3662 | if self.value != other.value: return False |
| 3663 | return True |
| 3664 | |
| 3665 | def pretty_print(self, q): |
| 3666 | q.text("unicast_query_timeout {") |
| 3667 | with q.group(): |
| 3668 | with q.indent(2): |
| 3669 | q.breakable() |
| 3670 | q.text("value = "); |
| 3671 | q.text("%#x" % self.value) |
| 3672 | q.breakable() |
| 3673 | q.text('}') |
| 3674 | |
| 3675 | bsn_tlv.subtypes[9] = unicast_query_timeout |
| 3676 | |
Harshmeet Singh | e632340 | 2015-04-02 14:38:52 -0700 | [diff] [blame] | 3677 | class vlan_pcp(bsn_tlv): |
| 3678 | type = 72 |
| 3679 | |
| 3680 | def __init__(self, value=None): |
| 3681 | if value != None: |
| 3682 | self.value = value |
| 3683 | else: |
| 3684 | self.value = 0 |
| 3685 | return |
| 3686 | |
| 3687 | def pack(self): |
| 3688 | packed = [] |
| 3689 | packed.append(struct.pack("!H", self.type)) |
| 3690 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3691 | packed.append(struct.pack("!B", self.value)) |
| 3692 | length = sum([len(x) for x in packed]) |
| 3693 | packed[1] = struct.pack("!H", length) |
| 3694 | return ''.join(packed) |
| 3695 | |
| 3696 | @staticmethod |
| 3697 | def unpack(reader): |
| 3698 | obj = vlan_pcp() |
| 3699 | _type = reader.read("!H")[0] |
| 3700 | assert(_type == 72) |
| 3701 | _length = reader.read("!H")[0] |
| 3702 | orig_reader = reader |
| 3703 | reader = orig_reader.slice(_length, 4) |
| 3704 | obj.value = reader.read("!B")[0] |
| 3705 | return obj |
| 3706 | |
| 3707 | def __eq__(self, other): |
| 3708 | if type(self) != type(other): return False |
| 3709 | if self.value != other.value: return False |
| 3710 | return True |
| 3711 | |
| 3712 | def pretty_print(self, q): |
| 3713 | q.text("vlan_pcp {") |
| 3714 | with q.group(): |
| 3715 | with q.indent(2): |
| 3716 | q.breakable() |
| 3717 | q.text("value = "); |
| 3718 | q.text("%#x" % self.value) |
| 3719 | q.breakable() |
| 3720 | q.text('}') |
| 3721 | |
| 3722 | bsn_tlv.subtypes[72] = vlan_pcp |
| 3723 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3724 | class vlan_vid(bsn_tlv): |
| 3725 | type = 6 |
| 3726 | |
| 3727 | def __init__(self, value=None): |
| 3728 | if value != None: |
| 3729 | self.value = value |
| 3730 | else: |
| 3731 | self.value = 0 |
| 3732 | return |
| 3733 | |
| 3734 | def pack(self): |
| 3735 | packed = [] |
| 3736 | packed.append(struct.pack("!H", self.type)) |
| 3737 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3738 | packed.append(struct.pack("!H", self.value)) |
| 3739 | length = sum([len(x) for x in packed]) |
| 3740 | packed[1] = struct.pack("!H", length) |
| 3741 | return ''.join(packed) |
| 3742 | |
| 3743 | @staticmethod |
| 3744 | def unpack(reader): |
| 3745 | obj = vlan_vid() |
| 3746 | _type = reader.read("!H")[0] |
| 3747 | assert(_type == 6) |
| 3748 | _length = reader.read("!H")[0] |
| 3749 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3750 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3751 | obj.value = reader.read("!H")[0] |
| 3752 | return obj |
| 3753 | |
| 3754 | def __eq__(self, other): |
| 3755 | if type(self) != type(other): return False |
| 3756 | if self.value != other.value: return False |
| 3757 | return True |
| 3758 | |
| 3759 | def pretty_print(self, q): |
| 3760 | q.text("vlan_vid {") |
| 3761 | with q.group(): |
| 3762 | with q.indent(2): |
| 3763 | q.breakable() |
| 3764 | q.text("value = "); |
| 3765 | q.text("%#x" % self.value) |
| 3766 | q.breakable() |
| 3767 | q.text('}') |
| 3768 | |
| 3769 | bsn_tlv.subtypes[6] = vlan_vid |
| 3770 | |
Rich Lane | 5116831 | 2015-06-25 13:13:54 -0700 | [diff] [blame] | 3771 | class vlan_vid_mask(bsn_tlv): |
| 3772 | type = 77 |
| 3773 | |
| 3774 | def __init__(self, value=None): |
| 3775 | if value != None: |
| 3776 | self.value = value |
| 3777 | else: |
| 3778 | self.value = 0 |
| 3779 | return |
| 3780 | |
| 3781 | def pack(self): |
| 3782 | packed = [] |
| 3783 | packed.append(struct.pack("!H", self.type)) |
| 3784 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3785 | packed.append(struct.pack("!H", self.value)) |
| 3786 | length = sum([len(x) for x in packed]) |
| 3787 | packed[1] = struct.pack("!H", length) |
| 3788 | return ''.join(packed) |
| 3789 | |
| 3790 | @staticmethod |
| 3791 | def unpack(reader): |
| 3792 | obj = vlan_vid_mask() |
| 3793 | _type = reader.read("!H")[0] |
| 3794 | assert(_type == 77) |
| 3795 | _length = reader.read("!H")[0] |
| 3796 | orig_reader = reader |
| 3797 | reader = orig_reader.slice(_length, 4) |
| 3798 | obj.value = reader.read("!H")[0] |
| 3799 | return obj |
| 3800 | |
| 3801 | def __eq__(self, other): |
| 3802 | if type(self) != type(other): return False |
| 3803 | if self.value != other.value: return False |
| 3804 | return True |
| 3805 | |
| 3806 | def pretty_print(self, q): |
| 3807 | q.text("vlan_vid_mask {") |
| 3808 | with q.group(): |
| 3809 | with q.indent(2): |
| 3810 | q.breakable() |
| 3811 | q.text("value = "); |
| 3812 | q.text("%#x" % self.value) |
| 3813 | q.breakable() |
| 3814 | q.text('}') |
| 3815 | |
| 3816 | bsn_tlv.subtypes[77] = vlan_vid_mask |
| 3817 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3818 | class vrf(bsn_tlv): |
| 3819 | type = 19 |
| 3820 | |
| 3821 | def __init__(self, value=None): |
| 3822 | if value != None: |
| 3823 | self.value = value |
| 3824 | else: |
| 3825 | self.value = 0 |
| 3826 | return |
| 3827 | |
| 3828 | def pack(self): |
| 3829 | packed = [] |
| 3830 | packed.append(struct.pack("!H", self.type)) |
| 3831 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3832 | packed.append(struct.pack("!L", self.value)) |
| 3833 | length = sum([len(x) for x in packed]) |
| 3834 | packed[1] = struct.pack("!H", length) |
| 3835 | return ''.join(packed) |
| 3836 | |
| 3837 | @staticmethod |
| 3838 | def unpack(reader): |
| 3839 | obj = vrf() |
| 3840 | _type = reader.read("!H")[0] |
| 3841 | assert(_type == 19) |
| 3842 | _length = reader.read("!H")[0] |
| 3843 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3844 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3845 | obj.value = reader.read("!L")[0] |
| 3846 | return obj |
| 3847 | |
| 3848 | def __eq__(self, other): |
| 3849 | if type(self) != type(other): return False |
| 3850 | if self.value != other.value: return False |
| 3851 | return True |
| 3852 | |
| 3853 | def pretty_print(self, q): |
| 3854 | q.text("vrf {") |
| 3855 | with q.group(): |
| 3856 | with q.indent(2): |
| 3857 | q.breakable() |
| 3858 | q.text("value = "); |
| 3859 | q.text("%#x" % self.value) |
| 3860 | q.breakable() |
| 3861 | q.text('}') |
| 3862 | |
| 3863 | bsn_tlv.subtypes[19] = vrf |
| 3864 | |
| 3865 | |