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>
This commit is contained in:
Duncan Eastoe 2021-01-26 16:59:48 +00:00
parent ff6fd1cc8a
commit ec20380c34

View 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()
)