blob: 1e3184d0d518031c5e19fd4b423543ba08bf17b4 [file] [log] [blame]
Matteo Scandoloa229eca2017-08-08 13:05:28 -07001
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 Lane2e079da2014-10-29 15:30:24 -070017# 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
25import struct
26import loxi
Rich Lane2e079da2014-10-29 15:30:24 -070027import util
28import loxi.generic_util
29
Rich Lanee2567702015-01-26 15:04:35 -080030import sys
31ofp = sys.modules['loxi.of14']
32
Rich Lane2e079da2014-10-29 15:30:24 -070033class instruction_id(loxi.OFObject):
34 subtypes = {}
35
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
52 @staticmethod
53 def unpack(reader):
54 subtype, = reader.peek('!H', 0)
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 Lanecb18dbd2014-12-18 10:02:29 -080063 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -070064 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('}')
78
79
80class 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
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 Lanecb18dbd2014-12-18 10:02:29 -0800101 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700102 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
116instruction_id.subtypes[4] = apply_actions
117
Rich Lane2e079da2014-10-29 15:30:24 -0700118class experimenter(instruction_id):
119 subtypes = {}
120
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
139 @staticmethod
140 def unpack(reader):
141 subtype, = reader.peek('!L', 4)
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 Lanecb18dbd2014-12-18 10:02:29 -0800151 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700152 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('}')
167
168instruction_id.subtypes[65535] = experimenter
169
Rich Laneccd32ed2014-11-10 17:48:24 -0800170class bsn(experimenter):
171 subtypes = {}
172
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))
189 length = sum([len(x) for x in packed])
190 packed[1] = struct.pack("!H", length)
191 return ''.join(packed)
192
193 @staticmethod
194 def unpack(reader):
195 subtype, = reader.peek('!L', 8)
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 Lanecb18dbd2014-12-18 10:02:29 -0800205 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800206 _experimenter = reader.read("!L")[0]
207 assert(_experimenter == 6035143)
208 obj.subtype = reader.read("!L")[0]
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('}')
223
224experimenter.subtypes[6035143] = bsn
225
226class 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))
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 Lanecb18dbd2014-12-18 10:02:29 -0800251 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800252 _experimenter = reader.read("!L")[0]
253 assert(_experimenter == 6035143)
254 _subtype = reader.read("!L")[0]
255 assert(_subtype == 1)
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
270bsn.subtypes[1] = bsn_arp_offload
271
Harshmeet Singh301f7172014-12-08 13:07:29 -0800272class 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 Lanecb18dbd2014-12-18 10:02:29 -0800297 reader = orig_reader.slice(_len, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -0800298 _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
316bsn.subtypes[11] = bsn_auto_negotiation
317
Rich Laneccd32ed2014-11-10 17:48:24 -0800318class 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 Lanecb18dbd2014-12-18 10:02:29 -0800343 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800344 _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
362bsn.subtypes[5] = bsn_deny
363
364class 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))
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 Lanecb18dbd2014-12-18 10:02:29 -0800389 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800390 _experimenter = reader.read("!L")[0]
391 assert(_experimenter == 6035143)
392 _subtype = reader.read("!L")[0]
393 assert(_subtype == 2)
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
408bsn.subtypes[2] = bsn_dhcp_offload
409
Kiran Poola36a302c2015-04-22 11:20:16 -0700410class 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
454bsn.subtypes[13] = bsn_disable_l3
455
Rich Laneccd32ed2014-11-10 17:48:24 -0800456class bsn_disable_src_mac_check(bsn):
457 type = 65535
458 experimenter = 6035143
459 subtype = 0
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_src_mac_check()
477 _type = reader.read("!H")[0]
478 assert(_type == 65535)
479 _len = reader.read("!H")[0]
480 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800481 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800482 _experimenter = reader.read("!L")[0]
483 assert(_experimenter == 6035143)
484 _subtype = reader.read("!L")[0]
485 assert(_subtype == 0)
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_src_mac_check {")
494 with q.group():
495 with q.indent(2):
496 q.breakable()
497 q.breakable()
498 q.text('}')
499
500bsn.subtypes[0] = bsn_disable_src_mac_check
501
502class bsn_disable_vlan_counters(bsn):
503 type = 65535
504 experimenter = 6035143
505 subtype = 9
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))
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_vlan_counters()
523 _type = reader.read("!H")[0]
524 assert(_type == 65535)
525 _len = reader.read("!H")[0]
526 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800527 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800528 _experimenter = reader.read("!L")[0]
529 assert(_experimenter == 6035143)
530 _subtype = reader.read("!L")[0]
531 assert(_subtype == 9)
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_vlan_counters {")
540 with q.group():
541 with q.indent(2):
542 q.breakable()
543 q.breakable()
544 q.text('}')
545
546bsn.subtypes[9] = bsn_disable_vlan_counters
547
Rich Lane7b69e792015-03-31 11:12:50 -0700548class bsn_internal_priority(bsn):
549 type = 65535
550 experimenter = 6035143
551 subtype = 12
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_internal_priority()
569 _type = reader.read("!H")[0]
570 assert(_type == 65535)
571 _len = reader.read("!H")[0]
572 orig_reader = reader
573 reader = orig_reader.slice(_len, 4)
574 _experimenter = reader.read("!L")[0]
575 assert(_experimenter == 6035143)
576 _subtype = reader.read("!L")[0]
577 assert(_subtype == 12)
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_internal_priority {")
586 with q.group():
587 with q.indent(2):
588 q.breakable()
589 q.breakable()
590 q.text('}')
591
592bsn.subtypes[12] = bsn_internal_priority
593
Rich Laneccd32ed2014-11-10 17:48:24 -0800594class bsn_packet_of_death(bsn):
595 type = 65535
596 experimenter = 6035143
597 subtype = 6
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_packet_of_death()
615 _type = reader.read("!H")[0]
616 assert(_type == 65535)
617 _len = reader.read("!H")[0]
618 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800619 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800620 _experimenter = reader.read("!L")[0]
621 assert(_experimenter == 6035143)
622 _subtype = reader.read("!L")[0]
623 assert(_subtype == 6)
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_packet_of_death {")
632 with q.group():
633 with q.indent(2):
634 q.breakable()
635 q.breakable()
636 q.text('}')
637
638bsn.subtypes[6] = bsn_packet_of_death
639
640class bsn_permit(bsn):
641 type = 65535
642 experimenter = 6035143
643 subtype = 4
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_permit()
661 _type = reader.read("!H")[0]
662 assert(_type == 65535)
663 _len = reader.read("!H")[0]
664 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800665 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800666 _experimenter = reader.read("!L")[0]
667 assert(_experimenter == 6035143)
668 _subtype = reader.read("!L")[0]
669 assert(_subtype == 4)
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_permit {")
678 with q.group():
679 with q.indent(2):
680 q.breakable()
681 q.breakable()
682 q.text('}')
683
684bsn.subtypes[4] = bsn_permit
685
686class bsn_prioritize_pdus(bsn):
687 type = 65535
688 experimenter = 6035143
689 subtype = 7
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_prioritize_pdus()
707 _type = reader.read("!H")[0]
708 assert(_type == 65535)
709 _len = reader.read("!H")[0]
710 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800711 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800712 _experimenter = reader.read("!L")[0]
713 assert(_experimenter == 6035143)
714 _subtype = reader.read("!L")[0]
715 assert(_subtype == 7)
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_prioritize_pdus {")
724 with q.group():
725 with q.indent(2):
726 q.breakable()
727 q.breakable()
728 q.text('}')
729
730bsn.subtypes[7] = bsn_prioritize_pdus
731
732class bsn_require_vlan_xlate(bsn):
733 type = 65535
734 experimenter = 6035143
735 subtype = 8
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_require_vlan_xlate()
753 _type = reader.read("!H")[0]
754 assert(_type == 65535)
755 _len = reader.read("!H")[0]
756 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800757 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800758 _experimenter = reader.read("!L")[0]
759 assert(_experimenter == 6035143)
760 _subtype = reader.read("!L")[0]
761 assert(_subtype == 8)
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_require_vlan_xlate {")
770 with q.group():
771 with q.indent(2):
772 q.breakable()
773 q.breakable()
774 q.text('}')
775
776bsn.subtypes[8] = bsn_require_vlan_xlate
777
778class bsn_span_destination(bsn):
779 type = 65535
780 experimenter = 6035143
781 subtype = 10
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_span_destination()
799 _type = reader.read("!H")[0]
800 assert(_type == 65535)
801 _len = reader.read("!H")[0]
802 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800803 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800804 _experimenter = reader.read("!L")[0]
805 assert(_experimenter == 6035143)
806 _subtype = reader.read("!L")[0]
807 assert(_subtype == 10)
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_span_destination {")
816 with q.group():
817 with q.indent(2):
818 q.breakable()
819 q.breakable()
820 q.text('}')
821
822bsn.subtypes[10] = bsn_span_destination
823
824class clear_actions(instruction_id):
825 type = 5
826
827 def __init__(self):
828 return
829
830 def pack(self):
831 packed = []
832 packed.append(struct.pack("!H", self.type))
833 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
834 length = sum([len(x) for x in packed])
835 packed[1] = struct.pack("!H", length)
836 return ''.join(packed)
837
838 @staticmethod
839 def unpack(reader):
840 obj = clear_actions()
841 _type = reader.read("!H")[0]
842 assert(_type == 5)
843 _len = reader.read("!H")[0]
844 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800845 reader = orig_reader.slice(_len, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800846 return obj
847
848 def __eq__(self, other):
849 if type(self) != type(other): return False
850 return True
851
852 def pretty_print(self, q):
853 q.text("clear_actions {")
854 with q.group():
855 with q.indent(2):
856 q.breakable()
857 q.breakable()
858 q.text('}')
859
860instruction_id.subtypes[5] = clear_actions
861
Rich Lane2e079da2014-10-29 15:30:24 -0700862class goto_table(instruction_id):
863 type = 1
864
865 def __init__(self):
866 return
867
868 def pack(self):
869 packed = []
870 packed.append(struct.pack("!H", self.type))
871 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
872 length = sum([len(x) for x in packed])
873 packed[1] = struct.pack("!H", length)
874 return ''.join(packed)
875
876 @staticmethod
877 def unpack(reader):
878 obj = goto_table()
879 _type = reader.read("!H")[0]
880 assert(_type == 1)
881 _len = reader.read("!H")[0]
882 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800883 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700884 return obj
885
886 def __eq__(self, other):
887 if type(self) != type(other): return False
888 return True
889
890 def pretty_print(self, q):
891 q.text("goto_table {")
892 with q.group():
893 with q.indent(2):
894 q.breakable()
895 q.breakable()
896 q.text('}')
897
898instruction_id.subtypes[1] = goto_table
899
900class meter(instruction_id):
901 type = 6
902
903 def __init__(self):
904 return
905
906 def pack(self):
907 packed = []
908 packed.append(struct.pack("!H", self.type))
909 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
910 length = sum([len(x) for x in packed])
911 packed[1] = struct.pack("!H", length)
912 return ''.join(packed)
913
914 @staticmethod
915 def unpack(reader):
916 obj = meter()
917 _type = reader.read("!H")[0]
918 assert(_type == 6)
919 _len = reader.read("!H")[0]
920 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800921 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700922 return obj
923
924 def __eq__(self, other):
925 if type(self) != type(other): return False
926 return True
927
928 def pretty_print(self, q):
929 q.text("meter {")
930 with q.group():
931 with q.indent(2):
932 q.breakable()
933 q.breakable()
934 q.text('}')
935
936instruction_id.subtypes[6] = meter
937
938class write_actions(instruction_id):
939 type = 3
940
941 def __init__(self):
942 return
943
944 def pack(self):
945 packed = []
946 packed.append(struct.pack("!H", self.type))
947 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
948 length = sum([len(x) for x in packed])
949 packed[1] = struct.pack("!H", length)
950 return ''.join(packed)
951
952 @staticmethod
953 def unpack(reader):
954 obj = write_actions()
955 _type = reader.read("!H")[0]
956 assert(_type == 3)
957 _len = reader.read("!H")[0]
958 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800959 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700960 return obj
961
962 def __eq__(self, other):
963 if type(self) != type(other): return False
964 return True
965
966 def pretty_print(self, q):
967 q.text("write_actions {")
968 with q.group():
969 with q.indent(2):
970 q.breakable()
971 q.breakable()
972 q.text('}')
973
974instruction_id.subtypes[3] = write_actions
975
976class write_metadata(instruction_id):
977 type = 2
978
979 def __init__(self):
980 return
981
982 def pack(self):
983 packed = []
984 packed.append(struct.pack("!H", self.type))
985 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
986 length = sum([len(x) for x in packed])
987 packed[1] = struct.pack("!H", length)
988 return ''.join(packed)
989
990 @staticmethod
991 def unpack(reader):
992 obj = write_metadata()
993 _type = reader.read("!H")[0]
994 assert(_type == 2)
995 _len = reader.read("!H")[0]
996 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800997 reader = orig_reader.slice(_len, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700998 return obj
999
1000 def __eq__(self, other):
1001 if type(self) != type(other): return False
1002 return True
1003
1004 def pretty_print(self, q):
1005 q.text("write_metadata {")
1006 with q.group():
1007 with q.indent(2):
1008 q.breakable()
1009 q.breakable()
1010 q.text('}')
1011
1012instruction_id.subtypes[2] = write_metadata
1013
1014