Skip to content

Commit

Permalink
support encap and decap for nsh and ethernet
Browse files Browse the repository at this point in the history
Signed-off-by: zhenglinan <[email protected]>
  • Loading branch information
zhenglinan committed Aug 21, 2022
2 parents 54ae4d2 + 38f85f0 commit c5ed7bf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions openflow15/nx_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -1953,14 +1953,21 @@ func (p *PropTLV) UnmarshalBinary(data []byte) error {
return nil
}

type EncapType uint32

const (
Ethernet EncapType = 0
Nsh EncapType = 1<<16 | 0x894f
)

type NXActionEncapsulate struct {
*NXActionHeader
HeaderSize uint16
HeaderType uint32
HeaderType EncapType
Property []PropTLV
}

func NewNXActionEncapsulate(headerSize uint16, headerType uint32, property []PropTLV) *NXActionEncapsulate {
func NewNXActionEncapsulate(headerSize uint16, headerType EncapType, property []PropTLV) *NXActionEncapsulate {
a := new(NXActionEncapsulate)
a.NXActionHeader = NewNxActionHeader(NXAST_RAW_ENCAP)
a.Length = 16
Expand Down Expand Up @@ -2047,7 +2054,7 @@ func NewNXActionDecapsulate(headerType uint32) *NXActionDecapsulate {
}

func (a *NXActionDecapsulate) Len() (n uint16) {
return a.Length
return 16
}

func (a *NXActionDecapsulate) MarshalBinary() (data []byte, err error) {
Expand Down

0 comments on commit c5ed7bf

Please sign in to comment.