summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_bgp.py
diff options
context:
space:
mode:
authorCheeze_It <none@none.com>2021-01-17 16:32:45 -0700
committerCheeze_It <none@none.com>2021-01-20 14:42:17 -0700
commita0a88d2dea9710efd80b27b24b4f40b13c613768 (patch)
tree6eec8cbd3ee6d01f04224a57b6c96e73e64b24a8 /src/conf_mode/protocols_bgp.py
parent56ec3259b67c6441d992948a8bae95039194eb6c (diff)
downloadvyos-1x-a0a88d2dea9710efd80b27b24b4f40b13c613768.tar.gz
vyos-1x-a0a88d2dea9710efd80b27b24b4f40b13c613768.zip
bgp: T1875: Adding BGP listen range FRR feature
In this commit we are adding the FRR BGP listen range feature. Specifically it is useful for being able to specify a range in which BGP peers can connect to the local router.
Diffstat (limited to 'src/conf_mode/protocols_bgp.py')
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index de0148b2f..f8e34285e 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -94,7 +94,7 @@ def verify(bgp):
if tmp not in afi_config['prefix_list']:
# bail out early
continue
- # get_config_dict() mangles all '-' characters to '_' this is legitim, thus all our
+ # get_config_dict() mangles all '-' characters to '_' this is legitimate, thus all our
# compares will run on '_' as also '_' is a valid name for a prefix-list
prefix_list = afi_config['prefix_list'][tmp].replace('-', '_')
if afi == 'ipv4_unicast':
@@ -112,7 +112,13 @@ def verify(bgp):
route_map = afi_config['route_map'][tmp].replace('-', '_')
if dict_search(f'policy.route_map.{route_map}', asn_config) == None:
raise ConfigError(f'route-map "{route_map}" used for "{tmp}" does not exist!')
-
+
+ # Throw an error if a peer group is not configured for allow range
+ if 'listen' in asn_config:
+ if 'range' in asn_config['listen']:
+ for prefix in asn_config['listen']['range']:
+ if not 'peer_group' in asn_config['listen']['range'].get(prefix):
+ raise ConfigError(f'Listen range for prefix "{prefix}" has no peer group configured.')
return None