Skip to content

Commit a5cfd1d

Browse files
committed
bgp: T3504: add support for per-peer graceful shutdown
This commit has a dependecy on FRRouting/frr#8403, thus support will be "commented out" by default.
1 parent 53d1fa6 commit a5cfd1d

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

data/templates/frr/bgp.frr.tmpl

+10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@
3535
{% if config.ebgp_multihop is defined and config.ebgp_multihop is not none %}
3636
neighbor {{ neighbor }} ebgp-multihop {{ config.ebgp_multihop }}
3737
{% endif %}
38+
{% if config.graceful_restart is defined and config.graceful_restart is not none %}
39+
{% if config.graceful_restart == 'enable' %}
40+
{% set graceful_restart = 'graceful-restart' %}
41+
{% elif config.graceful_restart == 'disable' %}
42+
{% set graceful_restart = 'graceful-restart-disable' %}
43+
{% elif config.graceful_restart == 'restart-helper' %}
44+
{% set graceful_restart = 'graceful-restart-helper' %}
45+
{% endif %}
46+
neighbor {{ neighbor }} {{ graceful_restart }}
47+
{% endif %}
3848
{% if config.local_as is defined and config.local_as is not none %}
3949
{% for local_asn in config.local_as %}
4050
neighbor {{ neighbor }} local-as {{ local_asn }} {{ 'no-prepend' if config.local_as[local_asn].no_prepend is defined }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- include start from bgp/neighbor-graceful-restart.xml.i -->
2+
<leafNode name="graceful-restart">
3+
<properties>
4+
<help>BGP graceful restart functionality</help>
5+
<completionHelp>
6+
<list>enable disable restart-helper</list>
7+
</completionHelp>
8+
<valueHelp>
9+
<format>enable</format>
10+
<description>Enable BGP graceful restart at peer level</description>
11+
</valueHelp>
12+
<valueHelp>
13+
<format>disable</format>
14+
<description>Disable BGP graceful restart at peer level</description>
15+
</valueHelp>
16+
<valueHelp>
17+
<format>restart-helper</format>
18+
<description>Enable BGP graceful restart helper only functionality</description>
19+
</valueHelp>
20+
<constraint>
21+
<regex>^(enable|disable|restart-helper)$</regex>
22+
</constraint>
23+
</properties>
24+
</leafNode>
25+
<!-- include end -->

interface-definitions/include/bgp/protocol-common-config.xml.i

+9
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,10 @@
10001000
#include <include/bgp/neighbor-disable-capability-negotiation.xml.i>
10011001
#include <include/bgp/neighbor-disable-connected-check.xml.i>
10021002
#include <include/bgp/neighbor-ebgp-multihop.xml.i>
1003+
<!--
1004+
requires GitHub FRR issues #8403 to be fixed
1005+
bgp/neighbor-graceful-restart.xml.i
1006+
-->
10031007
<node name="interface">
10041008
<properties>
10051009
<help>Interface parameters</help>
@@ -1435,6 +1439,11 @@
14351439
#include <include/bgp/neighbor-disable-capability-negotiation.xml.i>
14361440
#include <include/bgp/neighbor-disable-connected-check.xml.i>
14371441
#include <include/bgp/neighbor-ebgp-multihop.xml.i>
1442+
<!--
1443+
requires GitHub FRR issues #8403 to be fixed
1444+
bgp/neighbor-graceful-restart.xml.i
1445+
-->
1446+
#include <include/bgp/neighbor-graceful-restart.xml.i>
14381447
#include <include/bgp/neighbor-local-as.xml.i>
14391448
#include <include/bgp/neighbor-override-capability.xml.i>
14401449
#include <include/bgp/neighbor-passive.xml.i>

src/conf_mode/protocols_bgp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def verify(bgp):
161161
# Check if neighbor has both ipv4 unicast and ipv4 labeled unicast configured at the same time.
162162
if 'ipv4_unicast' in peer_config['address_family'] and 'ipv4_labeled_unicast' in peer_config['address_family']:
163163
raise ConfigError(f'Neighbor "{peer}" cannot have both ipv4-unicast and ipv4-labeled-unicast configured at the same time!')
164-
164+
165165
# Check if neighbor has both ipv6 unicast and ipv6 labeled unicast configured at the same time.
166166
if 'ipv6_unicast' in peer_config['address_family'] and 'ipv6_labeled_unicast' in peer_config['address_family']:
167167
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):
214214
if dict_search(f'parameters.distance.global.{key}', bgp) == None:
215215
raise ConfigError('Missing mandatory configuration option for '\
216216
f'global administrative distance {key}!')
217-
217+
218218
# Throw an error if the address family specific administrative distance parameters aren't all filled out.
219219
if dict_search('address_family', bgp) == None:
220220
pass

0 commit comments

Comments
 (0)