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