mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 09:20:25 +00:00
ospf: add IPv6 OSPF convergence test
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.
This commit is contained in:
parent
56842c0469
commit
f175c4eb97
10
tests/topotests/ospf-topo1/r1/ospf6d.conf
Normal file
10
tests/topotests/ospf-topo1/r1/ospf6d.conf
Normal file
@ -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
|
||||||
|
!
|
13
tests/topotests/ospf-topo1/r1/ospf6route.txt
Normal file
13
tests/topotests/ospf-topo1/r1/ospf6route.txt
Normal file
@ -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
|
5
tests/topotests/ospf-topo1/r1/ospf6route_down.txt
Normal file
5
tests/topotests/ospf-topo1/r1/ospf6route_down.txt
Normal file
@ -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
|
@ -4,9 +4,11 @@ log file /tmp/r1-zebra.log
|
|||||||
!
|
!
|
||||||
interface r1-eth0
|
interface r1-eth0
|
||||||
ip address 10.0.1.1/24
|
ip address 10.0.1.1/24
|
||||||
|
ipv6 address 2001:db8:1::1/64
|
||||||
!
|
!
|
||||||
interface r1-eth1
|
interface r1-eth1
|
||||||
ip address 10.0.3.2/24
|
ip address 10.0.3.2/24
|
||||||
|
ipv6 address 2001:db8:3::2/64
|
||||||
!
|
!
|
||||||
ip forwarding
|
ip forwarding
|
||||||
!
|
!
|
||||||
|
10
tests/topotests/ospf-topo1/r2/ospf6d.conf
Normal file
10
tests/topotests/ospf-topo1/r2/ospf6d.conf
Normal file
@ -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
|
||||||
|
!
|
13
tests/topotests/ospf-topo1/r2/ospf6route.txt
Normal file
13
tests/topotests/ospf-topo1/r2/ospf6route.txt
Normal file
@ -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
|
5
tests/topotests/ospf-topo1/r2/ospf6route_down.txt
Normal file
5
tests/topotests/ospf-topo1/r2/ospf6route_down.txt
Normal file
@ -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
|
@ -4,9 +4,11 @@ log file /tmp/r2-zebra.log
|
|||||||
!
|
!
|
||||||
interface r2-eth0
|
interface r2-eth0
|
||||||
ip address 10.0.2.1/24
|
ip address 10.0.2.1/24
|
||||||
|
ipv6 address 2001:db8:2::1/64
|
||||||
!
|
!
|
||||||
interface r2-eth1
|
interface r2-eth1
|
||||||
ip address 10.0.3.3/24
|
ip address 10.0.3.3/24
|
||||||
|
ipv6 address 2001:db8:3::3/64
|
||||||
!
|
!
|
||||||
ip forwarding
|
ip forwarding
|
||||||
!
|
!
|
||||||
|
11
tests/topotests/ospf-topo1/r3/ospf6d.conf
Normal file
11
tests/topotests/ospf-topo1/r3/ospf6d.conf
Normal file
@ -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
|
||||||
|
!
|
12
tests/topotests/ospf-topo1/r3/ospf6route.txt
Normal file
12
tests/topotests/ospf-topo1/r3/ospf6route.txt
Normal file
@ -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
|
5
tests/topotests/ospf-topo1/r3/ospf6route_down.txt
Normal file
5
tests/topotests/ospf-topo1/r3/ospf6route_down.txt
Normal file
@ -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
|
@ -4,12 +4,15 @@ log file /tmp/r3-zebra.log
|
|||||||
!
|
!
|
||||||
interface r3-eth0
|
interface r3-eth0
|
||||||
ip address 10.0.3.1/24
|
ip address 10.0.3.1/24
|
||||||
|
ipv6 address 2001:db8:3::1/64
|
||||||
!
|
!
|
||||||
interface r3-eth1
|
interface r3-eth1
|
||||||
ip address 10.0.10.1/24
|
ip address 10.0.10.1/24
|
||||||
|
ipv6 address 2001:db8:100::1/64
|
||||||
!
|
!
|
||||||
interface r3-eth2
|
interface r3-eth2
|
||||||
ip address 172.16.0.2/24
|
ip address 172.16.0.2/24
|
||||||
|
ipv6 address 2001:db8:200::2/64
|
||||||
!
|
!
|
||||||
ip forwarding
|
ip forwarding
|
||||||
!
|
!
|
||||||
|
10
tests/topotests/ospf-topo1/r4/ospf6d.conf
Normal file
10
tests/topotests/ospf-topo1/r4/ospf6d.conf
Normal file
@ -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
|
||||||
|
!
|
13
tests/topotests/ospf-topo1/r4/ospf6route.txt
Normal file
13
tests/topotests/ospf-topo1/r4/ospf6route.txt
Normal file
@ -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
|
5
tests/topotests/ospf-topo1/r4/ospf6route_down.txt
Normal file
5
tests/topotests/ospf-topo1/r4/ospf6route_down.txt
Normal file
@ -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
|
@ -4,9 +4,11 @@ log file /tmp/r4-zebra.log
|
|||||||
!
|
!
|
||||||
interface r4-eth0
|
interface r4-eth0
|
||||||
ip address 172.16.0.1/24
|
ip address 172.16.0.1/24
|
||||||
|
ipv6 address 2001:db8:200::1/64
|
||||||
!
|
!
|
||||||
interface r4-eth1
|
interface r4-eth1
|
||||||
ip address 172.16.1.100/24
|
ip address 172.16.1.100/24
|
||||||
|
ipv6 address 2001:db8:300::100/64
|
||||||
!
|
!
|
||||||
ip forwarding
|
ip forwarding
|
||||||
!
|
!
|
||||||
|
@ -27,6 +27,7 @@ test_ospf_topo1.py: Test the FRR/Quagga OSPF routing daemon.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import pytest
|
import pytest
|
||||||
@ -96,6 +97,10 @@ def setup_module(mod):
|
|||||||
TopoRouter.RD_OSPF,
|
TopoRouter.RD_OSPF,
|
||||||
os.path.join(CWD, '{}/ospfd.conf'.format(rname))
|
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.
|
# Initialize all routers.
|
||||||
tgen.start_router()
|
tgen.start_router()
|
||||||
@ -117,6 +122,31 @@ def compare_show_ip_ospf(rname, expected):
|
|||||||
title1="Current output",
|
title1="Current output",
|
||||||
title2="Expected 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():
|
def test_ospf_convergence():
|
||||||
"Test OSPF daemon convergence"
|
"Test OSPF daemon convergence"
|
||||||
for rnum in range(1, 5):
|
for rnum in range(1, 5):
|
||||||
@ -134,6 +164,23 @@ def test_ospf_convergence():
|
|||||||
count=20, wait=3)
|
count=20, wait=3)
|
||||||
assert result, 'OSPF did not converge on {}:\n{}'.format(router, diff)
|
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():
|
def test_ospf_json():
|
||||||
"Test 'show ip ospf json' output for coherency."
|
"Test 'show ip ospf json' output for coherency."
|
||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
@ -226,6 +273,24 @@ def test_ospf_link_down():
|
|||||||
count=20, wait=3)
|
count=20, wait=3)
|
||||||
assert result, 'OSPF did not converge on {}:\n{}'.format(router, diff)
|
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():
|
def test_memory_leak():
|
||||||
"Run the memory leak test and report results."
|
"Run the memory leak test and report results."
|
||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
|
Loading…
Reference in New Issue
Block a user