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