summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/frr/bgpd.frr.tmpl6
-rw-r--r--interface-definitions/include/bgp/afi-export-import.xml.i28
-rw-r--r--interface-definitions/include/bgp/protocol-common-config.xml.i2
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py20
4 files changed, 56 insertions, 0 deletions
diff --git a/data/templates/frr/bgpd.frr.tmpl b/data/templates/frr/bgpd.frr.tmpl
index aa297876b..a21a2fefe 100644
--- a/data/templates/frr/bgpd.frr.tmpl
+++ b/data/templates/frr/bgpd.frr.tmpl
@@ -308,6 +308,12 @@ router bgp {{ local_as }} {{ 'vrf ' ~ vrf if vrf is defined and vrf is not none
{% endfor %}
{% endif %}
{% endif %}
+{% if afi_config.export is defined and afi_config.export.vpn is defined %}
+ export vpn
+{% endif %}
+{% if afi_config.import is defined and afi_config.import.vpn is defined %}
+ import vpn
+{% 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-export-import.xml.i b/interface-definitions/include/bgp/afi-export-import.xml.i
new file mode 100644
index 000000000..ad54c723e
--- /dev/null
+++ b/interface-definitions/include/bgp/afi-export-import.xml.i
@@ -0,0 +1,28 @@
+<!-- include start from bgp/afi-export-import.xml.i -->
+<node name="export">
+ <properties>
+ <help>Export routes from this address-family</help>
+ </properties>
+ <children>
+ <leafNode name="vpn">
+ <properties>
+ <help>to/from default instance VPN RIB</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+<node name="import">
+ <properties>
+ <help>Import routes to this address-family</help>
+ </properties>
+ <children>
+ <leafNode name="vpn">
+ <properties>
+ <help>to/from default instance VPN RIB</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </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 7ec320b61..da32fcc52 100644
--- a/interface-definitions/include/bgp/protocol-common-config.xml.i
+++ b/interface-definitions/include/bgp/protocol-common-config.xml.i
@@ -478,6 +478,7 @@
</tagNode>
</children>
</node>
+ #include <include/bgp/afi-export-import.xml.i>
<tagNode name="network">
<properties>
<help>BGP network</help>
@@ -638,6 +639,7 @@
</tagNode>
</children>
</node>
+ #include <include/bgp/afi-export-import.xml.i>
<tagNode name="network">
<properties>
<help>Import BGP network/prefix into multicast IPv6 RIB</help>
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index c3a2ffbf9..22e892e26 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -710,5 +710,25 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.assertIn(f'router bgp {ASN}', frrconfig)
self.assertIn(f' neighbor {neighbor} solo', frrconfig)
+ def test_bgp_14_vpn(self):
+ remote_asn = str(int(ASN) + 150)
+ neighbor = '192.0.2.55'
+
+ 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'])
+
+ # commit changes
+ self.cli_commit()
+
+ # Verify FRR bgpd configuration
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
+ self.assertIn(f'router bgp {ASN}', frrconfig)
+ self.assertIn(f' address-family ipv6 unicast', frrconfig)
+ self.assertIn(f' export vpn', frrconfig)
+ self.assertIn(f' import vpn', frrconfig)
+ self.assertIn(f' exit-address-family', frrconfig)
+
if __name__ == '__main__':
unittest.main(verbosity=2) \ No newline at end of file