summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Eastoe <duncan.eastoe@att.com>2021-01-26 16:59:48 +0000
committerDuncan Eastoe <duncan.eastoe@att.com>2021-01-27 12:19:52 +0000
commitec20380c347b92dddee342b46995dce512a571e4 (patch)
treec02616b3373f4e1988555635c437da5022bb0c76
parentff6fd1cc8a7fb8e4b3bb91e1a639a5c39a280ef1 (diff)
tests: more robust show route header stripping
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>
-rw-r--r--tests/topotests/all-protocol-startup/test_all_protocol_startup.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
index 24bef07ec2..d4c831e1c4 100644
--- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
+++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
@@ -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()
)