diff options
Diffstat (limited to 'internal/pkg/table/policy_test.go')
-rw-r--r-- | internal/pkg/table/policy_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/pkg/table/policy_test.go b/internal/pkg/table/policy_test.go index 9f74f32c..fbe9d06b 100644 --- a/internal/pkg/table/policy_test.go +++ b/internal/pkg/table/policy_test.go @@ -3024,6 +3024,31 @@ func TestPrefixSetMatchV4withV6Prefix(t *testing.T) { assert.False(t, m.Evaluate(path, nil)) } +func TestPrefixSetMatchV6LabeledwithV6Prefix(t *testing.T) { + p1 := config.Prefix{ + IpPrefix: "2806:106e:19::/48", + MasklengthRange: "48..48", + } + ps, err := NewPrefixSet(config.PrefixSet{ + PrefixSetName: "ps1", + PrefixList: []config.Prefix{p1}, + }) + assert.Nil(t, err) + m := &PrefixCondition{ + set: ps, + } + + labels := bgp.NewMPLSLabelStack(100, 200) + n1 := bgp.NewLabeledIPv6AddrPrefix(48, "2806:106e:19::", *labels) + path := NewPath(nil, n1, false, []bgp.PathAttributeInterface{}, time.Now(), false) + assert.True(t, m.Evaluate(path, nil)) + + labels = bgp.NewMPLSLabelStack(100, 200) + n2 := bgp.NewLabeledIPv6AddrPrefix(48, "1806:106e:19::", *labels) + path = NewPath(nil, n2, false, []bgp.PathAttributeInterface{}, time.Now(), false) + assert.False(t, m.Evaluate(path, nil)) +} + func TestLargeCommunityMatchAction(t *testing.T) { coms := []*bgp.LargeCommunity{ &bgp.LargeCommunity{ASN: 100, LocalData1: 100, LocalData2: 100}, |