forked from contiv/ofnet
-
Notifications
You must be signed in to change notification settings - Fork 16
/
fgraphNXOutput.go
34 lines (28 loc) · 934 Bytes
/
fgraphNXOutput.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package ofctrl
import "antrea.io/libOpenflow/openflow13"
// This file implements the forwarding graph API for output to NX register element
type NXOutput struct {
field *openflow13.MatchField // Target OXM/NXM field
fieldRange *openflow13.NXRange // Field range of target register to output
}
// Return a NXOutput action
func (self *NXOutput) GetActionMessage() openflow13.Action {
ofsNbits := self.fieldRange.ToOfsBits()
targetField := self.field
// Create NX output Register action
return openflow13.NewOutputFromField(targetField, ofsNbits)
}
func (self *NXOutput) GetActionType() string {
return ActTypeNXOutput
}
func NewNXOutput(name string, start int, end int) (*NXOutput, error) {
field, err := openflow13.FindFieldHeaderByName(name, false)
if err != nil {
return nil, err
}
fieldRange := openflow13.NewNXRange(start, end)
return &NXOutput{
field: field,
fieldRange: fieldRange,
}, nil
}