]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf: add IPv6 OSPF convergence test
authorRafael Zalamena <rzalamena@gmail.com>
Fri, 30 Jun 2017 19:23:25 +0000 (16:23 -0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:12 +0000 (20:22 -0500)
Add more tests to the ospf-topo1 to include IPv6 testing. Since both IP
versions are running together, there is no need to wait OSPF convergence
per IP version.

17 files changed:
tests/topotests/ospf-topo1/r1/ospf6d.conf [new file with mode: 0644]
tests/topotests/ospf-topo1/r1/ospf6route.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r1/ospf6route_down.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r1/zebra.conf
tests/topotests/ospf-topo1/r2/ospf6d.conf [new file with mode: 0644]
tests/topotests/ospf-topo1/r2/ospf6route.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r2/ospf6route_down.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r2/zebra.conf
tests/topotests/ospf-topo1/r3/ospf6d.conf [new file with mode: 0644]
tests/topotests/ospf-topo1/r3/ospf6route.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r3/ospf6route_down.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r3/zebra.conf
tests/topotests/ospf-topo1/r4/ospf6d.conf [new file with mode: 0644]
tests/topotests/ospf-topo1/r4/ospf6route.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r4/ospf6route_down.txt [new file with mode: 0644]
tests/topotests/ospf-topo1/r4/zebra.conf
tests/topotests/ospf-topo1/test_ospf_topo1.py

diff --git a/tests/topotests/ospf-topo1/r1/ospf6d.conf b/tests/topotests/ospf-topo1/r1/ospf6d.conf
new file mode 100644 (file)
index 0000000..97779cf
--- /dev/null
@@ -0,0 +1,10 @@
+log file /tmp/r1-ospf6d.log
+!
+router ospf6
+ router-id 10.0.255.1
+ redistribute kernel
+ redistribute connected
+ redistribute static
+ interface r1-eth0 area 0.0.0.0
+ interface r1-eth1 area 0.0.0.0
+!
diff --git a/tests/topotests/ospf-topo1/r1/ospf6route.txt b/tests/topotests/ospf-topo1/r1/ospf6route.txt
new file mode 100644 (file)
index 0000000..1bfd694
--- /dev/null
@@ -0,0 +1,13 @@
+*N IA 2001:db8:1::/64                ::                        r1-eth0 00:02:11
+*N IA 2001:db8:2::/64                fe80::b038:bcff:fe27:e2d6 r1-eth1 00:02:06
+ N E1 2001:db8:2::/64                fe80::b038:bcff:fe27:e2d6 r1-eth1 00:02:06
+*N IA 2001:db8:3::/64                ::                        r1-eth1 00:02:11
+ N E1 2001:db8:3::/64                fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:06
+ N E1 2001:db8:3::/64                fe80::b038:bcff:fe27:e2d6 r1-eth1 00:02:06
+*N IA 2001:db8:100::/64              fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:06
+ N E1 2001:db8:100::/64              fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:06
+*N IE 2001:db8:200::/64              fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:06
+ N E1 2001:db8:200::/64              fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:06
+ N E1 2001:db8:200::/64              fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:04
+*N IE 2001:db8:300::/64              fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:04
+ N E1 2001:db8:300::/64              fe80::50b7:d8ff:fe5f:8ff0 r1-eth1 00:02:04
diff --git a/tests/topotests/ospf-topo1/r1/ospf6route_down.txt b/tests/topotests/ospf-topo1/r1/ospf6route_down.txt
new file mode 100644 (file)
index 0000000..1ce96c8
--- /dev/null
@@ -0,0 +1,5 @@
+*N IA 2001:db8:1::/64                ::                        r1-eth0 00:01:51
+*N IA 2001:db8:2::/64                fe80::281a:23ff:fe22:8a40 r1-eth1 00:00:52
+ N E1 2001:db8:2::/64                fe80::281a:23ff:fe22:8a40 r1-eth1 00:00:52
+*N IA 2001:db8:3::/64                ::                        r1-eth1 00:00:52
+ N E1 2001:db8:3::/64                fe80::281a:23ff:fe22:8a40 r1-eth1 00:00:52
index 152d3c0a9030647d6d375601151ba728f536ec03..fd3acbe7e36ea9965b2bc6a24338f51463ba2fad 100644 (file)
@@ -4,9 +4,11 @@ log file /tmp/r1-zebra.log
 !
 interface r1-eth0
  ip address 10.0.1.1/24
+ ipv6 address 2001:db8:1::1/64
 !
 interface r1-eth1
  ip address 10.0.3.2/24
+ ipv6 address 2001:db8:3::2/64
 !
 ip forwarding
 !
diff --git a/tests/topotests/ospf-topo1/r2/ospf6d.conf b/tests/topotests/ospf-topo1/r2/ospf6d.conf
new file mode 100644 (file)
index 0000000..d9039ce
--- /dev/null
@@ -0,0 +1,10 @@
+log file /tmp/r2-ospf6d.log
+!
+router ospf6
+ router-id 10.0.255.2
+ redistribute kernel
+ redistribute connected
+ redistribute static
+ interface r2-eth0 area 0.0.0.0
+ interface r2-eth1 area 0.0.0.0
+!
diff --git a/tests/topotests/ospf-topo1/r2/ospf6route.txt b/tests/topotests/ospf-topo1/r2/ospf6route.txt
new file mode 100644 (file)
index 0000000..7d3ce5b
--- /dev/null
@@ -0,0 +1,13 @@
+*N IA 2001:db8:1::/64                fe80::b49b:4cff:fe80:4e87 r2-eth1 00:03:34
+ N E1 2001:db8:1::/64                fe80::b49b:4cff:fe80:4e87 r2-eth1 00:03:34
+*N IA 2001:db8:2::/64                ::                        r2-eth0 00:03:39
+*N IA 2001:db8:3::/64                ::                        r2-eth1 00:03:34
+ N E1 2001:db8:3::/64                fe80::b49b:4cff:fe80:4e87 r2-eth1 00:03:34
+ N E1 2001:db8:3::/64                fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:34
+*N IA 2001:db8:100::/64              fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:34
+ N E1 2001:db8:100::/64              fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:34
+*N IE 2001:db8:200::/64              fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:34
+ N E1 2001:db8:200::/64              fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:34
+ N E1 2001:db8:200::/64              fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:32
+*N IE 2001:db8:300::/64              fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:32
+ N E1 2001:db8:300::/64              fe80::50b7:d8ff:fe5f:8ff0 r2-eth1 00:03:32
diff --git a/tests/topotests/ospf-topo1/r2/ospf6route_down.txt b/tests/topotests/ospf-topo1/r2/ospf6route_down.txt
new file mode 100644 (file)
index 0000000..acfffc9
--- /dev/null
@@ -0,0 +1,5 @@
+*N IA 2001:db8:1::/64                fe80::fc0b:daff:fe31:6791 r2-eth1 00:06:19
+ N E1 2001:db8:1::/64                fe80::fc0b:daff:fe31:6791 r2-eth1 00:06:19
+*N IA 2001:db8:2::/64                ::                        r2-eth0 00:07:17
+*N IA 2001:db8:3::/64                ::                        r2-eth1 00:06:27
+ N E1 2001:db8:3::/64                fe80::fc0b:daff:fe31:6791 r2-eth1 00:06:19
index 35d9c96b5417e590144e621945a6e35e1173181e..e247d9e51be365fea21a6a223d62149465dfb003 100644 (file)
@@ -4,9 +4,11 @@ log file /tmp/r2-zebra.log
 !
 interface r2-eth0
  ip address 10.0.2.1/24
+ ipv6 address 2001:db8:2::1/64
 !
 interface r2-eth1
  ip address 10.0.3.3/24
+ ipv6 address 2001:db8:3::3/64
 !
 ip forwarding
 !
diff --git a/tests/topotests/ospf-topo1/r3/ospf6d.conf b/tests/topotests/ospf-topo1/r3/ospf6d.conf
new file mode 100644 (file)
index 0000000..6ea308b
--- /dev/null
@@ -0,0 +1,11 @@
+log file /tmp/r3-ospf6d.log
+!
+router ospf6
+ router-id 10.0.255.3
+ redistribute kernel
+ redistribute connected
+ redistribute static
+ interface r3-eth0 area 0.0.0.0
+ interface r3-eth1 area 0.0.0.0
+ interface r3-eth2 area 0.0.0.1
+!
diff --git a/tests/topotests/ospf-topo1/r3/ospf6route.txt b/tests/topotests/ospf-topo1/r3/ospf6route.txt
new file mode 100644 (file)
index 0000000..b123c42
--- /dev/null
@@ -0,0 +1,12 @@
+*N IA 2001:db8:1::/64                fe80::b49b:4cff:fe80:4e87 r3-eth0 00:04:03
+ N E1 2001:db8:1::/64                fe80::b49b:4cff:fe80:4e87 r3-eth0 00:04:03
+*N IA 2001:db8:2::/64                fe80::b038:bcff:fe27:e2d6 r3-eth0 00:04:03
+ N E1 2001:db8:2::/64                fe80::b038:bcff:fe27:e2d6 r3-eth0 00:04:03
+*N IA 2001:db8:3::/64                ::                        r3-eth0 00:04:08
+ N E1 2001:db8:3::/64                fe80::b49b:4cff:fe80:4e87 r3-eth0 00:04:03
+ N E1 2001:db8:3::/64                fe80::b038:bcff:fe27:e2d6 r3-eth0 00:04:03
+*N IA 2001:db8:100::/64              ::                        r3-eth1 00:04:08
+*N IA 2001:db8:200::/64              ::                        r3-eth2 00:04:05
+ N E1 2001:db8:200::/64              fe80::78e0:deff:feb1:ec0  r3-eth2 00:04:00
+*N IA 2001:db8:300::/64              fe80::78e0:deff:feb1:ec0  r3-eth2 00:04:00
+ N E1 2001:db8:300::/64              fe80::78e0:deff:feb1:ec0  r3-eth2 00:04:00
diff --git a/tests/topotests/ospf-topo1/r3/ospf6route_down.txt b/tests/topotests/ospf-topo1/r3/ospf6route_down.txt
new file mode 100644 (file)
index 0000000..ed69a83
--- /dev/null
@@ -0,0 +1,5 @@
+*N IA 2001:db8:100::/64              ::                        r3-eth1 00:08:06
+*N IA 2001:db8:200::/64              ::                        r3-eth2 00:08:04
+ N E1 2001:db8:200::/64              fe80::80a6:c3ff:fea9:88be r3-eth2 00:07:59
+*N IA 2001:db8:300::/64              fe80::80a6:c3ff:fea9:88be r3-eth2 00:07:59
+ N E1 2001:db8:300::/64              fe80::80a6:c3ff:fea9:88be r3-eth2 00:07:59
index 7521a9b95ba2cda3060fd5ada7d775c94c637097..49046a35cd0634a94eb585c32d0e838eeb88d6d1 100644 (file)
@@ -4,12 +4,15 @@ log file /tmp/r3-zebra.log
 !
 interface r3-eth0
  ip address 10.0.3.1/24
+ ipv6 address 2001:db8:3::1/64
 !
 interface r3-eth1
  ip address 10.0.10.1/24
+ ipv6 address 2001:db8:100::1/64
 !
 interface r3-eth2
  ip address 172.16.0.2/24
+ ipv6 address 2001:db8:200::2/64
 !
 ip forwarding
 !
diff --git a/tests/topotests/ospf-topo1/r4/ospf6d.conf b/tests/topotests/ospf-topo1/r4/ospf6d.conf
new file mode 100644 (file)
index 0000000..35c046a
--- /dev/null
@@ -0,0 +1,10 @@
+log file /tmp/r4-ospf6d.log
+!
+router ospf6
+ router-id 10.0.255.4
+ redistribute kernel
+ redistribute connected
+ redistribute static
+ interface r4-eth0 area 0.0.0.1
+ interface r4-eth1 area 0.0.0.1
+!
diff --git a/tests/topotests/ospf-topo1/r4/ospf6route.txt b/tests/topotests/ospf-topo1/r4/ospf6route.txt
new file mode 100644 (file)
index 0000000..ceeee2c
--- /dev/null
@@ -0,0 +1,13 @@
+*N IE 2001:db8:1::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+ N E1 2001:db8:1::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+*N IE 2001:db8:2::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+ N E1 2001:db8:2::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+*N IE 2001:db8:3::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+ N E1 2001:db8:3::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+ N E1 2001:db8:3::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+ N E1 2001:db8:3::/64                fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+*N IE 2001:db8:100::/64              fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+ N E1 2001:db8:100::/64              fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+*N IA 2001:db8:200::/64              ::                        r4-eth0 00:04:30
+ N E1 2001:db8:200::/64              fe80::987b:baff:fe8a:c864 r4-eth0 00:04:25
+*N IA 2001:db8:300::/64              ::                        r4-eth1 00:04:30
diff --git a/tests/topotests/ospf-topo1/r4/ospf6route_down.txt b/tests/topotests/ospf-topo1/r4/ospf6route_down.txt
new file mode 100644 (file)
index 0000000..4ad636d
--- /dev/null
@@ -0,0 +1,5 @@
+*N IE 2001:db8:100::/64              fe80::b44b:a1ff:fe48:3d69 r4-eth0 00:01:45
+ N E1 2001:db8:100::/64              fe80::b44b:a1ff:fe48:3d69 r4-eth0 00:01:45
+*N IA 2001:db8:200::/64              ::                        r4-eth0 00:01:50
+ N E1 2001:db8:200::/64              fe80::b44b:a1ff:fe48:3d69 r4-eth0 00:01:45
+*N IA 2001:db8:300::/64              ::                        r4-eth1 00:01:50
index d90bdc6cf4f2af986d5e945d6430e2ddcbe70b52..fec7e36d4fa54d915af999857e44ba60ea3af43e 100644 (file)
@@ -4,9 +4,11 @@ log file /tmp/r4-zebra.log
 !
 interface r4-eth0
  ip address 172.16.0.1/24
+ ipv6 address 2001:db8:200::1/64
 !
 interface r4-eth1
  ip address 172.16.1.100/24
+ ipv6 address 2001:db8:300::100/64
 !
 ip forwarding
 !
index b801677af54d6b660c806496919c88b85d486bcc..f5b2641ae5b2074072a60ddbc9c465e3b2c2ded5 100755 (executable)
@@ -27,6 +27,7 @@ test_ospf_topo1.py: Test the FRR/Quagga OSPF routing daemon.
 """
 
 import os
+import re
 import sys
 from functools import partial
 import pytest
@@ -96,6 +97,10 @@ def setup_module(mod):
             TopoRouter.RD_OSPF,
             os.path.join(CWD, '{}/ospfd.conf'.format(rname))
         )
+        router.load_config(
+            TopoRouter.RD_OSPF6,
+            os.path.join(CWD, '{}/ospf6d.conf'.format(rname))
+        )
 
     # Initialize all routers.
     tgen.start_router()
@@ -117,6 +122,31 @@ def compare_show_ip_ospf(rname, expected):
                               title1="Current output",
                               title2="Expected output")
 
+def compare_show_ipv6_ospf6(rname, expected):
+    """
+    Calls 'show ipv6 ospf6 route' for router `rname` and compare the obtained
+    result with the expected output.
+    """
+    tgen = get_topogen()
+    current = tgen.gears[rname].vtysh_cmd('show ipv6 ospf6 route')
+
+    # This output has space formating and random IPv6 link addresses, we have to
+    # remove them first before testing.
+    current = topotest.normalize_text(current)
+    expected = topotest.normalize_text(expected)
+
+    # Remove the link addresses
+    current = re.sub(r'fe80:[^ ]+', '', current)
+    expected = re.sub(r'fe80:[^ ]+', '', expected)
+
+    # Remove the time
+    current = re.sub(r'\d+:\d{2}:\d{2}', '', current)
+    expected = re.sub(r'\d+:\d{2}:\d{2}', '', expected)
+
+    return topotest.difflines(current, expected,
+                              title1="Current output",
+                              title2="Expected output")
+
 def test_ospf_convergence():
     "Test OSPF daemon convergence"
     for rnum in range(1, 5):
@@ -134,6 +164,23 @@ def test_ospf_convergence():
                                                count=20, wait=3)
         assert result, 'OSPF did not converge on {}:\n{}'.format(router, diff)
 
+def test_ospf6_convergence():
+    "Test OSPF6 daemon convergence"
+    for rnum in range(1, 5):
+        router = 'r{}'.format(rnum)
+
+        logger.info('Waiting for router "%s" IPv6 OSPF convergence', router)
+
+        # Load expected results from the command
+        reffile = os.path.join(CWD, '{}/ospf6route.txt'.format(router))
+        expected = open(reffile).read()
+
+        # Run test function until we get an result. Wait at most 60 seconds.
+        test_func = partial(compare_show_ipv6_ospf6, router, expected)
+        result, diff = topotest.run_and_expect(test_func, '',
+                                               count=20, wait=3)
+        assert result, 'OSPF6 did not converge on {}:\n{}'.format(router, diff)
+
 def test_ospf_json():
     "Test 'show ip ospf json' output for coherency."
     tgen = get_topogen()
@@ -226,6 +273,24 @@ def test_ospf_link_down():
                                                count=20, wait=3)
         assert result, 'OSPF did not converge on {}:\n{}'.format(router, diff)
 
+def test_ospf6_link_down():
+    "Test OSPF6 daemon convergence after link goes down"
+
+    for rnum in range(1, 5):
+        router = 'r{}'.format(rnum)
+
+        logger.info('Waiting for router "%s" IPv6 OSPF convergence after link down', router)
+
+        # Load expected results from the command
+        reffile = os.path.join(CWD, '{}/ospf6route_down.txt'.format(router))
+        expected = open(reffile).read()
+
+        # Run test function until we get an result. Wait at most 60 seconds.
+        test_func = partial(compare_show_ipv6_ospf6, router, expected)
+        result, diff = topotest.run_and_expect(test_func, '',
+                                               count=20, wait=3)
+        assert result, 'OSPF6 did not converge on {}:\n{}'.format(router, diff)
+
 def test_memory_leak():
     "Run the memory leak test and report results."
     tgen = get_topogen()