summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-04-27 22:33:55 +0200
committerChristian Breunig <christian@breunig.cc>2023-04-27 22:34:37 +0200
commit78a9eaaf8be3daa980b91abf254d484075d103e8 (patch)
tree73b529be0f6bb2b49da1e73c35fd8b3555ff32cb
parente624d9c6cac6ea37ffbcb068790bcb8aa9e8e6e2 (diff)
downloadvyos-1x-78a9eaaf8be3daa980b91abf254d484075d103e8.tar.gz
vyos-1x-78a9eaaf8be3daa980b91abf254d484075d103e8.zip
bgp: T5010: add verify() for L2VPN EVPN route-distinguisher and route-target
Without the change users might get confused as the setting is specified on the VyOS CLI but never makes it to FRR due to an internal FRR check.
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index 6e6b3fa96..b23584bdb 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -441,7 +441,6 @@ def verify(bgp):
f'{afi} administrative distance {key}!')
if afi in ['ipv4_unicast', 'ipv6_unicast']:
-
vrf_name = bgp['vrf'] if dict_search('vrf', bgp) else 'default'
# Verify if currant VRF contains rd and route-target options
# and does not exist in import list in other VRFs
@@ -490,6 +489,15 @@ def verify(bgp):
tmp = dict_search(f'route_map.vpn.{export_import}', afi_config)
if tmp: verify_route_map(tmp, bgp)
+ # Checks only required for L2VPN EVPN
+ if afi in ['l2vpn_evpn']:
+ if 'vni' in afi_config:
+ for vni, vni_config in afi_config['vni'].items():
+ if 'rd' in vni_config and 'advertise_all_vni' not in afi_config:
+ raise ConfigError('BGP EVPN "rd" requires "advertise-all-vni" to be set!')
+ if 'route_target' in vni_config and 'advertise_all_vni' not in afi_config:
+ raise ConfigError('BGP EVPN "route-target" requires "advertise-all-vni" to be set!')
+
return None
def generate(bgp):