Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
| 5 | |
| 6 | # Automatically generated by LOXI from template module.py |
| 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -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.of13'] |
| 16 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 17 | class bsn_tlv(loxi.OFObject): |
| 18 | subtypes = {} |
| 19 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 36 | @staticmethod |
| 37 | def unpack(reader): |
| 38 | subtype, = reader.peek('!H', 0) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 39 | subclass = bsn_tlv.subtypes.get(subtype) |
| 40 | if subclass: |
| 41 | return subclass.unpack(reader) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 42 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 | 95f7fc9 | 2014-01-27 17:08:16 -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 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [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 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 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 | 2e079da | 2014-10-29 15:30:24 -0700 | [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 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [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 | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 346 | class broadcast_query_timeout(bsn_tlv): |
| 347 | type = 10 |
| 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("!L", 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 = broadcast_query_timeout() |
| 368 | _type = reader.read("!H")[0] |
| 369 | assert(_type == 10) |
| 370 | _length = reader.read("!H")[0] |
| 371 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 372 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 373 | obj.value = reader.read("!L")[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("broadcast_query_timeout {") |
| 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[10] = broadcast_query_timeout |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 392 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 393 | class bucket(bsn_tlv): |
| 394 | type = 64 |
| 395 | |
| 396 | def __init__(self, value=None): |
| 397 | if value != None: |
| 398 | self.value = value |
| 399 | else: |
| 400 | self.value = [] |
| 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(loxi.generic_util.pack_list(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 = bucket() |
| 415 | _type = reader.read("!H")[0] |
| 416 | assert(_type == 64) |
| 417 | _length = reader.read("!H")[0] |
| 418 | orig_reader = reader |
| 419 | reader = orig_reader.slice(_length, 4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 420 | 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] | 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("bucket {") |
| 430 | with q.group(): |
| 431 | with q.indent(2): |
| 432 | q.breakable() |
| 433 | q.text("value = "); |
| 434 | q.pp(self.value) |
| 435 | q.breakable() |
| 436 | q.text('}') |
| 437 | |
| 438 | bsn_tlv.subtypes[64] = bucket |
| 439 | |
Rich Lane | 1b75abf | 2014-02-05 11:23:20 -0800 | [diff] [blame] | 440 | class circuit_id(bsn_tlv): |
| 441 | type = 14 |
| 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(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 = circuit_id() |
| 462 | _type = reader.read("!H")[0] |
| 463 | assert(_type == 14) |
| 464 | _length = reader.read("!H")[0] |
| 465 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 466 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 1b75abf | 2014-02-05 11:23:20 -0800 | [diff] [blame] | 467 | obj.value = str(reader.read_all()) |
| 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("circuit_id {") |
| 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[14] = circuit_id |
| 486 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 487 | class convergence_status(bsn_tlv): |
| 488 | type = 45 |
| 489 | |
| 490 | def __init__(self, value=None): |
| 491 | if value != None: |
| 492 | self.value = value |
| 493 | else: |
| 494 | self.value = 0 |
| 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(struct.pack("!B", 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 = convergence_status() |
| 509 | _type = reader.read("!H")[0] |
| 510 | assert(_type == 45) |
| 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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 514 | obj.value = reader.read("!B")[0] |
| 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("convergence_status {") |
| 524 | with q.group(): |
| 525 | with q.indent(2): |
| 526 | q.breakable() |
| 527 | q.text("value = "); |
| 528 | q.text("%#x" % self.value) |
| 529 | q.breakable() |
| 530 | q.text('}') |
| 531 | |
| 532 | bsn_tlv.subtypes[45] = convergence_status |
| 533 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 534 | class crc_enabled(bsn_tlv): |
| 535 | type = 22 |
| 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 = crc_enabled() |
| 556 | _type = reader.read("!H")[0] |
| 557 | assert(_type == 22) |
| 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 | 5587ab1 | 2014-06-30 11:19:09 -0700 | [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("crc_enabled {") |
| 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[22] = crc_enabled |
| 580 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 581 | class data(bsn_tlv): |
| 582 | type = 55 |
| 583 | |
| 584 | def __init__(self, value=None): |
| 585 | if value != None: |
| 586 | self.value = value |
| 587 | else: |
| 588 | self.value = '' |
| 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(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 = data() |
| 603 | _type = reader.read("!H")[0] |
| 604 | assert(_type == 55) |
| 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 = str(reader.read_all()) |
| 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("data {") |
| 618 | with q.group(): |
| 619 | with q.indent(2): |
| 620 | q.breakable() |
| 621 | q.text("value = "); |
| 622 | q.pp(self.value) |
| 623 | q.breakable() |
| 624 | q.text('}') |
| 625 | |
| 626 | bsn_tlv.subtypes[55] = data |
| 627 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 628 | class eth_dst(bsn_tlv): |
| 629 | type = 33 |
| 630 | |
| 631 | def __init__(self, value=None): |
| 632 | if value != None: |
| 633 | self.value = value |
| 634 | else: |
| 635 | self.value = [0,0,0,0,0,0] |
| 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(struct.pack("!6B", *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 = eth_dst() |
| 650 | _type = reader.read("!H")[0] |
| 651 | assert(_type == 33) |
| 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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 655 | obj.value = list(reader.read('!6B')) |
| 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("eth_dst {") |
| 665 | with q.group(): |
| 666 | with q.indent(2): |
| 667 | q.breakable() |
| 668 | q.text("value = "); |
| 669 | q.text(util.pretty_mac(self.value)) |
| 670 | q.breakable() |
| 671 | q.text('}') |
| 672 | |
| 673 | bsn_tlv.subtypes[33] = eth_dst |
| 674 | |
| 675 | class eth_src(bsn_tlv): |
| 676 | type = 32 |
| 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_src() |
| 697 | _type = reader.read("!H")[0] |
| 698 | assert(_type == 32) |
| 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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [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_src {") |
| 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[32] = eth_src |
| 721 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 722 | class external_gateway_ip(bsn_tlv): |
| 723 | type = 26 |
| 724 | |
| 725 | def __init__(self, value=None): |
| 726 | if value != None: |
| 727 | self.value = value |
| 728 | else: |
| 729 | self.value = 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("!L", 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 = external_gateway_ip() |
| 744 | _type = reader.read("!H")[0] |
| 745 | assert(_type == 26) |
| 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 | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 749 | obj.value = reader.read("!L")[0] |
| 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("external_gateway_ip {") |
| 759 | with q.group(): |
| 760 | with q.indent(2): |
| 761 | q.breakable() |
| 762 | q.text("value = "); |
| 763 | q.text(util.pretty_ipv4(self.value)) |
| 764 | q.breakable() |
| 765 | q.text('}') |
| 766 | |
| 767 | bsn_tlv.subtypes[26] = external_gateway_ip |
| 768 | |
Rich Lane | 18ec535 | 2014-10-02 09:09:17 -0700 | [diff] [blame] | 769 | class external_gateway_mac(bsn_tlv): |
| 770 | type = 29 |
| 771 | |
| 772 | def __init__(self, value=None): |
| 773 | if value != None: |
| 774 | self.value = value |
| 775 | else: |
| 776 | self.value = [0,0,0,0,0,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("!6B", *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_mac() |
| 791 | _type = reader.read("!H")[0] |
| 792 | assert(_type == 29) |
| 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 | 18ec535 | 2014-10-02 09:09:17 -0700 | [diff] [blame] | 796 | obj.value = list(reader.read('!6B')) |
| 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_mac {") |
| 806 | with q.group(): |
| 807 | with q.indent(2): |
| 808 | q.breakable() |
| 809 | q.text("value = "); |
| 810 | q.text(util.pretty_mac(self.value)) |
| 811 | q.breakable() |
| 812 | q.text('}') |
| 813 | |
| 814 | bsn_tlv.subtypes[29] = external_gateway_mac |
| 815 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 816 | class external_ip(bsn_tlv): |
| 817 | type = 23 |
| 818 | |
| 819 | def __init__(self, value=None): |
| 820 | if value != None: |
| 821 | self.value = value |
| 822 | else: |
| 823 | self.value = 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("!L", 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_ip() |
| 838 | _type = reader.read("!H")[0] |
| 839 | assert(_type == 23) |
| 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 | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 843 | obj.value = reader.read("!L")[0] |
| 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_ip {") |
| 853 | with q.group(): |
| 854 | with q.indent(2): |
| 855 | q.breakable() |
| 856 | q.text("value = "); |
| 857 | q.text(util.pretty_ipv4(self.value)) |
| 858 | q.breakable() |
| 859 | q.text('}') |
| 860 | |
| 861 | bsn_tlv.subtypes[23] = external_ip |
| 862 | |
| 863 | class external_mac(bsn_tlv): |
| 864 | type = 24 |
| 865 | |
| 866 | def __init__(self, value=None): |
| 867 | if value != None: |
| 868 | self.value = value |
| 869 | else: |
| 870 | self.value = [0,0,0,0,0,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("!6B", *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_mac() |
| 885 | _type = reader.read("!H")[0] |
| 886 | assert(_type == 24) |
| 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 | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 890 | obj.value = list(reader.read('!6B')) |
| 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_mac {") |
| 900 | with q.group(): |
| 901 | with q.indent(2): |
| 902 | q.breakable() |
| 903 | q.text("value = "); |
| 904 | q.text(util.pretty_mac(self.value)) |
| 905 | q.breakable() |
| 906 | q.text('}') |
| 907 | |
| 908 | bsn_tlv.subtypes[24] = external_mac |
| 909 | |
| 910 | class external_netmask(bsn_tlv): |
| 911 | type = 25 |
| 912 | |
| 913 | def __init__(self, value=None): |
| 914 | if value != None: |
| 915 | self.value = value |
| 916 | else: |
| 917 | self.value = 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("!L", 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_netmask() |
| 932 | _type = reader.read("!H")[0] |
| 933 | assert(_type == 25) |
| 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 | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 937 | obj.value = reader.read("!L")[0] |
| 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_netmask {") |
| 947 | with q.group(): |
| 948 | with q.indent(2): |
| 949 | q.breakable() |
| 950 | q.text("value = "); |
| 951 | q.text(util.pretty_ipv4(self.value)) |
| 952 | q.breakable() |
| 953 | q.text('}') |
| 954 | |
| 955 | bsn_tlv.subtypes[25] = external_netmask |
| 956 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 957 | class header_size(bsn_tlv): |
| 958 | type = 31 |
| 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 = header_size() |
| 979 | _type = reader.read("!H")[0] |
| 980 | assert(_type == 31) |
| 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) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [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("header_size {") |
| 994 | with q.group(): |
| 995 | with q.indent(2): |
| 996 | q.breakable() |
| 997 | q.text("value = "); |
| 998 | q.text("%#x" % self.value) |
| 999 | q.breakable() |
| 1000 | q.text('}') |
| 1001 | |
| 1002 | bsn_tlv.subtypes[31] = header_size |
| 1003 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 1004 | class icmp_code(bsn_tlv): |
| 1005 | type = 69 |
| 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("!B", 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 = icmp_code() |
| 1026 | _type = reader.read("!H")[0] |
| 1027 | assert(_type == 69) |
| 1028 | _length = reader.read("!H")[0] |
| 1029 | orig_reader = reader |
| 1030 | reader = orig_reader.slice(_length, 4) |
| 1031 | obj.value = reader.read("!B")[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("icmp_code {") |
| 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[69] = icmp_code |
| 1050 | |
| 1051 | class icmp_id(bsn_tlv): |
| 1052 | type = 70 |
| 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("!H", 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 = icmp_id() |
| 1073 | _type = reader.read("!H")[0] |
| 1074 | assert(_type == 70) |
| 1075 | _length = reader.read("!H")[0] |
| 1076 | orig_reader = reader |
| 1077 | reader = orig_reader.slice(_length, 4) |
| 1078 | obj.value = reader.read("!H")[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("icmp_id {") |
| 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[70] = icmp_id |
| 1097 | |
| 1098 | class icmp_type(bsn_tlv): |
| 1099 | type = 68 |
| 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_type() |
| 1120 | _type = reader.read("!H")[0] |
| 1121 | assert(_type == 68) |
| 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_type {") |
| 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[68] = icmp_type |
| 1144 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1145 | class idle_notification(bsn_tlv): |
| 1146 | type = 7 |
| 1147 | |
| 1148 | def __init__(self): |
| 1149 | return |
| 1150 | |
| 1151 | def pack(self): |
| 1152 | packed = [] |
| 1153 | packed.append(struct.pack("!H", self.type)) |
| 1154 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1155 | length = sum([len(x) for x in packed]) |
| 1156 | packed[1] = struct.pack("!H", length) |
| 1157 | return ''.join(packed) |
| 1158 | |
| 1159 | @staticmethod |
| 1160 | def unpack(reader): |
| 1161 | obj = idle_notification() |
| 1162 | _type = reader.read("!H")[0] |
| 1163 | assert(_type == 7) |
| 1164 | _length = reader.read("!H")[0] |
| 1165 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1166 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1167 | return obj |
| 1168 | |
| 1169 | def __eq__(self, other): |
| 1170 | if type(self) != type(other): return False |
| 1171 | return True |
| 1172 | |
| 1173 | def pretty_print(self, q): |
| 1174 | q.text("idle_notification {") |
| 1175 | with q.group(): |
| 1176 | with q.indent(2): |
| 1177 | q.breakable() |
| 1178 | q.breakable() |
| 1179 | q.text('}') |
| 1180 | |
| 1181 | bsn_tlv.subtypes[7] = idle_notification |
| 1182 | |
| 1183 | class idle_time(bsn_tlv): |
| 1184 | type = 5 |
| 1185 | |
| 1186 | def __init__(self, value=None): |
| 1187 | if value != None: |
| 1188 | self.value = value |
| 1189 | else: |
| 1190 | self.value = 0 |
| 1191 | return |
| 1192 | |
| 1193 | def pack(self): |
| 1194 | packed = [] |
| 1195 | packed.append(struct.pack("!H", self.type)) |
| 1196 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1197 | packed.append(struct.pack("!Q", self.value)) |
| 1198 | length = sum([len(x) for x in packed]) |
| 1199 | packed[1] = struct.pack("!H", length) |
| 1200 | return ''.join(packed) |
| 1201 | |
| 1202 | @staticmethod |
| 1203 | def unpack(reader): |
| 1204 | obj = idle_time() |
| 1205 | _type = reader.read("!H")[0] |
| 1206 | assert(_type == 5) |
| 1207 | _length = reader.read("!H")[0] |
| 1208 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1209 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1210 | obj.value = reader.read("!Q")[0] |
| 1211 | return obj |
| 1212 | |
| 1213 | def __eq__(self, other): |
| 1214 | if type(self) != type(other): return False |
| 1215 | if self.value != other.value: return False |
| 1216 | return True |
| 1217 | |
| 1218 | def pretty_print(self, q): |
| 1219 | q.text("idle_time {") |
| 1220 | with q.group(): |
| 1221 | with q.indent(2): |
| 1222 | q.breakable() |
| 1223 | q.text("value = "); |
| 1224 | q.text("%#x" % self.value) |
| 1225 | q.breakable() |
| 1226 | q.text('}') |
| 1227 | |
| 1228 | bsn_tlv.subtypes[5] = idle_time |
| 1229 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1230 | class idle_timeout(bsn_tlv): |
| 1231 | type = 8 |
| 1232 | |
| 1233 | def __init__(self, value=None): |
| 1234 | if value != None: |
| 1235 | self.value = value |
| 1236 | else: |
| 1237 | self.value = 0 |
| 1238 | return |
| 1239 | |
| 1240 | def pack(self): |
| 1241 | packed = [] |
| 1242 | packed.append(struct.pack("!H", self.type)) |
| 1243 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1244 | packed.append(struct.pack("!L", self.value)) |
| 1245 | length = sum([len(x) for x in packed]) |
| 1246 | packed[1] = struct.pack("!H", length) |
| 1247 | return ''.join(packed) |
| 1248 | |
| 1249 | @staticmethod |
| 1250 | def unpack(reader): |
| 1251 | obj = idle_timeout() |
| 1252 | _type = reader.read("!H")[0] |
| 1253 | assert(_type == 8) |
| 1254 | _length = reader.read("!H")[0] |
| 1255 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1256 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1257 | obj.value = reader.read("!L")[0] |
| 1258 | return obj |
| 1259 | |
| 1260 | def __eq__(self, other): |
| 1261 | if type(self) != type(other): return False |
| 1262 | if self.value != other.value: return False |
| 1263 | return True |
| 1264 | |
| 1265 | def pretty_print(self, q): |
| 1266 | q.text("idle_timeout {") |
| 1267 | with q.group(): |
| 1268 | with q.indent(2): |
| 1269 | q.breakable() |
| 1270 | q.text("value = "); |
| 1271 | q.text("%#x" % self.value) |
| 1272 | q.breakable() |
| 1273 | q.text('}') |
| 1274 | |
| 1275 | bsn_tlv.subtypes[8] = idle_timeout |
| 1276 | |
Rich Lane | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 1277 | class internal_gateway_mac(bsn_tlv): |
| 1278 | type = 28 |
| 1279 | |
| 1280 | def __init__(self, value=None): |
| 1281 | if value != None: |
| 1282 | self.value = value |
| 1283 | else: |
| 1284 | self.value = [0,0,0,0,0,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("!6B", *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 = internal_gateway_mac() |
| 1299 | _type = reader.read("!H")[0] |
| 1300 | assert(_type == 28) |
| 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 | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 1304 | obj.value = list(reader.read('!6B')) |
| 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("internal_gateway_mac {") |
| 1314 | with q.group(): |
| 1315 | with q.indent(2): |
| 1316 | q.breakable() |
| 1317 | q.text("value = "); |
| 1318 | q.text(util.pretty_mac(self.value)) |
| 1319 | q.breakable() |
| 1320 | q.text('}') |
| 1321 | |
| 1322 | bsn_tlv.subtypes[28] = internal_gateway_mac |
| 1323 | |
| 1324 | class internal_mac(bsn_tlv): |
| 1325 | type = 27 |
| 1326 | |
| 1327 | def __init__(self, value=None): |
| 1328 | if value != None: |
| 1329 | self.value = value |
| 1330 | else: |
| 1331 | self.value = [0,0,0,0,0,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("!6B", *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 = internal_mac() |
| 1346 | _type = reader.read("!H")[0] |
| 1347 | assert(_type == 27) |
| 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 | cc80d42 | 2014-09-24 14:54:09 -0700 | [diff] [blame] | 1351 | obj.value = list(reader.read('!6B')) |
| 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("internal_mac {") |
| 1361 | with q.group(): |
| 1362 | with q.indent(2): |
| 1363 | q.breakable() |
| 1364 | q.text("value = "); |
| 1365 | q.text(util.pretty_mac(self.value)) |
| 1366 | q.breakable() |
| 1367 | q.text('}') |
| 1368 | |
| 1369 | bsn_tlv.subtypes[27] = internal_mac |
| 1370 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1371 | class interval(bsn_tlv): |
| 1372 | type = 58 |
| 1373 | |
| 1374 | def __init__(self, value=None): |
| 1375 | if value != None: |
| 1376 | self.value = value |
| 1377 | else: |
| 1378 | self.value = 0 |
| 1379 | return |
| 1380 | |
| 1381 | def pack(self): |
| 1382 | packed = [] |
| 1383 | packed.append(struct.pack("!H", self.type)) |
| 1384 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1385 | packed.append(struct.pack("!L", self.value)) |
| 1386 | length = sum([len(x) for x in packed]) |
| 1387 | packed[1] = struct.pack("!H", length) |
| 1388 | return ''.join(packed) |
| 1389 | |
| 1390 | @staticmethod |
| 1391 | def unpack(reader): |
| 1392 | obj = interval() |
| 1393 | _type = reader.read("!H")[0] |
| 1394 | assert(_type == 58) |
| 1395 | _length = reader.read("!H")[0] |
| 1396 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1397 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1398 | obj.value = reader.read("!L")[0] |
| 1399 | return obj |
| 1400 | |
| 1401 | def __eq__(self, other): |
| 1402 | if type(self) != type(other): return False |
| 1403 | if self.value != other.value: return False |
| 1404 | return True |
| 1405 | |
| 1406 | def pretty_print(self, q): |
| 1407 | q.text("interval {") |
| 1408 | with q.group(): |
| 1409 | with q.indent(2): |
| 1410 | q.breakable() |
| 1411 | q.text("value = "); |
| 1412 | q.text("%#x" % self.value) |
| 1413 | q.breakable() |
| 1414 | q.text('}') |
| 1415 | |
| 1416 | bsn_tlv.subtypes[58] = interval |
| 1417 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 1418 | class ip_proto(bsn_tlv): |
| 1419 | type = 67 |
| 1420 | |
| 1421 | def __init__(self, value=None): |
| 1422 | if value != None: |
| 1423 | self.value = value |
| 1424 | else: |
| 1425 | self.value = 0 |
| 1426 | return |
| 1427 | |
| 1428 | def pack(self): |
| 1429 | packed = [] |
| 1430 | packed.append(struct.pack("!H", self.type)) |
| 1431 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1432 | packed.append(struct.pack("!B", self.value)) |
| 1433 | length = sum([len(x) for x in packed]) |
| 1434 | packed[1] = struct.pack("!H", length) |
| 1435 | return ''.join(packed) |
| 1436 | |
| 1437 | @staticmethod |
| 1438 | def unpack(reader): |
| 1439 | obj = ip_proto() |
| 1440 | _type = reader.read("!H")[0] |
| 1441 | assert(_type == 67) |
| 1442 | _length = reader.read("!H")[0] |
| 1443 | orig_reader = reader |
| 1444 | reader = orig_reader.slice(_length, 4) |
| 1445 | obj.value = reader.read("!B")[0] |
| 1446 | return obj |
| 1447 | |
| 1448 | def __eq__(self, other): |
| 1449 | if type(self) != type(other): return False |
| 1450 | if self.value != other.value: return False |
| 1451 | return True |
| 1452 | |
| 1453 | def pretty_print(self, q): |
| 1454 | q.text("ip_proto {") |
| 1455 | with q.group(): |
| 1456 | with q.indent(2): |
| 1457 | q.breakable() |
| 1458 | q.text("value = "); |
| 1459 | q.text("%#x" % self.value) |
| 1460 | q.breakable() |
| 1461 | q.text('}') |
| 1462 | |
| 1463 | bsn_tlv.subtypes[67] = ip_proto |
| 1464 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1465 | class ipv4(bsn_tlv): |
| 1466 | type = 4 |
| 1467 | |
| 1468 | def __init__(self, value=None): |
| 1469 | if value != None: |
| 1470 | self.value = value |
| 1471 | else: |
| 1472 | self.value = 0 |
| 1473 | return |
| 1474 | |
| 1475 | def pack(self): |
| 1476 | packed = [] |
| 1477 | packed.append(struct.pack("!H", self.type)) |
| 1478 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1479 | packed.append(struct.pack("!L", self.value)) |
| 1480 | length = sum([len(x) for x in packed]) |
| 1481 | packed[1] = struct.pack("!H", length) |
| 1482 | return ''.join(packed) |
| 1483 | |
| 1484 | @staticmethod |
| 1485 | def unpack(reader): |
| 1486 | obj = ipv4() |
| 1487 | _type = reader.read("!H")[0] |
| 1488 | assert(_type == 4) |
| 1489 | _length = reader.read("!H")[0] |
| 1490 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1491 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1492 | obj.value = reader.read("!L")[0] |
| 1493 | return obj |
| 1494 | |
| 1495 | def __eq__(self, other): |
| 1496 | if type(self) != type(other): return False |
| 1497 | if self.value != other.value: return False |
| 1498 | return True |
| 1499 | |
| 1500 | def pretty_print(self, q): |
| 1501 | q.text("ipv4 {") |
| 1502 | with q.group(): |
| 1503 | with q.indent(2): |
| 1504 | q.breakable() |
| 1505 | q.text("value = "); |
| 1506 | q.text(util.pretty_ipv4(self.value)) |
| 1507 | q.breakable() |
| 1508 | q.text('}') |
| 1509 | |
| 1510 | bsn_tlv.subtypes[4] = ipv4 |
| 1511 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1512 | class ipv4_dst(bsn_tlv): |
| 1513 | type = 35 |
| 1514 | |
| 1515 | def __init__(self, value=None): |
| 1516 | if value != None: |
| 1517 | self.value = value |
| 1518 | else: |
| 1519 | self.value = 0 |
| 1520 | return |
| 1521 | |
| 1522 | def pack(self): |
| 1523 | packed = [] |
| 1524 | packed.append(struct.pack("!H", self.type)) |
| 1525 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1526 | packed.append(struct.pack("!L", self.value)) |
| 1527 | length = sum([len(x) for x in packed]) |
| 1528 | packed[1] = struct.pack("!H", length) |
| 1529 | return ''.join(packed) |
| 1530 | |
| 1531 | @staticmethod |
| 1532 | def unpack(reader): |
| 1533 | obj = ipv4_dst() |
| 1534 | _type = reader.read("!H")[0] |
| 1535 | assert(_type == 35) |
| 1536 | _length = reader.read("!H")[0] |
| 1537 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1538 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1539 | obj.value = reader.read("!L")[0] |
| 1540 | return obj |
| 1541 | |
| 1542 | def __eq__(self, other): |
| 1543 | if type(self) != type(other): return False |
| 1544 | if self.value != other.value: return False |
| 1545 | return True |
| 1546 | |
| 1547 | def pretty_print(self, q): |
| 1548 | q.text("ipv4_dst {") |
| 1549 | with q.group(): |
| 1550 | with q.indent(2): |
| 1551 | q.breakable() |
| 1552 | q.text("value = "); |
| 1553 | q.text(util.pretty_ipv4(self.value)) |
| 1554 | q.breakable() |
| 1555 | q.text('}') |
| 1556 | |
| 1557 | bsn_tlv.subtypes[35] = ipv4_dst |
| 1558 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1559 | class ipv4_netmask(bsn_tlv): |
| 1560 | type = 60 |
| 1561 | |
| 1562 | def __init__(self, value=None): |
| 1563 | if value != None: |
| 1564 | self.value = value |
| 1565 | else: |
| 1566 | self.value = 0 |
| 1567 | return |
| 1568 | |
| 1569 | def pack(self): |
| 1570 | packed = [] |
| 1571 | packed.append(struct.pack("!H", self.type)) |
| 1572 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1573 | packed.append(struct.pack("!L", self.value)) |
| 1574 | length = sum([len(x) for x in packed]) |
| 1575 | packed[1] = struct.pack("!H", length) |
| 1576 | return ''.join(packed) |
| 1577 | |
| 1578 | @staticmethod |
| 1579 | def unpack(reader): |
| 1580 | obj = ipv4_netmask() |
| 1581 | _type = reader.read("!H")[0] |
| 1582 | assert(_type == 60) |
| 1583 | _length = reader.read("!H")[0] |
| 1584 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1585 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 1586 | obj.value = reader.read("!L")[0] |
| 1587 | return obj |
| 1588 | |
| 1589 | def __eq__(self, other): |
| 1590 | if type(self) != type(other): return False |
| 1591 | if self.value != other.value: return False |
| 1592 | return True |
| 1593 | |
| 1594 | def pretty_print(self, q): |
| 1595 | q.text("ipv4_netmask {") |
| 1596 | with q.group(): |
| 1597 | with q.indent(2): |
| 1598 | q.breakable() |
| 1599 | q.text("value = "); |
| 1600 | q.text(util.pretty_ipv4(self.value)) |
| 1601 | q.breakable() |
| 1602 | q.text('}') |
| 1603 | |
| 1604 | bsn_tlv.subtypes[60] = ipv4_netmask |
| 1605 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1606 | class ipv4_src(bsn_tlv): |
| 1607 | type = 34 |
| 1608 | |
| 1609 | def __init__(self, value=None): |
| 1610 | if value != None: |
| 1611 | self.value = value |
| 1612 | else: |
| 1613 | self.value = 0 |
| 1614 | return |
| 1615 | |
| 1616 | def pack(self): |
| 1617 | packed = [] |
| 1618 | packed.append(struct.pack("!H", self.type)) |
| 1619 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1620 | packed.append(struct.pack("!L", self.value)) |
| 1621 | length = sum([len(x) for x in packed]) |
| 1622 | packed[1] = struct.pack("!H", length) |
| 1623 | return ''.join(packed) |
| 1624 | |
| 1625 | @staticmethod |
| 1626 | def unpack(reader): |
| 1627 | obj = ipv4_src() |
| 1628 | _type = reader.read("!H")[0] |
| 1629 | assert(_type == 34) |
| 1630 | _length = reader.read("!H")[0] |
| 1631 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1632 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1633 | obj.value = reader.read("!L")[0] |
| 1634 | return obj |
| 1635 | |
| 1636 | def __eq__(self, other): |
| 1637 | if type(self) != type(other): return False |
| 1638 | if self.value != other.value: return False |
| 1639 | return True |
| 1640 | |
| 1641 | def pretty_print(self, q): |
| 1642 | q.text("ipv4_src {") |
| 1643 | with q.group(): |
| 1644 | with q.indent(2): |
| 1645 | q.breakable() |
| 1646 | q.text("value = "); |
| 1647 | q.text(util.pretty_ipv4(self.value)) |
| 1648 | q.breakable() |
| 1649 | q.text('}') |
| 1650 | |
| 1651 | bsn_tlv.subtypes[34] = ipv4_src |
| 1652 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1653 | class mac(bsn_tlv): |
| 1654 | type = 1 |
| 1655 | |
| 1656 | def __init__(self, value=None): |
| 1657 | if value != None: |
| 1658 | self.value = value |
| 1659 | else: |
| 1660 | self.value = [0,0,0,0,0,0] |
| 1661 | return |
| 1662 | |
| 1663 | def pack(self): |
| 1664 | packed = [] |
| 1665 | packed.append(struct.pack("!H", self.type)) |
| 1666 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1667 | packed.append(struct.pack("!6B", *self.value)) |
| 1668 | length = sum([len(x) for x in packed]) |
| 1669 | packed[1] = struct.pack("!H", length) |
| 1670 | return ''.join(packed) |
| 1671 | |
| 1672 | @staticmethod |
| 1673 | def unpack(reader): |
| 1674 | obj = mac() |
| 1675 | _type = reader.read("!H")[0] |
| 1676 | assert(_type == 1) |
| 1677 | _length = reader.read("!H")[0] |
| 1678 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1679 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1680 | obj.value = list(reader.read('!6B')) |
| 1681 | return obj |
| 1682 | |
| 1683 | def __eq__(self, other): |
| 1684 | if type(self) != type(other): return False |
| 1685 | if self.value != other.value: return False |
| 1686 | return True |
| 1687 | |
| 1688 | def pretty_print(self, q): |
| 1689 | q.text("mac {") |
| 1690 | with q.group(): |
| 1691 | with q.indent(2): |
| 1692 | q.breakable() |
| 1693 | q.text("value = "); |
| 1694 | q.text(util.pretty_mac(self.value)) |
| 1695 | q.breakable() |
| 1696 | q.text('}') |
| 1697 | |
| 1698 | bsn_tlv.subtypes[1] = mac |
| 1699 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1700 | class mac_mask(bsn_tlv): |
| 1701 | type = 56 |
| 1702 | |
| 1703 | def __init__(self, value=None): |
| 1704 | if value != None: |
| 1705 | self.value = value |
| 1706 | else: |
| 1707 | self.value = [0,0,0,0,0,0] |
| 1708 | return |
| 1709 | |
| 1710 | def pack(self): |
| 1711 | packed = [] |
| 1712 | packed.append(struct.pack("!H", self.type)) |
| 1713 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1714 | packed.append(struct.pack("!6B", *self.value)) |
| 1715 | length = sum([len(x) for x in packed]) |
| 1716 | packed[1] = struct.pack("!H", length) |
| 1717 | return ''.join(packed) |
| 1718 | |
| 1719 | @staticmethod |
| 1720 | def unpack(reader): |
| 1721 | obj = mac_mask() |
| 1722 | _type = reader.read("!H")[0] |
| 1723 | assert(_type == 56) |
| 1724 | _length = reader.read("!H")[0] |
| 1725 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1726 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1727 | obj.value = list(reader.read('!6B')) |
| 1728 | return obj |
| 1729 | |
| 1730 | def __eq__(self, other): |
| 1731 | if type(self) != type(other): return False |
| 1732 | if self.value != other.value: return False |
| 1733 | return True |
| 1734 | |
| 1735 | def pretty_print(self, q): |
| 1736 | q.text("mac_mask {") |
| 1737 | with q.group(): |
| 1738 | with q.indent(2): |
| 1739 | q.breakable() |
| 1740 | q.text("value = "); |
| 1741 | q.text(util.pretty_mac(self.value)) |
| 1742 | q.breakable() |
| 1743 | q.text('}') |
| 1744 | |
| 1745 | bsn_tlv.subtypes[56] = mac_mask |
| 1746 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1747 | class miss_packets(bsn_tlv): |
| 1748 | type = 13 |
| 1749 | |
| 1750 | def __init__(self, value=None): |
| 1751 | if value != None: |
| 1752 | self.value = value |
| 1753 | else: |
| 1754 | self.value = 0 |
| 1755 | return |
| 1756 | |
| 1757 | def pack(self): |
| 1758 | packed = [] |
| 1759 | packed.append(struct.pack("!H", self.type)) |
| 1760 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1761 | packed.append(struct.pack("!Q", self.value)) |
| 1762 | length = sum([len(x) for x in packed]) |
| 1763 | packed[1] = struct.pack("!H", length) |
| 1764 | return ''.join(packed) |
| 1765 | |
| 1766 | @staticmethod |
| 1767 | def unpack(reader): |
| 1768 | obj = miss_packets() |
| 1769 | _type = reader.read("!H")[0] |
| 1770 | assert(_type == 13) |
| 1771 | _length = reader.read("!H")[0] |
| 1772 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1773 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1774 | obj.value = reader.read("!Q")[0] |
| 1775 | return obj |
| 1776 | |
| 1777 | def __eq__(self, other): |
| 1778 | if type(self) != type(other): return False |
| 1779 | if self.value != other.value: return False |
| 1780 | return True |
| 1781 | |
| 1782 | def pretty_print(self, q): |
| 1783 | q.text("miss_packets {") |
| 1784 | with q.group(): |
| 1785 | with q.indent(2): |
| 1786 | q.breakable() |
| 1787 | q.text("value = "); |
| 1788 | q.text("%#x" % self.value) |
| 1789 | q.breakable() |
| 1790 | q.text('}') |
| 1791 | |
| 1792 | bsn_tlv.subtypes[13] = miss_packets |
| 1793 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1794 | class mpls_control_word(bsn_tlv): |
| 1795 | type = 62 |
| 1796 | |
| 1797 | def __init__(self, value=None): |
| 1798 | if value != None: |
| 1799 | self.value = value |
| 1800 | else: |
| 1801 | self.value = 0 |
| 1802 | return |
| 1803 | |
| 1804 | def pack(self): |
| 1805 | packed = [] |
| 1806 | packed.append(struct.pack("!H", self.type)) |
| 1807 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1808 | packed.append(struct.pack("!B", self.value)) |
| 1809 | length = sum([len(x) for x in packed]) |
| 1810 | packed[1] = struct.pack("!H", length) |
| 1811 | return ''.join(packed) |
| 1812 | |
| 1813 | @staticmethod |
| 1814 | def unpack(reader): |
| 1815 | obj = mpls_control_word() |
| 1816 | _type = reader.read("!H")[0] |
| 1817 | assert(_type == 62) |
| 1818 | _length = reader.read("!H")[0] |
| 1819 | orig_reader = reader |
| 1820 | reader = orig_reader.slice(_length, 4) |
| 1821 | obj.value = reader.read("!B")[0] |
| 1822 | return obj |
| 1823 | |
| 1824 | def __eq__(self, other): |
| 1825 | if type(self) != type(other): return False |
| 1826 | if self.value != other.value: return False |
| 1827 | return True |
| 1828 | |
| 1829 | def pretty_print(self, q): |
| 1830 | q.text("mpls_control_word {") |
| 1831 | with q.group(): |
| 1832 | with q.indent(2): |
| 1833 | q.breakable() |
| 1834 | q.text("value = "); |
| 1835 | q.text("%#x" % self.value) |
| 1836 | q.breakable() |
| 1837 | q.text('}') |
| 1838 | |
| 1839 | bsn_tlv.subtypes[62] = mpls_control_word |
| 1840 | |
| 1841 | class mpls_label(bsn_tlv): |
| 1842 | type = 61 |
| 1843 | |
| 1844 | def __init__(self, value=None): |
| 1845 | if value != None: |
| 1846 | self.value = value |
| 1847 | else: |
| 1848 | self.value = 0 |
| 1849 | return |
| 1850 | |
| 1851 | def pack(self): |
| 1852 | packed = [] |
| 1853 | packed.append(struct.pack("!H", self.type)) |
| 1854 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1855 | packed.append(struct.pack("!L", self.value)) |
| 1856 | length = sum([len(x) for x in packed]) |
| 1857 | packed[1] = struct.pack("!H", length) |
| 1858 | return ''.join(packed) |
| 1859 | |
| 1860 | @staticmethod |
| 1861 | def unpack(reader): |
| 1862 | obj = mpls_label() |
| 1863 | _type = reader.read("!H")[0] |
| 1864 | assert(_type == 61) |
| 1865 | _length = reader.read("!H")[0] |
| 1866 | orig_reader = reader |
| 1867 | reader = orig_reader.slice(_length, 4) |
| 1868 | obj.value = reader.read("!L")[0] |
| 1869 | return obj |
| 1870 | |
| 1871 | def __eq__(self, other): |
| 1872 | if type(self) != type(other): return False |
| 1873 | if self.value != other.value: return False |
| 1874 | return True |
| 1875 | |
| 1876 | def pretty_print(self, q): |
| 1877 | q.text("mpls_label {") |
| 1878 | with q.group(): |
| 1879 | with q.indent(2): |
| 1880 | q.breakable() |
| 1881 | q.text("value = "); |
| 1882 | q.text("%#x" % self.value) |
| 1883 | q.breakable() |
| 1884 | q.text('}') |
| 1885 | |
| 1886 | bsn_tlv.subtypes[61] = mpls_label |
| 1887 | |
| 1888 | class mpls_sequenced(bsn_tlv): |
| 1889 | type = 63 |
| 1890 | |
| 1891 | def __init__(self, value=None): |
| 1892 | if value != None: |
| 1893 | self.value = value |
| 1894 | else: |
| 1895 | self.value = 0 |
| 1896 | return |
| 1897 | |
| 1898 | def pack(self): |
| 1899 | packed = [] |
| 1900 | packed.append(struct.pack("!H", self.type)) |
| 1901 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1902 | packed.append(struct.pack("!B", self.value)) |
| 1903 | length = sum([len(x) for x in packed]) |
| 1904 | packed[1] = struct.pack("!H", length) |
| 1905 | return ''.join(packed) |
| 1906 | |
| 1907 | @staticmethod |
| 1908 | def unpack(reader): |
| 1909 | obj = mpls_sequenced() |
| 1910 | _type = reader.read("!H")[0] |
| 1911 | assert(_type == 63) |
| 1912 | _length = reader.read("!H")[0] |
| 1913 | orig_reader = reader |
| 1914 | reader = orig_reader.slice(_length, 4) |
| 1915 | obj.value = reader.read("!B")[0] |
| 1916 | return obj |
| 1917 | |
| 1918 | def __eq__(self, other): |
| 1919 | if type(self) != type(other): return False |
| 1920 | if self.value != other.value: return False |
| 1921 | return True |
| 1922 | |
| 1923 | def pretty_print(self, q): |
| 1924 | q.text("mpls_sequenced {") |
| 1925 | with q.group(): |
| 1926 | with q.indent(2): |
| 1927 | q.breakable() |
| 1928 | q.text("value = "); |
| 1929 | q.text("%#x" % self.value) |
| 1930 | q.breakable() |
| 1931 | q.text('}') |
| 1932 | |
| 1933 | bsn_tlv.subtypes[63] = mpls_sequenced |
| 1934 | |
Rich Lane | d0be755 | 2014-10-23 12:52:35 -0700 | [diff] [blame] | 1935 | class name(bsn_tlv): |
| 1936 | type = 52 |
| 1937 | |
| 1938 | def __init__(self, value=None): |
| 1939 | if value != None: |
| 1940 | self.value = value |
| 1941 | else: |
| 1942 | self.value = '' |
| 1943 | return |
| 1944 | |
| 1945 | def pack(self): |
| 1946 | packed = [] |
| 1947 | packed.append(struct.pack("!H", self.type)) |
| 1948 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1949 | packed.append(self.value) |
| 1950 | length = sum([len(x) for x in packed]) |
| 1951 | packed[1] = struct.pack("!H", length) |
| 1952 | return ''.join(packed) |
| 1953 | |
| 1954 | @staticmethod |
| 1955 | def unpack(reader): |
| 1956 | obj = name() |
| 1957 | _type = reader.read("!H")[0] |
| 1958 | assert(_type == 52) |
| 1959 | _length = reader.read("!H")[0] |
| 1960 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1961 | reader = orig_reader.slice(_length, 4) |
Rich Lane | d0be755 | 2014-10-23 12:52:35 -0700 | [diff] [blame] | 1962 | obj.value = str(reader.read_all()) |
| 1963 | return obj |
| 1964 | |
| 1965 | def __eq__(self, other): |
| 1966 | if type(self) != type(other): return False |
| 1967 | if self.value != other.value: return False |
| 1968 | return True |
| 1969 | |
| 1970 | def pretty_print(self, q): |
| 1971 | q.text("name {") |
| 1972 | with q.group(): |
| 1973 | with q.indent(2): |
| 1974 | q.breakable() |
| 1975 | q.text("value = "); |
| 1976 | q.pp(self.value) |
| 1977 | q.breakable() |
| 1978 | q.text('}') |
| 1979 | |
| 1980 | bsn_tlv.subtypes[52] = name |
| 1981 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 1982 | class partner_key(bsn_tlv): |
| 1983 | type = 51 |
| 1984 | |
| 1985 | def __init__(self, value=None): |
| 1986 | if value != None: |
| 1987 | self.value = value |
| 1988 | else: |
| 1989 | self.value = 0 |
| 1990 | return |
| 1991 | |
| 1992 | def pack(self): |
| 1993 | packed = [] |
| 1994 | packed.append(struct.pack("!H", self.type)) |
| 1995 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 1996 | packed.append(struct.pack("!H", self.value)) |
| 1997 | length = sum([len(x) for x in packed]) |
| 1998 | packed[1] = struct.pack("!H", length) |
| 1999 | return ''.join(packed) |
| 2000 | |
| 2001 | @staticmethod |
| 2002 | def unpack(reader): |
| 2003 | obj = partner_key() |
| 2004 | _type = reader.read("!H")[0] |
| 2005 | assert(_type == 51) |
| 2006 | _length = reader.read("!H")[0] |
| 2007 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2008 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2009 | obj.value = reader.read("!H")[0] |
| 2010 | return obj |
| 2011 | |
| 2012 | def __eq__(self, other): |
| 2013 | if type(self) != type(other): return False |
| 2014 | if self.value != other.value: return False |
| 2015 | return True |
| 2016 | |
| 2017 | def pretty_print(self, q): |
| 2018 | q.text("partner_key {") |
| 2019 | with q.group(): |
| 2020 | with q.indent(2): |
| 2021 | q.breakable() |
| 2022 | q.text("value = "); |
| 2023 | q.text("%#x" % self.value) |
| 2024 | q.breakable() |
| 2025 | q.text('}') |
| 2026 | |
| 2027 | bsn_tlv.subtypes[51] = partner_key |
| 2028 | |
| 2029 | class partner_port_num(bsn_tlv): |
| 2030 | type = 50 |
| 2031 | |
| 2032 | def __init__(self, value=None): |
| 2033 | if value != None: |
| 2034 | self.value = value |
| 2035 | else: |
| 2036 | self.value = 0 |
| 2037 | return |
| 2038 | |
| 2039 | def pack(self): |
| 2040 | packed = [] |
| 2041 | packed.append(struct.pack("!H", self.type)) |
| 2042 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2043 | packed.append(struct.pack("!H", self.value)) |
| 2044 | length = sum([len(x) for x in packed]) |
| 2045 | packed[1] = struct.pack("!H", length) |
| 2046 | return ''.join(packed) |
| 2047 | |
| 2048 | @staticmethod |
| 2049 | def unpack(reader): |
| 2050 | obj = partner_port_num() |
| 2051 | _type = reader.read("!H")[0] |
| 2052 | assert(_type == 50) |
| 2053 | _length = reader.read("!H")[0] |
| 2054 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2055 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2056 | obj.value = reader.read("!H")[0] |
| 2057 | return obj |
| 2058 | |
| 2059 | def __eq__(self, other): |
| 2060 | if type(self) != type(other): return False |
| 2061 | if self.value != other.value: return False |
| 2062 | return True |
| 2063 | |
| 2064 | def pretty_print(self, q): |
| 2065 | q.text("partner_port_num {") |
| 2066 | with q.group(): |
| 2067 | with q.indent(2): |
| 2068 | q.breakable() |
| 2069 | q.text("value = "); |
| 2070 | q.text("%#x" % self.value) |
| 2071 | q.breakable() |
| 2072 | q.text('}') |
| 2073 | |
| 2074 | bsn_tlv.subtypes[50] = partner_port_num |
| 2075 | |
| 2076 | class partner_port_priority(bsn_tlv): |
| 2077 | type = 49 |
| 2078 | |
| 2079 | def __init__(self, value=None): |
| 2080 | if value != None: |
| 2081 | self.value = value |
| 2082 | else: |
| 2083 | self.value = 0 |
| 2084 | return |
| 2085 | |
| 2086 | def pack(self): |
| 2087 | packed = [] |
| 2088 | packed.append(struct.pack("!H", self.type)) |
| 2089 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2090 | packed.append(struct.pack("!H", self.value)) |
| 2091 | length = sum([len(x) for x in packed]) |
| 2092 | packed[1] = struct.pack("!H", length) |
| 2093 | return ''.join(packed) |
| 2094 | |
| 2095 | @staticmethod |
| 2096 | def unpack(reader): |
| 2097 | obj = partner_port_priority() |
| 2098 | _type = reader.read("!H")[0] |
| 2099 | assert(_type == 49) |
| 2100 | _length = reader.read("!H")[0] |
| 2101 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2102 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2103 | obj.value = reader.read("!H")[0] |
| 2104 | return obj |
| 2105 | |
| 2106 | def __eq__(self, other): |
| 2107 | if type(self) != type(other): return False |
| 2108 | if self.value != other.value: return False |
| 2109 | return True |
| 2110 | |
| 2111 | def pretty_print(self, q): |
| 2112 | q.text("partner_port_priority {") |
| 2113 | with q.group(): |
| 2114 | with q.indent(2): |
| 2115 | q.breakable() |
| 2116 | q.text("value = "); |
| 2117 | q.text("%#x" % self.value) |
| 2118 | q.breakable() |
| 2119 | q.text('}') |
| 2120 | |
| 2121 | bsn_tlv.subtypes[49] = partner_port_priority |
| 2122 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 2123 | class partner_state(bsn_tlv): |
| 2124 | type = 54 |
| 2125 | |
| 2126 | def __init__(self, value=None): |
| 2127 | if value != None: |
| 2128 | self.value = value |
| 2129 | else: |
| 2130 | self.value = 0 |
| 2131 | return |
| 2132 | |
| 2133 | def pack(self): |
| 2134 | packed = [] |
| 2135 | packed.append(struct.pack("!H", self.type)) |
| 2136 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2137 | packed.append(struct.pack("!B", self.value)) |
| 2138 | length = sum([len(x) for x in packed]) |
| 2139 | packed[1] = struct.pack("!H", length) |
| 2140 | return ''.join(packed) |
| 2141 | |
| 2142 | @staticmethod |
| 2143 | def unpack(reader): |
| 2144 | obj = partner_state() |
| 2145 | _type = reader.read("!H")[0] |
| 2146 | assert(_type == 54) |
| 2147 | _length = reader.read("!H")[0] |
| 2148 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2149 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 2150 | obj.value = reader.read("!B")[0] |
| 2151 | return obj |
| 2152 | |
| 2153 | def __eq__(self, other): |
| 2154 | if type(self) != type(other): return False |
| 2155 | if self.value != other.value: return False |
| 2156 | return True |
| 2157 | |
| 2158 | def pretty_print(self, q): |
| 2159 | q.text("partner_state {") |
| 2160 | with q.group(): |
| 2161 | with q.indent(2): |
| 2162 | q.breakable() |
| 2163 | q.text("value = "); |
| 2164 | q.text("%#x" % self.value) |
| 2165 | q.breakable() |
| 2166 | q.text('}') |
| 2167 | |
| 2168 | bsn_tlv.subtypes[54] = partner_state |
| 2169 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2170 | class partner_system_mac(bsn_tlv): |
| 2171 | type = 48 |
| 2172 | |
| 2173 | def __init__(self, value=None): |
| 2174 | if value != None: |
| 2175 | self.value = value |
| 2176 | else: |
| 2177 | self.value = [0,0,0,0,0,0] |
| 2178 | return |
| 2179 | |
| 2180 | def pack(self): |
| 2181 | packed = [] |
| 2182 | packed.append(struct.pack("!H", self.type)) |
| 2183 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2184 | packed.append(struct.pack("!6B", *self.value)) |
| 2185 | length = sum([len(x) for x in packed]) |
| 2186 | packed[1] = struct.pack("!H", length) |
| 2187 | return ''.join(packed) |
| 2188 | |
| 2189 | @staticmethod |
| 2190 | def unpack(reader): |
| 2191 | obj = partner_system_mac() |
| 2192 | _type = reader.read("!H")[0] |
| 2193 | assert(_type == 48) |
| 2194 | _length = reader.read("!H")[0] |
| 2195 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2196 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2197 | obj.value = list(reader.read('!6B')) |
| 2198 | return obj |
| 2199 | |
| 2200 | def __eq__(self, other): |
| 2201 | if type(self) != type(other): return False |
| 2202 | if self.value != other.value: return False |
| 2203 | return True |
| 2204 | |
| 2205 | def pretty_print(self, q): |
| 2206 | q.text("partner_system_mac {") |
| 2207 | with q.group(): |
| 2208 | with q.indent(2): |
| 2209 | q.breakable() |
| 2210 | q.text("value = "); |
| 2211 | q.text(util.pretty_mac(self.value)) |
| 2212 | q.breakable() |
| 2213 | q.text('}') |
| 2214 | |
| 2215 | bsn_tlv.subtypes[48] = partner_system_mac |
| 2216 | |
| 2217 | class partner_system_priority(bsn_tlv): |
| 2218 | type = 47 |
| 2219 | |
| 2220 | def __init__(self, value=None): |
| 2221 | if value != None: |
| 2222 | self.value = value |
| 2223 | else: |
| 2224 | self.value = 0 |
| 2225 | return |
| 2226 | |
| 2227 | def pack(self): |
| 2228 | packed = [] |
| 2229 | packed.append(struct.pack("!H", self.type)) |
| 2230 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2231 | packed.append(struct.pack("!H", self.value)) |
| 2232 | length = sum([len(x) for x in packed]) |
| 2233 | packed[1] = struct.pack("!H", length) |
| 2234 | return ''.join(packed) |
| 2235 | |
| 2236 | @staticmethod |
| 2237 | def unpack(reader): |
| 2238 | obj = partner_system_priority() |
| 2239 | _type = reader.read("!H")[0] |
| 2240 | assert(_type == 47) |
| 2241 | _length = reader.read("!H")[0] |
| 2242 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2243 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2244 | obj.value = reader.read("!H")[0] |
| 2245 | return obj |
| 2246 | |
| 2247 | def __eq__(self, other): |
| 2248 | if type(self) != type(other): return False |
| 2249 | if self.value != other.value: return False |
| 2250 | return True |
| 2251 | |
| 2252 | def pretty_print(self, q): |
| 2253 | q.text("partner_system_priority {") |
| 2254 | with q.group(): |
| 2255 | with q.indent(2): |
| 2256 | q.breakable() |
| 2257 | q.text("value = "); |
| 2258 | q.text("%#x" % self.value) |
| 2259 | q.breakable() |
| 2260 | q.text('}') |
| 2261 | |
| 2262 | bsn_tlv.subtypes[47] = partner_system_priority |
| 2263 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2264 | class port(bsn_tlv): |
| 2265 | type = 0 |
| 2266 | |
| 2267 | def __init__(self, value=None): |
| 2268 | if value != None: |
| 2269 | self.value = value |
| 2270 | else: |
| 2271 | self.value = 0 |
| 2272 | return |
| 2273 | |
| 2274 | def pack(self): |
| 2275 | packed = [] |
| 2276 | packed.append(struct.pack("!H", self.type)) |
| 2277 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2278 | packed.append(util.pack_port_no(self.value)) |
| 2279 | length = sum([len(x) for x in packed]) |
| 2280 | packed[1] = struct.pack("!H", length) |
| 2281 | return ''.join(packed) |
| 2282 | |
| 2283 | @staticmethod |
| 2284 | def unpack(reader): |
| 2285 | obj = port() |
| 2286 | _type = reader.read("!H")[0] |
| 2287 | assert(_type == 0) |
| 2288 | _length = reader.read("!H")[0] |
| 2289 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2290 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2291 | obj.value = util.unpack_port_no(reader) |
| 2292 | return obj |
| 2293 | |
| 2294 | def __eq__(self, other): |
| 2295 | if type(self) != type(other): return False |
| 2296 | if self.value != other.value: return False |
| 2297 | return True |
| 2298 | |
| 2299 | def pretty_print(self, q): |
| 2300 | q.text("port {") |
| 2301 | with q.group(): |
| 2302 | with q.indent(2): |
| 2303 | q.breakable() |
| 2304 | q.text("value = "); |
| 2305 | q.text(util.pretty_port(self.value)) |
| 2306 | q.breakable() |
| 2307 | q.text('}') |
| 2308 | |
| 2309 | bsn_tlv.subtypes[0] = port |
| 2310 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2311 | class priority(bsn_tlv): |
| 2312 | type = 57 |
| 2313 | |
| 2314 | def __init__(self, value=None): |
| 2315 | if value != None: |
| 2316 | self.value = value |
| 2317 | else: |
| 2318 | self.value = 0 |
| 2319 | return |
| 2320 | |
| 2321 | def pack(self): |
| 2322 | packed = [] |
| 2323 | packed.append(struct.pack("!H", self.type)) |
| 2324 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2325 | packed.append(struct.pack("!L", self.value)) |
| 2326 | length = sum([len(x) for x in packed]) |
| 2327 | packed[1] = struct.pack("!H", length) |
| 2328 | return ''.join(packed) |
| 2329 | |
| 2330 | @staticmethod |
| 2331 | def unpack(reader): |
| 2332 | obj = priority() |
| 2333 | _type = reader.read("!H")[0] |
| 2334 | assert(_type == 57) |
| 2335 | _length = reader.read("!H")[0] |
| 2336 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2337 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2338 | obj.value = reader.read("!L")[0] |
| 2339 | return obj |
| 2340 | |
| 2341 | def __eq__(self, other): |
| 2342 | if type(self) != type(other): return False |
| 2343 | if self.value != other.value: return False |
| 2344 | return True |
| 2345 | |
| 2346 | def pretty_print(self, q): |
| 2347 | q.text("priority {") |
| 2348 | with q.group(): |
| 2349 | with q.indent(2): |
| 2350 | q.breakable() |
| 2351 | q.text("value = "); |
| 2352 | q.text("%#x" % self.value) |
| 2353 | q.breakable() |
| 2354 | q.text('}') |
| 2355 | |
| 2356 | bsn_tlv.subtypes[57] = priority |
| 2357 | |
Rich Lane | 78d9bcb | 2014-05-12 13:27:44 -0700 | [diff] [blame] | 2358 | class queue_id(bsn_tlv): |
| 2359 | type = 20 |
| 2360 | |
| 2361 | def __init__(self, value=None): |
| 2362 | if value != None: |
| 2363 | self.value = value |
| 2364 | else: |
| 2365 | self.value = 0 |
| 2366 | return |
| 2367 | |
| 2368 | def pack(self): |
| 2369 | packed = [] |
| 2370 | packed.append(struct.pack("!H", self.type)) |
| 2371 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2372 | packed.append(struct.pack("!L", self.value)) |
| 2373 | length = sum([len(x) for x in packed]) |
| 2374 | packed[1] = struct.pack("!H", length) |
| 2375 | return ''.join(packed) |
| 2376 | |
| 2377 | @staticmethod |
| 2378 | def unpack(reader): |
| 2379 | obj = queue_id() |
| 2380 | _type = reader.read("!H")[0] |
| 2381 | assert(_type == 20) |
| 2382 | _length = reader.read("!H")[0] |
| 2383 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2384 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 78d9bcb | 2014-05-12 13:27:44 -0700 | [diff] [blame] | 2385 | obj.value = reader.read("!L")[0] |
| 2386 | return obj |
| 2387 | |
| 2388 | def __eq__(self, other): |
| 2389 | if type(self) != type(other): return False |
| 2390 | if self.value != other.value: return False |
| 2391 | return True |
| 2392 | |
| 2393 | def pretty_print(self, q): |
| 2394 | q.text("queue_id {") |
| 2395 | with q.group(): |
| 2396 | with q.indent(2): |
| 2397 | q.breakable() |
| 2398 | q.text("value = "); |
| 2399 | q.text("%#x" % self.value) |
| 2400 | q.breakable() |
| 2401 | q.text('}') |
| 2402 | |
| 2403 | bsn_tlv.subtypes[20] = queue_id |
| 2404 | |
| 2405 | class queue_weight(bsn_tlv): |
| 2406 | type = 21 |
| 2407 | |
| 2408 | def __init__(self, value=None): |
| 2409 | if value != None: |
| 2410 | self.value = value |
| 2411 | else: |
| 2412 | self.value = 0 |
| 2413 | return |
| 2414 | |
| 2415 | def pack(self): |
| 2416 | packed = [] |
| 2417 | packed.append(struct.pack("!H", self.type)) |
| 2418 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2419 | packed.append(struct.pack("!L", self.value)) |
| 2420 | length = sum([len(x) for x in packed]) |
| 2421 | packed[1] = struct.pack("!H", length) |
| 2422 | return ''.join(packed) |
| 2423 | |
| 2424 | @staticmethod |
| 2425 | def unpack(reader): |
| 2426 | obj = queue_weight() |
| 2427 | _type = reader.read("!H")[0] |
| 2428 | assert(_type == 21) |
| 2429 | _length = reader.read("!H")[0] |
| 2430 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2431 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 78d9bcb | 2014-05-12 13:27:44 -0700 | [diff] [blame] | 2432 | obj.value = reader.read("!L")[0] |
| 2433 | return obj |
| 2434 | |
| 2435 | def __eq__(self, other): |
| 2436 | if type(self) != type(other): return False |
| 2437 | if self.value != other.value: return False |
| 2438 | return True |
| 2439 | |
| 2440 | def pretty_print(self, q): |
| 2441 | q.text("queue_weight {") |
| 2442 | with q.group(): |
| 2443 | with q.indent(2): |
| 2444 | q.breakable() |
| 2445 | q.text("value = "); |
| 2446 | q.text("%#x" % self.value) |
| 2447 | q.breakable() |
| 2448 | q.text('}') |
| 2449 | |
| 2450 | bsn_tlv.subtypes[21] = queue_weight |
| 2451 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 2452 | class reference(bsn_tlv): |
| 2453 | type = 59 |
| 2454 | |
| 2455 | def __init__(self, table_id=None, key=None): |
| 2456 | if table_id != None: |
| 2457 | self.table_id = table_id |
| 2458 | else: |
| 2459 | self.table_id = 0 |
| 2460 | if key != None: |
| 2461 | self.key = key |
| 2462 | else: |
| 2463 | self.key = [] |
| 2464 | return |
| 2465 | |
| 2466 | def pack(self): |
| 2467 | packed = [] |
| 2468 | packed.append(struct.pack("!H", self.type)) |
| 2469 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2470 | packed.append(struct.pack("!H", self.table_id)) |
| 2471 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 2472 | length = sum([len(x) for x in packed]) |
| 2473 | packed[1] = struct.pack("!H", length) |
| 2474 | return ''.join(packed) |
| 2475 | |
| 2476 | @staticmethod |
| 2477 | def unpack(reader): |
| 2478 | obj = reference() |
| 2479 | _type = reader.read("!H")[0] |
| 2480 | assert(_type == 59) |
| 2481 | _length = reader.read("!H")[0] |
| 2482 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2483 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 2484 | obj.table_id = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2485 | 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] | 2486 | return obj |
| 2487 | |
| 2488 | def __eq__(self, other): |
| 2489 | if type(self) != type(other): return False |
| 2490 | if self.table_id != other.table_id: return False |
| 2491 | if self.key != other.key: return False |
| 2492 | return True |
| 2493 | |
| 2494 | def pretty_print(self, q): |
| 2495 | q.text("reference {") |
| 2496 | with q.group(): |
| 2497 | with q.indent(2): |
| 2498 | q.breakable() |
| 2499 | q.text("table_id = "); |
| 2500 | q.text("%#x" % self.table_id) |
| 2501 | q.text(","); q.breakable() |
| 2502 | q.text("key = "); |
| 2503 | q.pp(self.key) |
| 2504 | q.breakable() |
| 2505 | q.text('}') |
| 2506 | |
| 2507 | bsn_tlv.subtypes[59] = reference |
| 2508 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2509 | class reply_packets(bsn_tlv): |
| 2510 | type = 12 |
| 2511 | |
| 2512 | def __init__(self, value=None): |
| 2513 | if value != None: |
| 2514 | self.value = value |
| 2515 | else: |
| 2516 | self.value = 0 |
| 2517 | return |
| 2518 | |
| 2519 | def pack(self): |
| 2520 | packed = [] |
| 2521 | packed.append(struct.pack("!H", self.type)) |
| 2522 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2523 | packed.append(struct.pack("!Q", self.value)) |
| 2524 | length = sum([len(x) for x in packed]) |
| 2525 | packed[1] = struct.pack("!H", length) |
| 2526 | return ''.join(packed) |
| 2527 | |
| 2528 | @staticmethod |
| 2529 | def unpack(reader): |
| 2530 | obj = reply_packets() |
| 2531 | _type = reader.read("!H")[0] |
| 2532 | assert(_type == 12) |
| 2533 | _length = reader.read("!H")[0] |
| 2534 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2535 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2536 | obj.value = reader.read("!Q")[0] |
| 2537 | return obj |
| 2538 | |
| 2539 | def __eq__(self, other): |
| 2540 | if type(self) != type(other): return False |
| 2541 | if self.value != other.value: return False |
| 2542 | return True |
| 2543 | |
| 2544 | def pretty_print(self, q): |
| 2545 | q.text("reply_packets {") |
| 2546 | with q.group(): |
| 2547 | with q.indent(2): |
| 2548 | q.breakable() |
| 2549 | q.text("value = "); |
| 2550 | q.text("%#x" % self.value) |
| 2551 | q.breakable() |
| 2552 | q.text('}') |
| 2553 | |
| 2554 | bsn_tlv.subtypes[12] = reply_packets |
| 2555 | |
| 2556 | class request_packets(bsn_tlv): |
| 2557 | type = 11 |
| 2558 | |
| 2559 | def __init__(self, value=None): |
| 2560 | if value != None: |
| 2561 | self.value = value |
| 2562 | else: |
| 2563 | self.value = 0 |
| 2564 | return |
| 2565 | |
| 2566 | def pack(self): |
| 2567 | packed = [] |
| 2568 | packed.append(struct.pack("!H", self.type)) |
| 2569 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2570 | packed.append(struct.pack("!Q", self.value)) |
| 2571 | length = sum([len(x) for x in packed]) |
| 2572 | packed[1] = struct.pack("!H", length) |
| 2573 | return ''.join(packed) |
| 2574 | |
| 2575 | @staticmethod |
| 2576 | def unpack(reader): |
| 2577 | obj = request_packets() |
| 2578 | _type = reader.read("!H")[0] |
| 2579 | assert(_type == 11) |
| 2580 | _length = reader.read("!H")[0] |
| 2581 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2582 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2583 | obj.value = reader.read("!Q")[0] |
| 2584 | return obj |
| 2585 | |
| 2586 | def __eq__(self, other): |
| 2587 | if type(self) != type(other): return False |
| 2588 | if self.value != other.value: return False |
| 2589 | return True |
| 2590 | |
| 2591 | def pretty_print(self, q): |
| 2592 | q.text("request_packets {") |
| 2593 | with q.group(): |
| 2594 | with q.indent(2): |
| 2595 | q.breakable() |
| 2596 | q.text("value = "); |
| 2597 | q.text("%#x" % self.value) |
| 2598 | q.breakable() |
| 2599 | q.text('}') |
| 2600 | |
| 2601 | bsn_tlv.subtypes[11] = request_packets |
| 2602 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2603 | class rx_bytes(bsn_tlv): |
| 2604 | type = 71 |
| 2605 | |
| 2606 | def __init__(self, value=None): |
| 2607 | if value != None: |
| 2608 | self.value = value |
| 2609 | else: |
| 2610 | self.value = 0 |
| 2611 | return |
| 2612 | |
| 2613 | def pack(self): |
| 2614 | packed = [] |
| 2615 | packed.append(struct.pack("!H", self.type)) |
| 2616 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2617 | packed.append(struct.pack("!Q", self.value)) |
| 2618 | length = sum([len(x) for x in packed]) |
| 2619 | packed[1] = struct.pack("!H", length) |
| 2620 | return ''.join(packed) |
| 2621 | |
| 2622 | @staticmethod |
| 2623 | def unpack(reader): |
| 2624 | obj = rx_bytes() |
| 2625 | _type = reader.read("!H")[0] |
| 2626 | assert(_type == 71) |
| 2627 | _length = reader.read("!H")[0] |
| 2628 | orig_reader = reader |
| 2629 | reader = orig_reader.slice(_length, 4) |
| 2630 | obj.value = reader.read("!Q")[0] |
| 2631 | return obj |
| 2632 | |
| 2633 | def __eq__(self, other): |
| 2634 | if type(self) != type(other): return False |
| 2635 | if self.value != other.value: return False |
| 2636 | return True |
| 2637 | |
| 2638 | def pretty_print(self, q): |
| 2639 | q.text("rx_bytes {") |
| 2640 | with q.group(): |
| 2641 | with q.indent(2): |
| 2642 | q.breakable() |
| 2643 | q.text("value = "); |
| 2644 | q.text("%#x" % self.value) |
| 2645 | q.breakable() |
| 2646 | q.text('}') |
| 2647 | |
| 2648 | bsn_tlv.subtypes[71] = rx_bytes |
| 2649 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2650 | class rx_packets(bsn_tlv): |
| 2651 | type = 2 |
| 2652 | |
| 2653 | def __init__(self, value=None): |
| 2654 | if value != None: |
| 2655 | self.value = value |
| 2656 | else: |
| 2657 | self.value = 0 |
| 2658 | return |
| 2659 | |
| 2660 | def pack(self): |
| 2661 | packed = [] |
| 2662 | packed.append(struct.pack("!H", self.type)) |
| 2663 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2664 | packed.append(struct.pack("!Q", self.value)) |
| 2665 | length = sum([len(x) for x in packed]) |
| 2666 | packed[1] = struct.pack("!H", length) |
| 2667 | return ''.join(packed) |
| 2668 | |
| 2669 | @staticmethod |
| 2670 | def unpack(reader): |
| 2671 | obj = rx_packets() |
| 2672 | _type = reader.read("!H")[0] |
| 2673 | assert(_type == 2) |
| 2674 | _length = reader.read("!H")[0] |
| 2675 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2676 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2677 | obj.value = reader.read("!Q")[0] |
| 2678 | return obj |
| 2679 | |
| 2680 | def __eq__(self, other): |
| 2681 | if type(self) != type(other): return False |
| 2682 | if self.value != other.value: return False |
| 2683 | return True |
| 2684 | |
| 2685 | def pretty_print(self, q): |
| 2686 | q.text("rx_packets {") |
| 2687 | with q.group(): |
| 2688 | with q.indent(2): |
| 2689 | q.breakable() |
| 2690 | q.text("value = "); |
| 2691 | q.text("%#x" % self.value) |
| 2692 | q.breakable() |
| 2693 | q.text('}') |
| 2694 | |
| 2695 | bsn_tlv.subtypes[2] = rx_packets |
| 2696 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2697 | class sampling_rate(bsn_tlv): |
| 2698 | type = 30 |
| 2699 | |
| 2700 | def __init__(self, value=None): |
| 2701 | if value != None: |
| 2702 | self.value = value |
| 2703 | else: |
| 2704 | self.value = 0 |
| 2705 | return |
| 2706 | |
| 2707 | def pack(self): |
| 2708 | packed = [] |
| 2709 | packed.append(struct.pack("!H", self.type)) |
| 2710 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2711 | packed.append(struct.pack("!L", self.value)) |
| 2712 | length = sum([len(x) for x in packed]) |
| 2713 | packed[1] = struct.pack("!H", length) |
| 2714 | return ''.join(packed) |
| 2715 | |
| 2716 | @staticmethod |
| 2717 | def unpack(reader): |
| 2718 | obj = sampling_rate() |
| 2719 | _type = reader.read("!H")[0] |
| 2720 | assert(_type == 30) |
| 2721 | _length = reader.read("!H")[0] |
| 2722 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2723 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2724 | obj.value = reader.read("!L")[0] |
| 2725 | return obj |
| 2726 | |
| 2727 | def __eq__(self, other): |
| 2728 | if type(self) != type(other): return False |
| 2729 | if self.value != other.value: return False |
| 2730 | return True |
| 2731 | |
| 2732 | def pretty_print(self, q): |
| 2733 | q.text("sampling_rate {") |
| 2734 | with q.group(): |
| 2735 | with q.indent(2): |
| 2736 | q.breakable() |
| 2737 | q.text("value = "); |
| 2738 | q.text("%#x" % self.value) |
| 2739 | q.breakable() |
| 2740 | q.text('}') |
| 2741 | |
| 2742 | bsn_tlv.subtypes[30] = sampling_rate |
| 2743 | |
| 2744 | class sub_agent_id(bsn_tlv): |
| 2745 | type = 38 |
| 2746 | |
| 2747 | def __init__(self, value=None): |
| 2748 | if value != None: |
| 2749 | self.value = value |
| 2750 | else: |
| 2751 | self.value = 0 |
| 2752 | return |
| 2753 | |
| 2754 | def pack(self): |
| 2755 | packed = [] |
| 2756 | packed.append(struct.pack("!H", self.type)) |
| 2757 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2758 | packed.append(struct.pack("!L", self.value)) |
| 2759 | length = sum([len(x) for x in packed]) |
| 2760 | packed[1] = struct.pack("!H", length) |
| 2761 | return ''.join(packed) |
| 2762 | |
| 2763 | @staticmethod |
| 2764 | def unpack(reader): |
| 2765 | obj = sub_agent_id() |
| 2766 | _type = reader.read("!H")[0] |
| 2767 | assert(_type == 38) |
| 2768 | _length = reader.read("!H")[0] |
| 2769 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2770 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2771 | obj.value = reader.read("!L")[0] |
| 2772 | return obj |
| 2773 | |
| 2774 | def __eq__(self, other): |
| 2775 | if type(self) != type(other): return False |
| 2776 | if self.value != other.value: return False |
| 2777 | return True |
| 2778 | |
| 2779 | def pretty_print(self, q): |
| 2780 | q.text("sub_agent_id {") |
| 2781 | with q.group(): |
| 2782 | with q.indent(2): |
| 2783 | q.breakable() |
| 2784 | q.text("value = "); |
| 2785 | q.text("%#x" % self.value) |
| 2786 | q.breakable() |
| 2787 | q.text('}') |
| 2788 | |
| 2789 | bsn_tlv.subtypes[38] = sub_agent_id |
| 2790 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 2791 | class tcp_dst(bsn_tlv): |
| 2792 | type = 66 |
| 2793 | |
| 2794 | def __init__(self, value=None): |
| 2795 | if value != None: |
| 2796 | self.value = value |
| 2797 | else: |
| 2798 | self.value = 0 |
| 2799 | return |
| 2800 | |
| 2801 | def pack(self): |
| 2802 | packed = [] |
| 2803 | packed.append(struct.pack("!H", self.type)) |
| 2804 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2805 | packed.append(struct.pack("!H", self.value)) |
| 2806 | length = sum([len(x) for x in packed]) |
| 2807 | packed[1] = struct.pack("!H", length) |
| 2808 | return ''.join(packed) |
| 2809 | |
| 2810 | @staticmethod |
| 2811 | def unpack(reader): |
| 2812 | obj = tcp_dst() |
| 2813 | _type = reader.read("!H")[0] |
| 2814 | assert(_type == 66) |
| 2815 | _length = reader.read("!H")[0] |
| 2816 | orig_reader = reader |
| 2817 | reader = orig_reader.slice(_length, 4) |
| 2818 | obj.value = reader.read("!H")[0] |
| 2819 | return obj |
| 2820 | |
| 2821 | def __eq__(self, other): |
| 2822 | if type(self) != type(other): return False |
| 2823 | if self.value != other.value: return False |
| 2824 | return True |
| 2825 | |
| 2826 | def pretty_print(self, q): |
| 2827 | q.text("tcp_dst {") |
| 2828 | with q.group(): |
| 2829 | with q.indent(2): |
| 2830 | q.breakable() |
| 2831 | q.text("value = "); |
| 2832 | q.text("%#x" % self.value) |
| 2833 | q.breakable() |
| 2834 | q.text('}') |
| 2835 | |
| 2836 | bsn_tlv.subtypes[66] = tcp_dst |
| 2837 | |
| 2838 | class tcp_src(bsn_tlv): |
| 2839 | type = 65 |
| 2840 | |
| 2841 | def __init__(self, value=None): |
| 2842 | if value != None: |
| 2843 | self.value = value |
| 2844 | else: |
| 2845 | self.value = 0 |
| 2846 | return |
| 2847 | |
| 2848 | def pack(self): |
| 2849 | packed = [] |
| 2850 | packed.append(struct.pack("!H", self.type)) |
| 2851 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2852 | packed.append(struct.pack("!H", self.value)) |
| 2853 | length = sum([len(x) for x in packed]) |
| 2854 | packed[1] = struct.pack("!H", length) |
| 2855 | return ''.join(packed) |
| 2856 | |
| 2857 | @staticmethod |
| 2858 | def unpack(reader): |
| 2859 | obj = tcp_src() |
| 2860 | _type = reader.read("!H")[0] |
| 2861 | assert(_type == 65) |
| 2862 | _length = reader.read("!H")[0] |
| 2863 | orig_reader = reader |
| 2864 | reader = orig_reader.slice(_length, 4) |
| 2865 | obj.value = reader.read("!H")[0] |
| 2866 | return obj |
| 2867 | |
| 2868 | def __eq__(self, other): |
| 2869 | if type(self) != type(other): return False |
| 2870 | if self.value != other.value: return False |
| 2871 | return True |
| 2872 | |
| 2873 | def pretty_print(self, q): |
| 2874 | q.text("tcp_src {") |
| 2875 | with q.group(): |
| 2876 | with q.indent(2): |
| 2877 | q.breakable() |
| 2878 | q.text("value = "); |
| 2879 | q.text("%#x" % self.value) |
| 2880 | q.breakable() |
| 2881 | q.text('}') |
| 2882 | |
| 2883 | bsn_tlv.subtypes[65] = tcp_src |
| 2884 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2885 | class tx_bytes(bsn_tlv): |
| 2886 | type = 39 |
| 2887 | |
| 2888 | def __init__(self, value=None): |
| 2889 | if value != None: |
| 2890 | self.value = value |
| 2891 | else: |
| 2892 | self.value = 0 |
| 2893 | return |
| 2894 | |
| 2895 | def pack(self): |
| 2896 | packed = [] |
| 2897 | packed.append(struct.pack("!H", self.type)) |
| 2898 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2899 | packed.append(struct.pack("!Q", self.value)) |
| 2900 | length = sum([len(x) for x in packed]) |
| 2901 | packed[1] = struct.pack("!H", length) |
| 2902 | return ''.join(packed) |
| 2903 | |
| 2904 | @staticmethod |
| 2905 | def unpack(reader): |
| 2906 | obj = tx_bytes() |
| 2907 | _type = reader.read("!H")[0] |
| 2908 | assert(_type == 39) |
| 2909 | _length = reader.read("!H")[0] |
| 2910 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2911 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 2912 | obj.value = reader.read("!Q")[0] |
| 2913 | return obj |
| 2914 | |
| 2915 | def __eq__(self, other): |
| 2916 | if type(self) != type(other): return False |
| 2917 | if self.value != other.value: return False |
| 2918 | return True |
| 2919 | |
| 2920 | def pretty_print(self, q): |
| 2921 | q.text("tx_bytes {") |
| 2922 | with q.group(): |
| 2923 | with q.indent(2): |
| 2924 | q.breakable() |
| 2925 | q.text("value = "); |
| 2926 | q.text("%#x" % self.value) |
| 2927 | q.breakable() |
| 2928 | q.text('}') |
| 2929 | |
| 2930 | bsn_tlv.subtypes[39] = tx_bytes |
| 2931 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2932 | class tx_packets(bsn_tlv): |
| 2933 | type = 3 |
| 2934 | |
| 2935 | def __init__(self, value=None): |
| 2936 | if value != None: |
| 2937 | self.value = value |
| 2938 | else: |
| 2939 | self.value = 0 |
| 2940 | return |
| 2941 | |
| 2942 | def pack(self): |
| 2943 | packed = [] |
| 2944 | packed.append(struct.pack("!H", self.type)) |
| 2945 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2946 | packed.append(struct.pack("!Q", self.value)) |
| 2947 | length = sum([len(x) for x in packed]) |
| 2948 | packed[1] = struct.pack("!H", length) |
| 2949 | return ''.join(packed) |
| 2950 | |
| 2951 | @staticmethod |
| 2952 | def unpack(reader): |
| 2953 | obj = tx_packets() |
| 2954 | _type = reader.read("!H")[0] |
| 2955 | assert(_type == 3) |
| 2956 | _length = reader.read("!H")[0] |
| 2957 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2958 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2959 | obj.value = reader.read("!Q")[0] |
| 2960 | return obj |
| 2961 | |
| 2962 | def __eq__(self, other): |
| 2963 | if type(self) != type(other): return False |
| 2964 | if self.value != other.value: return False |
| 2965 | return True |
| 2966 | |
| 2967 | def pretty_print(self, q): |
| 2968 | q.text("tx_packets {") |
| 2969 | with q.group(): |
| 2970 | with q.indent(2): |
| 2971 | q.breakable() |
| 2972 | q.text("value = "); |
| 2973 | q.text("%#x" % self.value) |
| 2974 | q.breakable() |
| 2975 | q.text('}') |
| 2976 | |
| 2977 | bsn_tlv.subtypes[3] = tx_packets |
| 2978 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2979 | class udf_anchor(bsn_tlv): |
| 2980 | type = 16 |
| 2981 | |
| 2982 | def __init__(self, value=None): |
| 2983 | if value != None: |
| 2984 | self.value = value |
| 2985 | else: |
| 2986 | self.value = 0 |
| 2987 | return |
| 2988 | |
| 2989 | def pack(self): |
| 2990 | packed = [] |
| 2991 | packed.append(struct.pack("!H", self.type)) |
| 2992 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 2993 | packed.append(struct.pack("!H", self.value)) |
| 2994 | length = sum([len(x) for x in packed]) |
| 2995 | packed[1] = struct.pack("!H", length) |
| 2996 | return ''.join(packed) |
| 2997 | |
| 2998 | @staticmethod |
| 2999 | def unpack(reader): |
| 3000 | obj = udf_anchor() |
| 3001 | _type = reader.read("!H")[0] |
| 3002 | assert(_type == 16) |
| 3003 | _length = reader.read("!H")[0] |
| 3004 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3005 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3006 | obj.value = reader.read("!H")[0] |
| 3007 | return obj |
| 3008 | |
| 3009 | def __eq__(self, other): |
| 3010 | if type(self) != type(other): return False |
| 3011 | if self.value != other.value: return False |
| 3012 | return True |
| 3013 | |
| 3014 | def pretty_print(self, q): |
| 3015 | q.text("udf_anchor {") |
| 3016 | with q.group(): |
| 3017 | with q.indent(2): |
| 3018 | q.breakable() |
| 3019 | q.text("value = "); |
| 3020 | q.text("%#x" % self.value) |
| 3021 | q.breakable() |
| 3022 | q.text('}') |
| 3023 | |
| 3024 | bsn_tlv.subtypes[16] = udf_anchor |
| 3025 | |
| 3026 | class udf_id(bsn_tlv): |
| 3027 | type = 15 |
| 3028 | |
| 3029 | def __init__(self, value=None): |
| 3030 | if value != None: |
| 3031 | self.value = value |
| 3032 | else: |
| 3033 | self.value = 0 |
| 3034 | return |
| 3035 | |
| 3036 | def pack(self): |
| 3037 | packed = [] |
| 3038 | packed.append(struct.pack("!H", self.type)) |
| 3039 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3040 | packed.append(struct.pack("!H", self.value)) |
| 3041 | length = sum([len(x) for x in packed]) |
| 3042 | packed[1] = struct.pack("!H", length) |
| 3043 | return ''.join(packed) |
| 3044 | |
| 3045 | @staticmethod |
| 3046 | def unpack(reader): |
| 3047 | obj = udf_id() |
| 3048 | _type = reader.read("!H")[0] |
| 3049 | assert(_type == 15) |
| 3050 | _length = reader.read("!H")[0] |
| 3051 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3052 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3053 | obj.value = reader.read("!H")[0] |
| 3054 | return obj |
| 3055 | |
| 3056 | def __eq__(self, other): |
| 3057 | if type(self) != type(other): return False |
| 3058 | if self.value != other.value: return False |
| 3059 | return True |
| 3060 | |
| 3061 | def pretty_print(self, q): |
| 3062 | q.text("udf_id {") |
| 3063 | with q.group(): |
| 3064 | with q.indent(2): |
| 3065 | q.breakable() |
| 3066 | q.text("value = "); |
| 3067 | q.text("%#x" % self.value) |
| 3068 | q.breakable() |
| 3069 | q.text('}') |
| 3070 | |
| 3071 | bsn_tlv.subtypes[15] = udf_id |
| 3072 | |
| 3073 | class udf_length(bsn_tlv): |
| 3074 | type = 18 |
| 3075 | |
| 3076 | def __init__(self, value=None): |
| 3077 | if value != None: |
| 3078 | self.value = value |
| 3079 | else: |
| 3080 | self.value = 0 |
| 3081 | return |
| 3082 | |
| 3083 | def pack(self): |
| 3084 | packed = [] |
| 3085 | packed.append(struct.pack("!H", self.type)) |
| 3086 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3087 | packed.append(struct.pack("!H", self.value)) |
| 3088 | length = sum([len(x) for x in packed]) |
| 3089 | packed[1] = struct.pack("!H", length) |
| 3090 | return ''.join(packed) |
| 3091 | |
| 3092 | @staticmethod |
| 3093 | def unpack(reader): |
| 3094 | obj = udf_length() |
| 3095 | _type = reader.read("!H")[0] |
| 3096 | assert(_type == 18) |
| 3097 | _length = reader.read("!H")[0] |
| 3098 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3099 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3100 | obj.value = reader.read("!H")[0] |
| 3101 | return obj |
| 3102 | |
| 3103 | def __eq__(self, other): |
| 3104 | if type(self) != type(other): return False |
| 3105 | if self.value != other.value: return False |
| 3106 | return True |
| 3107 | |
| 3108 | def pretty_print(self, q): |
| 3109 | q.text("udf_length {") |
| 3110 | with q.group(): |
| 3111 | with q.indent(2): |
| 3112 | q.breakable() |
| 3113 | q.text("value = "); |
| 3114 | q.text("%#x" % self.value) |
| 3115 | q.breakable() |
| 3116 | q.text('}') |
| 3117 | |
| 3118 | bsn_tlv.subtypes[18] = udf_length |
| 3119 | |
| 3120 | class udf_offset(bsn_tlv): |
| 3121 | type = 17 |
| 3122 | |
| 3123 | def __init__(self, value=None): |
| 3124 | if value != None: |
| 3125 | self.value = value |
| 3126 | else: |
| 3127 | self.value = 0 |
| 3128 | return |
| 3129 | |
| 3130 | def pack(self): |
| 3131 | packed = [] |
| 3132 | packed.append(struct.pack("!H", self.type)) |
| 3133 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3134 | packed.append(struct.pack("!H", self.value)) |
| 3135 | length = sum([len(x) for x in packed]) |
| 3136 | packed[1] = struct.pack("!H", length) |
| 3137 | return ''.join(packed) |
| 3138 | |
| 3139 | @staticmethod |
| 3140 | def unpack(reader): |
| 3141 | obj = udf_offset() |
| 3142 | _type = reader.read("!H")[0] |
| 3143 | assert(_type == 17) |
| 3144 | _length = reader.read("!H")[0] |
| 3145 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3146 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3147 | obj.value = reader.read("!H")[0] |
| 3148 | return obj |
| 3149 | |
| 3150 | def __eq__(self, other): |
| 3151 | if type(self) != type(other): return False |
| 3152 | if self.value != other.value: return False |
| 3153 | return True |
| 3154 | |
| 3155 | def pretty_print(self, q): |
| 3156 | q.text("udf_offset {") |
| 3157 | with q.group(): |
| 3158 | with q.indent(2): |
| 3159 | q.breakable() |
| 3160 | q.text("value = "); |
| 3161 | q.text("%#x" % self.value) |
| 3162 | q.breakable() |
| 3163 | q.text('}') |
| 3164 | |
| 3165 | bsn_tlv.subtypes[17] = udf_offset |
| 3166 | |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 3167 | class udp_dst(bsn_tlv): |
| 3168 | type = 37 |
| 3169 | |
| 3170 | def __init__(self, value=None): |
| 3171 | if value != None: |
| 3172 | self.value = value |
| 3173 | else: |
| 3174 | self.value = 0 |
| 3175 | return |
| 3176 | |
| 3177 | def pack(self): |
| 3178 | packed = [] |
| 3179 | packed.append(struct.pack("!H", self.type)) |
| 3180 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3181 | packed.append(struct.pack("!H", self.value)) |
| 3182 | length = sum([len(x) for x in packed]) |
| 3183 | packed[1] = struct.pack("!H", length) |
| 3184 | return ''.join(packed) |
| 3185 | |
| 3186 | @staticmethod |
| 3187 | def unpack(reader): |
| 3188 | obj = udp_dst() |
| 3189 | _type = reader.read("!H")[0] |
| 3190 | assert(_type == 37) |
| 3191 | _length = reader.read("!H")[0] |
| 3192 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3193 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 3194 | obj.value = reader.read("!H")[0] |
| 3195 | return obj |
| 3196 | |
| 3197 | def __eq__(self, other): |
| 3198 | if type(self) != type(other): return False |
| 3199 | if self.value != other.value: return False |
| 3200 | return True |
| 3201 | |
| 3202 | def pretty_print(self, q): |
| 3203 | q.text("udp_dst {") |
| 3204 | with q.group(): |
| 3205 | with q.indent(2): |
| 3206 | q.breakable() |
| 3207 | q.text("value = "); |
| 3208 | q.text("%#x" % self.value) |
| 3209 | q.breakable() |
| 3210 | q.text('}') |
| 3211 | |
| 3212 | bsn_tlv.subtypes[37] = udp_dst |
| 3213 | |
| 3214 | class udp_src(bsn_tlv): |
| 3215 | type = 36 |
| 3216 | |
| 3217 | def __init__(self, value=None): |
| 3218 | if value != None: |
| 3219 | self.value = value |
| 3220 | else: |
| 3221 | self.value = 0 |
| 3222 | return |
| 3223 | |
| 3224 | def pack(self): |
| 3225 | packed = [] |
| 3226 | packed.append(struct.pack("!H", self.type)) |
| 3227 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3228 | packed.append(struct.pack("!H", self.value)) |
| 3229 | length = sum([len(x) for x in packed]) |
| 3230 | packed[1] = struct.pack("!H", length) |
| 3231 | return ''.join(packed) |
| 3232 | |
| 3233 | @staticmethod |
| 3234 | def unpack(reader): |
| 3235 | obj = udp_src() |
| 3236 | _type = reader.read("!H")[0] |
| 3237 | assert(_type == 36) |
| 3238 | _length = reader.read("!H")[0] |
| 3239 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3240 | reader = orig_reader.slice(_length, 4) |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 3241 | obj.value = reader.read("!H")[0] |
| 3242 | return obj |
| 3243 | |
| 3244 | def __eq__(self, other): |
| 3245 | if type(self) != type(other): return False |
| 3246 | if self.value != other.value: return False |
| 3247 | return True |
| 3248 | |
| 3249 | def pretty_print(self, q): |
| 3250 | q.text("udp_src {") |
| 3251 | with q.group(): |
| 3252 | with q.indent(2): |
| 3253 | q.breakable() |
| 3254 | q.text("value = "); |
| 3255 | q.text("%#x" % self.value) |
| 3256 | q.breakable() |
| 3257 | q.text('}') |
| 3258 | |
| 3259 | bsn_tlv.subtypes[36] = udp_src |
| 3260 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3261 | class unicast_query_timeout(bsn_tlv): |
| 3262 | type = 9 |
| 3263 | |
| 3264 | def __init__(self, value=None): |
| 3265 | if value != None: |
| 3266 | self.value = value |
| 3267 | else: |
| 3268 | self.value = 0 |
| 3269 | return |
| 3270 | |
| 3271 | def pack(self): |
| 3272 | packed = [] |
| 3273 | packed.append(struct.pack("!H", self.type)) |
| 3274 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3275 | packed.append(struct.pack("!L", self.value)) |
| 3276 | length = sum([len(x) for x in packed]) |
| 3277 | packed[1] = struct.pack("!H", length) |
| 3278 | return ''.join(packed) |
| 3279 | |
| 3280 | @staticmethod |
| 3281 | def unpack(reader): |
| 3282 | obj = unicast_query_timeout() |
| 3283 | _type = reader.read("!H")[0] |
| 3284 | assert(_type == 9) |
| 3285 | _length = reader.read("!H")[0] |
| 3286 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3287 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3288 | obj.value = reader.read("!L")[0] |
| 3289 | return obj |
| 3290 | |
| 3291 | def __eq__(self, other): |
| 3292 | if type(self) != type(other): return False |
| 3293 | if self.value != other.value: return False |
| 3294 | return True |
| 3295 | |
| 3296 | def pretty_print(self, q): |
| 3297 | q.text("unicast_query_timeout {") |
| 3298 | with q.group(): |
| 3299 | with q.indent(2): |
| 3300 | q.breakable() |
| 3301 | q.text("value = "); |
| 3302 | q.text("%#x" % self.value) |
| 3303 | q.breakable() |
| 3304 | q.text('}') |
| 3305 | |
| 3306 | bsn_tlv.subtypes[9] = unicast_query_timeout |
| 3307 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3308 | class vlan_vid(bsn_tlv): |
| 3309 | type = 6 |
| 3310 | |
| 3311 | def __init__(self, value=None): |
| 3312 | if value != None: |
| 3313 | self.value = value |
| 3314 | else: |
| 3315 | self.value = 0 |
| 3316 | return |
| 3317 | |
| 3318 | def pack(self): |
| 3319 | packed = [] |
| 3320 | packed.append(struct.pack("!H", self.type)) |
| 3321 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3322 | packed.append(struct.pack("!H", self.value)) |
| 3323 | length = sum([len(x) for x in packed]) |
| 3324 | packed[1] = struct.pack("!H", length) |
| 3325 | return ''.join(packed) |
| 3326 | |
| 3327 | @staticmethod |
| 3328 | def unpack(reader): |
| 3329 | obj = vlan_vid() |
| 3330 | _type = reader.read("!H")[0] |
| 3331 | assert(_type == 6) |
| 3332 | _length = reader.read("!H")[0] |
| 3333 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3334 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3335 | obj.value = reader.read("!H")[0] |
| 3336 | return obj |
| 3337 | |
| 3338 | def __eq__(self, other): |
| 3339 | if type(self) != type(other): return False |
| 3340 | if self.value != other.value: return False |
| 3341 | return True |
| 3342 | |
| 3343 | def pretty_print(self, q): |
| 3344 | q.text("vlan_vid {") |
| 3345 | with q.group(): |
| 3346 | with q.indent(2): |
| 3347 | q.breakable() |
| 3348 | q.text("value = "); |
| 3349 | q.text("%#x" % self.value) |
| 3350 | q.breakable() |
| 3351 | q.text('}') |
| 3352 | |
| 3353 | bsn_tlv.subtypes[6] = vlan_vid |
| 3354 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3355 | class vrf(bsn_tlv): |
| 3356 | type = 19 |
| 3357 | |
| 3358 | def __init__(self, value=None): |
| 3359 | if value != None: |
| 3360 | self.value = value |
| 3361 | else: |
| 3362 | self.value = 0 |
| 3363 | return |
| 3364 | |
| 3365 | def pack(self): |
| 3366 | packed = [] |
| 3367 | packed.append(struct.pack("!H", self.type)) |
| 3368 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 3369 | packed.append(struct.pack("!L", self.value)) |
| 3370 | length = sum([len(x) for x in packed]) |
| 3371 | packed[1] = struct.pack("!H", length) |
| 3372 | return ''.join(packed) |
| 3373 | |
| 3374 | @staticmethod |
| 3375 | def unpack(reader): |
| 3376 | obj = vrf() |
| 3377 | _type = reader.read("!H")[0] |
| 3378 | assert(_type == 19) |
| 3379 | _length = reader.read("!H")[0] |
| 3380 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3381 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3382 | obj.value = reader.read("!L")[0] |
| 3383 | return obj |
| 3384 | |
| 3385 | def __eq__(self, other): |
| 3386 | if type(self) != type(other): return False |
| 3387 | if self.value != other.value: return False |
| 3388 | return True |
| 3389 | |
| 3390 | def pretty_print(self, q): |
| 3391 | q.text("vrf {") |
| 3392 | with q.group(): |
| 3393 | with q.indent(2): |
| 3394 | q.breakable() |
| 3395 | q.text("value = "); |
| 3396 | q.text("%#x" % self.value) |
| 3397 | q.breakable() |
| 3398 | q.text('}') |
| 3399 | |
| 3400 | bsn_tlv.subtypes[19] = vrf |
| 3401 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3402 | |