summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-03-07 21:49:50 +0100
committerChristian Poessinger <christian@poessinger.com>2021-03-07 21:49:50 +0100
commit87bbe75152e3e0625776587c1fd4cd7104319fe1 (patch)
tree7259806059cb0a9f574dffa2123faac209a5dcf3
parentdd35eb76153191bc487e3ea23c3e73c753ec1d4b (diff)
downloadvyos-1x-87bbe75152e3e0625776587c1fd4cd7104319fe1.tar.gz
vyos-1x-87bbe75152e3e0625776587c1fd4cd7104319fe1.zip
bgp: T3391: add per AFI maximum-paths support
* set protocols bgp ASN address-family ipv4-unicast maximum-paths * set protocols bgp ASN address-family ipv4-unicast maximum-paths-ibgp * set protocols bgp ASN address-family ipv6-unicast maximum-paths * set protocols bgp ASN address-family ipv6-unicast maximum-paths-ibgp
-rw-r--r--data/templates/frr/bgp.frr.tmpl6
-rw-r--r--interface-definitions/include/bgp-afi-maximum-paths.xml.i26
-rw-r--r--interface-definitions/protocols-bgp.xml.in2
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py21
4 files changed, 55 insertions, 0 deletions
diff --git a/data/templates/frr/bgp.frr.tmpl b/data/templates/frr/bgp.frr.tmpl
index 9340795bc..b7abbff5c 100644
--- a/data/templates/frr/bgp.frr.tmpl
+++ b/data/templates/frr/bgp.frr.tmpl
@@ -208,6 +208,12 @@ router bgp {{ asn }}
aggregate-address {{ ip }}{{ ' as-set' if afi_config.aggregate_address[ip].as_set is defined }}{{ ' summary-only' if afi_config.aggregate_address[ip].summary_only is defined }}
{% endfor %}
{% endif %}
+{% if afi_config.maximum_paths is defined and afi_config.maximum_paths is not none %}
+ maximum-paths {{ afi_config.maximum_paths }}
+{% endif %}
+{% if afi_config.maximum_paths_ibgp is defined and afi_config.maximum_paths_ibgp is not none %}
+ maximum-paths ibgp {{ afi_config.maximum_paths_ibgp }}
+{% endif %}
{% if afi_config.redistribute is defined and afi_config.redistribute is not none %}
{% for protocol in afi_config.redistribute %}
{% if protocol == 'table' %}
diff --git a/interface-definitions/include/bgp-afi-maximum-paths.xml.i b/interface-definitions/include/bgp-afi-maximum-paths.xml.i
new file mode 100644
index 000000000..5ee0d13a3
--- /dev/null
+++ b/interface-definitions/include/bgp-afi-maximum-paths.xml.i
@@ -0,0 +1,26 @@
+<!-- included start from bgp-afi-maximum-paths.xml.i -->
+<leafNode name="maximum-paths">
+ <properties>
+ <help>Forward packets over multiple paths (eBGP)</help>
+ <valueHelp>
+ <format>u32:1-256</format>
+ <description>Number of paths to consider</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-256"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="maximum-paths-ibgp">
+ <properties>
+ <help>Forward packets over multiple paths (iBGP)</help>
+ <valueHelp>
+ <format>u32:1-256</format>
+ <description>Number of paths to consider</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-256"/>
+ </constraint>
+ </properties>
+</leafNode>
+<!-- included end -->
diff --git a/interface-definitions/protocols-bgp.xml.in b/interface-definitions/protocols-bgp.xml.in
index cc4f9d2b6..c2a123313 100644
--- a/interface-definitions/protocols-bgp.xml.in
+++ b/interface-definitions/protocols-bgp.xml.in
@@ -62,6 +62,7 @@
#include <include/bgp-route-map.xml.i>
</children>
</tagNode>
+ #include <include/bgp-afi-maximum-paths.xml.i>
<node name="redistribute">
<properties>
<help>Redistribute routes from other protocols into BGP</help>
@@ -171,6 +172,7 @@
#include <include/bgp-route-map.xml.i>
</children>
</tagNode>
+ #include <include/bgp-afi-maximum-paths.xml.i>
<node name="redistribute">
<properties>
<help>Redistribute routes from other protocols into BGP</help>
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index 8d42fafc3..f22b47551 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -131,6 +131,9 @@ peer_group_config = {
def getFRRBGPconfig():
return cmd(f'vtysh -c "show run" | sed -n "/^router bgp {ASN}/,/^!/p"')
+def getFRRBgpAfiConfig(afi):
+ return cmd(f'vtysh -c "show run" | sed -n "/^router bgp {ASN}/,/^!/p" | sed -n "/^ address-family {afi} unicast/,/^ exit-address-family/p"')
+
def getFRRBGPVNIconfig(vni):
return cmd(f'vtysh -c "show run" | sed -n "/^ vni {vni}/,/^!/p"')
@@ -218,6 +221,10 @@ class TestProtocolsBGP(unittest.TestCase):
router_id = '127.0.0.1'
local_pref = '500'
stalepath_time = '60'
+ max_path_v4 = '2'
+ max_path_v4ibgp = '4'
+ max_path_v6 = '8'
+ max_path_v6ibgp = '16'
self.session.set(base_path + ['parameters', 'router-id', router_id])
self.session.set(base_path + ['parameters', 'log-neighbor-changes'])
@@ -229,6 +236,12 @@ class TestProtocolsBGP(unittest.TestCase):
self.session.set(base_path + ['parameters', 'graceful-shutdown'])
self.session.set(base_path + ['parameters', 'ebgp-requires-policy'])
+ # AFI maximum path support
+ self.session.set(base_path + ['address-family', 'ipv4-unicast', 'maximum-paths', max_path_v4])
+ self.session.set(base_path + ['address-family', 'ipv4-unicast', 'maximum-paths-ibgp', max_path_v4ibgp])
+ self.session.set(base_path + ['address-family', 'ipv6-unicast', 'maximum-paths', max_path_v6])
+ self.session.set(base_path + ['address-family', 'ipv6-unicast', 'maximum-paths-ibgp', max_path_v6ibgp])
+
# commit changes
self.session.commit()
@@ -243,6 +256,14 @@ class TestProtocolsBGP(unittest.TestCase):
self.assertIn(f' bgp graceful-shutdown', frrconfig)
self.assertNotIn(f'bgp ebgp-requires-policy', frrconfig)
+ afiv4_config = getFRRBgpAfiConfig('ipv4')
+ self.assertIn(f' maximum-paths {max_path_v4}', afiv4_config)
+ self.assertIn(f' maximum-paths ibgp {max_path_v4ibgp}', afiv4_config)
+
+ afiv6_config = getFRRBgpAfiConfig('ipv6')
+ self.assertIn(f' maximum-paths {max_path_v6}', afiv6_config)
+ self.assertIn(f' maximum-paths ibgp {max_path_v6ibgp}', afiv6_config)
+
def test_bgp_02_neighbors(self):
# Test out individual neighbor configuration items, not all of them are