diff options
Diffstat (limited to 'internal/pkg')
-rw-r--r-- | internal/pkg/apiutil/attribute.go | 6 | ||||
-rw-r--r-- | internal/pkg/apiutil/attribute_test.go | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/internal/pkg/apiutil/attribute.go b/internal/pkg/apiutil/attribute.go index f440772b..0e4eecae 100644 --- a/internal/pkg/apiutil/attribute.go +++ b/internal/pkg/apiutil/attribute.go @@ -1176,6 +1176,10 @@ func NewTunnelEncapAttributeFromNative(a *bgp.PathAttributeTunnelEncap) *api.Tun subTlv = &api.TunnelEncapSubTLVColor{ Color: sv.Color, } + case *bgp.TunnelEncapSubTLVUDPDestPort: + subTlv = &api.TunnelEncapSubTLVUDPDestPort{ + Port: uint32(sv.UDPDestPort), + } case *bgp.TunnelEncapSubTLVUnknown: subTlv = &api.TunnelEncapSubTLVUnknown{ Type: uint32(sv.Type), @@ -1658,6 +1662,8 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) { subTlv = bgp.NewTunnelEncapSubTLVProtocol(uint16(sv.Protocol)) case *api.TunnelEncapSubTLVColor: subTlv = bgp.NewTunnelEncapSubTLVColor(sv.Color) + case *api.TunnelEncapSubTLVUDPDestPort: + subTlv = bgp.NewTunnelEncapSubTLVUDPDestPort(uint16(sv.Port)) case *api.TunnelEncapSubTLVSRPreference: subTlv = bgp.NewTunnelEncapSubTLVSRPreference(sv.Flags, sv.Preference) case *api.TunnelEncapSubTLVSRPriority: diff --git a/internal/pkg/apiutil/attribute_test.go b/internal/pkg/apiutil/attribute_test.go index a3eff1a7..6c694030 100644 --- a/internal/pkg/apiutil/attribute_test.go +++ b/internal/pkg/apiutil/attribute_test.go @@ -1428,6 +1428,11 @@ func Test_TunnelEncapAttribute(t *testing.T) { }) assert.Nil(err) subTlvs = append(subTlvs, a) + a, err = ptypes.MarshalAny(&api.TunnelEncapSubTLVUDPDestPort{ + Port: 400, + }) + assert.Nil(err) + subTlvs = append(subTlvs, a) a, err = ptypes.MarshalAny(&api.TunnelEncapSubTLVUnknown{ Type: 0xff, // Max of uint8 Value: []byte{0x55, 0x66, 0x77, 0x88}, |