ldp-topo1: Make the implicit label optional to pass old frr code as well

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
Martin Winter 2017-07-17 21:14:28 -07:00 committed by Donald Sharp
parent cc230e73b7
commit 6c97c0cbf2
5 changed files with 27 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)