blob: 53a2eca136379d59b7a3a6ccb5d216b959df4010 [file] [log] [blame]
Don Newton98fd8812019-09-23 15:15:02 -04001/*
2 * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
3 * Copyright (c) 2011, 2012 Open Networking Foundation
4 * Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler.
5 * Copyright 2018, Red Hat, Inc.
6 */
7// Automatically generated by LOXI from template module.go
8// Do not modify
9
10package of13
11
12import (
13 "bytes"
14 "encoding/binary"
15 "fmt"
16
17 "github.com/skydive-project/goloxi"
18)
19
20type Instruction struct {
21 Type uint16
22 Len uint16
23}
24
25type IInstruction interface {
26 goloxi.Serializable
27 GetType() uint16
28 GetLen() uint16
29}
30
31func (self *Instruction) GetType() uint16 {
32 return self.Type
33}
34
35func (self *Instruction) SetType(v uint16) {
36 self.Type = v
37}
38
39func (self *Instruction) GetLen() uint16 {
40 return self.Len
41}
42
43func (self *Instruction) SetLen(v uint16) {
44 self.Len = v
45}
46
47func (self *Instruction) Serialize(encoder *goloxi.Encoder) error {
48
49 encoder.PutUint16(uint16(self.Type))
50 encoder.PutUint16(uint16(self.Len))
51
52 return nil
53}
54
55func DecodeInstruction(decoder *goloxi.Decoder) (IInstruction, error) {
56 _instruction := &Instruction{}
57 if decoder.Length() < 4 {
58 return nil, fmt.Errorf("Instruction packet too short: %d < 4", decoder.Length())
59 }
60 _instruction.Type = uint16(decoder.ReadUint16())
61 _instruction.Len = uint16(decoder.ReadUint16())
62 oldDecoder := decoder
63 defer func() { decoder = oldDecoder }()
64 decoder = decoder.SliceDecoder(int(_instruction.Len), 2+2)
65
66 switch _instruction.Type {
67 case 1:
68 return DecodeInstructionGotoTable(_instruction, decoder)
69 case 2:
70 return DecodeInstructionWriteMetadata(_instruction, decoder)
71 case 3:
72 return DecodeInstructionWriteActions(_instruction, decoder)
73 case 4:
74 return DecodeInstructionApplyActions(_instruction, decoder)
75 case 5:
76 return DecodeInstructionClearActions(_instruction, decoder)
77 case 6:
78 return DecodeInstructionMeter(_instruction, decoder)
79 case 65535:
80 return DecodeInstructionExperimenter(_instruction, decoder)
81 default:
82 return nil, fmt.Errorf("Invalid type '%d' for 'Instruction'", _instruction.Type)
83 }
84}
85
86func NewInstruction(_type uint16) *Instruction {
87 obj := &Instruction{}
88 obj.Type = _type
89 return obj
90}
91
92type InstructionApplyActions struct {
93 *Instruction
94 Actions []goloxi.IAction
95}
96
97type IInstructionApplyActions interface {
98 IInstruction
99 GetActions() []goloxi.IAction
100}
101
102func (self *InstructionApplyActions) GetActions() []goloxi.IAction {
103 return self.Actions
104}
105
106func (self *InstructionApplyActions) SetActions(v []goloxi.IAction) {
107 self.Actions = v
108}
109
110func (self *InstructionApplyActions) Serialize(encoder *goloxi.Encoder) error {
111 if err := self.Instruction.Serialize(encoder); err != nil {
112 return err
113 }
114
115 encoder.Write(bytes.Repeat([]byte{0}, 4))
116 for _, obj := range self.Actions {
117 if err := obj.Serialize(encoder); err != nil {
118 return err
119 }
120 }
121
122 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
123
124 return nil
125}
126
127func DecodeInstructionApplyActions(parent *Instruction, decoder *goloxi.Decoder) (*InstructionApplyActions, error) {
128 _instructionapplyactions := &InstructionApplyActions{Instruction: parent}
129 if decoder.Length() < 4 {
130 return nil, fmt.Errorf("InstructionApplyActions packet too short: %d < 4", decoder.Length())
131 }
132 decoder.Skip(4)
133
134 for decoder.Length() >= 8 {
135 item, err := DecodeAction(decoder)
136 if err != nil {
137 return nil, err
138 }
139 if item != nil {
140 _instructionapplyactions.Actions = append(_instructionapplyactions.Actions, item)
141 }
142 }
143 return _instructionapplyactions, nil
144}
145
146func NewInstructionApplyActions() *InstructionApplyActions {
147 obj := &InstructionApplyActions{
148 Instruction: NewInstruction(4),
149 }
150 return obj
151}
152
153type InstructionExperimenter struct {
154 *Instruction
155 Experimenter uint32
156}
157
158type IInstructionExperimenter interface {
159 IInstruction
160 GetExperimenter() uint32
161}
162
163func (self *InstructionExperimenter) GetExperimenter() uint32 {
164 return self.Experimenter
165}
166
167func (self *InstructionExperimenter) SetExperimenter(v uint32) {
168 self.Experimenter = v
169}
170
171func (self *InstructionExperimenter) Serialize(encoder *goloxi.Encoder) error {
172 if err := self.Instruction.Serialize(encoder); err != nil {
173 return err
174 }
175
176 encoder.PutUint32(uint32(self.Experimenter))
177
178 return nil
179}
180
181func DecodeInstructionExperimenter(parent *Instruction, decoder *goloxi.Decoder) (IInstructionExperimenter, error) {
182 _instructionexperimenter := &InstructionExperimenter{Instruction: parent}
183 if decoder.Length() < 4 {
184 return nil, fmt.Errorf("InstructionExperimenter packet too short: %d < 4", decoder.Length())
185 }
186 _instructionexperimenter.Experimenter = uint32(decoder.ReadUint32())
187
188 switch _instructionexperimenter.Experimenter {
189 case 6035143:
190 return DecodeInstructionBsn(_instructionexperimenter, decoder)
191 default:
192 return nil, fmt.Errorf("Invalid type '%d' for 'InstructionExperimenter'", _instructionexperimenter.Experimenter)
193 }
194}
195
196func NewInstructionExperimenter(_experimenter uint32) *InstructionExperimenter {
197 obj := &InstructionExperimenter{
198 Instruction: NewInstruction(65535),
199 }
200 obj.Experimenter = _experimenter
201 return obj
202}
203
204type InstructionBsn struct {
205 *InstructionExperimenter
206 Subtype uint32
207}
208
209type IInstructionBsn interface {
210 IInstructionExperimenter
211 GetSubtype() uint32
212}
213
214func (self *InstructionBsn) GetSubtype() uint32 {
215 return self.Subtype
216}
217
218func (self *InstructionBsn) SetSubtype(v uint32) {
219 self.Subtype = v
220}
221
222func (self *InstructionBsn) Serialize(encoder *goloxi.Encoder) error {
223 if err := self.InstructionExperimenter.Serialize(encoder); err != nil {
224 return err
225 }
226
227 encoder.PutUint32(uint32(self.Subtype))
228
229 return nil
230}
231
232func DecodeInstructionBsn(parent *InstructionExperimenter, decoder *goloxi.Decoder) (IInstructionBsn, error) {
233 _instructionbsn := &InstructionBsn{InstructionExperimenter: parent}
234 if decoder.Length() < 4 {
235 return nil, fmt.Errorf("InstructionBsn packet too short: %d < 4", decoder.Length())
236 }
237 _instructionbsn.Subtype = uint32(decoder.ReadUint32())
238
239 switch _instructionbsn.Subtype {
240 case 0:
241 return DecodeInstructionBsnDisableSrcMacCheck(_instructionbsn, decoder)
242 case 1:
243 return DecodeInstructionBsnArpOffload(_instructionbsn, decoder)
244 case 2:
245 return DecodeInstructionBsnDhcpOffload(_instructionbsn, decoder)
246 case 3:
247 return DecodeInstructionBsnDisableSplitHorizonCheck(_instructionbsn, decoder)
248 case 4:
249 return DecodeInstructionBsnPermit(_instructionbsn, decoder)
250 case 5:
251 return DecodeInstructionBsnDeny(_instructionbsn, decoder)
252 case 6:
253 return DecodeInstructionBsnPacketOfDeath(_instructionbsn, decoder)
254 case 7:
255 return DecodeInstructionBsnPrioritizePdus(_instructionbsn, decoder)
256 case 8:
257 return DecodeInstructionBsnRequireVlanXlate(_instructionbsn, decoder)
258 case 9:
259 return DecodeInstructionBsnDisableVlanCounters(_instructionbsn, decoder)
260 case 10:
261 return DecodeInstructionBsnSpanDestination(_instructionbsn, decoder)
262 case 11:
263 return DecodeInstructionBsnAutoNegotiation(_instructionbsn, decoder)
264 case 12:
265 return DecodeInstructionBsnInternalPriority(_instructionbsn, decoder)
266 case 13:
267 return DecodeInstructionBsnDisableL3(_instructionbsn, decoder)
268 case 14:
269 return DecodeInstructionBsnNdpOffload(_instructionbsn, decoder)
270 case 15:
271 return DecodeInstructionBsnHashSelect(_instructionbsn, decoder)
272 case 16:
273 return DecodeInstructionBsnDirectedBroadcast(_instructionbsn, decoder)
274 default:
275 return nil, fmt.Errorf("Invalid type '%d' for 'InstructionBsn'", _instructionbsn.Subtype)
276 }
277}
278
279func NewInstructionBsn(_subtype uint32) *InstructionBsn {
280 obj := &InstructionBsn{
281 InstructionExperimenter: NewInstructionExperimenter(6035143),
282 }
283 obj.Subtype = _subtype
284 return obj
285}
286
287type InstructionBsnArpOffload struct {
288 *InstructionBsn
289}
290
291type IInstructionBsnArpOffload interface {
292 IInstructionBsn
293}
294
295func (self *InstructionBsnArpOffload) Serialize(encoder *goloxi.Encoder) error {
296 if err := self.InstructionBsn.Serialize(encoder); err != nil {
297 return err
298 }
299
300 encoder.Write(bytes.Repeat([]byte{0}, 4))
301
302 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
303
304 return nil
305}
306
307func DecodeInstructionBsnArpOffload(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnArpOffload, error) {
308 _instructionbsnarpoffload := &InstructionBsnArpOffload{InstructionBsn: parent}
309 if decoder.Length() < 4 {
310 return nil, fmt.Errorf("InstructionBsnArpOffload packet too short: %d < 4", decoder.Length())
311 }
312 decoder.Skip(4)
313 return _instructionbsnarpoffload, nil
314}
315
316func NewInstructionBsnArpOffload() *InstructionBsnArpOffload {
317 obj := &InstructionBsnArpOffload{
318 InstructionBsn: NewInstructionBsn(1),
319 }
320 return obj
321}
322
323type InstructionBsnAutoNegotiation struct {
324 *InstructionBsn
325}
326
327type IInstructionBsnAutoNegotiation interface {
328 IInstructionBsn
329}
330
331func (self *InstructionBsnAutoNegotiation) Serialize(encoder *goloxi.Encoder) error {
332 if err := self.InstructionBsn.Serialize(encoder); err != nil {
333 return err
334 }
335
336 encoder.Write(bytes.Repeat([]byte{0}, 4))
337
338 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
339
340 return nil
341}
342
343func DecodeInstructionBsnAutoNegotiation(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnAutoNegotiation, error) {
344 _instructionbsnautonegotiation := &InstructionBsnAutoNegotiation{InstructionBsn: parent}
345 if decoder.Length() < 4 {
346 return nil, fmt.Errorf("InstructionBsnAutoNegotiation packet too short: %d < 4", decoder.Length())
347 }
348 decoder.Skip(4)
349 return _instructionbsnautonegotiation, nil
350}
351
352func NewInstructionBsnAutoNegotiation() *InstructionBsnAutoNegotiation {
353 obj := &InstructionBsnAutoNegotiation{
354 InstructionBsn: NewInstructionBsn(11),
355 }
356 return obj
357}
358
359type InstructionBsnDeny struct {
360 *InstructionBsn
361}
362
363type IInstructionBsnDeny interface {
364 IInstructionBsn
365}
366
367func (self *InstructionBsnDeny) Serialize(encoder *goloxi.Encoder) error {
368 if err := self.InstructionBsn.Serialize(encoder); err != nil {
369 return err
370 }
371
372 encoder.Write(bytes.Repeat([]byte{0}, 4))
373
374 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
375
376 return nil
377}
378
379func DecodeInstructionBsnDeny(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDeny, error) {
380 _instructionbsndeny := &InstructionBsnDeny{InstructionBsn: parent}
381 if decoder.Length() < 4 {
382 return nil, fmt.Errorf("InstructionBsnDeny packet too short: %d < 4", decoder.Length())
383 }
384 decoder.Skip(4)
385 return _instructionbsndeny, nil
386}
387
388func NewInstructionBsnDeny() *InstructionBsnDeny {
389 obj := &InstructionBsnDeny{
390 InstructionBsn: NewInstructionBsn(5),
391 }
392 return obj
393}
394
395type InstructionBsnDhcpOffload struct {
396 *InstructionBsn
397}
398
399type IInstructionBsnDhcpOffload interface {
400 IInstructionBsn
401}
402
403func (self *InstructionBsnDhcpOffload) Serialize(encoder *goloxi.Encoder) error {
404 if err := self.InstructionBsn.Serialize(encoder); err != nil {
405 return err
406 }
407
408 encoder.Write(bytes.Repeat([]byte{0}, 4))
409
410 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
411
412 return nil
413}
414
415func DecodeInstructionBsnDhcpOffload(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDhcpOffload, error) {
416 _instructionbsndhcpoffload := &InstructionBsnDhcpOffload{InstructionBsn: parent}
417 if decoder.Length() < 4 {
418 return nil, fmt.Errorf("InstructionBsnDhcpOffload packet too short: %d < 4", decoder.Length())
419 }
420 decoder.Skip(4)
421 return _instructionbsndhcpoffload, nil
422}
423
424func NewInstructionBsnDhcpOffload() *InstructionBsnDhcpOffload {
425 obj := &InstructionBsnDhcpOffload{
426 InstructionBsn: NewInstructionBsn(2),
427 }
428 return obj
429}
430
431type InstructionBsnDirectedBroadcast struct {
432 *InstructionBsn
433}
434
435type IInstructionBsnDirectedBroadcast interface {
436 IInstructionBsn
437}
438
439func (self *InstructionBsnDirectedBroadcast) Serialize(encoder *goloxi.Encoder) error {
440 if err := self.InstructionBsn.Serialize(encoder); err != nil {
441 return err
442 }
443
444 encoder.Write(bytes.Repeat([]byte{0}, 4))
445
446 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
447
448 return nil
449}
450
451func DecodeInstructionBsnDirectedBroadcast(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDirectedBroadcast, error) {
452 _instructionbsndirectedbroadcast := &InstructionBsnDirectedBroadcast{InstructionBsn: parent}
453 if decoder.Length() < 4 {
454 return nil, fmt.Errorf("InstructionBsnDirectedBroadcast packet too short: %d < 4", decoder.Length())
455 }
456 decoder.Skip(4)
457 return _instructionbsndirectedbroadcast, nil
458}
459
460func NewInstructionBsnDirectedBroadcast() *InstructionBsnDirectedBroadcast {
461 obj := &InstructionBsnDirectedBroadcast{
462 InstructionBsn: NewInstructionBsn(16),
463 }
464 return obj
465}
466
467type InstructionBsnDisableL3 struct {
468 *InstructionBsn
469}
470
471type IInstructionBsnDisableL3 interface {
472 IInstructionBsn
473}
474
475func (self *InstructionBsnDisableL3) Serialize(encoder *goloxi.Encoder) error {
476 if err := self.InstructionBsn.Serialize(encoder); err != nil {
477 return err
478 }
479
480 encoder.Write(bytes.Repeat([]byte{0}, 4))
481
482 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
483
484 return nil
485}
486
487func DecodeInstructionBsnDisableL3(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableL3, error) {
488 _instructionbsndisablel3 := &InstructionBsnDisableL3{InstructionBsn: parent}
489 if decoder.Length() < 4 {
490 return nil, fmt.Errorf("InstructionBsnDisableL3 packet too short: %d < 4", decoder.Length())
491 }
492 decoder.Skip(4)
493 return _instructionbsndisablel3, nil
494}
495
496func NewInstructionBsnDisableL3() *InstructionBsnDisableL3 {
497 obj := &InstructionBsnDisableL3{
498 InstructionBsn: NewInstructionBsn(13),
499 }
500 return obj
501}
502
503type InstructionBsnDisableSplitHorizonCheck struct {
504 *InstructionBsn
505}
506
507type IInstructionBsnDisableSplitHorizonCheck interface {
508 IInstructionBsn
509}
510
511func (self *InstructionBsnDisableSplitHorizonCheck) Serialize(encoder *goloxi.Encoder) error {
512 if err := self.InstructionBsn.Serialize(encoder); err != nil {
513 return err
514 }
515
516 encoder.Write(bytes.Repeat([]byte{0}, 4))
517
518 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
519
520 return nil
521}
522
523func DecodeInstructionBsnDisableSplitHorizonCheck(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableSplitHorizonCheck, error) {
524 _instructionbsndisablesplithorizoncheck := &InstructionBsnDisableSplitHorizonCheck{InstructionBsn: parent}
525 if decoder.Length() < 4 {
526 return nil, fmt.Errorf("InstructionBsnDisableSplitHorizonCheck packet too short: %d < 4", decoder.Length())
527 }
528 decoder.Skip(4)
529 return _instructionbsndisablesplithorizoncheck, nil
530}
531
532func NewInstructionBsnDisableSplitHorizonCheck() *InstructionBsnDisableSplitHorizonCheck {
533 obj := &InstructionBsnDisableSplitHorizonCheck{
534 InstructionBsn: NewInstructionBsn(3),
535 }
536 return obj
537}
538
539type InstructionBsnDisableSrcMacCheck struct {
540 *InstructionBsn
541}
542
543type IInstructionBsnDisableSrcMacCheck interface {
544 IInstructionBsn
545}
546
547func (self *InstructionBsnDisableSrcMacCheck) Serialize(encoder *goloxi.Encoder) error {
548 if err := self.InstructionBsn.Serialize(encoder); err != nil {
549 return err
550 }
551
552 encoder.Write(bytes.Repeat([]byte{0}, 4))
553
554 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
555
556 return nil
557}
558
559func DecodeInstructionBsnDisableSrcMacCheck(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableSrcMacCheck, error) {
560 _instructionbsndisablesrcmaccheck := &InstructionBsnDisableSrcMacCheck{InstructionBsn: parent}
561 if decoder.Length() < 4 {
562 return nil, fmt.Errorf("InstructionBsnDisableSrcMacCheck packet too short: %d < 4", decoder.Length())
563 }
564 decoder.Skip(4)
565 return _instructionbsndisablesrcmaccheck, nil
566}
567
568func NewInstructionBsnDisableSrcMacCheck() *InstructionBsnDisableSrcMacCheck {
569 obj := &InstructionBsnDisableSrcMacCheck{
570 InstructionBsn: NewInstructionBsn(0),
571 }
572 return obj
573}
574
575type InstructionBsnDisableVlanCounters struct {
576 *InstructionBsn
577}
578
579type IInstructionBsnDisableVlanCounters interface {
580 IInstructionBsn
581}
582
583func (self *InstructionBsnDisableVlanCounters) Serialize(encoder *goloxi.Encoder) error {
584 if err := self.InstructionBsn.Serialize(encoder); err != nil {
585 return err
586 }
587
588 encoder.Write(bytes.Repeat([]byte{0}, 4))
589
590 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
591
592 return nil
593}
594
595func DecodeInstructionBsnDisableVlanCounters(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnDisableVlanCounters, error) {
596 _instructionbsndisablevlancounters := &InstructionBsnDisableVlanCounters{InstructionBsn: parent}
597 if decoder.Length() < 4 {
598 return nil, fmt.Errorf("InstructionBsnDisableVlanCounters packet too short: %d < 4", decoder.Length())
599 }
600 decoder.Skip(4)
601 return _instructionbsndisablevlancounters, nil
602}
603
604func NewInstructionBsnDisableVlanCounters() *InstructionBsnDisableVlanCounters {
605 obj := &InstructionBsnDisableVlanCounters{
606 InstructionBsn: NewInstructionBsn(9),
607 }
608 return obj
609}
610
611type InstructionBsnHashSelect struct {
612 *InstructionBsn
613 Flags BsnHashSelectFlags
614}
615
616type IInstructionBsnHashSelect interface {
617 IInstructionBsn
618 GetFlags() BsnHashSelectFlags
619}
620
621func (self *InstructionBsnHashSelect) GetFlags() BsnHashSelectFlags {
622 return self.Flags
623}
624
625func (self *InstructionBsnHashSelect) SetFlags(v BsnHashSelectFlags) {
626 self.Flags = v
627}
628
629func (self *InstructionBsnHashSelect) Serialize(encoder *goloxi.Encoder) error {
630 if err := self.InstructionBsn.Serialize(encoder); err != nil {
631 return err
632 }
633
634 encoder.PutUint32(uint32(self.Flags))
635
636 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
637
638 return nil
639}
640
641func DecodeInstructionBsnHashSelect(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnHashSelect, error) {
642 _instructionbsnhashselect := &InstructionBsnHashSelect{InstructionBsn: parent}
643 if decoder.Length() < 4 {
644 return nil, fmt.Errorf("InstructionBsnHashSelect packet too short: %d < 4", decoder.Length())
645 }
646 _instructionbsnhashselect.Flags = BsnHashSelectFlags(decoder.ReadUint32())
647 return _instructionbsnhashselect, nil
648}
649
650func NewInstructionBsnHashSelect() *InstructionBsnHashSelect {
651 obj := &InstructionBsnHashSelect{
652 InstructionBsn: NewInstructionBsn(15),
653 }
654 return obj
655}
656
657type InstructionBsnInternalPriority struct {
658 *InstructionBsn
659 Value uint32
660}
661
662type IInstructionBsnInternalPriority interface {
663 IInstructionBsn
664 GetValue() uint32
665}
666
667func (self *InstructionBsnInternalPriority) GetValue() uint32 {
668 return self.Value
669}
670
671func (self *InstructionBsnInternalPriority) SetValue(v uint32) {
672 self.Value = v
673}
674
675func (self *InstructionBsnInternalPriority) Serialize(encoder *goloxi.Encoder) error {
676 if err := self.InstructionBsn.Serialize(encoder); err != nil {
677 return err
678 }
679
680 encoder.PutUint32(uint32(self.Value))
681
682 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
683
684 return nil
685}
686
687func DecodeInstructionBsnInternalPriority(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnInternalPriority, error) {
688 _instructionbsninternalpriority := &InstructionBsnInternalPriority{InstructionBsn: parent}
689 if decoder.Length() < 4 {
690 return nil, fmt.Errorf("InstructionBsnInternalPriority packet too short: %d < 4", decoder.Length())
691 }
692 _instructionbsninternalpriority.Value = uint32(decoder.ReadUint32())
693 return _instructionbsninternalpriority, nil
694}
695
696func NewInstructionBsnInternalPriority() *InstructionBsnInternalPriority {
697 obj := &InstructionBsnInternalPriority{
698 InstructionBsn: NewInstructionBsn(12),
699 }
700 return obj
701}
702
703type InstructionBsnNdpOffload struct {
704 *InstructionBsn
705}
706
707type IInstructionBsnNdpOffload interface {
708 IInstructionBsn
709}
710
711func (self *InstructionBsnNdpOffload) Serialize(encoder *goloxi.Encoder) error {
712 if err := self.InstructionBsn.Serialize(encoder); err != nil {
713 return err
714 }
715
716 encoder.Write(bytes.Repeat([]byte{0}, 4))
717
718 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
719
720 return nil
721}
722
723func DecodeInstructionBsnNdpOffload(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnNdpOffload, error) {
724 _instructionbsnndpoffload := &InstructionBsnNdpOffload{InstructionBsn: parent}
725 if decoder.Length() < 4 {
726 return nil, fmt.Errorf("InstructionBsnNdpOffload packet too short: %d < 4", decoder.Length())
727 }
728 decoder.Skip(4)
729 return _instructionbsnndpoffload, nil
730}
731
732func NewInstructionBsnNdpOffload() *InstructionBsnNdpOffload {
733 obj := &InstructionBsnNdpOffload{
734 InstructionBsn: NewInstructionBsn(14),
735 }
736 return obj
737}
738
739type InstructionBsnPacketOfDeath struct {
740 *InstructionBsn
741}
742
743type IInstructionBsnPacketOfDeath interface {
744 IInstructionBsn
745}
746
747func (self *InstructionBsnPacketOfDeath) Serialize(encoder *goloxi.Encoder) error {
748 if err := self.InstructionBsn.Serialize(encoder); err != nil {
749 return err
750 }
751
752 encoder.Write(bytes.Repeat([]byte{0}, 4))
753
754 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
755
756 return nil
757}
758
759func DecodeInstructionBsnPacketOfDeath(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnPacketOfDeath, error) {
760 _instructionbsnpacketofdeath := &InstructionBsnPacketOfDeath{InstructionBsn: parent}
761 if decoder.Length() < 4 {
762 return nil, fmt.Errorf("InstructionBsnPacketOfDeath packet too short: %d < 4", decoder.Length())
763 }
764 decoder.Skip(4)
765 return _instructionbsnpacketofdeath, nil
766}
767
768func NewInstructionBsnPacketOfDeath() *InstructionBsnPacketOfDeath {
769 obj := &InstructionBsnPacketOfDeath{
770 InstructionBsn: NewInstructionBsn(6),
771 }
772 return obj
773}
774
775type InstructionBsnPermit struct {
776 *InstructionBsn
777}
778
779type IInstructionBsnPermit interface {
780 IInstructionBsn
781}
782
783func (self *InstructionBsnPermit) Serialize(encoder *goloxi.Encoder) error {
784 if err := self.InstructionBsn.Serialize(encoder); err != nil {
785 return err
786 }
787
788 encoder.Write(bytes.Repeat([]byte{0}, 4))
789
790 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
791
792 return nil
793}
794
795func DecodeInstructionBsnPermit(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnPermit, error) {
796 _instructionbsnpermit := &InstructionBsnPermit{InstructionBsn: parent}
797 if decoder.Length() < 4 {
798 return nil, fmt.Errorf("InstructionBsnPermit packet too short: %d < 4", decoder.Length())
799 }
800 decoder.Skip(4)
801 return _instructionbsnpermit, nil
802}
803
804func NewInstructionBsnPermit() *InstructionBsnPermit {
805 obj := &InstructionBsnPermit{
806 InstructionBsn: NewInstructionBsn(4),
807 }
808 return obj
809}
810
811type InstructionBsnPrioritizePdus struct {
812 *InstructionBsn
813}
814
815type IInstructionBsnPrioritizePdus interface {
816 IInstructionBsn
817}
818
819func (self *InstructionBsnPrioritizePdus) Serialize(encoder *goloxi.Encoder) error {
820 if err := self.InstructionBsn.Serialize(encoder); err != nil {
821 return err
822 }
823
824 encoder.Write(bytes.Repeat([]byte{0}, 4))
825
826 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
827
828 return nil
829}
830
831func DecodeInstructionBsnPrioritizePdus(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnPrioritizePdus, error) {
832 _instructionbsnprioritizepdus := &InstructionBsnPrioritizePdus{InstructionBsn: parent}
833 if decoder.Length() < 4 {
834 return nil, fmt.Errorf("InstructionBsnPrioritizePdus packet too short: %d < 4", decoder.Length())
835 }
836 decoder.Skip(4)
837 return _instructionbsnprioritizepdus, nil
838}
839
840func NewInstructionBsnPrioritizePdus() *InstructionBsnPrioritizePdus {
841 obj := &InstructionBsnPrioritizePdus{
842 InstructionBsn: NewInstructionBsn(7),
843 }
844 return obj
845}
846
847type InstructionBsnRequireVlanXlate struct {
848 *InstructionBsn
849}
850
851type IInstructionBsnRequireVlanXlate interface {
852 IInstructionBsn
853}
854
855func (self *InstructionBsnRequireVlanXlate) Serialize(encoder *goloxi.Encoder) error {
856 if err := self.InstructionBsn.Serialize(encoder); err != nil {
857 return err
858 }
859
860 encoder.Write(bytes.Repeat([]byte{0}, 4))
861
862 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
863
864 return nil
865}
866
867func DecodeInstructionBsnRequireVlanXlate(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnRequireVlanXlate, error) {
868 _instructionbsnrequirevlanxlate := &InstructionBsnRequireVlanXlate{InstructionBsn: parent}
869 if decoder.Length() < 4 {
870 return nil, fmt.Errorf("InstructionBsnRequireVlanXlate packet too short: %d < 4", decoder.Length())
871 }
872 decoder.Skip(4)
873 return _instructionbsnrequirevlanxlate, nil
874}
875
876func NewInstructionBsnRequireVlanXlate() *InstructionBsnRequireVlanXlate {
877 obj := &InstructionBsnRequireVlanXlate{
878 InstructionBsn: NewInstructionBsn(8),
879 }
880 return obj
881}
882
883type InstructionBsnSpanDestination struct {
884 *InstructionBsn
885}
886
887type IInstructionBsnSpanDestination interface {
888 IInstructionBsn
889}
890
891func (self *InstructionBsnSpanDestination) Serialize(encoder *goloxi.Encoder) error {
892 if err := self.InstructionBsn.Serialize(encoder); err != nil {
893 return err
894 }
895
896 encoder.Write(bytes.Repeat([]byte{0}, 4))
897
898 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
899
900 return nil
901}
902
903func DecodeInstructionBsnSpanDestination(parent *InstructionBsn, decoder *goloxi.Decoder) (*InstructionBsnSpanDestination, error) {
904 _instructionbsnspandestination := &InstructionBsnSpanDestination{InstructionBsn: parent}
905 if decoder.Length() < 4 {
906 return nil, fmt.Errorf("InstructionBsnSpanDestination packet too short: %d < 4", decoder.Length())
907 }
908 decoder.Skip(4)
909 return _instructionbsnspandestination, nil
910}
911
912func NewInstructionBsnSpanDestination() *InstructionBsnSpanDestination {
913 obj := &InstructionBsnSpanDestination{
914 InstructionBsn: NewInstructionBsn(10),
915 }
916 return obj
917}
918
919type InstructionClearActions struct {
920 *Instruction
921}
922
923type IInstructionClearActions interface {
924 IInstruction
925}
926
927func (self *InstructionClearActions) Serialize(encoder *goloxi.Encoder) error {
928 if err := self.Instruction.Serialize(encoder); err != nil {
929 return err
930 }
931
932 encoder.Write(bytes.Repeat([]byte{0}, 4))
933
934 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
935
936 return nil
937}
938
939func DecodeInstructionClearActions(parent *Instruction, decoder *goloxi.Decoder) (*InstructionClearActions, error) {
940 _instructionclearactions := &InstructionClearActions{Instruction: parent}
941 if decoder.Length() < 4 {
942 return nil, fmt.Errorf("InstructionClearActions packet too short: %d < 4", decoder.Length())
943 }
944 decoder.Skip(4)
945 return _instructionclearactions, nil
946}
947
948func NewInstructionClearActions() *InstructionClearActions {
949 obj := &InstructionClearActions{
950 Instruction: NewInstruction(5),
951 }
952 return obj
953}
954
955type InstructionGotoTable struct {
956 *Instruction
957 TableId uint8
958}
959
960type IInstructionGotoTable interface {
961 IInstruction
962 GetTableId() uint8
963}
964
965func (self *InstructionGotoTable) GetTableId() uint8 {
966 return self.TableId
967}
968
969func (self *InstructionGotoTable) SetTableId(v uint8) {
970 self.TableId = v
971}
972
973func (self *InstructionGotoTable) Serialize(encoder *goloxi.Encoder) error {
974 if err := self.Instruction.Serialize(encoder); err != nil {
975 return err
976 }
977
978 encoder.PutUint8(uint8(self.TableId))
979 encoder.Write(bytes.Repeat([]byte{0}, 3))
980
981 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
982
983 return nil
984}
985
986func DecodeInstructionGotoTable(parent *Instruction, decoder *goloxi.Decoder) (*InstructionGotoTable, error) {
987 _instructiongototable := &InstructionGotoTable{Instruction: parent}
988 if decoder.Length() < 4 {
989 return nil, fmt.Errorf("InstructionGotoTable packet too short: %d < 4", decoder.Length())
990 }
991 _instructiongototable.TableId = uint8(decoder.ReadByte())
992 decoder.Skip(3)
993 return _instructiongototable, nil
994}
995
996func NewInstructionGotoTable() *InstructionGotoTable {
997 obj := &InstructionGotoTable{
998 Instruction: NewInstruction(1),
999 }
1000 return obj
1001}
1002
1003type InstructionMeter struct {
1004 *Instruction
1005 MeterId uint32
1006}
1007
1008type IInstructionMeter interface {
1009 IInstruction
1010 GetMeterId() uint32
1011}
1012
1013func (self *InstructionMeter) GetMeterId() uint32 {
1014 return self.MeterId
1015}
1016
1017func (self *InstructionMeter) SetMeterId(v uint32) {
1018 self.MeterId = v
1019}
1020
1021func (self *InstructionMeter) Serialize(encoder *goloxi.Encoder) error {
1022 if err := self.Instruction.Serialize(encoder); err != nil {
1023 return err
1024 }
1025
1026 encoder.PutUint32(uint32(self.MeterId))
1027
1028 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
1029
1030 return nil
1031}
1032
1033func DecodeInstructionMeter(parent *Instruction, decoder *goloxi.Decoder) (*InstructionMeter, error) {
1034 _instructionmeter := &InstructionMeter{Instruction: parent}
1035 if decoder.Length() < 4 {
1036 return nil, fmt.Errorf("InstructionMeter packet too short: %d < 4", decoder.Length())
1037 }
1038 _instructionmeter.MeterId = uint32(decoder.ReadUint32())
1039 return _instructionmeter, nil
1040}
1041
1042func NewInstructionMeter() *InstructionMeter {
1043 obj := &InstructionMeter{
1044 Instruction: NewInstruction(6),
1045 }
1046 return obj
1047}
1048
1049type InstructionWriteActions struct {
1050 *Instruction
1051 Actions []goloxi.IAction
1052}
1053
1054type IInstructionWriteActions interface {
1055 IInstruction
1056 GetActions() []goloxi.IAction
1057}
1058
1059func (self *InstructionWriteActions) GetActions() []goloxi.IAction {
1060 return self.Actions
1061}
1062
1063func (self *InstructionWriteActions) SetActions(v []goloxi.IAction) {
1064 self.Actions = v
1065}
1066
1067func (self *InstructionWriteActions) Serialize(encoder *goloxi.Encoder) error {
1068 if err := self.Instruction.Serialize(encoder); err != nil {
1069 return err
1070 }
1071
1072 encoder.Write(bytes.Repeat([]byte{0}, 4))
1073 for _, obj := range self.Actions {
1074 if err := obj.Serialize(encoder); err != nil {
1075 return err
1076 }
1077 }
1078
1079 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
1080
1081 return nil
1082}
1083
1084func DecodeInstructionWriteActions(parent *Instruction, decoder *goloxi.Decoder) (*InstructionWriteActions, error) {
1085 _instructionwriteactions := &InstructionWriteActions{Instruction: parent}
1086 if decoder.Length() < 4 {
1087 return nil, fmt.Errorf("InstructionWriteActions packet too short: %d < 4", decoder.Length())
1088 }
1089 decoder.Skip(4)
1090
1091 for decoder.Length() >= 8 {
1092 item, err := DecodeAction(decoder)
1093 if err != nil {
1094 return nil, err
1095 }
1096 if item != nil {
1097 _instructionwriteactions.Actions = append(_instructionwriteactions.Actions, item)
1098 }
1099 }
1100 return _instructionwriteactions, nil
1101}
1102
1103func NewInstructionWriteActions() *InstructionWriteActions {
1104 obj := &InstructionWriteActions{
1105 Instruction: NewInstruction(3),
1106 }
1107 return obj
1108}
1109
1110type InstructionWriteMetadata struct {
1111 *Instruction
1112 Metadata uint64
1113 MetadataMask uint64
1114}
1115
1116type IInstructionWriteMetadata interface {
1117 IInstruction
1118 GetMetadata() uint64
1119 GetMetadataMask() uint64
1120}
1121
1122func (self *InstructionWriteMetadata) GetMetadata() uint64 {
1123 return self.Metadata
1124}
1125
1126func (self *InstructionWriteMetadata) SetMetadata(v uint64) {
1127 self.Metadata = v
1128}
1129
1130func (self *InstructionWriteMetadata) GetMetadataMask() uint64 {
1131 return self.MetadataMask
1132}
1133
1134func (self *InstructionWriteMetadata) SetMetadataMask(v uint64) {
1135 self.MetadataMask = v
1136}
1137
1138func (self *InstructionWriteMetadata) Serialize(encoder *goloxi.Encoder) error {
1139 if err := self.Instruction.Serialize(encoder); err != nil {
1140 return err
1141 }
1142
1143 encoder.Write(bytes.Repeat([]byte{0}, 4))
1144 encoder.PutUint64(uint64(self.Metadata))
1145 encoder.PutUint64(uint64(self.MetadataMask))
1146
1147 binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
1148
1149 return nil
1150}
1151
1152func DecodeInstructionWriteMetadata(parent *Instruction, decoder *goloxi.Decoder) (*InstructionWriteMetadata, error) {
1153 _instructionwritemetadata := &InstructionWriteMetadata{Instruction: parent}
1154 if decoder.Length() < 20 {
1155 return nil, fmt.Errorf("InstructionWriteMetadata packet too short: %d < 20", decoder.Length())
1156 }
1157 decoder.Skip(4)
1158 _instructionwritemetadata.Metadata = uint64(decoder.ReadUint64())
1159 _instructionwritemetadata.MetadataMask = uint64(decoder.ReadUint64())
1160 return _instructionwritemetadata, nil
1161}
1162
1163func NewInstructionWriteMetadata() *InstructionWriteMetadata {
1164 obj := &InstructionWriteMetadata{
1165 Instruction: NewInstruction(2),
1166 }
1167 return obj
1168}