Skip to content
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

Merged
merged 1 commit into from Jan 20, 2021

Conversation

rzalamena
Copy link
Member

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:

bfd
 profile slowtx
  transmit-interval 1000
  receive-interval 2000
 !
 profile fasttx
  transmit-interval 250
  receive-interval 250
 !
!

Configuration in show running-config:

bfd
 profile slowtx
  transmit-interval 1000
  receive-interval 1234
 !
 profile midtx
  passive-mode
 !
!

Before this PR:

Lines To Delete
===============
no hostname frr
no profile midtx
bfd
no receive-interval 1234

Lines To Add
============
bfd
receive-interval 2000
profile fasttx
profile fasttx
transmit-interval 250
profile fasttx
receive-interval 250

With this PR fix:

Lines To Delete
===============
no hostname frr
bfd
no profile midtx
bfd
profile slowtx
no receive-interval 1234

Lines To Add
============
bfd
profile slowtx
receive-interval 2000
bfd
profile fasttx
bfd
profile fasttx
transmit-interval 250
bfd
profile fasttx
receive-interval 250

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>
Copy link

@polychaeta polychaeta left a 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.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Jan 20, 2021

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/7891 c42dfbb
Date 01/20/2021
Start 10:55:33
Finish 11:34:45
Run-Time 39:12
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2021-01-20-10:55:33.txt
Log autoscript-2021-01-20-10:56:31.log.bz2
Memory 501 469 427

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-16605/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.5.0.3 (current is 4.3.0)
W: frr source: pkg-js-tools-test-is-missing
W: frr source: newer-standards-version 4.5.0.3 (current is 4.3.0)
W: frr-doc: changelog-file-missing-explicit-entry 7.5-0 -> 7.6-dev-20210120-03-gc42dfbb50-0 (missing) -> 7.6-dev-20210120-03-gc42dfbb50-0~deb10u1
W: frr-snmp: changelog-file-missing-explicit-entry 7.5-0 -> 7.6-dev-20210120-03-gc42dfbb50-0 (missing) -> 7.6-dev-20210120-03-gc42dfbb50-0~deb10u1
W: frr-pythontools: changelog-file-missing-explicit-entry 7.5-0 -> 7.6-dev-20210120-03-gc42dfbb50-0 (missing) -> 7.6-dev-20210120-03-gc42dfbb50-0~deb10u1
W: frr-rpki-rtrlib: changelog-file-missing-explicit-entry 7.5-0 -> 7.6-dev-20210120-03-gc42dfbb50-0 (missing) -> 7.6-dev-20210120-03-gc42dfbb50-0~deb10u1
W: frr: changelog-file-missing-explicit-entry 7.5-0 -> 7.6-dev-20210120-03-gc42dfbb50-0 (missing) -> 7.6-dev-20210120-03-gc42dfbb50-0~deb10u1

@donaldsharp donaldsharp merged commit 1546ae8 into FRRouting:master Jan 20, 2021
@rzalamena rzalamena deleted the fr-bfd-prof branch January 26, 2021 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants