File tree Expand file tree Collapse file tree 5 files changed +34
-6
lines changed
Expand file tree Collapse file tree 5 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -160,8 +160,12 @@ def apply_config(node: Box, ngb: Box) -> None:
160160 global _config_name
161161 api .node_config (node ,_config_name ) # Remember that we have to do extra configuration
162162 for af in ('ipv4' ,'ipv6' ): # ... and add sessions that have to be cleared
163- if af in ngb :
163+ if af in ngb and '_src_vrf' not in ngb :
164164 data .append_to_list (node .bgp ,'_session_clear' ,ngb [af ])
165+ elif af in ngb and '_src_vrf' in ngb :
166+ for vname ,vdata in node .vrfs .items ():
167+ if vname == ngb ['_src_vrf' ]:
168+ data .append_to_list (node .vrfs [vname ].bgp ,'_session_clear' ,ngb [af ])
165169
166170'''
167171Apply attributes supported by bgp.policy plugin to a single neighbor
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ router bgp {{ bgp.as }}
7171{% endfor %}
7272{% endif %}
7373!
74- {% for ngb in bgp ._session_clear |default ([]) %}
75- do clear bgp {{ ngb }}
74+ do clear bgp *
75+ {% for vname ,vdata in (vrfs |default ({})).items () if vdata .bgp is defined %}
76+ do clear bgp vrf {{vname}} *
7677{% endfor %}
Original file line number Diff line number Diff line change @@ -35,8 +35,12 @@ def mark_plugin_config(node: Box, ngb: Box) -> None:
3535
3636 api .node_config (node ,_config_name ) # Remember that we have to do extra configuration
3737 for af in ('ipv4' ,'ipv6' ): # ... and add sessions that have to be cleared
38- if af in ngb :
38+ if af in ngb and '_src_vrf' not in ngb :
3939 data .append_to_list (node .bgp ,'_session_clear' ,ngb [af ])
40+ elif af in ngb and '_src_vrf' in ngb :
41+ for vname ,vdata in node .vrfs .items ():
42+ if vname == ngb ['_src_vrf' ]:
43+ data .append_to_list (node .vrfs [vname ].bgp ,'_session_clear' ,ngb [af ])
4044
4145'''
4246Apply attributes supported by bgp.session plugin to a single neighbor
Original file line number Diff line number Diff line change 7878updates:
7979{% for addr in bgp ._session_clear |default ([]) %}
8080{{ bgp_admin_state(addr,'default','disable') }}
81+
82+ {% if vrfs is defined %}
83+ {% for vname ,vdata in vrfs .items () if vdata .bgp is defined %}
84+ {% for addr in vdata .bgp ._session_clear |default ([]) %}
85+ {{ bgp_admin_state(addr,vname,'disable') }}
86+ {% endfor %}
87+ {% endfor %}
88+ {% endif %}
89+
8190{% endfor %}
8291{% for af in ['ipv4' ,'ipv6' ] %}
8392{% for n in bgp .neighbors if n [af ] is defined and (n [af ] is string or (af =='ipv6' and n .ipv 6)) %}
@@ -98,3 +107,11 @@ updates:
98107{% for addr in bgp ._session_clear |default ([]) %}
99108{{ bgp_admin_state(addr,'default','enable') }}
100109{% endfor %}
110+
111+ {% if vrfs is defined %}
112+ {% for vname ,vdata in vrfs .items () if vdata .bgp is defined %}
113+ {% for addr in vdata .bgp ._session_clear |default ([]) %}
114+ {{ bgp_admin_state(addr,vname,'enable') }}
115+ {% endfor %}
116+ {% endfor %}
117+ {% endif %}
Original file line number Diff line number Diff line change @@ -143,7 +143,6 @@ nodes:
143143 - 10.0.0.4
144144 - 10.1.0.2
145145 - 10.1.0.6
146- - 10.1.0.14
147146 advertise_loopback : true
148147 as : 65001
149148 community :
@@ -297,6 +296,8 @@ nodes:
297296 af :
298297 ipv4 : true
299298 bgp :
299+ _session_clear :
300+ - 10.1.0.14
300301 import :
301302 connected :
302303 auto : true
@@ -333,7 +334,6 @@ nodes:
333334 - link-bandwidth
334335 _session_clear :
335336 - 10.1.0.1
336- - 10.1.0.13
337337 - 10.0.0.3
338338 advertise_loopback : true
339339 as : 65002
@@ -448,6 +448,8 @@ nodes:
448448 af :
449449 ipv4 : true
450450 bgp :
451+ _session_clear :
452+ - 10.1.0.13
451453 import :
452454 connected :
453455 auto : true
You can’t perform that action at this time.
0 commit comments