From 2c7cac91ed6e7db0f6937923d2b57f97dbdbc337 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:53:30 +0200 Subject: Adding upstream version 8.4.4. Signed-off-by: Daniel Baumann --- tests/topotests/bfd_topo2/__init__.py | 0 tests/topotests/bfd_topo2/r1/bfdd.conf | 10 ++ tests/topotests/bfd_topo2/r1/bgpd.conf | 15 +++ tests/topotests/bfd_topo2/r1/ipv4_routes.json | 59 ++++++++++ tests/topotests/bfd_topo2/r1/ipv6_routes.json | 53 +++++++++ tests/topotests/bfd_topo2/r1/peers.json | 31 +++++ tests/topotests/bfd_topo2/r1/zebra.conf | 6 + tests/topotests/bfd_topo2/r2/bfdd.conf | 5 + tests/topotests/bfd_topo2/r2/bgpd.conf | 18 +++ tests/topotests/bfd_topo2/r2/ipv4_routes.json | 92 +++++++++++++++ tests/topotests/bfd_topo2/r2/ipv6_routes.json | 53 +++++++++ tests/topotests/bfd_topo2/r2/ospf6d.conf | 11 ++ tests/topotests/bfd_topo2/r2/ospfd.conf | 11 ++ tests/topotests/bfd_topo2/r2/peers.json | 45 +++++++ tests/topotests/bfd_topo2/r2/zebra.conf | 15 +++ tests/topotests/bfd_topo2/r3/bfdd.conf | 5 + tests/topotests/bfd_topo2/r3/ipv4_routes.json | 93 +++++++++++++++ tests/topotests/bfd_topo2/r3/ipv6_routes.json | 2 + tests/topotests/bfd_topo2/r3/ospfd.conf | 10 ++ tests/topotests/bfd_topo2/r3/peers.json | 17 +++ tests/topotests/bfd_topo2/r3/zebra.conf | 6 + tests/topotests/bfd_topo2/r4/bfdd.conf | 10 ++ tests/topotests/bfd_topo2/r4/ipv4_routes.json | 21 ++++ tests/topotests/bfd_topo2/r4/ipv6_routes.json | 53 +++++++++ tests/topotests/bfd_topo2/r4/ospf6d.conf | 10 ++ tests/topotests/bfd_topo2/r4/peers.json | 31 +++++ tests/topotests/bfd_topo2/r4/zebra.conf | 6 + tests/topotests/bfd_topo2/test_bfd_topo2.dot | 73 ++++++++++++ tests/topotests/bfd_topo2/test_bfd_topo2.jpg | Bin 0 -> 24206 bytes tests/topotests/bfd_topo2/test_bfd_topo2.py | 163 ++++++++++++++++++++++++++ 30 files changed, 924 insertions(+) create mode 100644 tests/topotests/bfd_topo2/__init__.py create mode 100644 tests/topotests/bfd_topo2/r1/bfdd.conf create mode 100644 tests/topotests/bfd_topo2/r1/bgpd.conf create mode 100644 tests/topotests/bfd_topo2/r1/ipv4_routes.json create mode 100644 tests/topotests/bfd_topo2/r1/ipv6_routes.json create mode 100644 tests/topotests/bfd_topo2/r1/peers.json create mode 100644 tests/topotests/bfd_topo2/r1/zebra.conf create mode 100644 tests/topotests/bfd_topo2/r2/bfdd.conf create mode 100644 tests/topotests/bfd_topo2/r2/bgpd.conf create mode 100644 tests/topotests/bfd_topo2/r2/ipv4_routes.json create mode 100644 tests/topotests/bfd_topo2/r2/ipv6_routes.json create mode 100644 tests/topotests/bfd_topo2/r2/ospf6d.conf create mode 100644 tests/topotests/bfd_topo2/r2/ospfd.conf create mode 100644 tests/topotests/bfd_topo2/r2/peers.json create mode 100644 tests/topotests/bfd_topo2/r2/zebra.conf create mode 100644 tests/topotests/bfd_topo2/r3/bfdd.conf create mode 100644 tests/topotests/bfd_topo2/r3/ipv4_routes.json create mode 100644 tests/topotests/bfd_topo2/r3/ipv6_routes.json create mode 100644 tests/topotests/bfd_topo2/r3/ospfd.conf create mode 100644 tests/topotests/bfd_topo2/r3/peers.json create mode 100644 tests/topotests/bfd_topo2/r3/zebra.conf create mode 100644 tests/topotests/bfd_topo2/r4/bfdd.conf create mode 100644 tests/topotests/bfd_topo2/r4/ipv4_routes.json create mode 100644 tests/topotests/bfd_topo2/r4/ipv6_routes.json create mode 100644 tests/topotests/bfd_topo2/r4/ospf6d.conf create mode 100644 tests/topotests/bfd_topo2/r4/peers.json create mode 100644 tests/topotests/bfd_topo2/r4/zebra.conf create mode 100644 tests/topotests/bfd_topo2/test_bfd_topo2.dot create mode 100644 tests/topotests/bfd_topo2/test_bfd_topo2.jpg create mode 100644 tests/topotests/bfd_topo2/test_bfd_topo2.py (limited to 'tests/topotests/bfd_topo2') diff --git a/tests/topotests/bfd_topo2/__init__.py b/tests/topotests/bfd_topo2/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/topotests/bfd_topo2/r1/bfdd.conf b/tests/topotests/bfd_topo2/r1/bfdd.conf new file mode 100644 index 0000000..df8baeb --- /dev/null +++ b/tests/topotests/bfd_topo2/r1/bfdd.conf @@ -0,0 +1,10 @@ +! +! debug bfd network +! debug bfd peer +! debug bfd zebra +! +bfd + peer 2001:db8:4::1 multihop local-address 2001:db8:1::1 + no shutdown + ! +! diff --git a/tests/topotests/bfd_topo2/r1/bgpd.conf b/tests/topotests/bfd_topo2/r1/bgpd.conf new file mode 100644 index 0000000..0918796 --- /dev/null +++ b/tests/topotests/bfd_topo2/r1/bgpd.conf @@ -0,0 +1,15 @@ +router bgp 101 + bgp router-id 10.254.254.1 + no bgp ebgp-requires-policy + neighbor r2g peer-group + neighbor r2g remote-as external + neighbor r2g bfd + neighbor r1-eth0 interface peer-group r2g + neighbor r1-eth0 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family + address-family ipv6 unicast + neighbor r2g activate + exit-address-family +! diff --git a/tests/topotests/bfd_topo2/r1/ipv4_routes.json b/tests/topotests/bfd_topo2/r1/ipv4_routes.json new file mode 100644 index 0000000..650c0a8 --- /dev/null +++ b/tests/topotests/bfd_topo2/r1/ipv4_routes.json @@ -0,0 +1,59 @@ +{ + "10.0.3.0/24": [ + { + "distance": 20, + "protocol": "bgp", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.0.3.0/24", + "nexthops": [ + { + "interfaceName": "r1-eth0", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv6" + } + ] + } + ], + "10.254.254.2/32": [ + { + "distance": 20, + "protocol": "bgp", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.254.254.2/32", + "nexthops": [ + { + "interfaceName": "r1-eth0", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv6" + } + ] + } + ], + "10.254.254.1/32": [ + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.254.254.1/32", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "lo", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ] +} diff --git a/tests/topotests/bfd_topo2/r1/ipv6_routes.json b/tests/topotests/bfd_topo2/r1/ipv6_routes.json new file mode 100644 index 0000000..50c1f9a --- /dev/null +++ b/tests/topotests/bfd_topo2/r1/ipv6_routes.json @@ -0,0 +1,53 @@ +{ + "2001:db8:4::/64": [ + { + "distance": 20, + "protocol": "bgp", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "2001:db8:4::/64", + "nexthops": [ + { + "interfaceName": "r1-eth0", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv6" + } + ] + } + ], + "2001:db8:1::/64": [ + { + "distance": 20, + "protocol": "bgp", + "metric": 0, + "prefix": "2001:db8:1::/64", + "nexthops": [ + { + "interfaceName": "r1-eth0", + "active": true, + "afi": "ipv6" + } + ] + }, + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "2001:db8:1::/64", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "r1-eth0", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ] +} diff --git a/tests/topotests/bfd_topo2/r1/peers.json b/tests/topotests/bfd_topo2/r1/peers.json new file mode 100644 index 0000000..9bce991 --- /dev/null +++ b/tests/topotests/bfd_topo2/r1/peers.json @@ -0,0 +1,31 @@ +[ + { + "multihop":true, + "peer":"2001:db8:4::1", + "local":"2001:db8:1::1", + "status":"up", + "diagnostic":"ok", + "remote-diagnostic":"ok", + "receive-interval":300, + "transmit-interval":300, + "echo-receive-interval":50, + "echo-transmit-interval":0, + "remote-receive-interval":300, + "remote-transmit-interval":300, + "remote-echo-receive-interval":50 + }, + { + "multihop":false, + "interface":"r1-eth0", + "status":"up", + "diagnostic":"ok", + "remote-diagnostic":"ok", + "receive-interval":300, + "transmit-interval":300, + "echo-receive-interval":50, + "echo-transmit-interval":0, + "remote-receive-interval":300, + "remote-transmit-interval":300, + "remote-echo-receive-interval":50 + } +] diff --git a/tests/topotests/bfd_topo2/r1/zebra.conf b/tests/topotests/bfd_topo2/r1/zebra.conf new file mode 100644 index 0000000..7fe5eb2 --- /dev/null +++ b/tests/topotests/bfd_topo2/r1/zebra.conf @@ -0,0 +1,6 @@ +interface lo + ip address 10.254.254.1/32 +! +interface r1-eth0 + ipv6 address 2001:db8:1::1/64 +! diff --git a/tests/topotests/bfd_topo2/r2/bfdd.conf b/tests/topotests/bfd_topo2/r2/bfdd.conf new file mode 100644 index 0000000..ee7144d --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/bfdd.conf @@ -0,0 +1,5 @@ +! +! debug bfd network +! debug bfd peer +! debug bfd zebra +! diff --git a/tests/topotests/bfd_topo2/r2/bgpd.conf b/tests/topotests/bfd_topo2/r2/bgpd.conf new file mode 100644 index 0000000..55d4856 --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/bgpd.conf @@ -0,0 +1,18 @@ +router bgp 102 + bgp router-id 10.254.254.2 + no bgp ebgp-requires-policy + neighbor r2g peer-group + neighbor r2g remote-as external + neighbor r2g bfd + neighbor r2-eth0 interface peer-group r2g + neighbor r2-eth0 timers 3 10 + ! + address-family ipv4 unicast + redistribute connected + exit-address-family + ! + address-family ipv6 unicast + redistribute connected + neighbor r2g activate + exit-address-family +! diff --git a/tests/topotests/bfd_topo2/r2/ipv4_routes.json b/tests/topotests/bfd_topo2/r2/ipv4_routes.json new file mode 100644 index 0000000..3d49b17 --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/ipv4_routes.json @@ -0,0 +1,92 @@ +{ + "10.0.3.0/24": [ + { + "distance": 110, + "protocol": "ospf", + "metric": 10, + "prefix": "10.0.3.0/24", + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "interfaceName": "r2-eth1" + } + ] + }, + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.0.3.0/24", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "r2-eth1", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ], + "10.254.254.3/32": [ + { + "distance": 110, + "protocol": "ospf", + "metric": 20, + "selected": true, + "installed": true, + "prefix": "10.254.254.3/32", + "nexthops": [ + { + "interfaceName": "r2-eth1", + "ip": "10.0.3.1", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv4" + } + ] + } + ], + "10.254.254.2/32": [ + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.254.254.2/32", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "lo", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ], + "10.254.254.1/32": [ + { + "distance": 20, + "protocol": "bgp", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.254.254.1/32", + "nexthops": [ + { + "interfaceName": "r2-eth0", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv6" + } + ] + } + ] +} diff --git a/tests/topotests/bfd_topo2/r2/ipv6_routes.json b/tests/topotests/bfd_topo2/r2/ipv6_routes.json new file mode 100644 index 0000000..4f3c74c --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/ipv6_routes.json @@ -0,0 +1,53 @@ +{ + "2001:db8:4::/64": [ + { + "distance": 110, + "protocol": "ospf6", + "metric": 10, + "prefix": "2001:db8:4::/64", + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "interfaceName": "r2-eth2" + } + ] + }, + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "2001:db8:4::/64", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "r2-eth2", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ], + "2001:db8:1::/64": [ + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "2001:db8:1::/64", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "r2-eth0", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ] +} diff --git a/tests/topotests/bfd_topo2/r2/ospf6d.conf b/tests/topotests/bfd_topo2/r2/ospf6d.conf new file mode 100644 index 0000000..524e2c9 --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/ospf6d.conf @@ -0,0 +1,11 @@ +interface r2-eth2 + ipv6 ospf6 area 0.0.0.1 + ipv6 ospf6 bfd + ipv6 ospf6 hello-interval 2 + ipv6 ospf6 dead-interval 10 +! +router ospf6 + ospf6 router-id 10.254.254.2 + redistribute connected + redistribute bgp +! diff --git a/tests/topotests/bfd_topo2/r2/ospfd.conf b/tests/topotests/bfd_topo2/r2/ospfd.conf new file mode 100644 index 0000000..c786f1f --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/ospfd.conf @@ -0,0 +1,11 @@ +interface r2-eth1 + ip ospf area 0.0.0.1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf bfd +! +router ospf + ospf router-id 10.254.254.2 + redistribute connected + redistribute bgp +! diff --git a/tests/topotests/bfd_topo2/r2/peers.json b/tests/topotests/bfd_topo2/r2/peers.json new file mode 100644 index 0000000..ec2135c --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/peers.json @@ -0,0 +1,45 @@ +[ + { + "status": "up", + "transmit-interval": 300, + "remote-receive-interval": 300, + "echo-receive-interval": 50, + "echo-transmit-interval": 0, + "diagnostic": "ok", + "multihop": false, + "interface": "r2-eth0", + "remote-transmit-interval": 300, + "receive-interval": 300, + "remote-echo-receive-interval": 50, + "remote-diagnostic": "ok" + }, + { + "status": "up", + "transmit-interval": 300, + "remote-receive-interval": 300, + "echo-receive-interval": 50, + "echo-transmit-interval": 0, + "diagnostic": "ok", + "multihop": false, + "interface": "r2-eth2", + "remote-transmit-interval": 300, + "receive-interval": 300, + "remote-echo-receive-interval": 50, + "remote-diagnostic": "ok" + }, + { + "status": "up", + "transmit-interval": 300, + "remote-receive-interval": 300, + "echo-receive-interval": 50, + "echo-transmit-interval": 0, + "diagnostic": "ok", + "multihop": false, + "interface": "r2-eth1", + "remote-transmit-interval": 300, + "receive-interval": 300, + "remote-echo-receive-interval": 50, + "remote-diagnostic": "ok", + "peer": "10.0.3.1" + } +] diff --git a/tests/topotests/bfd_topo2/r2/zebra.conf b/tests/topotests/bfd_topo2/r2/zebra.conf new file mode 100644 index 0000000..cccbf65 --- /dev/null +++ b/tests/topotests/bfd_topo2/r2/zebra.conf @@ -0,0 +1,15 @@ +ip forwarding +ipv6 forwarding +! +interface lo + ip address 10.254.254.2/32 +! +interface r2-eth0 + ipv6 address 2001:db8:1::2/64 +! +interface r2-eth1 + ip address 10.0.3.2/24 +! +interface r2-eth2 + ipv6 address 2001:db8:4::2/64 +! diff --git a/tests/topotests/bfd_topo2/r3/bfdd.conf b/tests/topotests/bfd_topo2/r3/bfdd.conf new file mode 100644 index 0000000..ee7144d --- /dev/null +++ b/tests/topotests/bfd_topo2/r3/bfdd.conf @@ -0,0 +1,5 @@ +! +! debug bfd network +! debug bfd peer +! debug bfd zebra +! diff --git a/tests/topotests/bfd_topo2/r3/ipv4_routes.json b/tests/topotests/bfd_topo2/r3/ipv4_routes.json new file mode 100644 index 0000000..e96fdc0 --- /dev/null +++ b/tests/topotests/bfd_topo2/r3/ipv4_routes.json @@ -0,0 +1,93 @@ +{ + "10.0.3.0/24": [ + { + "distance": 110, + "protocol": "ospf", + "metric": 10, + "prefix": "10.0.3.0/24", + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "interfaceName": "r3-eth0" + } + ] + }, + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.0.3.0/24", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "r3-eth0", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ], + "10.254.254.3/32": [ + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.254.254.3/32", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "lo", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ], + "10.254.254.2/32": [ + { + "distance": 110, + "protocol": "ospf", + "metric": 20, + "selected": true, + "installed": true, + "prefix": "10.254.254.2/32", + "nexthops": [ + { + "interfaceName": "r3-eth0", + "ip": "10.0.3.2", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv4" + } + ] + } + ], + "10.254.254.1/32": [ + { + "distance": 110, + "protocol": "ospf", + "metric": 20, + "selected": true, + "installed": true, + "prefix": "10.254.254.1/32", + "nexthops": [ + { + "interfaceName": "r3-eth0", + "ip": "10.0.3.2", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv4" + } + ] + } + ] +} diff --git a/tests/topotests/bfd_topo2/r3/ipv6_routes.json b/tests/topotests/bfd_topo2/r3/ipv6_routes.json new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/tests/topotests/bfd_topo2/r3/ipv6_routes.json @@ -0,0 +1,2 @@ +{ +} diff --git a/tests/topotests/bfd_topo2/r3/ospfd.conf b/tests/topotests/bfd_topo2/r3/ospfd.conf new file mode 100644 index 0000000..932ab4d --- /dev/null +++ b/tests/topotests/bfd_topo2/r3/ospfd.conf @@ -0,0 +1,10 @@ +interface r3-eth0 + ip ospf area 0.0.0.1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf bfd +! +router ospf + ospf router-id 10.254.254.3 + redistribute connected +! diff --git a/tests/topotests/bfd_topo2/r3/peers.json b/tests/topotests/bfd_topo2/r3/peers.json new file mode 100644 index 0000000..c19c980 --- /dev/null +++ b/tests/topotests/bfd_topo2/r3/peers.json @@ -0,0 +1,17 @@ +[ + { + "status": "up", + "transmit-interval": 300, + "remote-receive-interval": 300, + "echo-receive-interval": 50, + "echo-transmit-interval": 0, + "diagnostic": "ok", + "multihop": false, + "interface": "r3-eth0", + "remote-transmit-interval": 300, + "receive-interval": 300, + "remote-echo-receive-interval": 50, + "remote-diagnostic": "ok", + "peer": "10.0.3.2" + } +] diff --git a/tests/topotests/bfd_topo2/r3/zebra.conf b/tests/topotests/bfd_topo2/r3/zebra.conf new file mode 100644 index 0000000..96fd08c --- /dev/null +++ b/tests/topotests/bfd_topo2/r3/zebra.conf @@ -0,0 +1,6 @@ +interface lo + ip address 10.254.254.3/32 +! +interface r3-eth0 + ip address 10.0.3.1/24 +! diff --git a/tests/topotests/bfd_topo2/r4/bfdd.conf b/tests/topotests/bfd_topo2/r4/bfdd.conf new file mode 100644 index 0000000..c1e8d28 --- /dev/null +++ b/tests/topotests/bfd_topo2/r4/bfdd.conf @@ -0,0 +1,10 @@ +! +! debug bfd network +! debug bfd peer +! debug bfd zebra +! +bfd + peer 2001:db8:1::1 multihop local-address 2001:db8:4::1 + no shutdown + ! +! diff --git a/tests/topotests/bfd_topo2/r4/ipv4_routes.json b/tests/topotests/bfd_topo2/r4/ipv4_routes.json new file mode 100644 index 0000000..dc394aa --- /dev/null +++ b/tests/topotests/bfd_topo2/r4/ipv4_routes.json @@ -0,0 +1,21 @@ +{ + "10.254.254.4/32": [ + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "10.254.254.4/32", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "lo", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ] +} diff --git a/tests/topotests/bfd_topo2/r4/ipv6_routes.json b/tests/topotests/bfd_topo2/r4/ipv6_routes.json new file mode 100644 index 0000000..eb571d5 --- /dev/null +++ b/tests/topotests/bfd_topo2/r4/ipv6_routes.json @@ -0,0 +1,53 @@ +{ + "2001:db8:4::/64": [ + { + "distance": 110, + "protocol": "ospf6", + "metric": 10, + "prefix": "2001:db8:4::/64", + "nexthops": [ + { + "active": true, + "directlyConnected": true, + "interfaceName": "r4-eth0" + } + ] + }, + { + "distance": 0, + "protocol": "connected", + "metric": 0, + "selected": true, + "installed": true, + "prefix": "2001:db8:4::/64", + "nexthops": [ + { + "directlyConnected": true, + "interfaceName": "r4-eth0", + "fib": true, + "flags": 3, + "active": true + } + ] + } + ], + "2001:db8:1::/64": [ + { + "distance": 110, + "protocol": "ospf6", + "metric": 20, + "selected": true, + "installed": true, + "prefix": "2001:db8:1::/64", + "nexthops": [ + { + "interfaceName": "r4-eth0", + "fib": true, + "flags": 3, + "active": true, + "afi": "ipv6" + } + ] + } + ] +} diff --git a/tests/topotests/bfd_topo2/r4/ospf6d.conf b/tests/topotests/bfd_topo2/r4/ospf6d.conf new file mode 100644 index 0000000..2f38c51 --- /dev/null +++ b/tests/topotests/bfd_topo2/r4/ospf6d.conf @@ -0,0 +1,10 @@ +interface r4-eth0 + ipv6 ospf6 area 0.0.0.1 + ipv6 ospf6 bfd + ipv6 ospf6 hello-interval 2 + ipv6 ospf6 dead-interval 10 +! +router ospf6 + ospf6 router-id 10.254.254.4 + redistribute connected +! diff --git a/tests/topotests/bfd_topo2/r4/peers.json b/tests/topotests/bfd_topo2/r4/peers.json new file mode 100644 index 0000000..dd26b9b --- /dev/null +++ b/tests/topotests/bfd_topo2/r4/peers.json @@ -0,0 +1,31 @@ +[ + { + "multihop":true, + "peer":"2001:db8:1::1", + "local":"2001:db8:4::1", + "status":"up", + "diagnostic":"ok", + "remote-diagnostic":"ok", + "receive-interval":300, + "transmit-interval":300, + "echo-receive-interval": 50, + "echo-transmit-interval":0, + "remote-receive-interval":300, + "remote-transmit-interval":300, + "remote-echo-receive-interval":50 + }, + { + "multihop":false, + "interface":"r4-eth0", + "status":"up", + "diagnostic":"ok", + "remote-diagnostic":"ok", + "receive-interval":300, + "transmit-interval":300, + "echo-receive-interval": 50, + "echo-transmit-interval":0, + "remote-receive-interval":300, + "remote-transmit-interval":300, + "remote-echo-receive-interval":50 + } +] diff --git a/tests/topotests/bfd_topo2/r4/zebra.conf b/tests/topotests/bfd_topo2/r4/zebra.conf new file mode 100644 index 0000000..e4f8fd8 --- /dev/null +++ b/tests/topotests/bfd_topo2/r4/zebra.conf @@ -0,0 +1,6 @@ +interface lo + ip address 10.254.254.4/32 +! +interface r4-eth0 + ipv6 address 2001:db8:4::1/64 +! diff --git a/tests/topotests/bfd_topo2/test_bfd_topo2.dot b/tests/topotests/bfd_topo2/test_bfd_topo2.dot new file mode 100644 index 0000000..6b68fb3 --- /dev/null +++ b/tests/topotests/bfd_topo2/test_bfd_topo2.dot @@ -0,0 +1,73 @@ +## Color coding: +######################### +## Main FRR: #f08080 red +## Switches: #d0e0d0 gray +## RIP: #19e3d9 Cyan +## RIPng: #fcb314 dark yellow +## OSPFv2: #32b835 Green +## OSPFv3: #19e3d9 Cyan +## ISIS IPv4 #fcb314 dark yellow +## ISIS IPv6 #9a81ec purple +## BGP IPv4 #eee3d3 beige +## BGP IPv6 #fdff00 yellow +##### Colors (see http://www.color-hex.com/) + +graph template { + label="bfd-topo2"; + + # Routers + r1 [ + shape=doubleoctagon, + label="r1", + fillcolor="#f08080", + style=filled, + ]; + r2 [ + shape=doubleoctagon + label="r2", + fillcolor="#f08080", + style=filled, + ]; + r3 [ + shape=doubleoctagon + label="r3", + fillcolor="#f08080", + style=filled, + ]; + r4 [ + shape=doubleoctagon + label="r4", + fillcolor="#f08080", + style=filled, + ]; + + # Switches + sw1 [ + shape=oval, + label="sw1\n2001:db8:1::/64", + fillcolor="#d0e0d0", + style=filled, + ]; + sw2 [ + shape=oval, + label="sw2\n10.0.3.0/24", + fillcolor="#d0e0d0", + style=filled, + ]; + sw3 [ + shape=oval, + label="sw3\n2001:db8:4::/64", + fillcolor="#d0e0d0", + style=filled, + ]; + + # Connections + r1 -- sw1 [label="eth0"]; + r2 -- sw1 [label="eth0"]; + + r2 -- sw2 [label="eth1"]; + r3 -- sw2 [label="eth0"]; + + r2 -- sw3 [label="eth2"]; + r4 -- sw3 [label="eth0"]; +} diff --git a/tests/topotests/bfd_topo2/test_bfd_topo2.jpg b/tests/topotests/bfd_topo2/test_bfd_topo2.jpg new file mode 100644 index 0000000..35fe562 Binary files /dev/null and b/tests/topotests/bfd_topo2/test_bfd_topo2.jpg differ diff --git a/tests/topotests/bfd_topo2/test_bfd_topo2.py b/tests/topotests/bfd_topo2/test_bfd_topo2.py new file mode 100644 index 0000000..a9b9358 --- /dev/null +++ b/tests/topotests/bfd_topo2/test_bfd_topo2.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python + +# +# test_bfd_topo2.py +# Part of NetDEF Topology Tests +# +# Copyright (c) 2019 by +# Network Device Education Foundation, Inc. ("NetDEF") +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +test_bfd_topo2.py: Test the FRR BFD daemon with multihop and BGP +unnumbered. +""" + +import os +import sys +import json +from functools import partial +import pytest + +# Save the Current Working Directory to find configuration files. +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +# Import topogen and topotest helpers +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger + +pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd, pytest.mark.ospfd] + + +def setup_module(mod): + "Sets up the pytest environment" + topodef = { + "s1": ("r1", "r2"), + "s2": ("r2", "r3"), + "s3": ("r2", "r4"), + } + tgen = Topogen(topodef, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + for rname, router in router_list.items(): + daemon_file = "{}/{}/zebra.conf".format(CWD, rname) + router.load_config(TopoRouter.RD_ZEBRA, daemon_file) + + daemon_file = "{}/{}/bfdd.conf".format(CWD, rname) + if os.path.isfile(daemon_file): + router.load_config(TopoRouter.RD_BFD, daemon_file) + + daemon_file = "{}/{}/bgpd.conf".format(CWD, rname) + if os.path.isfile(daemon_file): + router.load_config(TopoRouter.RD_BGP, daemon_file) + + daemon_file = "{}/{}/ospfd.conf".format(CWD, rname) + if os.path.isfile(daemon_file): + router.load_config(TopoRouter.RD_OSPF, daemon_file) + + daemon_file = "{}/{}/ospf6d.conf".format(CWD, rname) + if os.path.isfile(daemon_file): + router.load_config(TopoRouter.RD_OSPF6, daemon_file) + + # Initialize all routers. + tgen.start_router() + + +def teardown_module(_mod): + "Teardown the pytest environment" + tgen = get_topogen() + tgen.stop_topology() + + +def test_protocols_convergence(): + """ + Assert that all protocols have converged before checking for the BFD + statuses as they depend on it. + """ + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Check IPv4 routing tables. + logger.info("Checking IPv4 routes for convergence") + for router in tgen.routers().values(): + json_file = "{}/{}/ipv4_routes.json".format(CWD, router.name) + if not os.path.isfile(json_file): + logger.info("skipping file {}".format(json_file)) + continue + + expected = json.loads(open(json_file).read()) + test_func = partial( + topotest.router_json_cmp, router, "show ip route json", expected + ) + _, result = topotest.run_and_expect(test_func, None, count=40, wait=2) + assertmsg = '"{}" JSON output mismatches'.format(router.name) + assert result is None, assertmsg + + # Check IPv6 routing tables. + logger.info("Checking IPv6 routes for convergence") + for router in tgen.routers().values(): + json_file = "{}/{}/ipv6_routes.json".format(CWD, router.name) + if not os.path.isfile(json_file): + logger.info("skipping file {}".format(json_file)) + continue + + expected = json.loads(open(json_file).read()) + test_func = partial( + topotest.router_json_cmp, router, "show ipv6 route json", expected + ) + _, result = topotest.run_and_expect(test_func, None, count=40, wait=2) + assertmsg = '"{}" JSON output mismatches'.format(router.name) + assert result is None, assertmsg + + +def test_bfd_connection(): + "Assert that the BFD peers can find themselves." + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info("waiting for bfd peers to go up") + + for router in tgen.routers().values(): + json_file = "{}/{}/peers.json".format(CWD, router.name) + expected = json.loads(open(json_file).read()) + + test_func = partial( + topotest.router_json_cmp, router, "show bfd peers json", expected + ) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + assertmsg = '"{}" JSON output mismatches'.format(router.name) + assert result is None, assertmsg + + +def test_memory_leak(): + "Run the memory leak test and report results." + tgen = get_topogen() + if not tgen.is_memleak_enabled(): + pytest.skip("Memory leak test/report is disabled") + + tgen.report_memory_leaks() + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) -- cgit v1.2.3