summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/table/policy_test.go
diff options
context:
space:
mode:
authorTahir Azim <tazim@amazon.com>2020-12-02 05:08:27 +0000
committerTahir Azim <tahir.azim@gmail.com>2020-12-16 18:12:24 +1100
commit5aa7108d85b6926eca99978a2fb0e728176aae98 (patch)
tree42e6eeed7879c172378407ec4095490cd0f116c8 /internal/pkg/table/policy_test.go
parent066e791610596c9bb76cb15f1b3c91c1b620bc03 (diff)
Enable IPv6 and IPv4 labeled prefixes to match against prefix set in policy
Diffstat (limited to 'internal/pkg/table/policy_test.go')
-rw-r--r--internal/pkg/table/policy_test.go25
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},