summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-04-30 22:34:42 +0200
committerChristian Poessinger <christian@poessinger.com>2021-04-30 22:51:50 +0200
commit4a2c752303da9af69eaf1d4b95da8cfed797cfbd (patch)
treebbba79b2442a8b75dba163c18ce5809c5deed62d
parentd11a18f820b84a7d4af6ee0eccbfc0a2351a6f4e (diff)
downloadvyos-1x-4a2c752303da9af69eaf1d4b95da8cfed797cfbd.tar.gz
vyos-1x-4a2c752303da9af69eaf1d4b95da8cfed797cfbd.zip
bgp: T3504: add support for per-peer graceful shutdown
This commit has a dependecy on https://github.com/FRRouting/frr/issues/8403, thus support will be "commented out" by default.
-rw-r--r--data/templates/frr/bgp.frr.tmpl10
-rw-r--r--interface-definitions/include/bgp/neighbor-graceful-restart.xml.i25
-rw-r--r--interface-definitions/include/bgp/protocol-common-config.xml.i9
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py4
4 files changed, 46 insertions, 2 deletions
diff --git a/data/templates/frr/bgp.frr.tmpl b/data/templates/frr/bgp.frr.tmpl
index dafe45f59..2f67fa39e 100644
--- a/data/templates/frr/bgp.frr.tmpl
+++ b/data/templates/frr/bgp.frr.tmpl
@@ -35,6 +35,16 @@
{% if config.ebgp_multihop is defined and config.ebgp_multihop is not none %}
neighbor {{ neighbor }} ebgp-multihop {{ config.ebgp_multihop }}
{% endif %}
+{% if config.graceful_restart is defined and config.graceful_restart is not none %}
+{% if config.graceful_restart == 'enable' %}
+{% set graceful_restart = 'graceful-restart' %}
+{% elif config.graceful_restart == 'disable' %}
+{% set graceful_restart = 'graceful-restart-disable' %}
+{% elif config.graceful_restart == 'restart-helper' %}
+{% set graceful_restart = 'graceful-restart-helper' %}
+{% endif %}
+ neighbor {{ neighbor }} {{ graceful_restart }}
+{% endif %}
{% if config.local_as is defined and config.local_as is not none %}
{% for local_asn in config.local_as %}
neighbor {{ neighbor }} local-as {{ local_asn }} {{ 'no-prepend' if config.local_as[local_asn].no_prepend is defined }}
diff --git a/interface-definitions/include/bgp/neighbor-graceful-restart.xml.i b/interface-definitions/include/bgp/neighbor-graceful-restart.xml.i
new file mode 100644
index 000000000..25558cd5c
--- /dev/null
+++ b/interface-definitions/include/bgp/neighbor-graceful-restart.xml.i
@@ -0,0 +1,25 @@
+<!-- include start from bgp/neighbor-graceful-restart.xml.i -->
+<leafNode name="graceful-restart">
+ <properties>
+ <help>BGP graceful restart functionality</help>
+ <completionHelp>
+ <list>enable disable restart-helper</list>
+ </completionHelp>
+ <valueHelp>
+ <format>enable</format>
+ <description>Enable BGP graceful restart at peer level</description>
+ </valueHelp>
+ <valueHelp>
+ <format>disable</format>
+ <description>Disable BGP graceful restart at peer level</description>
+ </valueHelp>
+ <valueHelp>
+ <format>restart-helper</format>
+ <description>Enable BGP graceful restart helper only functionality</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(enable|disable|restart-helper)$</regex>
+ </constraint>
+ </properties>
+</leafNode>
+<!-- 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 1d5fe88b1..9c17780bf 100644
--- a/interface-definitions/include/bgp/protocol-common-config.xml.i
+++ b/interface-definitions/include/bgp/protocol-common-config.xml.i
@@ -1000,6 +1000,10 @@
#include <include/bgp/neighbor-disable-capability-negotiation.xml.i>
#include <include/bgp/neighbor-disable-connected-check.xml.i>
#include <include/bgp/neighbor-ebgp-multihop.xml.i>
+<!--
+ requires GitHub FRR issues #8403 to be fixed
+ bgp/neighbor-graceful-restart.xml.i
+-->
<node name="interface">
<properties>
<help>Interface parameters</help>
@@ -1435,6 +1439,11 @@
#include <include/bgp/neighbor-disable-capability-negotiation.xml.i>
#include <include/bgp/neighbor-disable-connected-check.xml.i>
#include <include/bgp/neighbor-ebgp-multihop.xml.i>
+<!--
+ requires GitHub FRR issues #8403 to be fixed
+ bgp/neighbor-graceful-restart.xml.i
+-->
+ #include <include/bgp/neighbor-graceful-restart.xml.i>
#include <include/bgp/neighbor-local-as.xml.i>
#include <include/bgp/neighbor-override-capability.xml.i>
#include <include/bgp/neighbor-passive.xml.i>
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index a8c8ff2a2..aca1dbe46 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -161,7 +161,7 @@ def verify(bgp):
# Check if neighbor has both ipv4 unicast and ipv4 labeled unicast configured at the same time.
if 'ipv4_unicast' in peer_config['address_family'] and 'ipv4_labeled_unicast' in peer_config['address_family']:
raise ConfigError(f'Neighbor "{peer}" cannot have both ipv4-unicast and ipv4-labeled-unicast configured at the same time!')
-
+
# Check if neighbor has both ipv6 unicast and ipv6 labeled unicast configured at the same time.
if 'ipv6_unicast' in peer_config['address_family'] and 'ipv6_labeled_unicast' in peer_config['address_family']:
raise ConfigError(f'Neighbor "{peer}" cannot have both ipv6-unicast and ipv6-labeled-unicast configured at the same time!')
@@ -214,7 +214,7 @@ def verify(bgp):
if dict_search(f'parameters.distance.global.{key}', bgp) == None:
raise ConfigError('Missing mandatory configuration option for '\
f'global administrative distance {key}!')
-
+
# Throw an error if the address family specific administrative distance parameters aren't all filled out.
if dict_search('address_family', bgp) == None:
pass