From 6c97c0cbf2bc184372e0533a46a9770217307a62 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Mon, 17 Jul 2017 21:14:28 -0700 Subject: [PATCH] ldp-topo1: Make the implicit label optional to pass old frr code as well Signed-off-by: Martin Winter --- .../ldp-topo1/r1/show_ipv4_route.ref | 6 +++--- .../ldp-topo1/r2/show_ipv4_route.ref | 6 +++--- .../ldp-topo1/r3/show_ipv4_route.ref | 6 +++--- .../ldp-topo1/r4/show_ipv4_route.ref | 8 ++++---- tests/topotests/ldp-topo1/test_ldp_topo1.py | 19 ++++++++++++++----- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/tests/topotests/ldp-topo1/r1/show_ipv4_route.ref b/tests/topotests/ldp-topo1/r1/show_ipv4_route.ref index aadf03aa49..73c3fd9d20 100644 --- a/tests/topotests/ldp-topo1/r1/show_ipv4_route.ref +++ b/tests/topotests/ldp-topo1/r1/show_ipv4_route.ref @@ -1,7 +1,7 @@ O 1.1.1.1/32 [110/0] is directly connected, lo -O>* 2.2.2.2/32 [110/10] via 10.0.1.2, r1-eth0, label xxx +O>* 2.2.2.2/32 [110/10] via 10.0.1.2, r1-eth0, label y O>* 3.3.3.3/32 [110/20] via 10.0.1.2, r1-eth0, label xxx O>* 4.4.4.4/32 [110/20] via 10.0.1.2, r1-eth0, label xxx O 10.0.1.0/24 [110/10] is directly connected, r1-eth0 -O>* 10.0.2.0/24 [110/20] via 10.0.1.2, r1-eth0, label xxx -O>* 10.0.3.0/24 [110/20] via 10.0.1.2, r1-eth0, label xxx +O>* 10.0.2.0/24 [110/20] via 10.0.1.2, r1-eth0, label y +O>* 10.0.3.0/24 [110/20] via 10.0.1.2, r1-eth0, label y diff --git a/tests/topotests/ldp-topo1/r2/show_ipv4_route.ref b/tests/topotests/ldp-topo1/r2/show_ipv4_route.ref index db997018ea..9a62437826 100644 --- a/tests/topotests/ldp-topo1/r2/show_ipv4_route.ref +++ b/tests/topotests/ldp-topo1/r2/show_ipv4_route.ref @@ -1,7 +1,7 @@ -O>* 1.1.1.1/32 [110/10] via 10.0.1.1, r2-eth0, label xxx +O>* 1.1.1.1/32 [110/10] via 10.0.1.1, r2-eth0, label y O 2.2.2.2/32 [110/0] is directly connected, lo -O>* 3.3.3.3/32 [110/10] via 10.0.2.3, r2-eth1, label xxx -O>* 4.4.4.4/32 [110/10] via 10.0.2.4, r2-eth1, label xxx +O>* 3.3.3.3/32 [110/10] via 10.0.2.3, r2-eth1, label y +O>* 4.4.4.4/32 [110/10] via 10.0.2.4, r2-eth1, label y O 10.0.1.0/24 [110/10] is directly connected, r2-eth0 O 10.0.2.0/24 [110/10] is directly connected, r2-eth1 O 10.0.3.0/24 [110/10] is directly connected, r2-eth2 diff --git a/tests/topotests/ldp-topo1/r3/show_ipv4_route.ref b/tests/topotests/ldp-topo1/r3/show_ipv4_route.ref index e5989a975f..41709e5815 100644 --- a/tests/topotests/ldp-topo1/r3/show_ipv4_route.ref +++ b/tests/topotests/ldp-topo1/r3/show_ipv4_route.ref @@ -1,7 +1,7 @@ O>* 1.1.1.1/32 [110/20] via 10.0.2.2, r3-eth0, label xxx -O>* 2.2.2.2/32 [110/10] via 10.0.2.2, r3-eth0, label xxx +O>* 2.2.2.2/32 [110/10] via 10.0.2.2, r3-eth0, label y O 3.3.3.3/32 [110/0] is directly connected, lo -O>* 4.4.4.4/32 [110/10] via 10.0.2.4, r3-eth0, label xxx -O>* 10.0.1.0/24 [110/20] via 10.0.2.2, r3-eth0, label xxx +O>* 4.4.4.4/32 [110/10] via 10.0.2.4, r3-eth0, label y +O>* 10.0.1.0/24 [110/20] via 10.0.2.2, r3-eth0, label y O 10.0.2.0/24 [110/10] is directly connected, r3-eth0 O 10.0.3.0/24 [110/10] is directly connected, r3-eth1 diff --git a/tests/topotests/ldp-topo1/r4/show_ipv4_route.ref b/tests/topotests/ldp-topo1/r4/show_ipv4_route.ref index 5ffaf78504..ab0db90a85 100644 --- a/tests/topotests/ldp-topo1/r4/show_ipv4_route.ref +++ b/tests/topotests/ldp-topo1/r4/show_ipv4_route.ref @@ -1,7 +1,7 @@ O>* 1.1.1.1/32 [110/20] via 10.0.2.2, r4-eth0, label xxx -O>* 2.2.2.2/32 [110/10] via 10.0.2.2, r4-eth0, label xxx -O>* 3.3.3.3/32 [110/10] via 10.0.2.3, r4-eth0, label xxx +O>* 2.2.2.2/32 [110/10] via 10.0.2.2, r4-eth0, label y +O>* 3.3.3.3/32 [110/10] via 10.0.2.3, r4-eth0, label y O 4.4.4.4/32 [110/0] is directly connected, lo -O>* 10.0.1.0/24 [110/20] via 10.0.2.2, r4-eth0, label xxx +O>* 10.0.1.0/24 [110/20] via 10.0.2.2, r4-eth0, label y O 10.0.2.0/24 [110/10] is directly connected, r4-eth0 -O>* 10.0.3.0/24 [110/20] via 10.0.2.2, r4-eth0, label xxx +O>* 10.0.3.0/24 [110/20] via 10.0.2.2, r4-eth0, label y diff --git a/tests/topotests/ldp-topo1/test_ldp_topo1.py b/tests/topotests/ldp-topo1/test_ldp_topo1.py index 82ee80fc24..187e6eb9f5 100755 --- a/tests/topotests/ldp-topo1/test_ldp_topo1.py +++ b/tests/topotests/ldp-topo1/test_ldp_topo1.py @@ -544,17 +544,26 @@ def test_zebra_ipv4_routingTable(): if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() - # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) # Actual output from router actual = net['r%s' % i].cmd('vtysh -c "show ip route" 2> /dev/null | grep "^O"').rstrip() # Drop timers on end of line (older Quagga Versions) actual = re.sub(r", [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", "", actual) - # Mask out label - actual = re.sub(r" label [0-9]+", " label xxx", actual) + + # Mask out label - all LDP labels should be >= 10 (2-digit) + # leaving the implicit labels unmasked + actual = re.sub(r" label [0-9][0-9]+", " label xxx", actual) + # and translating remaining implicit (single-digit) labels to label y + actual = re.sub(r" label [0-9]+", " label y", actual) + # Check if we have implicit labels - if not, then remove them from reference + if (not re.search(r" label y", actual)): + expected = re.sub(r", label y", "", expected) + + # now fix newlines of expected (make them all the same) + expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + # Add missing comma before label (for old version) - actual = re.sub(r"([0-9]) label xxx", r"\1, label xxx", actual) + actual = re.sub(r"([0-9]) label ", r"\1, label ", actual) # Fix newlines (make them all the same) actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) -- 2.39.5