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