Stephane Barbarie | 6e1bd50 | 2018-11-05 22:44:45 -0500 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 15 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 16 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 17 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
| 18 | |
| 19 | # Automatically generated by LOXI from template module.py |
| 20 | # Do not modify |
| 21 | |
| 22 | import struct |
| 23 | import loxi |
| 24 | import util |
| 25 | import loxi.generic_util |
| 26 | |
| 27 | import sys |
| 28 | ofp = sys.modules['loxi.of14'] |
| 29 | |
| 30 | class instruction(loxi.OFObject): |
| 31 | subtypes = {} |
| 32 | |
| 33 | |
| 34 | def __init__(self, type=None): |
| 35 | if type != None: |
| 36 | self.type = type |
| 37 | else: |
| 38 | self.type = 0 |
| 39 | return |
| 40 | |
| 41 | def pack(self): |
| 42 | packed = [] |
| 43 | packed.append(struct.pack("!H", self.type)) |
| 44 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 45 | length = sum([len(x) for x in packed]) |
| 46 | packed[1] = struct.pack("!H", length) |
| 47 | return ''.join(packed) |
| 48 | |
| 49 | @staticmethod |
| 50 | def unpack(reader): |
| 51 | subtype, = reader.peek('!H', 0) |
| 52 | subclass = instruction.subtypes.get(subtype) |
| 53 | if subclass: |
| 54 | return subclass.unpack(reader) |
| 55 | |
| 56 | obj = instruction() |
| 57 | obj.type = reader.read("!H")[0] |
| 58 | _len = reader.read("!H")[0] |
| 59 | orig_reader = reader |
| 60 | reader = orig_reader.slice(_len, 4) |
| 61 | return obj |
| 62 | |
| 63 | def __eq__(self, other): |
| 64 | if type(self) != type(other): return False |
| 65 | if self.type != other.type: return False |
| 66 | return True |
| 67 | |
| 68 | def pretty_print(self, q): |
| 69 | q.text("instruction {") |
| 70 | with q.group(): |
| 71 | with q.indent(2): |
| 72 | q.breakable() |
| 73 | q.breakable() |
| 74 | q.text('}') |
| 75 | |
| 76 | |
| 77 | class apply_actions(instruction): |
| 78 | type = 4 |
| 79 | |
| 80 | def __init__(self, actions=None): |
| 81 | if actions != None: |
| 82 | self.actions = actions |
| 83 | else: |
| 84 | self.actions = [] |
| 85 | return |
| 86 | |
| 87 | def pack(self): |
| 88 | packed = [] |
| 89 | packed.append(struct.pack("!H", self.type)) |
| 90 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 91 | packed.append('\x00' * 4) |
| 92 | packed.append(loxi.generic_util.pack_list(self.actions)) |
| 93 | length = sum([len(x) for x in packed]) |
| 94 | packed[1] = struct.pack("!H", length) |
| 95 | return ''.join(packed) |
| 96 | |
| 97 | @staticmethod |
| 98 | def unpack(reader): |
| 99 | obj = apply_actions() |
| 100 | _type = reader.read("!H")[0] |
| 101 | assert(_type == 4) |
| 102 | _len = reader.read("!H")[0] |
| 103 | orig_reader = reader |
| 104 | reader = orig_reader.slice(_len, 4) |
| 105 | reader.skip(4) |
| 106 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
| 107 | return obj |
| 108 | |
| 109 | def __eq__(self, other): |
| 110 | if type(self) != type(other): return False |
| 111 | if self.actions != other.actions: return False |
| 112 | return True |
| 113 | |
| 114 | def pretty_print(self, q): |
| 115 | q.text("apply_actions {") |
| 116 | with q.group(): |
| 117 | with q.indent(2): |
| 118 | q.breakable() |
| 119 | q.text("actions = "); |
| 120 | q.pp(self.actions) |
| 121 | q.breakable() |
| 122 | q.text('}') |
| 123 | |
| 124 | instruction.subtypes[4] = apply_actions |
| 125 | |
| 126 | class experimenter(instruction): |
| 127 | subtypes = {} |
| 128 | |
| 129 | type = 65535 |
| 130 | |
| 131 | def __init__(self, experimenter=None, data=None): |
| 132 | if experimenter != None: |
| 133 | self.experimenter = experimenter |
| 134 | else: |
| 135 | self.experimenter = 0 |
| 136 | if data != None: |
| 137 | self.data = data |
| 138 | else: |
| 139 | self.data = '' |
| 140 | return |
| 141 | |
| 142 | def pack(self): |
| 143 | packed = [] |
| 144 | packed.append(struct.pack("!H", self.type)) |
| 145 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 146 | packed.append(struct.pack("!L", self.experimenter)) |
| 147 | packed.append(self.data) |
| 148 | length = sum([len(x) for x in packed]) |
| 149 | packed[1] = struct.pack("!H", length) |
| 150 | return ''.join(packed) |
| 151 | |
| 152 | @staticmethod |
| 153 | def unpack(reader): |
| 154 | subtype, = reader.peek('!L', 4) |
| 155 | subclass = experimenter.subtypes.get(subtype) |
| 156 | if subclass: |
| 157 | return subclass.unpack(reader) |
| 158 | |
| 159 | obj = experimenter() |
| 160 | _type = reader.read("!H")[0] |
| 161 | assert(_type == 65535) |
| 162 | _len = reader.read("!H")[0] |
| 163 | orig_reader = reader |
| 164 | reader = orig_reader.slice(_len, 4) |
| 165 | obj.experimenter = reader.read("!L")[0] |
| 166 | obj.data = str(reader.read_all()) |
| 167 | return obj |
| 168 | |
| 169 | def __eq__(self, other): |
| 170 | if type(self) != type(other): return False |
| 171 | if self.experimenter != other.experimenter: return False |
| 172 | if self.data != other.data: return False |
| 173 | return True |
| 174 | |
| 175 | def pretty_print(self, q): |
| 176 | q.text("experimenter {") |
| 177 | with q.group(): |
| 178 | with q.indent(2): |
| 179 | q.breakable() |
| 180 | q.text("data = "); |
| 181 | q.pp(self.data) |
| 182 | q.breakable() |
| 183 | q.text('}') |
| 184 | |
| 185 | instruction.subtypes[65535] = experimenter |
| 186 | |
| 187 | class bsn(experimenter): |
| 188 | subtypes = {} |
| 189 | |
| 190 | type = 65535 |
| 191 | experimenter = 6035143 |
| 192 | |
| 193 | def __init__(self, subtype=None): |
| 194 | if subtype != None: |
| 195 | self.subtype = subtype |
| 196 | else: |
| 197 | self.subtype = 0 |
| 198 | return |
| 199 | |
| 200 | def pack(self): |
| 201 | packed = [] |
| 202 | packed.append(struct.pack("!H", self.type)) |
| 203 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 204 | packed.append(struct.pack("!L", self.experimenter)) |
| 205 | packed.append(struct.pack("!L", self.subtype)) |
| 206 | packed.append('\x00' * 4) |
| 207 | length = sum([len(x) for x in packed]) |
| 208 | packed[1] = struct.pack("!H", length) |
| 209 | return ''.join(packed) |
| 210 | |
| 211 | @staticmethod |
| 212 | def unpack(reader): |
| 213 | subtype, = reader.peek('!L', 8) |
| 214 | subclass = bsn.subtypes.get(subtype) |
| 215 | if subclass: |
| 216 | return subclass.unpack(reader) |
| 217 | |
| 218 | obj = bsn() |
| 219 | _type = reader.read("!H")[0] |
| 220 | assert(_type == 65535) |
| 221 | _len = reader.read("!H")[0] |
| 222 | orig_reader = reader |
| 223 | reader = orig_reader.slice(_len, 4) |
| 224 | _experimenter = reader.read("!L")[0] |
| 225 | assert(_experimenter == 6035143) |
| 226 | obj.subtype = reader.read("!L")[0] |
| 227 | reader.skip(4) |
| 228 | return obj |
| 229 | |
| 230 | def __eq__(self, other): |
| 231 | if type(self) != type(other): return False |
| 232 | if self.subtype != other.subtype: return False |
| 233 | return True |
| 234 | |
| 235 | def pretty_print(self, q): |
| 236 | q.text("bsn {") |
| 237 | with q.group(): |
| 238 | with q.indent(2): |
| 239 | q.breakable() |
| 240 | q.breakable() |
| 241 | q.text('}') |
| 242 | |
| 243 | experimenter.subtypes[6035143] = bsn |
| 244 | |
| 245 | class bsn_arp_offload(bsn): |
| 246 | type = 65535 |
| 247 | experimenter = 6035143 |
| 248 | subtype = 1 |
| 249 | |
| 250 | def __init__(self): |
| 251 | return |
| 252 | |
| 253 | def pack(self): |
| 254 | packed = [] |
| 255 | packed.append(struct.pack("!H", self.type)) |
| 256 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 257 | packed.append(struct.pack("!L", self.experimenter)) |
| 258 | packed.append(struct.pack("!L", self.subtype)) |
| 259 | packed.append('\x00' * 4) |
| 260 | length = sum([len(x) for x in packed]) |
| 261 | packed[1] = struct.pack("!H", length) |
| 262 | return ''.join(packed) |
| 263 | |
| 264 | @staticmethod |
| 265 | def unpack(reader): |
| 266 | obj = bsn_arp_offload() |
| 267 | _type = reader.read("!H")[0] |
| 268 | assert(_type == 65535) |
| 269 | _len = reader.read("!H")[0] |
| 270 | orig_reader = reader |
| 271 | reader = orig_reader.slice(_len, 4) |
| 272 | _experimenter = reader.read("!L")[0] |
| 273 | assert(_experimenter == 6035143) |
| 274 | _subtype = reader.read("!L")[0] |
| 275 | assert(_subtype == 1) |
| 276 | reader.skip(4) |
| 277 | return obj |
| 278 | |
| 279 | def __eq__(self, other): |
| 280 | if type(self) != type(other): return False |
| 281 | return True |
| 282 | |
| 283 | def pretty_print(self, q): |
| 284 | q.text("bsn_arp_offload {") |
| 285 | with q.group(): |
| 286 | with q.indent(2): |
| 287 | q.breakable() |
| 288 | q.breakable() |
| 289 | q.text('}') |
| 290 | |
| 291 | bsn.subtypes[1] = bsn_arp_offload |
| 292 | |
| 293 | class bsn_auto_negotiation(bsn): |
| 294 | type = 65535 |
| 295 | experimenter = 6035143 |
| 296 | subtype = 11 |
| 297 | |
| 298 | def __init__(self): |
| 299 | return |
| 300 | |
| 301 | def pack(self): |
| 302 | packed = [] |
| 303 | packed.append(struct.pack("!H", self.type)) |
| 304 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 305 | packed.append(struct.pack("!L", self.experimenter)) |
| 306 | packed.append(struct.pack("!L", self.subtype)) |
| 307 | packed.append('\x00' * 4) |
| 308 | length = sum([len(x) for x in packed]) |
| 309 | packed[1] = struct.pack("!H", length) |
| 310 | return ''.join(packed) |
| 311 | |
| 312 | @staticmethod |
| 313 | def unpack(reader): |
| 314 | obj = bsn_auto_negotiation() |
| 315 | _type = reader.read("!H")[0] |
| 316 | assert(_type == 65535) |
| 317 | _len = reader.read("!H")[0] |
| 318 | orig_reader = reader |
| 319 | reader = orig_reader.slice(_len, 4) |
| 320 | _experimenter = reader.read("!L")[0] |
| 321 | assert(_experimenter == 6035143) |
| 322 | _subtype = reader.read("!L")[0] |
| 323 | assert(_subtype == 11) |
| 324 | reader.skip(4) |
| 325 | return obj |
| 326 | |
| 327 | def __eq__(self, other): |
| 328 | if type(self) != type(other): return False |
| 329 | return True |
| 330 | |
| 331 | def pretty_print(self, q): |
| 332 | q.text("bsn_auto_negotiation {") |
| 333 | with q.group(): |
| 334 | with q.indent(2): |
| 335 | q.breakable() |
| 336 | q.breakable() |
| 337 | q.text('}') |
| 338 | |
| 339 | bsn.subtypes[11] = bsn_auto_negotiation |
| 340 | |
| 341 | class bsn_deny(bsn): |
| 342 | type = 65535 |
| 343 | experimenter = 6035143 |
| 344 | subtype = 5 |
| 345 | |
| 346 | def __init__(self): |
| 347 | return |
| 348 | |
| 349 | def pack(self): |
| 350 | packed = [] |
| 351 | packed.append(struct.pack("!H", self.type)) |
| 352 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 353 | packed.append(struct.pack("!L", self.experimenter)) |
| 354 | packed.append(struct.pack("!L", self.subtype)) |
| 355 | packed.append('\x00' * 4) |
| 356 | length = sum([len(x) for x in packed]) |
| 357 | packed[1] = struct.pack("!H", length) |
| 358 | return ''.join(packed) |
| 359 | |
| 360 | @staticmethod |
| 361 | def unpack(reader): |
| 362 | obj = bsn_deny() |
| 363 | _type = reader.read("!H")[0] |
| 364 | assert(_type == 65535) |
| 365 | _len = reader.read("!H")[0] |
| 366 | orig_reader = reader |
| 367 | reader = orig_reader.slice(_len, 4) |
| 368 | _experimenter = reader.read("!L")[0] |
| 369 | assert(_experimenter == 6035143) |
| 370 | _subtype = reader.read("!L")[0] |
| 371 | assert(_subtype == 5) |
| 372 | reader.skip(4) |
| 373 | return obj |
| 374 | |
| 375 | def __eq__(self, other): |
| 376 | if type(self) != type(other): return False |
| 377 | return True |
| 378 | |
| 379 | def pretty_print(self, q): |
| 380 | q.text("bsn_deny {") |
| 381 | with q.group(): |
| 382 | with q.indent(2): |
| 383 | q.breakable() |
| 384 | q.breakable() |
| 385 | q.text('}') |
| 386 | |
| 387 | bsn.subtypes[5] = bsn_deny |
| 388 | |
| 389 | class bsn_dhcp_offload(bsn): |
| 390 | type = 65535 |
| 391 | experimenter = 6035143 |
| 392 | subtype = 2 |
| 393 | |
| 394 | def __init__(self): |
| 395 | return |
| 396 | |
| 397 | def pack(self): |
| 398 | packed = [] |
| 399 | packed.append(struct.pack("!H", self.type)) |
| 400 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 401 | packed.append(struct.pack("!L", self.experimenter)) |
| 402 | packed.append(struct.pack("!L", self.subtype)) |
| 403 | packed.append('\x00' * 4) |
| 404 | length = sum([len(x) for x in packed]) |
| 405 | packed[1] = struct.pack("!H", length) |
| 406 | return ''.join(packed) |
| 407 | |
| 408 | @staticmethod |
| 409 | def unpack(reader): |
| 410 | obj = bsn_dhcp_offload() |
| 411 | _type = reader.read("!H")[0] |
| 412 | assert(_type == 65535) |
| 413 | _len = reader.read("!H")[0] |
| 414 | orig_reader = reader |
| 415 | reader = orig_reader.slice(_len, 4) |
| 416 | _experimenter = reader.read("!L")[0] |
| 417 | assert(_experimenter == 6035143) |
| 418 | _subtype = reader.read("!L")[0] |
| 419 | assert(_subtype == 2) |
| 420 | reader.skip(4) |
| 421 | return obj |
| 422 | |
| 423 | def __eq__(self, other): |
| 424 | if type(self) != type(other): return False |
| 425 | return True |
| 426 | |
| 427 | def pretty_print(self, q): |
| 428 | q.text("bsn_dhcp_offload {") |
| 429 | with q.group(): |
| 430 | with q.indent(2): |
| 431 | q.breakable() |
| 432 | q.breakable() |
| 433 | q.text('}') |
| 434 | |
| 435 | bsn.subtypes[2] = bsn_dhcp_offload |
| 436 | |
| 437 | class bsn_disable_l3(bsn): |
| 438 | type = 65535 |
| 439 | experimenter = 6035143 |
| 440 | subtype = 13 |
| 441 | |
| 442 | def __init__(self): |
| 443 | return |
| 444 | |
| 445 | def pack(self): |
| 446 | packed = [] |
| 447 | packed.append(struct.pack("!H", self.type)) |
| 448 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 449 | packed.append(struct.pack("!L", self.experimenter)) |
| 450 | packed.append(struct.pack("!L", self.subtype)) |
| 451 | packed.append('\x00' * 4) |
| 452 | length = sum([len(x) for x in packed]) |
| 453 | packed[1] = struct.pack("!H", length) |
| 454 | return ''.join(packed) |
| 455 | |
| 456 | @staticmethod |
| 457 | def unpack(reader): |
| 458 | obj = bsn_disable_l3() |
| 459 | _type = reader.read("!H")[0] |
| 460 | assert(_type == 65535) |
| 461 | _len = reader.read("!H")[0] |
| 462 | orig_reader = reader |
| 463 | reader = orig_reader.slice(_len, 4) |
| 464 | _experimenter = reader.read("!L")[0] |
| 465 | assert(_experimenter == 6035143) |
| 466 | _subtype = reader.read("!L")[0] |
| 467 | assert(_subtype == 13) |
| 468 | reader.skip(4) |
| 469 | return obj |
| 470 | |
| 471 | def __eq__(self, other): |
| 472 | if type(self) != type(other): return False |
| 473 | return True |
| 474 | |
| 475 | def pretty_print(self, q): |
| 476 | q.text("bsn_disable_l3 {") |
| 477 | with q.group(): |
| 478 | with q.indent(2): |
| 479 | q.breakable() |
| 480 | q.breakable() |
| 481 | q.text('}') |
| 482 | |
| 483 | bsn.subtypes[13] = bsn_disable_l3 |
| 484 | |
| 485 | class bsn_disable_src_mac_check(bsn): |
| 486 | type = 65535 |
| 487 | experimenter = 6035143 |
| 488 | subtype = 0 |
| 489 | |
| 490 | def __init__(self): |
| 491 | return |
| 492 | |
| 493 | def pack(self): |
| 494 | packed = [] |
| 495 | packed.append(struct.pack("!H", self.type)) |
| 496 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 497 | packed.append(struct.pack("!L", self.experimenter)) |
| 498 | packed.append(struct.pack("!L", self.subtype)) |
| 499 | packed.append('\x00' * 4) |
| 500 | length = sum([len(x) for x in packed]) |
| 501 | packed[1] = struct.pack("!H", length) |
| 502 | return ''.join(packed) |
| 503 | |
| 504 | @staticmethod |
| 505 | def unpack(reader): |
| 506 | obj = bsn_disable_src_mac_check() |
| 507 | _type = reader.read("!H")[0] |
| 508 | assert(_type == 65535) |
| 509 | _len = reader.read("!H")[0] |
| 510 | orig_reader = reader |
| 511 | reader = orig_reader.slice(_len, 4) |
| 512 | _experimenter = reader.read("!L")[0] |
| 513 | assert(_experimenter == 6035143) |
| 514 | _subtype = reader.read("!L")[0] |
| 515 | assert(_subtype == 0) |
| 516 | reader.skip(4) |
| 517 | return obj |
| 518 | |
| 519 | def __eq__(self, other): |
| 520 | if type(self) != type(other): return False |
| 521 | return True |
| 522 | |
| 523 | def pretty_print(self, q): |
| 524 | q.text("bsn_disable_src_mac_check {") |
| 525 | with q.group(): |
| 526 | with q.indent(2): |
| 527 | q.breakable() |
| 528 | q.breakable() |
| 529 | q.text('}') |
| 530 | |
| 531 | bsn.subtypes[0] = bsn_disable_src_mac_check |
| 532 | |
| 533 | class bsn_disable_vlan_counters(bsn): |
| 534 | type = 65535 |
| 535 | experimenter = 6035143 |
| 536 | subtype = 9 |
| 537 | |
| 538 | def __init__(self): |
| 539 | return |
| 540 | |
| 541 | def pack(self): |
| 542 | packed = [] |
| 543 | packed.append(struct.pack("!H", self.type)) |
| 544 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 545 | packed.append(struct.pack("!L", self.experimenter)) |
| 546 | packed.append(struct.pack("!L", self.subtype)) |
| 547 | packed.append('\x00' * 4) |
| 548 | length = sum([len(x) for x in packed]) |
| 549 | packed[1] = struct.pack("!H", length) |
| 550 | return ''.join(packed) |
| 551 | |
| 552 | @staticmethod |
| 553 | def unpack(reader): |
| 554 | obj = bsn_disable_vlan_counters() |
| 555 | _type = reader.read("!H")[0] |
| 556 | assert(_type == 65535) |
| 557 | _len = reader.read("!H")[0] |
| 558 | orig_reader = reader |
| 559 | reader = orig_reader.slice(_len, 4) |
| 560 | _experimenter = reader.read("!L")[0] |
| 561 | assert(_experimenter == 6035143) |
| 562 | _subtype = reader.read("!L")[0] |
| 563 | assert(_subtype == 9) |
| 564 | reader.skip(4) |
| 565 | return obj |
| 566 | |
| 567 | def __eq__(self, other): |
| 568 | if type(self) != type(other): return False |
| 569 | return True |
| 570 | |
| 571 | def pretty_print(self, q): |
| 572 | q.text("bsn_disable_vlan_counters {") |
| 573 | with q.group(): |
| 574 | with q.indent(2): |
| 575 | q.breakable() |
| 576 | q.breakable() |
| 577 | q.text('}') |
| 578 | |
| 579 | bsn.subtypes[9] = bsn_disable_vlan_counters |
| 580 | |
| 581 | class bsn_internal_priority(bsn): |
| 582 | type = 65535 |
| 583 | experimenter = 6035143 |
| 584 | subtype = 12 |
| 585 | |
| 586 | def __init__(self, value=None): |
| 587 | if value != None: |
| 588 | self.value = value |
| 589 | else: |
| 590 | self.value = 0 |
| 591 | return |
| 592 | |
| 593 | def pack(self): |
| 594 | packed = [] |
| 595 | packed.append(struct.pack("!H", self.type)) |
| 596 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 597 | packed.append(struct.pack("!L", self.experimenter)) |
| 598 | packed.append(struct.pack("!L", self.subtype)) |
| 599 | packed.append(struct.pack("!L", self.value)) |
| 600 | length = sum([len(x) for x in packed]) |
| 601 | packed[1] = struct.pack("!H", length) |
| 602 | return ''.join(packed) |
| 603 | |
| 604 | @staticmethod |
| 605 | def unpack(reader): |
| 606 | obj = bsn_internal_priority() |
| 607 | _type = reader.read("!H")[0] |
| 608 | assert(_type == 65535) |
| 609 | _len = reader.read("!H")[0] |
| 610 | orig_reader = reader |
| 611 | reader = orig_reader.slice(_len, 4) |
| 612 | _experimenter = reader.read("!L")[0] |
| 613 | assert(_experimenter == 6035143) |
| 614 | _subtype = reader.read("!L")[0] |
| 615 | assert(_subtype == 12) |
| 616 | obj.value = reader.read("!L")[0] |
| 617 | return obj |
| 618 | |
| 619 | def __eq__(self, other): |
| 620 | if type(self) != type(other): return False |
| 621 | if self.value != other.value: return False |
| 622 | return True |
| 623 | |
| 624 | def pretty_print(self, q): |
| 625 | q.text("bsn_internal_priority {") |
| 626 | with q.group(): |
| 627 | with q.indent(2): |
| 628 | q.breakable() |
| 629 | q.text("value = "); |
| 630 | q.text("%#x" % self.value) |
| 631 | q.breakable() |
| 632 | q.text('}') |
| 633 | |
| 634 | bsn.subtypes[12] = bsn_internal_priority |
| 635 | |
| 636 | class bsn_packet_of_death(bsn): |
| 637 | type = 65535 |
| 638 | experimenter = 6035143 |
| 639 | subtype = 6 |
| 640 | |
| 641 | def __init__(self): |
| 642 | return |
| 643 | |
| 644 | def pack(self): |
| 645 | packed = [] |
| 646 | packed.append(struct.pack("!H", self.type)) |
| 647 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 648 | packed.append(struct.pack("!L", self.experimenter)) |
| 649 | packed.append(struct.pack("!L", self.subtype)) |
| 650 | packed.append('\x00' * 4) |
| 651 | length = sum([len(x) for x in packed]) |
| 652 | packed[1] = struct.pack("!H", length) |
| 653 | return ''.join(packed) |
| 654 | |
| 655 | @staticmethod |
| 656 | def unpack(reader): |
| 657 | obj = bsn_packet_of_death() |
| 658 | _type = reader.read("!H")[0] |
| 659 | assert(_type == 65535) |
| 660 | _len = reader.read("!H")[0] |
| 661 | orig_reader = reader |
| 662 | reader = orig_reader.slice(_len, 4) |
| 663 | _experimenter = reader.read("!L")[0] |
| 664 | assert(_experimenter == 6035143) |
| 665 | _subtype = reader.read("!L")[0] |
| 666 | assert(_subtype == 6) |
| 667 | reader.skip(4) |
| 668 | return obj |
| 669 | |
| 670 | def __eq__(self, other): |
| 671 | if type(self) != type(other): return False |
| 672 | return True |
| 673 | |
| 674 | def pretty_print(self, q): |
| 675 | q.text("bsn_packet_of_death {") |
| 676 | with q.group(): |
| 677 | with q.indent(2): |
| 678 | q.breakable() |
| 679 | q.breakable() |
| 680 | q.text('}') |
| 681 | |
| 682 | bsn.subtypes[6] = bsn_packet_of_death |
| 683 | |
| 684 | class bsn_permit(bsn): |
| 685 | type = 65535 |
| 686 | experimenter = 6035143 |
| 687 | subtype = 4 |
| 688 | |
| 689 | def __init__(self): |
| 690 | return |
| 691 | |
| 692 | def pack(self): |
| 693 | packed = [] |
| 694 | packed.append(struct.pack("!H", self.type)) |
| 695 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 696 | packed.append(struct.pack("!L", self.experimenter)) |
| 697 | packed.append(struct.pack("!L", self.subtype)) |
| 698 | packed.append('\x00' * 4) |
| 699 | length = sum([len(x) for x in packed]) |
| 700 | packed[1] = struct.pack("!H", length) |
| 701 | return ''.join(packed) |
| 702 | |
| 703 | @staticmethod |
| 704 | def unpack(reader): |
| 705 | obj = bsn_permit() |
| 706 | _type = reader.read("!H")[0] |
| 707 | assert(_type == 65535) |
| 708 | _len = reader.read("!H")[0] |
| 709 | orig_reader = reader |
| 710 | reader = orig_reader.slice(_len, 4) |
| 711 | _experimenter = reader.read("!L")[0] |
| 712 | assert(_experimenter == 6035143) |
| 713 | _subtype = reader.read("!L")[0] |
| 714 | assert(_subtype == 4) |
| 715 | reader.skip(4) |
| 716 | return obj |
| 717 | |
| 718 | def __eq__(self, other): |
| 719 | if type(self) != type(other): return False |
| 720 | return True |
| 721 | |
| 722 | def pretty_print(self, q): |
| 723 | q.text("bsn_permit {") |
| 724 | with q.group(): |
| 725 | with q.indent(2): |
| 726 | q.breakable() |
| 727 | q.breakable() |
| 728 | q.text('}') |
| 729 | |
| 730 | bsn.subtypes[4] = bsn_permit |
| 731 | |
| 732 | class bsn_prioritize_pdus(bsn): |
| 733 | type = 65535 |
| 734 | experimenter = 6035143 |
| 735 | subtype = 7 |
| 736 | |
| 737 | def __init__(self): |
| 738 | return |
| 739 | |
| 740 | def pack(self): |
| 741 | packed = [] |
| 742 | packed.append(struct.pack("!H", self.type)) |
| 743 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 744 | packed.append(struct.pack("!L", self.experimenter)) |
| 745 | packed.append(struct.pack("!L", self.subtype)) |
| 746 | packed.append('\x00' * 4) |
| 747 | length = sum([len(x) for x in packed]) |
| 748 | packed[1] = struct.pack("!H", length) |
| 749 | return ''.join(packed) |
| 750 | |
| 751 | @staticmethod |
| 752 | def unpack(reader): |
| 753 | obj = bsn_prioritize_pdus() |
| 754 | _type = reader.read("!H")[0] |
| 755 | assert(_type == 65535) |
| 756 | _len = reader.read("!H")[0] |
| 757 | orig_reader = reader |
| 758 | reader = orig_reader.slice(_len, 4) |
| 759 | _experimenter = reader.read("!L")[0] |
| 760 | assert(_experimenter == 6035143) |
| 761 | _subtype = reader.read("!L")[0] |
| 762 | assert(_subtype == 7) |
| 763 | reader.skip(4) |
| 764 | return obj |
| 765 | |
| 766 | def __eq__(self, other): |
| 767 | if type(self) != type(other): return False |
| 768 | return True |
| 769 | |
| 770 | def pretty_print(self, q): |
| 771 | q.text("bsn_prioritize_pdus {") |
| 772 | with q.group(): |
| 773 | with q.indent(2): |
| 774 | q.breakable() |
| 775 | q.breakable() |
| 776 | q.text('}') |
| 777 | |
| 778 | bsn.subtypes[7] = bsn_prioritize_pdus |
| 779 | |
| 780 | class bsn_require_vlan_xlate(bsn): |
| 781 | type = 65535 |
| 782 | experimenter = 6035143 |
| 783 | subtype = 8 |
| 784 | |
| 785 | def __init__(self): |
| 786 | return |
| 787 | |
| 788 | def pack(self): |
| 789 | packed = [] |
| 790 | packed.append(struct.pack("!H", self.type)) |
| 791 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 792 | packed.append(struct.pack("!L", self.experimenter)) |
| 793 | packed.append(struct.pack("!L", self.subtype)) |
| 794 | packed.append('\x00' * 4) |
| 795 | length = sum([len(x) for x in packed]) |
| 796 | packed[1] = struct.pack("!H", length) |
| 797 | return ''.join(packed) |
| 798 | |
| 799 | @staticmethod |
| 800 | def unpack(reader): |
| 801 | obj = bsn_require_vlan_xlate() |
| 802 | _type = reader.read("!H")[0] |
| 803 | assert(_type == 65535) |
| 804 | _len = reader.read("!H")[0] |
| 805 | orig_reader = reader |
| 806 | reader = orig_reader.slice(_len, 4) |
| 807 | _experimenter = reader.read("!L")[0] |
| 808 | assert(_experimenter == 6035143) |
| 809 | _subtype = reader.read("!L")[0] |
| 810 | assert(_subtype == 8) |
| 811 | reader.skip(4) |
| 812 | return obj |
| 813 | |
| 814 | def __eq__(self, other): |
| 815 | if type(self) != type(other): return False |
| 816 | return True |
| 817 | |
| 818 | def pretty_print(self, q): |
| 819 | q.text("bsn_require_vlan_xlate {") |
| 820 | with q.group(): |
| 821 | with q.indent(2): |
| 822 | q.breakable() |
| 823 | q.breakable() |
| 824 | q.text('}') |
| 825 | |
| 826 | bsn.subtypes[8] = bsn_require_vlan_xlate |
| 827 | |
| 828 | class bsn_span_destination(bsn): |
| 829 | type = 65535 |
| 830 | experimenter = 6035143 |
| 831 | subtype = 10 |
| 832 | |
| 833 | def __init__(self): |
| 834 | return |
| 835 | |
| 836 | def pack(self): |
| 837 | packed = [] |
| 838 | packed.append(struct.pack("!H", self.type)) |
| 839 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 840 | packed.append(struct.pack("!L", self.experimenter)) |
| 841 | packed.append(struct.pack("!L", self.subtype)) |
| 842 | packed.append('\x00' * 4) |
| 843 | length = sum([len(x) for x in packed]) |
| 844 | packed[1] = struct.pack("!H", length) |
| 845 | return ''.join(packed) |
| 846 | |
| 847 | @staticmethod |
| 848 | def unpack(reader): |
| 849 | obj = bsn_span_destination() |
| 850 | _type = reader.read("!H")[0] |
| 851 | assert(_type == 65535) |
| 852 | _len = reader.read("!H")[0] |
| 853 | orig_reader = reader |
| 854 | reader = orig_reader.slice(_len, 4) |
| 855 | _experimenter = reader.read("!L")[0] |
| 856 | assert(_experimenter == 6035143) |
| 857 | _subtype = reader.read("!L")[0] |
| 858 | assert(_subtype == 10) |
| 859 | reader.skip(4) |
| 860 | return obj |
| 861 | |
| 862 | def __eq__(self, other): |
| 863 | if type(self) != type(other): return False |
| 864 | return True |
| 865 | |
| 866 | def pretty_print(self, q): |
| 867 | q.text("bsn_span_destination {") |
| 868 | with q.group(): |
| 869 | with q.indent(2): |
| 870 | q.breakable() |
| 871 | q.breakable() |
| 872 | q.text('}') |
| 873 | |
| 874 | bsn.subtypes[10] = bsn_span_destination |
| 875 | |
| 876 | class clear_actions(instruction): |
| 877 | type = 5 |
| 878 | |
| 879 | def __init__(self): |
| 880 | return |
| 881 | |
| 882 | def pack(self): |
| 883 | packed = [] |
| 884 | packed.append(struct.pack("!H", self.type)) |
| 885 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 886 | packed.append('\x00' * 4) |
| 887 | length = sum([len(x) for x in packed]) |
| 888 | packed[1] = struct.pack("!H", length) |
| 889 | return ''.join(packed) |
| 890 | |
| 891 | @staticmethod |
| 892 | def unpack(reader): |
| 893 | obj = clear_actions() |
| 894 | _type = reader.read("!H")[0] |
| 895 | assert(_type == 5) |
| 896 | _len = reader.read("!H")[0] |
| 897 | orig_reader = reader |
| 898 | reader = orig_reader.slice(_len, 4) |
| 899 | reader.skip(4) |
| 900 | return obj |
| 901 | |
| 902 | def __eq__(self, other): |
| 903 | if type(self) != type(other): return False |
| 904 | return True |
| 905 | |
| 906 | def pretty_print(self, q): |
| 907 | q.text("clear_actions {") |
| 908 | with q.group(): |
| 909 | with q.indent(2): |
| 910 | q.breakable() |
| 911 | q.breakable() |
| 912 | q.text('}') |
| 913 | |
| 914 | instruction.subtypes[5] = clear_actions |
| 915 | |
| 916 | class goto_table(instruction): |
| 917 | type = 1 |
| 918 | |
| 919 | def __init__(self, table_id=None): |
| 920 | if table_id != None: |
| 921 | self.table_id = table_id |
| 922 | else: |
| 923 | self.table_id = 0 |
| 924 | return |
| 925 | |
| 926 | def pack(self): |
| 927 | packed = [] |
| 928 | packed.append(struct.pack("!H", self.type)) |
| 929 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 930 | packed.append(struct.pack("!B", self.table_id)) |
| 931 | packed.append('\x00' * 3) |
| 932 | length = sum([len(x) for x in packed]) |
| 933 | packed[1] = struct.pack("!H", length) |
| 934 | return ''.join(packed) |
| 935 | |
| 936 | @staticmethod |
| 937 | def unpack(reader): |
| 938 | obj = goto_table() |
| 939 | _type = reader.read("!H")[0] |
| 940 | assert(_type == 1) |
| 941 | _len = reader.read("!H")[0] |
| 942 | orig_reader = reader |
| 943 | reader = orig_reader.slice(_len, 4) |
| 944 | obj.table_id = reader.read("!B")[0] |
| 945 | reader.skip(3) |
| 946 | return obj |
| 947 | |
| 948 | def __eq__(self, other): |
| 949 | if type(self) != type(other): return False |
| 950 | if self.table_id != other.table_id: return False |
| 951 | return True |
| 952 | |
| 953 | def pretty_print(self, q): |
| 954 | q.text("goto_table {") |
| 955 | with q.group(): |
| 956 | with q.indent(2): |
| 957 | q.breakable() |
| 958 | q.text("table_id = "); |
| 959 | q.text("%#x" % self.table_id) |
| 960 | q.breakable() |
| 961 | q.text('}') |
| 962 | |
| 963 | instruction.subtypes[1] = goto_table |
| 964 | |
| 965 | class meter(instruction): |
| 966 | type = 6 |
| 967 | |
| 968 | def __init__(self, meter_id=None): |
| 969 | if meter_id != None: |
| 970 | self.meter_id = meter_id |
| 971 | else: |
| 972 | self.meter_id = 0 |
| 973 | return |
| 974 | |
| 975 | def pack(self): |
| 976 | packed = [] |
| 977 | packed.append(struct.pack("!H", self.type)) |
| 978 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 979 | packed.append(struct.pack("!L", self.meter_id)) |
| 980 | length = sum([len(x) for x in packed]) |
| 981 | packed[1] = struct.pack("!H", length) |
| 982 | return ''.join(packed) |
| 983 | |
| 984 | @staticmethod |
| 985 | def unpack(reader): |
| 986 | obj = meter() |
| 987 | _type = reader.read("!H")[0] |
| 988 | assert(_type == 6) |
| 989 | _len = reader.read("!H")[0] |
| 990 | orig_reader = reader |
| 991 | reader = orig_reader.slice(_len, 4) |
| 992 | obj.meter_id = reader.read("!L")[0] |
| 993 | return obj |
| 994 | |
| 995 | def __eq__(self, other): |
| 996 | if type(self) != type(other): return False |
| 997 | if self.meter_id != other.meter_id: return False |
| 998 | return True |
| 999 | |
| 1000 | def pretty_print(self, q): |
| 1001 | q.text("meter {") |
| 1002 | with q.group(): |
| 1003 | with q.indent(2): |
| 1004 | q.breakable() |
| 1005 | q.text("meter_id = "); |
| 1006 | q.text("%#x" % self.meter_id) |
| 1007 | q.breakable() |
| 1008 | q.text('}') |
| 1009 | |
| 1010 | instruction.subtypes[6] = meter |
| 1011 | |
| 1012 | class write_actions(instruction): |
| 1013 | type = 3 |
| 1014 | |
| 1015 | def __init__(self, actions=None): |
| 1016 | if actions != None: |
| 1017 | self.actions = actions |
| 1018 | else: |
| 1019 | self.actions = [] |
| 1020 | return |
| 1021 | |
| 1022 | def pack(self): |
| 1023 | packed = [] |
| 1024 | packed.append(struct.pack("!H", self.type)) |
| 1025 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 1026 | packed.append('\x00' * 4) |
| 1027 | packed.append(loxi.generic_util.pack_list(self.actions)) |
| 1028 | length = sum([len(x) for x in packed]) |
| 1029 | packed[1] = struct.pack("!H", length) |
| 1030 | return ''.join(packed) |
| 1031 | |
| 1032 | @staticmethod |
| 1033 | def unpack(reader): |
| 1034 | obj = write_actions() |
| 1035 | _type = reader.read("!H")[0] |
| 1036 | assert(_type == 3) |
| 1037 | _len = reader.read("!H")[0] |
| 1038 | orig_reader = reader |
| 1039 | reader = orig_reader.slice(_len, 4) |
| 1040 | reader.skip(4) |
| 1041 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
| 1042 | return obj |
| 1043 | |
| 1044 | def __eq__(self, other): |
| 1045 | if type(self) != type(other): return False |
| 1046 | if self.actions != other.actions: return False |
| 1047 | return True |
| 1048 | |
| 1049 | def pretty_print(self, q): |
| 1050 | q.text("write_actions {") |
| 1051 | with q.group(): |
| 1052 | with q.indent(2): |
| 1053 | q.breakable() |
| 1054 | q.text("actions = "); |
| 1055 | q.pp(self.actions) |
| 1056 | q.breakable() |
| 1057 | q.text('}') |
| 1058 | |
| 1059 | instruction.subtypes[3] = write_actions |
| 1060 | |
| 1061 | class write_metadata(instruction): |
| 1062 | type = 2 |
| 1063 | |
| 1064 | def __init__(self, metadata=None, metadata_mask=None): |
| 1065 | if metadata != None: |
| 1066 | self.metadata = metadata |
| 1067 | else: |
| 1068 | self.metadata = 0 |
| 1069 | if metadata_mask != None: |
| 1070 | self.metadata_mask = metadata_mask |
| 1071 | else: |
| 1072 | self.metadata_mask = 0 |
| 1073 | return |
| 1074 | |
| 1075 | def pack(self): |
| 1076 | packed = [] |
| 1077 | packed.append(struct.pack("!H", self.type)) |
| 1078 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 1079 | packed.append('\x00' * 4) |
| 1080 | packed.append(struct.pack("!Q", self.metadata)) |
| 1081 | packed.append(struct.pack("!Q", self.metadata_mask)) |
| 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 = write_metadata() |
| 1089 | _type = reader.read("!H")[0] |
| 1090 | assert(_type == 2) |
| 1091 | _len = reader.read("!H")[0] |
| 1092 | orig_reader = reader |
| 1093 | reader = orig_reader.slice(_len, 4) |
| 1094 | reader.skip(4) |
| 1095 | obj.metadata = reader.read("!Q")[0] |
| 1096 | obj.metadata_mask = reader.read("!Q")[0] |
| 1097 | return obj |
| 1098 | |
| 1099 | def __eq__(self, other): |
| 1100 | if type(self) != type(other): return False |
| 1101 | if self.metadata != other.metadata: return False |
| 1102 | if self.metadata_mask != other.metadata_mask: return False |
| 1103 | return True |
| 1104 | |
| 1105 | def pretty_print(self, q): |
| 1106 | q.text("write_metadata {") |
| 1107 | with q.group(): |
| 1108 | with q.indent(2): |
| 1109 | q.breakable() |
| 1110 | q.text("metadata = "); |
| 1111 | q.text("%#x" % self.metadata) |
| 1112 | q.text(","); q.breakable() |
| 1113 | q.text("metadata_mask = "); |
| 1114 | q.text("%#x" % self.metadata_mask) |
| 1115 | q.breakable() |
| 1116 | q.text('}') |
| 1117 | |
| 1118 | instruction.subtypes[2] = write_metadata |
| 1119 | |
| 1120 | |