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