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