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