summaryrefslogtreecommitdiffhomepage
path: root/pkg/packet/bgp/sr_policy_test.go
diff options
context:
space:
mode:
authorzvfvrv <franclombardo@gmail.com>2021-06-18 12:06:43 +0200
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2021-06-30 07:38:00 +0900
commitedda6899101cca31e21a2eec079dc418d5213fd4 (patch)
tree1b43fe0dc06f8ed57c82c382983f506925d16380 /pkg/packet/bgp/sr_policy_test.go
parent8aaeb6d33902c725e2980256c0e83a9edd853124 (diff)
add support of the optional "SRv6 Endpoint Behavior and SID Structure" in segment type b
Diffstat (limited to 'pkg/packet/bgp/sr_policy_test.go')
-rw-r--r--pkg/packet/bgp/sr_policy_test.go41
1 files changed, 39 insertions, 2 deletions
diff --git a/pkg/packet/bgp/sr_policy_test.go b/pkg/packet/bgp/sr_policy_test.go
index 13d605f2..493e2be2 100644
--- a/pkg/packet/bgp/sr_policy_test.go
+++ b/pkg/packet/bgp/sr_policy_test.go
@@ -205,12 +205,49 @@ func TestSegmentListRoundTrip(t *testing.T) {
&SegmentTypeB{
TunnelEncapSubTLV: TunnelEncapSubTLV{Type: EncapSubTLVType(TypeB), Length: 6},
Flags: 0,
- SID: net.ParseIP("2001:1::1").To16(), //[]byte{},
+ SID: net.ParseIP("2001:1::1").To16(),
},
&SegmentTypeB{
TunnelEncapSubTLV: TunnelEncapSubTLV{Type: EncapSubTLVType(TypeB), Length: 6},
Flags: 0,
- SID: net.ParseIP("2001:1::2").To16(), //[]byte{}
+ SID: net.ParseIP("2001:1::2").To16(),
+ },
+ },
+ },
+ fail: false,
+ },
+ {
+ name: "weight and 2 type B segment with SR Endpoint Behavior and Structure",
+ input: &TunnelEncapSubTLVSRSegmentList{
+ TunnelEncapSubTLV: TunnelEncapSubTLV{
+ Type: ENCAP_SUBTLV_TYPE_SRSEGMENT_LIST,
+ Length: 6, // Weight (6 bytes) + Length of each segment + 2
+ },
+ Weight: &SegmentListWeight{
+ TunnelEncapSubTLV: TunnelEncapSubTLV{
+ Type: SegmentListSubTLVWeight,
+ Length: 6,
+ },
+ Flags: 0,
+ Weight: 100,
+ },
+ Segments: []TunnelEncapSubTLVInterface{
+ &SegmentTypeB{
+ TunnelEncapSubTLV: TunnelEncapSubTLV{Type: EncapSubTLVType(TypeB), Length: 6},
+ Flags: 0,
+ SID: net.ParseIP("2001:1::1").To16(),
+ SRv6EBS: &SRv6EndpointBehaviorStructure{
+ Behavior: 39,
+ BlockLen: 5,
+ NodeLen: 6,
+ FuncLen: 7,
+ ArgLen: 8,
+ },
+ },
+ &SegmentTypeB{
+ TunnelEncapSubTLV: TunnelEncapSubTLV{Type: EncapSubTLVType(TypeB), Length: 6},
+ Flags: 0,
+ SID: net.ParseIP("2001:1::2").To16(),
},
},
},