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