summaryrefslogtreecommitdiffstats
path: root/tools/frr-reload.py
diff options
context:
space:
mode:
authorDon Slice <dslice@cumulusnetworks.com>2018-08-09 23:24:24 +0200
committerDon Slice <dslice@cumulusnetworks.com>2018-08-10 18:59:24 +0200
commitd60f480010f7aeb28af246097894f873f8be4e75 (patch)
treed339242acc22ad4ed9ee1f99272cc0f4f1ca464d /tools/frr-reload.py
parentMerge pull request #2806 from opensourcerouting/vty-term-fd (diff)
downloadfrr-d60f480010f7aeb28af246097894f873f8be4e75.tar.xz
frr-d60f480010f7aeb28af246097894f873f8be4e75.zip
tools: correct frr-reload.py handling of bgp vni/exit-vni config
Problem reported that when a peer-group was added in certain configurations, it would be rejected because of the order of the commands put in by nclu. Issued turned out to be how frr-reload.py was handling the sub-sub-context of the vni under the address-family and subsequently how it handled the following exit-vni. Ticket: CM-21996 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Diffstat (limited to 'tools/frr-reload.py')
-rwxr-xr-xtools/frr-reload.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py
index a9f183ed7..9d1af27d6 100755
--- a/tools/frr-reload.py
+++ b/tools/frr-reload.py
@@ -413,7 +413,7 @@ end
ctx_keys = []
current_context_lines = []
- elif line in ["exit-address-family", "exit", "exit-vnc", "exit-vni"]:
+ elif line in ["exit-address-family", "exit", "exit-vnc"]:
# if this exit is for address-family ipv4 unicast, ignore the pop
if main_ctx_key:
self.save_contexts(ctx_keys, current_context_lines)
@@ -423,6 +423,15 @@ end
current_context_lines = []
log.debug('LINE %-50s: popping from subcontext to ctx%-50s', line, ctx_keys)
+ elif line == "exit-vni":
+ if sub_main_ctx_key:
+ self.save_contexts(ctx_keys, current_context_lines)
+
+ # Start a new context
+ ctx_keys = copy.deepcopy(sub_main_ctx_key)
+ current_context_lines = []
+ log.debug('LINE %-50s: popping from sub-subcontext to ctx%-50s', line, ctx_keys)
+
elif new_ctx is True:
if not main_ctx_key:
ctx_keys = [line, ]
@@ -436,11 +445,7 @@ end
elif (line.startswith("address-family ") or
line.startswith("vnc defaults") or
line.startswith("vnc l2-group") or
- line.startswith("vnc nve-group") or
- (line.startswith("vni ") and
- len(ctx_keys) == 2 and
- ctx_keys[0].startswith('router bgp') and
- ctx_keys[1] == 'address-family l2vpn evpn')):
+ line.startswith("vnc nve-group")):
main_ctx_key = []
# Save old context first
@@ -458,6 +463,18 @@ end
else:
ctx_keys.append(line)
+ elif ((line.startswith("vni ") and
+ len(ctx_keys) == 2 and
+ ctx_keys[0].startswith('router bgp') and
+ ctx_keys[1] == 'address-family l2vpn evpn')):
+
+ # Save old context first
+ self.save_contexts(ctx_keys, current_context_lines)
+ current_context_lines = []
+ sub_main_ctx_key = copy.deepcopy(ctx_keys)
+ log.debug('LINE %-50s: entering sub-sub-context, append to ctx_keys', line)
+ ctx_keys.append(line)
+
else:
# Continuing in an existing context, add non-commented lines to it
current_context_lines.append(line)