summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2021-01-20 22:39:02 +0100
committerGitHub <noreply@github.com>2021-01-20 22:39:02 +0100
commit1546ae8c261c65523233fc674a2786caf04f2ddb (patch)
treeedbdef748ee65691468b143c216b0bf63bedea46
parentMerge pull request #7832 from pjdruddy/snmp-test-infra (diff)
parenttools: fix frr-reload BFD profile support (diff)
downloadfrr-1546ae8c261c65523233fc674a2786caf04f2ddb.tar.xz
frr-1546ae8c261c65523233fc674a2786caf04f2ddb.zip
Merge pull request #7891 from opensourcerouting/fr-bfd-prof
tools: fix frr-reload BFD profile support
-rwxr-xr-xtools/frr-reload.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py
index 0aa5f1e51..dca877dbf 100755
--- a/tools/frr-reload.py
+++ b/tools/frr-reload.py
@@ -580,6 +580,18 @@ end
if line.startswith("!") or line.startswith("#"):
continue
+ if (len(ctx_keys) == 2
+ and ctx_keys[0].startswith('bfd')
+ and ctx_keys[1].startswith('profile ')
+ and line == 'end'):
+ log.debug('LINE %-50s: popping from sub context, %-50s', line, ctx_keys)
+
+ if main_ctx_key:
+ self.save_contexts(ctx_keys, current_context_lines)
+ ctx_keys = copy.deepcopy(main_ctx_key)
+ current_context_lines = []
+ continue
+
# one line contexts
# there is one exception though: ldpd accepts a 'router-id' clause
# as part of its 'mpls ldp' config context. If we are processing
@@ -882,6 +894,22 @@ end
)
ctx_keys.append(line)
+ elif (
+ line.startswith('profile ')
+ and len(ctx_keys) == 1
+ and ctx_keys[0].startswith('bfd')
+ ):
+
+ # Save old context first
+ self.save_contexts(ctx_keys, current_context_lines)
+ current_context_lines = []
+ main_ctx_key = copy.deepcopy(ctx_keys)
+ log.debug(
+ "LINE %-50s: entering BFD profile 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)