From 3a90c7a333ef90fea6cd520483d5849fc979f614 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 16 Jun 2021 20:23:18 +0200 Subject: policy: T3631: migrate "set extcommunity-rt/soo" to "set extcommunity rt|soo" Thi adds a new configuration level "set extcommunity" which then holds rt and soo als leaf-nodes below. This is the foundational work required to properly implement T3624 ("BGP: add support for extended community bandwidth definition") --- interface-definitions/policy.xml.in | 39 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'interface-definitions/policy.xml.in') diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in index 195e074a3..1b37c93b0 100644 --- a/interface-definitions/policy.xml.in +++ b/interface-definitions/policy.xml.in @@ -1007,24 +1007,31 @@ - + - Set route target value - - txt - ASN:nn_or_IP_address:nn VPN extended community - + BGP extended community attribute - - - - Set Site of Origin value - - txt - ASN:nn_or_IP_address:nn VPN extended community - - - + + + + Set route target value + + txt + ASN:nn_or_IP_address:nn VPN extended community + + + + + + Set Site of Origin value + + txt + ASN:nn_or_IP_address:nn VPN extended community + + + + + Nexthop IP address -- cgit v1.2.3 From 36a6f3771fd78b3d035d44679411f5e648fb90f2 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 16 Jun 2021 20:41:36 +0200 Subject: policy: T3624: add extended community bandwith support to route-map --- data/templates/frr/policy.frr.tmpl | 3 +++ interface-definitions/policy.xml.in | 24 ++++++++++++++++++++++++ smoketest/scripts/cli/test_policy.py | 17 +++++++++++++++++ 3 files changed, 44 insertions(+) (limited to 'interface-definitions/policy.xml.in') diff --git a/data/templates/frr/policy.frr.tmpl b/data/templates/frr/policy.frr.tmpl index a16eacdef..b5649b44e 100644 --- a/data/templates/frr/policy.frr.tmpl +++ b/data/templates/frr/policy.frr.tmpl @@ -247,6 +247,9 @@ route-map {{ route_map }} {{ rule_config.action }} {{ rule }} {% if rule_config.set.distance is defined and rule_config.set.distance is not none %} set distance {{ rule_config.set.distance }} {% endif %} +{% if rule_config.set.extcommunity is defined and rule_config.set.extcommunity.bandwidth is defined and rule_config.set.extcommunity.bandwidth is not none %} + set extcommunity bandwidth {{ rule_config.set.extcommunity.bandwidth }} +{% endif %} {% if rule_config.set.extcommunity is defined and rule_config.set.extcommunity.rt is defined and rule_config.set.extcommunity.rt is not none %} set extcommunity rt {{ rule_config.set.extcommunity.rt }} {% endif %} diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in index 1b37c93b0..7bee8d635 100644 --- a/interface-definitions/policy.xml.in +++ b/interface-definitions/policy.xml.in @@ -1012,6 +1012,30 @@ BGP extended community attribute + + + Bandwidth value in Mbps + + cumulative num-multipaths + + + u32:1-25600 + Bandwidth value in Mbps + + + cumulative + Cumulative bandwidth of all multipaths (outbound-only) + + + num-multipaths + Internally computed bandwidth based on number of multipaths (outbound-only) + + + + ^(cumulative|num-multipaths)$ + + + Set route target value diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py index bfa44088e..2d7b78048 100755 --- a/smoketest/scripts/cli/test_policy.py +++ b/smoketest/scripts/cli/test_policy.py @@ -773,6 +773,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): 'as-path-prepend' : '1234567890 987654321', 'atomic-aggregate' : '', 'distance' : '110', + 'extcommunity-bw' : '20000', 'extcommunity-rt' : '123:456', 'extcommunity-soo' : '456:789', 'ipv6-next-hop-global': '2001::1', @@ -791,6 +792,18 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): }, }, }, + 'bandwidth-configuration' : { + 'rule' : { + '10' : { + 'action' : 'deny', + 'set' : { + 'as-path-prepend' : '100 100', + 'distance' : '200', + 'extcommunity-bw' : 'num-multipaths', + }, + }, + }, + }, } self.cli_set(['policy', 'access-list', access_list, 'rule', '10', 'action', 'permit']) @@ -898,6 +911,8 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): self.cli_set(path + ['rule', rule, 'set', 'atomic-aggregate']) if 'distance' in rule_config['set']: self.cli_set(path + ['rule', rule, 'set', 'distance', rule_config['set']['distance']]) + if 'extcommunity-bw' in rule_config['set']: + self.cli_set(path + ['rule', rule, 'set', 'extcommunity', 'bandwidth', rule_config['set']['extcommunity-bw']]) if 'extcommunity-rt' in rule_config['set']: self.cli_set(path + ['rule', rule, 'set', 'extcommunity', 'rt', rule_config['set']['extcommunity-rt']]) if 'extcommunity-soo' in rule_config['set']: @@ -1041,6 +1056,8 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): tmp += 'atomic-aggregate' elif 'distance' in rule_config['set']: tmp += 'distance ' + rule_config['set']['distance'] + elif 'extcommunity-bw' in rule_config['set']: + tmp += 'extcommunity bandwidth' + rule_config['set']['extcommunity-bw'] elif 'extcommunity-rt' in rule_config['set']: tmp += 'extcommunity rt' + rule_config['set']['extcommunity-rt'] elif 'extcommunity-soo' in rule_config['set']: -- cgit v1.2.3 From 53d32756f08b76f87f86ab21ef4b542e2e2b0562 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 16 Jun 2021 20:41:39 +0200 Subject: policy: T3624: remove duplicate CLI node for "bgp-extcommunity-rt" Key was already present as "extcommunity-rt". --- interface-definitions/policy.xml.in | 9 --------- 1 file changed, 9 deletions(-) (limited to 'interface-definitions/policy.xml.in') diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in index 7bee8d635..8cba17330 100644 --- a/interface-definitions/policy.xml.in +++ b/interface-definitions/policy.xml.in @@ -925,15 +925,6 @@ - - - Set route target value - - <aa:nn> - ExtCommunity in format: asn:value - - - Border Gateway Protocol (BGP) communities matching a community-list -- cgit v1.2.3 From 1db31230890811d701a3d64c1571e3d4bfa4b3d4 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 17 Jun 2021 19:04:47 +0200 Subject: route-map: T3632: fix invalid validation regex for extcommunity-rt|soo Use the validation string/system available within vyos-1x. This also works on VyOS 1.2 series systems. --- interface-definitions/policy.xml.in | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'interface-definitions/policy.xml.in') diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in index 8cba17330..6a002cc20 100644 --- a/interface-definitions/policy.xml.in +++ b/interface-definitions/policy.xml.in @@ -1031,18 +1031,34 @@ Set route target value - txt - ASN:nn_or_IP_address:nn VPN extended community + ASN:NN + based on autonomous system number + + + IP:NN + Based on a router-id IP address + + ^((?:[0-9]{1,3}\.){3}[0-9]{1,3}|\d+):\d+$ + + Should be in form: ASN:NN or IPADDR:NN where ASN is autonomous system number Set Site of Origin value - txt - ASN:nn_or_IP_address:nn VPN extended community + ASN:NN + based on autonomous system number + + + IP:NN + Based on a router-id IP address + + ^((?:[0-9]{1,3}\.){3}[0-9]{1,3}|\d+):\d+$ + + Should be in form: ASN:NN or IPADDR:NN where ASN is autonomous system number -- cgit v1.2.3