summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/frr/bgpd.frr.tmpl8
-rw-r--r--interface-definitions/include/bgp/afi-route-map-vpn.xml.i17
-rw-r--r--interface-definitions/include/bgp/protocol-common-config.xml.i2
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py2
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py5
5 files changed, 34 insertions, 0 deletions
diff --git a/data/templates/frr/bgpd.frr.tmpl b/data/templates/frr/bgpd.frr.tmpl
index 143960e6b..96815836b 100644
--- a/data/templates/frr/bgpd.frr.tmpl
+++ b/data/templates/frr/bgpd.frr.tmpl
@@ -380,6 +380,14 @@ router bgp {{ local_as }} {{ 'vrf ' ~ vrf if vrf is defined and vrf is not none
{% endif %}
{% endif %}
{% endif %}
+{% if afi_config.route_map is defined and afi_config.route_map.vpn is defined and afi_config.route_map.vpn is not none %}
+{% if afi_config.route_map.vpn.export is defined and afi_config.route_map.vpn.export is not none %}
+ route-map vpn export {{ afi_config.route_map.vpn.export }}
+{% endif %}
+{% if afi_config.route_map.vpn.import is defined and afi_config.route_map.vpn.import is not none %}
+ route-map vpn import {{ afi_config.route_map.vpn.import }}
+{% endif %}
+{% endif %}
{% if afi_config.vni is defined and afi_config.vni is not none %}
{% for vni, vni_config in afi_config.vni.items() %}
vni {{ vni }}
diff --git a/interface-definitions/include/bgp/afi-route-map-vpn.xml.i b/interface-definitions/include/bgp/afi-route-map-vpn.xml.i
new file mode 100644
index 000000000..e6be113c5
--- /dev/null
+++ b/interface-definitions/include/bgp/afi-route-map-vpn.xml.i
@@ -0,0 +1,17 @@
+<!-- include start from bgp/afi-route-map-vpn.xml.i -->
+<node name="route-map">
+ <properties>
+ <help>Route-map to filter route updates to/from this peer</help>
+ </properties>
+ <children>
+ <node name="vpn">
+ <properties>
+ <help>Between current address-family and VPN</help>
+ </properties>
+ <children>
+ #include <include/bgp/afi-route-map-export-import.xml.i>
+ </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 6fb9adf93..a971c52b8 100644
--- a/interface-definitions/include/bgp/protocol-common-config.xml.i
+++ b/interface-definitions/include/bgp/protocol-common-config.xml.i
@@ -118,6 +118,7 @@
</children>
</tagNode>
#include <include/bgp/afi-rd.xml.i>
+ #include <include/bgp/afi-route-map-vpn.xml.i>
<node name="route-target">
<properties>
<help>Specify route distinguisher</help>
@@ -518,6 +519,7 @@
</children>
</tagNode>
#include <include/bgp/afi-rd.xml.i>
+ #include <include/bgp/afi-route-map-vpn.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 dbe1a81d6..f535408db 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -751,6 +751,8 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.assertIn(f' import vpn', afi_config)
self.assertIn(f' label vpn export {label}', afi_config)
self.assertIn(f' rd vpn export {rd}', afi_config)
+ self.assertIn(f' route-map vpn export {route_map_out}', afi_config)
+ self.assertIn(f' route-map vpn import {route_map_in}', afi_config)
self.assertIn(f' exit-address-family', afi_config)
afi_config = self.getFRRconfig(f' address-family ipv4 unicast', endsection='exit-address-family', daemon='bgpd')
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index bc7acaf6c..7d05eed9f 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -250,6 +250,11 @@ def verify(bgp):
raise ConfigError('Please unconfigure VPN to VRF commands before '\
'using "import vrf" commands!')
+ # Verify that the export/import route-maps do exist
+ for export_import in ['export', 'import']:
+ tmp = dict_search(f'route_map.vpn.{export_import}', afi_config)
+ if tmp: verify_route_map(tmp, bgp)
+
if afi in ['l2vpn_evpn'] and 'vrf' not in bgp:
# Some L2VPN EVPN AFI options are only supported under VRF
if 'vni' in afi_config: