summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-18 11:12:08 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-18 12:57:14 +0200
commit73c0e87109855f9b3372540b4ace03c6fb517c2a (patch)
tree1431a67fbd2df5fc6b8f24025eb0800304ca08c7
parent4058e389f1ca1398ad4fca790839c638a58f7aa3 (diff)
downloadvyos-1x-73c0e87109855f9b3372540b4ace03c6fb517c2a.tar.gz
vyos-1x-73c0e87109855f9b3372540b4ace03c6fb517c2a.zip
bgp: T3759: add l3vpn "label vpn export" commands
Add the following new commands: * set protocols bgp address-family ipv4-unicast label vpn export (auto | 0-1048575) * set protocols bgp address-family ipv6-unicast label vpn export (auto | 0-1048575)
-rw-r--r--data/templates/frr/bgpd.frr.tmpl3
-rw-r--r--interface-definitions/include/bgp/afi-label.xml.i36
-rw-r--r--interface-definitions/include/bgp/protocol-common-config.xml.i6
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py7
4 files changed, 48 insertions, 4 deletions
diff --git a/data/templates/frr/bgpd.frr.tmpl b/data/templates/frr/bgpd.frr.tmpl
index 2f2e94ce0..3ee6a5cb3 100644
--- a/data/templates/frr/bgpd.frr.tmpl
+++ b/data/templates/frr/bgpd.frr.tmpl
@@ -321,6 +321,9 @@ router bgp {{ local_as }} {{ 'vrf ' ~ vrf if vrf is defined and vrf is not none
{% endfor %}
{% endif %}
{% endif %}
+{% if afi_config.label is defined and afi_config.label.vpn is defined and afi_config.label.vpn.export is defined and afi_config.label.vpn.export is not none %}
+ label vpn export {{ afi_config.label.vpn.export }}
+{% endif %}
{% if afi_config.local_install is defined and afi_config.local_install is not none %}
{% for interface in afi_config.local_install.interface %}
local-install {{ interface }}
diff --git a/interface-definitions/include/bgp/afi-label.xml.i b/interface-definitions/include/bgp/afi-label.xml.i
new file mode 100644
index 000000000..f8cf57a9c
--- /dev/null
+++ b/interface-definitions/include/bgp/afi-label.xml.i
@@ -0,0 +1,36 @@
+<!-- include start from bgp/afi-label.xml.i -->
+<node name="label">
+ <properties>
+ <help>Label value for VRF</help>
+ </properties>
+ <children>
+ <node name="vpn">
+ <properties>
+ <help>Between current address-family and vpn</help>
+ </properties>
+ <children>
+ <leafNode name="export">
+ <properties>
+ <help>For routes leaked from current address-family to VPN</help>
+ <completionHelp>
+ <list>auto</list>
+ </completionHelp>
+ <valueHelp>
+ <format>auto</format>
+ <description>Automatically assign a label</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:0-1048575</format>
+ <description>Label Value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-1048575"/>
+ <regex>^(auto)$</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/bgp/protocol-common-config.xml.i b/interface-definitions/include/bgp/protocol-common-config.xml.i
index 6a4e1de3f..58e3c5798 100644
--- a/interface-definitions/include/bgp/protocol-common-config.xml.i
+++ b/interface-definitions/include/bgp/protocol-common-config.xml.i
@@ -94,6 +94,8 @@
</children>
</node>
#include <include/bgp/afi-export-import.xml.i>
+ #include <include/bgp/afi-label.xml.i>
+ #include <include/bgp/afi-maximum-paths.xml.i>
<tagNode name="network">
<properties>
<help>BGP network</help>
@@ -115,7 +117,6 @@
#include <include/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>
@@ -480,6 +481,8 @@
</children>
</node>
#include <include/bgp/afi-export-import.xml.i>
+ #include <include/bgp/afi-label.xml.i>
+ #include <include/bgp/afi-maximum-paths.xml.i>
<tagNode name="network">
<properties>
<help>BGP network</help>
@@ -496,7 +499,6 @@
#include <include/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 7a470abf9..d3d061229 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -730,11 +730,14 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
remote_asn = str(int(ASN) + 150)
neighbor = '192.0.2.55'
vrf_name = 'red'
+ label = 'auto'
self.cli_set(base_path + ['local-as', ASN])
# testing only one AFI is sufficient as it's generic code
- self.cli_set(base_path + ['address-family', 'ipv6-unicast', 'export', 'vpn'])
- self.cli_set(base_path + ['address-family', 'ipv6-unicast', 'import', 'vpn'])
+ for afi in ['ipv4-unicast', 'ipv6-unicast']:
+ self.cli_set(base_path + ['address-family', afi, 'export', 'vpn'])
+ self.cli_set(base_path + ['address-family', afi, 'import', 'vpn'])
+ self.cli_set(base_path + ['address-family', afi, 'label', 'vpn', 'export', label])
# commit changes
self.cli_commit()