From 4f29fd7785b89d7b7c7b77d2e8c7e57b958bf79a Mon Sep 17 00:00:00 2001 From: zvfvrv Date: Wed, 23 Jun 2021 17:40:53 +0200 Subject: fix UnmarshalSRSegments for SegmentTypeB --- internal/pkg/apiutil/attribute.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'internal/pkg/apiutil') diff --git a/internal/pkg/apiutil/attribute.go b/internal/pkg/apiutil/attribute.go index 1b4a73e7..9d8267a1 100644 --- a/internal/pkg/apiutil/attribute.go +++ b/internal/pkg/apiutil/attribute.go @@ -1871,7 +1871,6 @@ func MarshalSRSegments(segs []bgp.TunnelEncapSubTLVInterface) []*any.Any { BFlag: s.Flags&0x10 == 0x10, }, } - // TODO (sbezverk) Add Type B Segment when SRv6 Binding SID gets finalized. case *bgp.SegmentTypeB: flags := &api.SegmentFlags{ VFlag: s.Flags&0x80 == 0x80, @@ -1960,6 +1959,16 @@ func UnmarshalSRSegments(s []*any.Any) ([]bgp.TunnelEncapSubTLVInterface, error) if v.Flags.BFlag { seg.Flags += 0x10 } + if v.EndpointBehaviorStructure != nil { + ebs := v.GetEndpointBehaviorStructure() + seg.SRv6EBS = &bgp.SRv6EndpointBehaviorStructure{ + Behavior: bgp.SRBehavior(ebs.Behavior), + BlockLen: uint8(ebs.BlockLen), + NodeLen: uint8(ebs.NodeLen), + FuncLen: uint8(ebs.FuncLen), + ArgLen: uint8(ebs.ArgLen), + } + } segments[i] = seg } } -- cgit v1.2.3