New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: fix frr-reload BFD profile support #7891
Conversation
Fix the handling of multiple BFD profiles by adding the appropriated code to push/pop contexts inside BFD configuration node. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution to FRR!
Click for style suggestions
To apply these suggestions:
curl -s https://gist.githubusercontent.com/polychaeta/1de8d1fa27e30d8f4ec1633756089ba8/raw/06820bb05a9e704fb37bf9063d2b75d61350e360/cr_7891_1611155115.diff | git apply
diff --git a/tools/frr-reload.py b/tools/frr-reload.py
index dca877dbf..8b76e009d 100755
--- a/tools/frr-reload.py
+++ b/tools/frr-reload.py
@@ -186,17 +186,17 @@ class Vtysh(object):
class Context(object):
"""
- A Context object represents a section of frr configuration such as:
-!
-interface swp3
- description swp3 -> r8's swp1
- ipv6 nd suppress-ra
- link-detect
-!
+ A Context object represents a section of frr configuration such as:
+ !
+ interface swp3
+ description swp3 -> r8's swp1
+ ipv6 nd suppress-ra
+ link-detect
+ !
-or a single line context object such as this:
+ or a single line context object such as this:
-ip forwarding
+ ip forwarding
"""
@@ -580,11 +580,13 @@ 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 (
+ 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)
@@ -895,9 +897,9 @@ end
ctx_keys.append(line)
elif (
- line.startswith('profile ')
+ line.startswith("profile ")
and len(ctx_keys) == 1
- and ctx_keys[0].startswith('bfd')
+ and ctx_keys[0].startswith("bfd")
):
# Save old context first
@@ -906,7 +908,7 @@ end
main_ctx_key = copy.deepcopy(ctx_keys)
log.debug(
"LINE %-50s: entering BFD profile sub-context, append to ctx_keys",
- line
+ line,
)
ctx_keys.append(line)
If you are a new contributor to FRR, please see our contributing guidelines.
After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-16605/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build: |
Summary
Fix the handling of multiple BFD profiles by adding the appropriated code to push/pop contexts inside BFD configuration node.
Sample Output of the Problem
Configuration in
/etc/frr/frr.conf:Configuration in
show running-config:Before this PR:
With this PR fix: