]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: more robust show route header stripping
authorDuncan Eastoe <duncan.eastoe@att.com>
Tue, 26 Jan 2021 16:59:48 +0000 (16:59 +0000)
committerDuncan Eastoe <duncan.eastoe@att.com>
Wed, 27 Jan 2021 12:19:52 +0000 (12:19 +0000)
In test_converge_protocols() use sed to match the "show ip(v6) route"
header and strip it, rather than using tail which requires hardcoding
the expected length of the header (which is subject to change).

Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
tests/topotests/all-protocol-startup/test_all_protocol_startup.py

index 24bef07ec25e12eb78d8d52fd53eb254da86e846..d4c831e1c483ca92dbf16c5562f8a0c6498e804a 100644 (file)
@@ -344,7 +344,7 @@ def test_converge_protocols():
         actual = (
             net["r%s" % i]
             .cmd(
-                'vtysh -c "show ip route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
+                'vtysh -c "show ip route" | sed -e \'/^Codes: /,/^\s*$/d\' | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
             )
             .rstrip()
         )
@@ -375,7 +375,7 @@ def test_converge_protocols():
         actual = (
             net["r%s" % i]
             .cmd(
-                'vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
+                'vtysh -c "show ipv6 route" | sed -e \'/^Codes: /,/^\s*$/d\' | env LC_ALL=en_US.UTF-8 sort 2> /dev/null'
             )
             .rstrip()
         )