diff --git a/openflow15/nx_action.go b/openflow15/nx_action.go index e54a270..f0824b8 100644 --- a/openflow15/nx_action.go +++ b/openflow15/nx_action.go @@ -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 @@ -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) {