From ec20380c347b92dddee342b46995dce512a571e4 Mon Sep 17 00:00:00 2001 From: Duncan Eastoe Date: Tue, 26 Jan 2021 16:59:48 +0000 Subject: [PATCH 1/2] 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 --- .../all-protocol-startup/test_all_protocol_startup.py | 4 ++-- 1 file 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() ) From e3490d1fa24fc2d2979d4799cfceb1585bfd801c Mon Sep 17 00:00:00 2001 From: Duncan Eastoe Date: Tue, 26 Jan 2021 12:19:05 +0000 Subject: [PATCH 2/2] lib: restore blank line after show route header In 5a3cf85391b3665b5344d577e98aaa29a1927818 the trailing empty line following the "show ip(v6) route" header was removed. Restore it for consistency. Signed-off-by: Duncan Eastoe --- lib/route_types.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/route_types.pl b/lib/route_types.pl index 759e9b4729..8c216e13bd 100755 --- a/lib/route_types.pl +++ b/lib/route_types.pl @@ -130,7 +130,7 @@ sub codelist { $str =~ s/ $//; push @lines, $str . "\\n\" \\\n"; push @lines, " \" > - selected route, * - FIB route, q - queued, r - rejected, b - backup\\n\""; - push @lines, " \" t - trapped, o - offload failure\\n\""; + push @lines, " \" t - trapped, o - offload failure\\n\\n\""; return join("", @lines);