blob: 5b34f1a9911df8fb0222401b1fed6360b68ef4f5 [file] [log] [blame]
Rich Lane7dcdf022013-12-11 14:45:27 -08001# 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
9import struct
10import loxi
Rich Lane7dcdf022013-12-11 14:45:27 -080011import util
12import loxi.generic_util
13
Rich Lanee2567702015-01-26 15:04:35 -080014import sys
15ofp = sys.modules['loxi.of13']
16
Rich Lane7dcdf022013-12-11 14:45:27 -080017class instruction_id(loxi.OFObject):
18 subtypes = {}
19
Rich Lane95f7fc92014-01-27 17:08:16 -080020
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 Lane7dcdf022013-12-11 14:45:27 -080036 @staticmethod
37 def unpack(reader):
38 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080039 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 Lanecb18dbd2014-12-18 10:02:29 -080047 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080048 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 Lane7dcdf022013-12-11 14:45:27 -080062
63
64class 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 Lane7dcdf022013-12-11 14:45:27 -080074 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 Lanecb18dbd2014-12-18 10:02:29 -080085 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -080086 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
100instruction_id.subtypes[4] = apply_actions
101
102class experimenter(instruction_id):
103 subtypes = {}
104
Rich Lane95f7fc92014-01-27 17:08:16 -0800105 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 Lane7dcdf022013-12-11 14:45:27 -0800123 @staticmethod
124 def unpack(reader):
125 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800126 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 Lanecb18dbd2014-12-18 10:02:29 -0800135 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800136 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 Lane7dcdf022013-12-11 14:45:27 -0800151
152instruction_id.subtypes[65535] = experimenter
153
154class bsn(experimenter):
155 subtypes = {}
156
Rich Lane95f7fc92014-01-27 17:08:16 -0800157 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 Lane95f7fc92014-01-27 17:08:16 -0800173 length = sum([len(x) for x in packed])
174 packed[1] = struct.pack("!H", length)
175 return ''.join(packed)
176
Rich Lane7dcdf022013-12-11 14:45:27 -0800177 @staticmethod
178 def unpack(reader):
179 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800180 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 Lanecb18dbd2014-12-18 10:02:29 -0800189 reader = orig_reader.slice(_len, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800190 _experimenter = reader.read("!L")[0]
191 assert(_experimenter == 6035143)
192 obj.subtype = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800193 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 Lane7dcdf022013-12-11 14:45:27 -0800207
208experimenter.subtypes[6035143] = bsn
209
Rich Lane5454b682014-01-14 17:07:36 -0800210class 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 Lane5454b682014-01-14 17:07:36 -0800224 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 Lanecb18dbd2014-12-18 10:02:29 -0800235 reader = orig_reader.slice(_len, 4)
Rich Lane5454b682014-01-14 17:07:36 -0800236 _experimenter = reader.read("!L")[0]
237 assert(_experimenter == 6035143)
238 _subtype = reader.read("!L")[0]
239 assert(_subtype == 1)
Rich Lane5454b682014-01-14 17:07:36 -0800240 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
254bsn.subtypes[1] = bsn_arp_offload
255
Harshmeet Singh301f7172014-12-08 13:07:29 -0800256class 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 Lanecb18dbd2014-12-18 10:02:29 -0800281 reader = orig_reader.slice(_len, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -0800282 _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
300bsn.subtypes[11] = bsn_auto_negotiation
301
Rich Lane9ec3fca2014-02-26 16:22:56 -0800302class 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 Lanecb18dbd2014-12-18 10:02:29 -0800327 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800328 _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
346bsn.subtypes[5] = bsn_deny
347
Rich Lane1b75abf2014-02-05 11:23:20 -0800348class 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 Lane1b75abf2014-02-05 11:23:20 -0800362 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 Lanecb18dbd2014-12-18 10:02:29 -0800373 reader = orig_reader.slice(_len, 4)
Rich Lane1b75abf2014-02-05 11:23:20 -0800374 _experimenter = reader.read("!L")[0]
375 assert(_experimenter == 6035143)
376 _subtype = reader.read("!L")[0]
377 assert(_subtype == 2)
Rich Lane1b75abf2014-02-05 11:23:20 -0800378 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
392bsn.subtypes[2] = bsn_dhcp_offload
393
Kiran Poola36a302c2015-04-22 11:20:16 -0700394class bsn_disable_l3(bsn):
395 type = 65535
396 experimenter = 6035143
397 subtype = 13
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_l3()
415 _type = reader.read("!H")[0]
416 assert(_type == 65535)
417 _len = reader.read("!H")[0]
418 orig_reader = reader
419 reader = orig_reader.slice(_len, 4)
420 _experimenter = reader.read("!L")[0]
421 assert(_experimenter == 6035143)
422 _subtype = reader.read("!L")[0]
423 assert(_subtype == 13)
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_l3 {")
432 with q.group():
433 with q.indent(2):
434 q.breakable()
435 q.breakable()
436 q.text('}')
437
438bsn.subtypes[13] = bsn_disable_l3
439
Rich Lane9ec3fca2014-02-26 16:22:56 -0800440class bsn_disable_split_horizon_check(bsn):
441 type = 65535
442 experimenter = 6035143
443 subtype = 3
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))
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_split_horizon_check()
461 _type = reader.read("!H")[0]
462 assert(_type == 65535)
463 _len = reader.read("!H")[0]
464 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800465 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800466 _experimenter = reader.read("!L")[0]
467 assert(_experimenter == 6035143)
468 _subtype = reader.read("!L")[0]
469 assert(_subtype == 3)
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_split_horizon_check {")
478 with q.group():
479 with q.indent(2):
480 q.breakable()
481 q.breakable()
482 q.text('}')
483
484bsn.subtypes[3] = bsn_disable_split_horizon_check
485
Rich Lane7dcdf022013-12-11 14:45:27 -0800486class bsn_disable_src_mac_check(bsn):
487 type = 65535
488 experimenter = 6035143
489 subtype = 0
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))
Rich Lane7dcdf022013-12-11 14:45:27 -0800500 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_src_mac_check()
507 _type = reader.read("!H")[0]
508 assert(_type == 65535)
509 _len = reader.read("!H")[0]
510 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800511 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800512 _experimenter = reader.read("!L")[0]
513 assert(_experimenter == 6035143)
514 _subtype = reader.read("!L")[0]
515 assert(_subtype == 0)
Rich Lane7dcdf022013-12-11 14:45:27 -0800516 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_src_mac_check {")
524 with q.group():
525 with q.indent(2):
526 q.breakable()
527 q.breakable()
528 q.text('}')
529
530bsn.subtypes[0] = bsn_disable_src_mac_check
531
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700532class bsn_disable_vlan_counters(bsn):
533 type = 65535
534 experimenter = 6035143
535 subtype = 9
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_disable_vlan_counters()
553 _type = reader.read("!H")[0]
554 assert(_type == 65535)
555 _len = reader.read("!H")[0]
556 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800557 reader = orig_reader.slice(_len, 4)
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700558 _experimenter = reader.read("!L")[0]
559 assert(_experimenter == 6035143)
560 _subtype = reader.read("!L")[0]
561 assert(_subtype == 9)
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_disable_vlan_counters {")
570 with q.group():
571 with q.indent(2):
572 q.breakable()
573 q.breakable()
574 q.text('}')
575
576bsn.subtypes[9] = bsn_disable_vlan_counters
577
Rich Lane7b69e792015-03-31 11:12:50 -0700578class bsn_internal_priority(bsn):
579 type = 65535
580 experimenter = 6035143
581 subtype = 12
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_internal_priority()
599 _type = reader.read("!H")[0]
600 assert(_type == 65535)
601 _len = reader.read("!H")[0]
602 orig_reader = reader
603 reader = orig_reader.slice(_len, 4)
604 _experimenter = reader.read("!L")[0]
605 assert(_experimenter == 6035143)
606 _subtype = reader.read("!L")[0]
607 assert(_subtype == 12)
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_internal_priority {")
616 with q.group():
617 with q.indent(2):
618 q.breakable()
619 q.breakable()
620 q.text('}')
621
622bsn.subtypes[12] = bsn_internal_priority
623
Rich Lanef50b7c32014-03-20 11:38:02 -0700624class bsn_packet_of_death(bsn):
625 type = 65535
626 experimenter = 6035143
627 subtype = 6
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_packet_of_death()
645 _type = reader.read("!H")[0]
646 assert(_type == 65535)
647 _len = reader.read("!H")[0]
648 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800649 reader = orig_reader.slice(_len, 4)
Rich Lanef50b7c32014-03-20 11:38:02 -0700650 _experimenter = reader.read("!L")[0]
651 assert(_experimenter == 6035143)
652 _subtype = reader.read("!L")[0]
653 assert(_subtype == 6)
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_packet_of_death {")
662 with q.group():
663 with q.indent(2):
664 q.breakable()
665 q.breakable()
666 q.text('}')
667
668bsn.subtypes[6] = bsn_packet_of_death
669
Rich Lane9ec3fca2014-02-26 16:22:56 -0800670class bsn_permit(bsn):
671 type = 65535
672 experimenter = 6035143
673 subtype = 4
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_permit()
691 _type = reader.read("!H")[0]
692 assert(_type == 65535)
693 _len = reader.read("!H")[0]
694 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800695 reader = orig_reader.slice(_len, 4)
Rich Lane9ec3fca2014-02-26 16:22:56 -0800696 _experimenter = reader.read("!L")[0]
697 assert(_experimenter == 6035143)
698 _subtype = reader.read("!L")[0]
699 assert(_subtype == 4)
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_permit {")
708 with q.group():
709 with q.indent(2):
710 q.breakable()
711 q.breakable()
712 q.text('}')
713
714bsn.subtypes[4] = bsn_permit
715
Rich Lane78d9bcb2014-05-12 13:27:44 -0700716class bsn_prioritize_pdus(bsn):
717 type = 65535
718 experimenter = 6035143
719 subtype = 7
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_prioritize_pdus()
737 _type = reader.read("!H")[0]
738 assert(_type == 65535)
739 _len = reader.read("!H")[0]
740 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800741 reader = orig_reader.slice(_len, 4)
Rich Lane78d9bcb2014-05-12 13:27:44 -0700742 _experimenter = reader.read("!L")[0]
743 assert(_experimenter == 6035143)
744 _subtype = reader.read("!L")[0]
745 assert(_subtype == 7)
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_prioritize_pdus {")
754 with q.group():
755 with q.indent(2):
756 q.breakable()
757 q.breakable()
758 q.text('}')
759
760bsn.subtypes[7] = bsn_prioritize_pdus
761
Rich Lane5587ab12014-06-30 11:19:09 -0700762class bsn_require_vlan_xlate(bsn):
763 type = 65535
764 experimenter = 6035143
765 subtype = 8
766
767 def __init__(self):
768 return
769
770 def pack(self):
771 packed = []
772 packed.append(struct.pack("!H", self.type))
773 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
774 packed.append(struct.pack("!L", self.experimenter))
775 packed.append(struct.pack("!L", self.subtype))
776 length = sum([len(x) for x in packed])
777 packed[1] = struct.pack("!H", length)
778 return ''.join(packed)
779
780 @staticmethod
781 def unpack(reader):
782 obj = bsn_require_vlan_xlate()
783 _type = reader.read("!H")[0]
784 assert(_type == 65535)
785 _len = reader.read("!H")[0]
786 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800787 reader = orig_reader.slice(_len, 4)
Rich Lane5587ab12014-06-30 11:19:09 -0700788 _experimenter = reader.read("!L")[0]
789 assert(_experimenter == 6035143)
790 _subtype = reader.read("!L")[0]
791 assert(_subtype == 8)
792 return obj
793
794 def __eq__(self, other):
795 if type(self) != type(other): return False
796 return True
797
798 def pretty_print(self, q):
799 q.text("bsn_require_vlan_xlate {")
800 with q.group():
801 with q.indent(2):
802 q.breakable()
803 q.breakable()
804 q.text('}')
805
806bsn.subtypes[8] = bsn_require_vlan_xlate
807
Rich Lanef9530c42014-09-15 09:59:43 -0700808class bsn_span_destination(bsn):
809 type = 65535
810 experimenter = 6035143
811 subtype = 10
812
813 def __init__(self):
814 return
815
816 def pack(self):
817 packed = []
818 packed.append(struct.pack("!H", self.type))
819 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
820 packed.append(struct.pack("!L", self.experimenter))
821 packed.append(struct.pack("!L", self.subtype))
822 length = sum([len(x) for x in packed])
823 packed[1] = struct.pack("!H", length)
824 return ''.join(packed)
825
826 @staticmethod
827 def unpack(reader):
828 obj = bsn_span_destination()
829 _type = reader.read("!H")[0]
830 assert(_type == 65535)
831 _len = reader.read("!H")[0]
832 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800833 reader = orig_reader.slice(_len, 4)
Rich Lanef9530c42014-09-15 09:59:43 -0700834 _experimenter = reader.read("!L")[0]
835 assert(_experimenter == 6035143)
836 _subtype = reader.read("!L")[0]
837 assert(_subtype == 10)
838 return obj
839
840 def __eq__(self, other):
841 if type(self) != type(other): return False
842 return True
843
844 def pretty_print(self, q):
845 q.text("bsn_span_destination {")
846 with q.group():
847 with q.indent(2):
848 q.breakable()
849 q.breakable()
850 q.text('}')
851
852bsn.subtypes[10] = bsn_span_destination
853
Rich Lane7dcdf022013-12-11 14:45:27 -0800854class clear_actions(instruction_id):
855 type = 5
856
857 def __init__(self):
858 return
859
860 def pack(self):
861 packed = []
862 packed.append(struct.pack("!H", self.type))
863 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800864 length = sum([len(x) for x in packed])
865 packed[1] = struct.pack("!H", length)
866 return ''.join(packed)
867
868 @staticmethod
869 def unpack(reader):
870 obj = clear_actions()
871 _type = reader.read("!H")[0]
872 assert(_type == 5)
873 _len = reader.read("!H")[0]
874 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800875 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800876 return obj
877
878 def __eq__(self, other):
879 if type(self) != type(other): return False
880 return True
881
882 def pretty_print(self, q):
883 q.text("clear_actions {")
884 with q.group():
885 with q.indent(2):
886 q.breakable()
887 q.breakable()
888 q.text('}')
889
890instruction_id.subtypes[5] = clear_actions
891
892class goto_table(instruction_id):
893 type = 1
894
895 def __init__(self):
896 return
897
898 def pack(self):
899 packed = []
900 packed.append(struct.pack("!H", self.type))
901 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800902 length = sum([len(x) for x in packed])
903 packed[1] = struct.pack("!H", length)
904 return ''.join(packed)
905
906 @staticmethod
907 def unpack(reader):
908 obj = goto_table()
909 _type = reader.read("!H")[0]
910 assert(_type == 1)
911 _len = reader.read("!H")[0]
912 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800913 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800914 return obj
915
916 def __eq__(self, other):
917 if type(self) != type(other): return False
918 return True
919
920 def pretty_print(self, q):
921 q.text("goto_table {")
922 with q.group():
923 with q.indent(2):
924 q.breakable()
925 q.breakable()
926 q.text('}')
927
928instruction_id.subtypes[1] = goto_table
929
930class meter(instruction_id):
931 type = 6
932
933 def __init__(self):
934 return
935
936 def pack(self):
937 packed = []
938 packed.append(struct.pack("!H", self.type))
939 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
940 length = sum([len(x) for x in packed])
941 packed[1] = struct.pack("!H", length)
942 return ''.join(packed)
943
944 @staticmethod
945 def unpack(reader):
946 obj = meter()
947 _type = reader.read("!H")[0]
948 assert(_type == 6)
949 _len = reader.read("!H")[0]
950 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800951 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800952 return obj
953
954 def __eq__(self, other):
955 if type(self) != type(other): return False
956 return True
957
958 def pretty_print(self, q):
959 q.text("meter {")
960 with q.group():
961 with q.indent(2):
962 q.breakable()
963 q.breakable()
964 q.text('}')
965
966instruction_id.subtypes[6] = meter
967
968class write_actions(instruction_id):
969 type = 3
970
971 def __init__(self):
972 return
973
974 def pack(self):
975 packed = []
976 packed.append(struct.pack("!H", self.type))
977 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800978 length = sum([len(x) for x in packed])
979 packed[1] = struct.pack("!H", length)
980 return ''.join(packed)
981
982 @staticmethod
983 def unpack(reader):
984 obj = write_actions()
985 _type = reader.read("!H")[0]
986 assert(_type == 3)
987 _len = reader.read("!H")[0]
988 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800989 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -0800990 return obj
991
992 def __eq__(self, other):
993 if type(self) != type(other): return False
994 return True
995
996 def pretty_print(self, q):
997 q.text("write_actions {")
998 with q.group():
999 with q.indent(2):
1000 q.breakable()
1001 q.breakable()
1002 q.text('}')
1003
1004instruction_id.subtypes[3] = write_actions
1005
1006class write_metadata(instruction_id):
1007 type = 2
1008
1009 def __init__(self):
1010 return
1011
1012 def pack(self):
1013 packed = []
1014 packed.append(struct.pack("!H", self.type))
1015 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -08001016 length = sum([len(x) for x in packed])
1017 packed[1] = struct.pack("!H", length)
1018 return ''.join(packed)
1019
1020 @staticmethod
1021 def unpack(reader):
1022 obj = write_metadata()
1023 _type = reader.read("!H")[0]
1024 assert(_type == 2)
1025 _len = reader.read("!H")[0]
1026 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001027 reader = orig_reader.slice(_len, 4)
Rich Lane7dcdf022013-12-11 14:45:27 -08001028 return obj
1029
1030 def __eq__(self, other):
1031 if type(self) != type(other): return False
1032 return True
1033
1034 def pretty_print(self, q):
1035 q.text("write_metadata {")
1036 with q.group():
1037 with q.indent(2):
1038 q.breakable()
1039 q.breakable()
1040 q.text('}')
1041
1042instruction_id.subtypes[2] = write_metadata
1043
1044