From b2a2107adee0062a422f60d9c2dc9b5888c2978f Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 31 May 2021 10:27:51 -0300 Subject: [PATCH] tests: add OSPF graceful restart topotest Add a new topotest that features a topology with seven routers spread across four OSPF areas: * 1 backbone area; * 1 regular non-backbone area (0.0.0.1); * 1 stub area (0.0.0.2); * 1 NSSA area (0.0.0.3). All routers have both GR and GR helper functionality enabled in the configuration. The test consists of restarting each router, one at time, and checking that all forwarding planes (and LSDBs) are kept intact during those restarts. A successful run takes about three minutes to finish. Signed-off-by: Renato Westphal --- tests/topotests/ospf_gr_topo1/__init__.py | 0 tests/topotests/ospf_gr_topo1/rt1/ospfd.conf | 32 ++ .../rt1/show_ip_ospf_database.json | 98 +++++ .../rt1/show_ip_ospf_neighbor.json | 11 + .../ospf_gr_topo1/rt1/show_ip_ospf_route.json | 180 ++++++++ .../ospf_gr_topo1/rt1/show_ip_route.json | 210 ++++++++++ tests/topotests/ospf_gr_topo1/rt1/zebra.conf | 23 + tests/topotests/ospf_gr_topo1/rt2/ospfd.conf | 37 ++ .../rt2/show_ip_ospf_database.json | 160 +++++++ .../rt2/show_ip_ospf_neighbor.json | 18 + .../ospf_gr_topo1/rt2/show_ip_ospf_route.json | 201 +++++++++ .../ospf_gr_topo1/rt2/show_ip_route.json | 224 ++++++++++ tests/topotests/ospf_gr_topo1/rt2/zebra.conf | 23 + tests/topotests/ospf_gr_topo1/rt3/ospfd.conf | 43 ++ .../rt3/show_ip_ospf_database.json | 83 ++++ .../rt3/show_ip_ospf_neighbor.json | 25 ++ .../ospf_gr_topo1/rt3/show_ip_ospf_route.json | 214 ++++++++++ .../ospf_gr_topo1/rt3/show_ip_route.json | 223 ++++++++++ tests/topotests/ospf_gr_topo1/rt3/zebra.conf | 26 ++ tests/topotests/ospf_gr_topo1/rt4/ospfd.conf | 37 ++ .../rt4/show_ip_ospf_database.json | 164 ++++++++ .../rt4/show_ip_ospf_neighbor.json | 18 + .../ospf_gr_topo1/rt4/show_ip_ospf_route.json | 202 +++++++++ .../ospf_gr_topo1/rt4/show_ip_route.json | 224 ++++++++++ tests/topotests/ospf_gr_topo1/rt4/zebra.conf | 23 + tests/topotests/ospf_gr_topo1/rt5/ospfd.conf | 31 ++ .../rt5/show_ip_ospf_database.json | 102 +++++ .../rt5/show_ip_ospf_neighbor.json | 11 + .../ospf_gr_topo1/rt5/show_ip_ospf_route.json | 203 +++++++++ .../ospf_gr_topo1/rt5/show_ip_route.json | 225 ++++++++++ tests/topotests/ospf_gr_topo1/rt5/zebra.conf | 20 + tests/topotests/ospf_gr_topo1/rt6/ospfd.conf | 38 ++ .../rt6/show_ip_ospf_database.json | 168 ++++++++ .../rt6/show_ip_ospf_neighbor.json | 18 + .../ospf_gr_topo1/rt6/show_ip_ospf_route.json | 214 ++++++++++ .../ospf_gr_topo1/rt6/show_ip_route.json | 224 ++++++++++ tests/topotests/ospf_gr_topo1/rt6/zebra.conf | 23 + tests/topotests/ospf_gr_topo1/rt7/ospfd.conf | 33 ++ .../rt7/show_ip_ospf_database.json | 99 +++++ .../rt7/show_ip_ospf_neighbor.json | 11 + .../ospf_gr_topo1/rt7/show_ip_ospf_route.json | 168 ++++++++ .../ospf_gr_topo1/rt7/show_ip_route.json | 210 ++++++++++ tests/topotests/ospf_gr_topo1/rt7/zebra.conf | 23 + .../ospf_gr_topo1/test_ospf_gr_topo1.py | 393 ++++++++++++++++++ 44 files changed, 4713 insertions(+) create mode 100644 tests/topotests/ospf_gr_topo1/__init__.py create mode 100644 tests/topotests/ospf_gr_topo1/rt1/ospfd.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_database.json create mode 100644 tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json create mode 100644 tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt1/show_ip_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt1/zebra.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt2/ospfd.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_database.json create mode 100644 tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json create mode 100644 tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt2/show_ip_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt2/zebra.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt3/ospfd.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_database.json create mode 100644 tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json create mode 100644 tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt3/show_ip_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt3/zebra.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt4/ospfd.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_database.json create mode 100644 tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json create mode 100644 tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt4/show_ip_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt4/zebra.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt5/ospfd.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_database.json create mode 100644 tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json create mode 100644 tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt5/show_ip_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt5/zebra.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt6/ospfd.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_database.json create mode 100644 tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json create mode 100644 tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt6/show_ip_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt6/zebra.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt7/ospfd.conf create mode 100644 tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_database.json create mode 100644 tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json create mode 100644 tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt7/show_ip_route.json create mode 100644 tests/topotests/ospf_gr_topo1/rt7/zebra.conf create mode 100755 tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py diff --git a/tests/topotests/ospf_gr_topo1/__init__.py b/tests/topotests/ospf_gr_topo1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf new file mode 100644 index 0000000000..9c04b74d35 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf @@ -0,0 +1,32 @@ +password 1 +hostname rt1 +log file ospfd.log +log commands +! +debug ospf zebra +debug ospf event +debug ospf lsa +debug ospf te +debug ospf packet all +debug ospf packet ls-update detail +debug ospf ism +debug ospf nsm +debug ospf nssa +debug ospf graceful-restart +! +interface lo + ip ospf area 1 +! +interface eth-rt2 + ip ospf network point-to-point + ip ospf area 1 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +router ospf + router-id 1.1.1.1 + capability opaque + redistribute connected + graceful-restart grace-period 120 + graceful-restart helper-only +! diff --git a/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_database.json b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_database.json new file mode 100644 index 0000000000..d01ac74c17 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_database.json @@ -0,0 +1,98 @@ +{ + "routerId":"1.1.1.1", + "areas":{ + "0.0.0.1":{ + "routerLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"1.1.1.1", + "numOfRouterLinks":3 + }, + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "numOfRouterLinks":2 + } + ], + "summaryLinkStates":[ + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"2.2.2.2\/32" + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"3.3.3.3\/32" + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"4.4.4.4\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"6.6.6.6\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.2.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.2.0\/24" + }, + { + "lsId":"10.0.3.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.3.0\/24" + }, + { + "lsId":"10.0.4.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.4.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.5.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"6.6.6.6", + "advertisedRouter":"2.2.2.2" + } + ] + } + }, + "asExternalLinkStates":[ + { + "lsId":"172.16.1.0", + "advertisedRouter":"1.1.1.1", + "metricType":"E2", + "route":"172.16.1.0\/24", + "tag":0 + }, + { + "lsId":"192.168.1.0", + "advertisedRouter":"6.6.6.6", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json new file mode 100644 index 0000000000..ed290323a4 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json @@ -0,0 +1,11 @@ +{ + "neighbors":{ + "2.2.2.2":[ + { + "state":"Full\/DROther", + "address":"10.0.1.2", + "ifaceName":"eth-rt2:10.0.1.1" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json new file mode 100644 index 0000000000..548ca1e2d1 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json @@ -0,0 +1,180 @@ +{ + "1.1.1.1\/32":{ + "routeType":"N", + "cost":0, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":" ", + "directly attached to":"lo" + } + ] + }, + "2.2.2.2\/32":{ + "routeType":"N IA", + "cost":10, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "3.3.3.3\/32":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "4.4.4.4\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "5.5.5.5\/32":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "6.6.6.6\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "7.7.7.7\/32":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "10.0.1.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt2" + } + ] + }, + "10.0.2.0\/24":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "10.0.3.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "10.0.4.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "10.0.5.0\/24":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "10.0.6.0\/24":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "2.2.2.2":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.1", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "6.6.6.6":{ + "routeType":"R ", + "cost":30, + "area":"0.0.0.1", + "IA":true, + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + }, + "192.168.1.0\/24":{ + "routeType":"N E2", + "cost":40, + "nexthops":[ + { + "ip":"10.0.1.2", + "via":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt1/show_ip_route.json b/tests/topotests/ospf_gr_topo1/rt1/show_ip_route.json new file mode 100644 index 0000000000..3dce1eee3e --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt1/show_ip_route.json @@ -0,0 +1,210 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"ospf", + "distance":110, + "metric":0, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"lo" + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "7.7.7.7\/32":[ + { + "prefix":"7.7.7.7\/32", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "192.168.1.0\/24":[ + { + "prefix":"192.168.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt1/zebra.conf b/tests/topotests/ospf_gr_topo1/rt1/zebra.conf new file mode 100644 index 0000000000..183cd3df48 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt1/zebra.conf @@ -0,0 +1,23 @@ +password 1 +hostname rt1 +log file zebra.log +log commands +! +debug zebra event +debug zebra packet +debug zebra rib +debug zebra kernel +! +interface lo + ip address 1.1.1.1/32 +! +interface stub1 + ip address 172.16.1.1/24 +! +interface eth-rt2 + ip address 10.0.1.1/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf new file mode 100644 index 0000000000..922db8c8cc --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf @@ -0,0 +1,37 @@ +password 1 +hostname rt2 +log file ospfd.log +log commands +! +debug ospf zebra +debug ospf event +debug ospf lsa +debug ospf te +debug ospf packet all +debug ospf packet ls-update detail +debug ospf ism +debug ospf nsm +debug ospf nssa +debug ospf graceful-restart +! +interface lo + ip ospf area 0 +! +interface eth-rt1 + ip ospf network point-to-point + ip ospf area 1 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +interface eth-rt3 + ip ospf network point-to-point + ip ospf area 0 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +router ospf + router-id 2.2.2.2 + capability opaque + graceful-restart grace-period 120 + graceful-restart helper-only +! diff --git a/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_database.json b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_database.json new file mode 100644 index 0000000000..40c3e82d6a --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_database.json @@ -0,0 +1,160 @@ +{ + "routerId":"2.2.2.2", + "areas":{ + "0.0.0.0":{ + "routerLinkStates":[ + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "numOfRouterLinks":3 + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"3.3.3.3", + "numOfRouterLinks":7 + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "numOfRouterLinks":3 + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.5.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2" + } + ] + }, + "0.0.0.1":{ + "routerLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"1.1.1.1", + "numOfRouterLinks":3 + }, + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "numOfRouterLinks":2 + } + ], + "summaryLinkStates":[ + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"2.2.2.2\/32" + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"3.3.3.3\/32" + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"4.4.4.4\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"6.6.6.6\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.2.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.2.0\/24" + }, + { + "lsId":"10.0.3.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.3.0\/24" + }, + { + "lsId":"10.0.4.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.4.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.5.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"6.6.6.6", + "advertisedRouter":"2.2.2.2" + } + ] + } + }, + "asExternalLinkStates":[ + { + "lsId":"172.16.1.0", + "advertisedRouter":"1.1.1.1", + "metricType":"E2", + "route":"172.16.1.0\/24", + "tag":0 + }, + { + "lsId":"192.168.1.0", + "advertisedRouter":"6.6.6.6", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json new file mode 100644 index 0000000000..4fe92b0b98 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json @@ -0,0 +1,18 @@ +{ + "neighbors":{ + "1.1.1.1":[ + { + "state":"Full\/DROther", + "address":"10.0.1.1", + "ifaceName":"eth-rt1:10.0.1.2" + } + ], + "3.3.3.3":[ + { + "state":"Full\/DROther", + "address":"10.0.2.3", + "ifaceName":"eth-rt3:10.0.2.2" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json new file mode 100644 index 0000000000..4accb2ba4a --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json @@ -0,0 +1,201 @@ +{ + "1.1.1.1\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":"10.0.1.1", + "via":"eth-rt1" + } + ] + }, + "2.2.2.2\/32":{ + "routeType":"N", + "cost":0, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"lo" + } + ] + }, + "3.3.3.3\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "4.4.4.4\/32":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "5.5.5.5\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "6.6.6.6\/32":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "7.7.7.7\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "10.0.1.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.1", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt1" + } + ] + }, + "10.0.2.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt3" + } + ] + }, + "10.0.3.0\/24":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "10.0.4.0\/24":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "10.0.5.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "10.0.6.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "1.1.1.1":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.1", + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.1.1", + "via":"eth-rt1" + } + ] + }, + "4.4.4.4":{ + "routeType":"R ", + "cost":20, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "6.6.6.6":{ + "routeType":"R ", + "cost":20, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + }, + "172.16.1.0\/24":{ + "routeType":"N E2", + "cost":10, + "nexthops":[ + { + "ip":"10.0.1.1", + "via":"eth-rt1" + } + ] + }, + "192.168.1.0\/24":{ + "routeType":"N E2", + "cost":30, + "nexthops":[ + { + "ip":"10.0.2.3", + "via":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt2/show_ip_route.json b/tests/topotests/ospf_gr_topo1/rt2/show_ip_route.json new file mode 100644 index 0000000000..8989a45765 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt2/show_ip_route.json @@ -0,0 +1,224 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.1.1", + "afi":"ipv4", + "interfaceName":"eth-rt1" + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"ospf", + "distance":110, + "metric":0, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"lo" + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "7.7.7.7\/32":[ + { + "prefix":"7.7.7.7\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt1" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "172.16.1.0\/24":[ + { + "prefix":"172.16.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.1.1", + "afi":"ipv4", + "interfaceName":"eth-rt1" + } + ] + } + ], + "192.168.1.0\/24":[ + { + "prefix":"192.168.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt2/zebra.conf b/tests/topotests/ospf_gr_topo1/rt2/zebra.conf new file mode 100644 index 0000000000..8bde98ad44 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt2/zebra.conf @@ -0,0 +1,23 @@ +password 1 +hostname rt2 +log file zebra.log +log commands +! +debug zebra event +debug zebra packet +debug zebra rib +debug zebra kernel +! +interface lo + ip address 2.2.2.2/32 +! +interface eth-rt1 + ip address 10.0.1.2/24 +! +interface eth-rt3 + ip address 10.0.2.2/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf new file mode 100644 index 0000000000..51e48f13da --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf @@ -0,0 +1,43 @@ +password 1 +hostname rt3 +log file ospfd.log +log commands +! +debug ospf zebra +debug ospf event +debug ospf lsa +debug ospf te +debug ospf packet all +debug ospf packet ls-update detail +debug ospf ism +debug ospf nsm +debug ospf nssa +debug ospf graceful-restart +! +interface lo + ip ospf area 0 +! +interface eth-rt2 + ip ospf network point-to-point + ip ospf area 0 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +interface eth-rt4 + ip ospf network point-to-point + ip ospf area 0 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +interface eth-rt6 + ip ospf network point-to-point + ip ospf area 0 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +router ospf + router-id 3.3.3.3 + capability opaque + graceful-restart grace-period 120 + graceful-restart helper-only +! diff --git a/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_database.json b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_database.json new file mode 100644 index 0000000000..1fc5b546e4 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_database.json @@ -0,0 +1,83 @@ +{ + "routerId":"3.3.3.3", + "areas":{ + "0.0.0.0":{ + "routerLinkStates":[ + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "numOfRouterLinks":3 + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"3.3.3.3", + "numOfRouterLinks":7 + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "numOfRouterLinks":3 + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.5.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2" + } + ] + } + }, + "asExternalLinkStates":[ + { + "lsId":"172.16.1.0", + "advertisedRouter":"1.1.1.1", + "metricType":"E2", + "route":"172.16.1.0\/24", + "tag":0 + }, + { + "lsId":"192.168.1.0", + "advertisedRouter":"6.6.6.6", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json new file mode 100644 index 0000000000..e3c36ab9a3 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json @@ -0,0 +1,25 @@ +{ + "neighbors":{ + "2.2.2.2":[ + { + "state":"Full\/DROther", + "address":"10.0.2.2", + "ifaceName":"eth-rt2:10.0.2.3" + } + ], + "4.4.4.4":[ + { + "state":"Full\/DROther", + "address":"10.0.3.4", + "ifaceName":"eth-rt4:10.0.3.3" + } + ], + "6.6.6.6":[ + { + "state":"Full\/DROther", + "address":"10.0.4.6", + "ifaceName":"eth-rt6:10.0.4.3" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json new file mode 100644 index 0000000000..b2f37e25a1 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json @@ -0,0 +1,214 @@ +{ + "1.1.1.1\/32":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.2", + "via":"eth-rt2" + } + ] + }, + "2.2.2.2\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.2", + "via":"eth-rt2" + } + ] + }, + "3.3.3.3\/32":{ + "routeType":"N", + "cost":0, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"lo" + } + ] + }, + "4.4.4.4\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.4", + "via":"eth-rt4" + } + ] + }, + "5.5.5.5\/32":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.4", + "via":"eth-rt4" + } + ] + }, + "6.6.6.6\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.6", + "via":"eth-rt6" + } + ] + }, + "7.7.7.7\/32":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.6", + "via":"eth-rt6" + } + ] + }, + "10.0.1.0\/24":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.2.2", + "via":"eth-rt2" + } + ] + }, + "10.0.2.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt2" + } + ] + }, + "10.0.3.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt4" + } + ] + }, + "10.0.4.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt6" + } + ] + }, + "10.0.5.0\/24":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.4", + "via":"eth-rt4" + } + ] + }, + "10.0.6.0\/24":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.6", + "via":"eth-rt6" + } + ] + }, + "1.1.1.1":{ + "routeType":"R ", + "cost":20, + "area":"0.0.0.0", + "IA":true, + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.2.2", + "via":"eth-rt2" + } + ] + }, + "2.2.2.2":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.2.2", + "via":"eth-rt2" + } + ] + }, + "4.4.4.4":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.3.4", + "via":"eth-rt4" + } + ] + }, + "6.6.6.6":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.4.6", + "via":"eth-rt6" + } + ] + }, + "172.16.1.0\/24":{ + "routeType":"N E2", + "cost":20, + "nexthops":[ + { + "ip":"10.0.2.2", + "via":"eth-rt2" + } + ] + }, + "192.168.1.0\/24":{ + "routeType":"N E2", + "cost":20, + "nexthops":[ + { + "ip":"10.0.4.6", + "via":"eth-rt6" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt3/show_ip_route.json b/tests/topotests/ospf_gr_topo1/rt3/show_ip_route.json new file mode 100644 index 0000000000..c9a1e18b92 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt3/show_ip_route.json @@ -0,0 +1,223 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"ospf", + "distance":110, + "metric":0, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"lo" + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.4.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "7.7.7.7\/32":[ + { + "prefix":"7.7.7.7\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt2" + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt6" + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "172.16.1.0\/24":[ + { + "prefix":"172.16.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2" + } + ] + } + ], + "192.168.1.0\/24":[ + { + "prefix":"192.168.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt3/zebra.conf b/tests/topotests/ospf_gr_topo1/rt3/zebra.conf new file mode 100644 index 0000000000..dfd89cbe5b --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt3/zebra.conf @@ -0,0 +1,26 @@ +password 1 +hostname rt3 +log file zebra.log +log commands +! +debug zebra event +debug zebra packet +debug zebra rib +debug zebra kernel +! +interface lo + ip address 3.3.3.3/32 +! +interface eth-rt2 + ip address 10.0.2.3/24 +! +interface eth-rt4 + ip address 10.0.3.3/24 +! +interface eth-rt6 + ip address 10.0.4.3/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf new file mode 100644 index 0000000000..a54f27a1d7 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf @@ -0,0 +1,37 @@ +password 1 +hostname rt4 +log file ospfd.log +log commands +! +debug ospf zebra +debug ospf event +debug ospf lsa +debug ospf te +debug ospf packet all +debug ospf packet ls-update detail +debug ospf ism +debug ospf nsm +debug ospf nssa +debug ospf graceful-restart +! +interface lo + ip ospf area 0 +! +interface eth-rt3 + ip ospf network point-to-point + ip ospf area 0 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +interface eth-rt5 + ip ospf network point-to-point + ip ospf area 2 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +router ospf + router-id 4.4.4.4 + capability opaque + graceful-restart grace-period 120 + graceful-restart helper-only +! diff --git a/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_database.json b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_database.json new file mode 100644 index 0000000000..87b80414c9 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_database.json @@ -0,0 +1,164 @@ +{ + "routerId":"4.4.4.4", + "areas":{ + "0.0.0.0":{ + "routerLinkStates":[ + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "numOfRouterLinks":3 + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"3.3.3.3", + "numOfRouterLinks":7 + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "numOfRouterLinks":3 + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.5.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2" + } + ] + }, + "0.0.0.2":{ + "routerLinkStates":[ + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "numOfRouterLinks":2 + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"5.5.5.5", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"2.2.2.2", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"2.2.2.2\/32" + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"3.3.3.3\/32" + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"4.4.4.4\/32" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"6.6.6.6\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.2.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.2.0\/24" + }, + { + "lsId":"10.0.3.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.3.0\/24" + }, + { + "lsId":"10.0.4.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.4.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"4.4.4.4" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"4.4.4.4" + } + ] + } + }, + "asExternalLinkStates":[ + { + "lsId":"172.16.1.0", + "advertisedRouter":"1.1.1.1", + "metricType":"E2", + "route":"172.16.1.0\/24", + "tag":0 + }, + { + "lsId":"192.168.1.0", + "advertisedRouter":"6.6.6.6", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json new file mode 100644 index 0000000000..2123ecb8da --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json @@ -0,0 +1,18 @@ +{ + "neighbors":{ + "3.3.3.3":[ + { + "state":"Full\/DROther", + "address":"10.0.3.3", + "ifaceName":"eth-rt3:10.0.3.4" + } + ], + "5.5.5.5":[ + { + "state":"Full\/DROther", + "address":"10.0.5.5", + "ifaceName":"eth-rt5:10.0.5.4" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json new file mode 100644 index 0000000000..04e318aef0 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json @@ -0,0 +1,202 @@ +{ + "1.1.1.1\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "2.2.2.2\/32":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "3.3.3.3\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "4.4.4.4\/32":{ + "routeType":"N", + "cost":0, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"lo" + } + ] + }, + "5.5.5.5\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.5", + "via":"eth-rt5" + } + ] + }, + "6.6.6.6\/32":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "7.7.7.7\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "10.0.1.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "10.0.2.0\/24":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "10.0.3.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt3" + } + ] + }, + "10.0.4.0\/24":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "10.0.5.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt5" + } + ] + }, + "10.0.6.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "1.1.1.1":{ + "routeType":"R ", + "cost":30, + "area":"0.0.0.0", + "IA":true, + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "2.2.2.2":{ + "routeType":"R ", + "cost":20, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "6.6.6.6":{ + "routeType":"R ", + "cost":20, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "172.16.1.0\/24":{ + "routeType":"N E2", + "cost":30, + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + }, + "192.168.1.0\/24":{ + "routeType":"N E2", + "cost":30, + "nexthops":[ + { + "ip":"10.0.3.3", + "via":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt4/show_ip_route.json b/tests/topotests/ospf_gr_topo1/rt4/show_ip_route.json new file mode 100644 index 0000000000..8058f8f431 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt4/show_ip_route.json @@ -0,0 +1,224 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"ospf", + "distance":110, + "metric":0, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"lo" + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5" + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "7.7.7.7\/32":[ + { + "prefix":"7.7.7.7\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt5" + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "172.16.1.0\/24":[ + { + "prefix":"172.16.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "192.168.1.0\/24":[ + { + "prefix":"192.168.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.3.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt4/zebra.conf b/tests/topotests/ospf_gr_topo1/rt4/zebra.conf new file mode 100644 index 0000000000..f399b29f3f --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt4/zebra.conf @@ -0,0 +1,23 @@ +password 1 +hostname rt4 +log file zebra.log +log commands +! +debug zebra event +debug zebra packet +debug zebra rib +debug zebra kernel +! +interface lo + ip address 4.4.4.4/32 +! +interface eth-rt3 + ip address 10.0.3.4/24 +! +interface eth-rt5 + ip address 10.0.5.4/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf new file mode 100644 index 0000000000..724af0e97c --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf @@ -0,0 +1,31 @@ +password 1 +hostname rt5 +log file ospfd.log +log commands +! +debug ospf zebra +debug ospf event +debug ospf lsa +debug ospf te +debug ospf packet all +debug ospf packet ls-update detail +debug ospf ism +debug ospf nsm +debug ospf nssa +debug ospf graceful-restart +! +interface lo + ip ospf area 2 +! +interface eth-rt4 + ip ospf network point-to-point + ip ospf area 2 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +router ospf + router-id 5.5.5.5 + capability opaque + graceful-restart grace-period 120 + graceful-restart helper-only +! diff --git a/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_database.json b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_database.json new file mode 100644 index 0000000000..aeb8604473 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_database.json @@ -0,0 +1,102 @@ +{ + "routerId":"5.5.5.5", + "areas":{ + "0.0.0.2":{ + "routerLinkStates":[ + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "numOfRouterLinks":2 + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"5.5.5.5", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"2.2.2.2", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"2.2.2.2\/32" + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"3.3.3.3\/32" + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"4.4.4.4\/32" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"6.6.6.6\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.2.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.2.0\/24" + }, + { + "lsId":"10.0.3.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.3.0\/24" + }, + { + "lsId":"10.0.4.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.4.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"4.4.4.4" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"4.4.4.4" + } + ] + } + }, + "asExternalLinkStates":[ + { + "lsId":"172.16.1.0", + "advertisedRouter":"1.1.1.1", + "metricType":"E2", + "route":"172.16.1.0\/24", + "tag":0 + }, + { + "lsId":"192.168.1.0", + "advertisedRouter":"6.6.6.6", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json new file mode 100644 index 0000000000..6440b67698 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json @@ -0,0 +1,11 @@ +{ + "neighbors":{ + "4.4.4.4":[ + { + "state":"Full\/DROther", + "address":"10.0.5.4", + "ifaceName":"eth-rt4:10.0.5.5" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json new file mode 100644 index 0000000000..e7f712ea6b --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json @@ -0,0 +1,203 @@ +{ + "1.1.1.1\/32":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "2.2.2.2\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "3.3.3.3\/32":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "4.4.4.4\/32":{ + "routeType":"N IA", + "cost":10, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "5.5.5.5\/32":{ + "routeType":"N", + "cost":0, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":" ", + "directly attached to":"lo" + } + ] + }, + "6.6.6.6\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "7.7.7.7\/32":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "10.0.1.0\/24":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "10.0.2.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "10.0.3.0\/24":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "10.0.4.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "10.0.5.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt4" + } + ] + }, + "10.0.6.0\/24":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.2", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "1.1.1.1":{ + "routeType":"R ", + "cost":40, + "area":"0.0.0.2", + "IA":true, + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "4.4.4.4":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.2", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "6.6.6.6":{ + "routeType":"R ", + "cost":30, + "area":"0.0.0.2", + "IA":true, + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "172.16.1.0\/24":{ + "routeType":"N E2", + "cost":40, + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + }, + "192.168.1.0\/24":{ + "routeType":"N E2", + "cost":40, + "nexthops":[ + { + "ip":"10.0.5.4", + "via":"eth-rt4" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt5/show_ip_route.json b/tests/topotests/ospf_gr_topo1/rt5/show_ip_route.json new file mode 100644 index 0000000000..9896839440 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt5/show_ip_route.json @@ -0,0 +1,225 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"ospf", + "distance":110, + "metric":0, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"lo" + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "7.7.7.7\/32":[ + { + "prefix":"7.7.7.7\/32", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt4" + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "172.16.1.0\/24":[ + { + "prefix":"172.16.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], + "192.168.1.0\/24":[ + { + "prefix":"192.168.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.5.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt5/zebra.conf b/tests/topotests/ospf_gr_topo1/rt5/zebra.conf new file mode 100644 index 0000000000..49a1c05a6d --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt5/zebra.conf @@ -0,0 +1,20 @@ +password 1 +hostname rt5 +log file zebra.log +log commands +! +debug zebra event +debug zebra packet +debug zebra rib +debug zebra kernel +! +interface lo + ip address 5.5.5.5/32 +! +interface eth-rt4 + ip address 10.0.5.5/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf new file mode 100644 index 0000000000..0b9b83bcd2 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf @@ -0,0 +1,38 @@ +password 1 +hostname rt6 +log file ospfd.log +log commands +! +debug ospf zebra +debug ospf event +debug ospf lsa +debug ospf te +debug ospf packet all +debug ospf packet ls-update detail +debug ospf ism +debug ospf nsm +debug ospf nssa +debug ospf graceful-restart +! +interface lo + ip ospf area 0 +! +interface eth-rt3 + ip ospf network point-to-point + ip ospf area 0 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +interface eth-rt7 + ip ospf network point-to-point + ip ospf area 3 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +router ospf + router-id 6.6.6.6 + capability opaque + area 3 nssa + graceful-restart grace-period 120 + graceful-restart helper-only +! diff --git a/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_database.json b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_database.json new file mode 100644 index 0000000000..294b2c904e --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_database.json @@ -0,0 +1,168 @@ +{ + "routerId":"6.6.6.6", + "areas":{ + "0.0.0.0":{ + "routerLinkStates":[ + { + "lsId":"2.2.2.2", + "advertisedRouter":"2.2.2.2", + "numOfRouterLinks":3 + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"3.3.3.3", + "numOfRouterLinks":7 + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"4.4.4.4", + "numOfRouterLinks":3 + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"7.7.7.7\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"2.2.2.2", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"4.4.4.4", + "summaryAddress":"10.0.5.0\/24" + }, + { + "lsId":"10.0.6.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.6.0\/24" + } + ], + "asbrSummaryLinkStates":[ + { + "lsId":"1.1.1.1", + "advertisedRouter":"2.2.2.2" + } + ] + }, + "0.0.0.3":{ + "routerLinkStates":[ + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "numOfRouterLinks":2 + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"7.7.7.7", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"0.0.0.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"0.0.0.0\/0" + }, + { + "lsId":"1.1.1.1", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"2.2.2.2", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"2.2.2.2\/32" + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"3.3.3.3\/32" + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"4.4.4.4\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"6.6.6.6\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.2.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.2.0\/24" + }, + { + "lsId":"10.0.3.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.3.0\/24" + }, + { + "lsId":"10.0.4.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.4.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.5.0\/24" + } + ], + "nssaExternalLinkStates":[ + { + "lsId":"192.168.1.0", + "advertisedRouter":"7.7.7.7", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] + } + }, + "asExternalLinkStates":[ + { + "lsId":"172.16.1.0", + "advertisedRouter":"1.1.1.1", + "metricType":"E2", + "route":"172.16.1.0\/24", + "tag":0 + }, + { + "lsId":"192.168.1.0", + "advertisedRouter":"6.6.6.6", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json new file mode 100644 index 0000000000..d815c23927 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json @@ -0,0 +1,18 @@ +{ + "neighbors":{ + "3.3.3.3":[ + { + "state":"Full\/DROther", + "address":"10.0.4.3", + "ifaceName":"eth-rt3:10.0.4.6" + } + ], + "7.7.7.7":[ + { + "state":"Full\/DROther", + "address":"10.0.6.7", + "ifaceName":"eth-rt7:10.0.6.6" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json new file mode 100644 index 0000000000..d9009724d5 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json @@ -0,0 +1,214 @@ +{ + "1.1.1.1\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "2.2.2.2\/32":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "3.3.3.3\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "4.4.4.4\/32":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "5.5.5.5\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "6.6.6.6\/32":{ + "routeType":"N", + "cost":0, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"lo" + } + ] + }, + "7.7.7.7\/32":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.7", + "via":"eth-rt7" + } + ] + }, + "10.0.1.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "10.0.2.0\/24":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "10.0.3.0\/24":{ + "routeType":"N", + "cost":20, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "10.0.4.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt3" + } + ] + }, + "10.0.5.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.0", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "10.0.6.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt7" + } + ] + }, + "1.1.1.1":{ + "routeType":"R ", + "cost":30, + "area":"0.0.0.0", + "IA":true, + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "2.2.2.2":{ + "routeType":"R ", + "cost":20, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "4.4.4.4":{ + "routeType":"R ", + "cost":20, + "area":"0.0.0.0", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "7.7.7.7":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.3", + "routerType":"asbr", + "nexthops":[ + { + "ip":"10.0.6.7", + "via":"eth-rt7" + } + ] + }, + "172.16.1.0\/24":{ + "routeType":"N E2", + "cost":30, + "nexthops":[ + { + "ip":"10.0.4.3", + "via":"eth-rt3" + } + ] + }, + "192.168.1.0\/24":{ + "routeType":"N E2", + "cost":10, + "nexthops":[ + { + "ip":"10.0.6.7", + "via":"eth-rt7" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt6/show_ip_route.json b/tests/topotests/ospf_gr_topo1/rt6/show_ip_route.json new file mode 100644 index 0000000000..dd95f1fab1 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt6/show_ip_route.json @@ -0,0 +1,224 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"ospf", + "distance":110, + "metric":0, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"lo" + } + ] + } + ], + "7.7.7.7\/32":[ + { + "prefix":"7.7.7.7\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.6.7", + "afi":"ipv4", + "interfaceName":"eth-rt7" + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt7" + } + ] + } + ], + "172.16.1.0\/24":[ + { + "prefix":"172.16.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3" + } + ] + } + ], + "192.168.1.0\/24":[ + { + "prefix":"192.168.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.7", + "afi":"ipv4", + "interfaceName":"eth-rt7" + } + ] + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt6/zebra.conf b/tests/topotests/ospf_gr_topo1/rt6/zebra.conf new file mode 100644 index 0000000000..d6a8f52b3a --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt6/zebra.conf @@ -0,0 +1,23 @@ +password 1 +hostname rt6 +log file zebra.log +log commands +! +debug zebra event +debug zebra packet +debug zebra rib +debug zebra kernel +! +interface lo + ip address 6.6.6.6/32 +! +interface eth-rt3 + ip address 10.0.4.6/24 +! +interface eth-rt7 + ip address 10.0.6.6/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf new file mode 100644 index 0000000000..49db254410 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf @@ -0,0 +1,33 @@ +password 1 +hostname rt7 +log file ospfd.log +log commands +! +debug ospf zebra +debug ospf event +debug ospf lsa +debug ospf te +debug ospf packet all +debug ospf packet ls-update detail +debug ospf ism +debug ospf nsm +debug ospf nssa +debug ospf graceful-restart +! +interface lo + ip ospf area 3 +! +interface eth-rt6 + ip ospf network point-to-point + ip ospf area 3 + ip ospf hello-interval 3 + ip ospf dead-interval 9 +! +router ospf + router-id 7.7.7.7 + capability opaque + redistribute connected + area 3 nssa + graceful-restart grace-period 120 + graceful-restart helper-only +! diff --git a/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_database.json b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_database.json new file mode 100644 index 0000000000..4916fba9d4 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_database.json @@ -0,0 +1,99 @@ +{ + "routerId":"7.7.7.7", + "areas":{ + "0.0.0.3":{ + "routerLinkStates":[ + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "numOfRouterLinks":2 + }, + { + "lsId":"7.7.7.7", + "advertisedRouter":"7.7.7.7", + "numOfRouterLinks":3 + } + ], + "summaryLinkStates":[ + { + "lsId":"0.0.0.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"0.0.0.0\/0" + }, + { + "lsId":"1.1.1.1", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"1.1.1.1\/32" + }, + { + "lsId":"2.2.2.2", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"2.2.2.2\/32" + }, + { + "lsId":"3.3.3.3", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"3.3.3.3\/32" + }, + { + "lsId":"4.4.4.4", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"4.4.4.4\/32" + }, + { + "lsId":"5.5.5.5", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"5.5.5.5\/32" + }, + { + "lsId":"6.6.6.6", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"6.6.6.6\/32" + }, + { + "lsId":"10.0.1.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.1.0\/24" + }, + { + "lsId":"10.0.2.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.2.0\/24" + }, + { + "lsId":"10.0.3.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.3.0\/24" + }, + { + "lsId":"10.0.4.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.4.0\/24" + }, + { + "lsId":"10.0.5.0", + "advertisedRouter":"6.6.6.6", + "summaryAddress":"10.0.5.0\/24" + } + ], + "nssaExternalLinkStates":[ + { + "lsId":"192.168.1.0", + "advertisedRouter":"7.7.7.7", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] + } + }, + "asExternalLinkStates":[ + { + "lsId":"192.168.1.0", + "advertisedRouter":"7.7.7.7", + "metricType":"E2", + "route":"192.168.1.0\/24", + "tag":0 + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json new file mode 100644 index 0000000000..2254aea9a6 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json @@ -0,0 +1,11 @@ +{ + "neighbors":{ + "6.6.6.6":[ + { + "state":"Full\/DROther", + "address":"10.0.6.6", + "ifaceName":"eth-rt6:10.0.6.7" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json new file mode 100644 index 0000000000..89bad320bb --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json @@ -0,0 +1,168 @@ +{ + "0.0.0.0\/0":{ + "routeType":"N IA", + "cost":11, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "1.1.1.1\/32":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "2.2.2.2\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "3.3.3.3\/32":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "4.4.4.4\/32":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "5.5.5.5\/32":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "6.6.6.6\/32":{ + "routeType":"N IA", + "cost":10, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "7.7.7.7\/32":{ + "routeType":"N", + "cost":0, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":" ", + "directly attached to":"lo" + } + ] + }, + "10.0.1.0\/24":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "10.0.2.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "10.0.3.0\/24":{ + "routeType":"N IA", + "cost":30, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "10.0.4.0\/24":{ + "routeType":"N IA", + "cost":20, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "10.0.5.0\/24":{ + "routeType":"N IA", + "cost":40, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + }, + "10.0.6.0\/24":{ + "routeType":"N", + "cost":10, + "area":"0.0.0.3", + "nexthops":[ + { + "ip":" ", + "directly attached to":"eth-rt6" + } + ] + }, + "6.6.6.6":{ + "routeType":"R ", + "cost":10, + "area":"0.0.0.3", + "routerType":"abr", + "nexthops":[ + { + "ip":"10.0.6.6", + "via":"eth-rt6" + } + ] + } +} diff --git a/tests/topotests/ospf_gr_topo1/rt7/show_ip_route.json b/tests/topotests/ospf_gr_topo1/rt7/show_ip_route.json new file mode 100644 index 0000000000..0fb906b76b --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt7/show_ip_route.json @@ -0,0 +1,210 @@ +{ + "0.0.0.0\/0":[ + { + "prefix":"0.0.0.0\/0", + "protocol":"ospf", + "distance":110, + "metric":11, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "7.7.7.7\/32":[ + { + "prefix":"7.7.7.7\/32", + "protocol":"ospf", + "distance":110, + "metric":0, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"lo" + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"ospf", + "distance":110, + "metric":30, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"ospf", + "distance":110, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"ospf", + "distance":110, + "metric":40, + "nexthops":[ + { + "ip":"10.0.6.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"ospf", + "distance":110, + "metric":10, + "nexthops":[ + { + "directlyConnected":true, + "interfaceName":"eth-rt6" + } + ] + } + ] +} diff --git a/tests/topotests/ospf_gr_topo1/rt7/zebra.conf b/tests/topotests/ospf_gr_topo1/rt7/zebra.conf new file mode 100644 index 0000000000..c481e4532b --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/rt7/zebra.conf @@ -0,0 +1,23 @@ +password 1 +hostname rt7 +log file zebra.log +log commands +! +debug zebra event +debug zebra packet +debug zebra rib +debug zebra kernel +! +interface lo + ip address 7.7.7.7/32 +! +interface stub1 + ip address 192.168.1.1/24 +! +interface eth-rt6 + ip address 10.0.6.7/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py b/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py new file mode 100755 index 0000000000..0507c2d516 --- /dev/null +++ b/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py @@ -0,0 +1,393 @@ +#!/usr/bin/env python + +# +# test_ospf_gr_topo1.py +# Part of NetDEF Topology Tests +# +# Copyright (c) 2021 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_ospf_gr_topo1.py: + + +---------+ + | RT1 | + | 1.1.1.1 | + +---------+ + |eth-rt2 + | + |10.0.1.0/24 + | + |eth-rt1 + +---------+ + | RT2 | + | 2.2.2.2 | + +---------+ + |eth-rt3 + | + |10.0.2.0/24 + | + |eth-rt2 + +---------+ + | RT3 | + | 3.3.3.3 | + +---------+ + eth-rt4| |eth-rt6 + | | + 10.0.3.0/24 | | 10.0.4.0/24 + +---------+ +--------+ + | | + |eth-rt3 |eth-rt3 + +---------+ +---------+ + | RT4 | | RT6 | + | 4.4.4.4 | | 6.6.6.6 | + +---------+ +---------+ + |eth-rt5 |eth-rt7 + | | + |10.0.5.0/24 |10.0.6.0/24 + | | + |eth-rt4 |eth-rt6 + +---------+ +---------+ + | RT5 | | RT7 | + | 5.5.5.5 | | 7.7.7.7 | + +---------+ +---------+ +""" + +import os +import sys +import pytest +import json +import re +import tempfile +from time import sleep +from functools import partial + +# 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 +from lib.common_config import ( + kill_router_daemons, + start_router_daemons, +) + +# Required to instantiate the topology builder class. +from mininet.topo import Topo + +pytestmark = [pytest.mark.ospfd] + +# Global multi-dimensional dictionary containing all expected outputs +outputs = {} + + +class TemplateTopo(Topo): + "Test topology builder" + + def build(self, *_args, **_opts): + "Build function" + tgen = get_topogen(self) + + # + # Define FRR Routers + # + for router in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6", "rt7"]: + tgen.add_router(router) + + # + # Define connections + # + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["rt1"], nodeif="eth-rt2") + switch.add_link(tgen.gears["rt2"], nodeif="eth-rt1") + + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["rt1"], nodeif="stub1") + + switch = tgen.add_switch("s3") + switch.add_link(tgen.gears["rt2"], nodeif="eth-rt3") + switch.add_link(tgen.gears["rt3"], nodeif="eth-rt2") + + switch = tgen.add_switch("s4") + switch.add_link(tgen.gears["rt3"], nodeif="eth-rt4") + switch.add_link(tgen.gears["rt4"], nodeif="eth-rt3") + + switch = tgen.add_switch("s5") + switch.add_link(tgen.gears["rt3"], nodeif="eth-rt6") + switch.add_link(tgen.gears["rt6"], nodeif="eth-rt3") + + switch = tgen.add_switch("s6") + switch.add_link(tgen.gears["rt4"], nodeif="eth-rt5") + switch.add_link(tgen.gears["rt5"], nodeif="eth-rt4") + + switch = tgen.add_switch("s7") + switch.add_link(tgen.gears["rt6"], nodeif="eth-rt7") + switch.add_link(tgen.gears["rt7"], nodeif="eth-rt6") + + switch = tgen.add_switch("s8") + switch.add_link(tgen.gears["rt7"], nodeif="stub1") + + +def setup_module(mod): + "Sets up the pytest environment" + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + # For all registered routers, load the zebra configuration file + for rname, router in router_list.items(): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_OSPF, os.path.join(CWD, "{}/ospfd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + "Teardown the pytest environment" + tgen = get_topogen() + + # This function tears down the whole topology. + tgen.stop_topology() + + +def router_compare_json_output(rname, command, reference, tries): + "Compare router JSON output" + + logger.info('Comparing router "%s" "%s" output', rname, command) + + tgen = get_topogen() + filename = "{}/{}/{}".format(CWD, rname, reference) + expected = json.loads(open(filename).read()) + + test_func = partial(topotest.router_json_cmp, tgen.gears[rname], command, expected) + _, diff = topotest.run_and_expect(test_func, None, count=tries, wait=0.5) + assertmsg = '"{}" JSON output mismatches the expected result'.format(rname) + assert diff is None, assertmsg + + +def check_routers(initial_convergence=False, exiting=None, restarting=None): + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6", "rt7"]: + # Check the RIB first, which should be preserved across restarts in + # all routers of the routing domain. + if initial_convergence == True: + tries = 240 + else: + tries = 1 + router_compare_json_output( + rname, "show ip route ospf json", "show_ip_route.json", tries + ) + + # Check that all adjacencies are up and running (except when there's + # an OSPF instance that is shutting down). + if exiting == None: + tries = 240 + router_compare_json_output( + rname, "show ip ospf neighbor json", "show_ip_ospf_neighbor.json", tries + ) + + # Check the OSPF RIB and LSDB. + # In the restarting router, wait up to one minute for the LSDB to converge. + if exiting != rname: + if initial_convergence == True or restarting == rname: + tries = 240 + else: + tries = 1 + router_compare_json_output( + rname, "show ip ospf database json", "show_ip_ospf_database.json", tries + ) + router_compare_json_output( + rname, "show ip ospf route json", "show_ip_ospf_route.json", tries + ) + + +# +# Test initial network convergence +# +def test_initial_convergence(): + logger.info("Test: verify initial network convergence") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + check_routers(initial_convergence=True) + + +# +# Test rt1 performing a graceful restart +# +def test_gr_rt1(): + logger.info("Test: verify rt1 performing a graceful restart") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.net["rt1"].cmd('vtysh -c "graceful-restart prepare ip ospf"') + sleep(3) + kill_router_daemons(tgen, "rt1", ["ospfd"], save_config=False) + check_routers(exiting="rt1") + + start_router_daemons(tgen, "rt1", ["ospfd"]) + check_routers(restarting="rt1") + + +# +# Test rt2 performing a graceful restart +# +def test_gr_rt2(): + logger.info("Test: verify rt2 performing a graceful restart") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.net["rt2"].cmd('vtysh -c "graceful-restart prepare ip ospf"') + sleep(3) + kill_router_daemons(tgen, "rt2", ["ospfd"], save_config=False) + check_routers(exiting="rt2") + + start_router_daemons(tgen, "rt2", ["ospfd"]) + check_routers(restarting="rt2") + + +# +# Test rt3 performing a graceful restart +# +def test_gr_rt3(): + logger.info("Test: verify rt3 performing a graceful restart") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.net["rt3"].cmd('vtysh -c "graceful-restart prepare ip ospf"') + sleep(3) + kill_router_daemons(tgen, "rt3", ["ospfd"], save_config=False) + check_routers(exiting="rt3") + + start_router_daemons(tgen, "rt3", ["ospfd"]) + check_routers(restarting="rt3") + + +# +# Test rt4 performing a graceful restart +# +def test_gr_rt4(): + logger.info("Test: verify rt4 performing a graceful restart") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.net["rt4"].cmd('vtysh -c "graceful-restart prepare ip ospf"') + sleep(3) + kill_router_daemons(tgen, "rt4", ["ospfd"], save_config=False) + check_routers(exiting="rt4") + + start_router_daemons(tgen, "rt4", ["ospfd"]) + check_routers(restarting="rt4") + + +# +# Test rt5 performing a graceful restart +# +def test_gr_rt5(): + logger.info("Test: verify rt5 performing a graceful restart") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.net["rt5"].cmd('vtysh -c "graceful-restart prepare ip ospf"') + sleep(3) + kill_router_daemons(tgen, "rt5", ["ospfd"], save_config=False) + check_routers(exiting="rt5") + + start_router_daemons(tgen, "rt5", ["ospfd"]) + check_routers(restarting="rt5") + + +# +# Test rt6 performing a graceful restart +# +def test_gr_rt6(): + logger.info("Test: verify rt6 performing a graceful restart") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.net["rt6"].cmd('vtysh -c "graceful-restart prepare ip ospf"') + sleep(3) + kill_router_daemons(tgen, "rt6", ["ospfd"], save_config=False) + check_routers(exiting="rt6") + + start_router_daemons(tgen, "rt6", ["ospfd"]) + check_routers(restarting="rt6") + + +# +# Test rt7 performing a graceful restart +# +def test_gr_rt7(): + logger.info("Test: verify rt7 performing a graceful restart") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.net["rt7"].cmd('vtysh -c "graceful-restart prepare ip ospf"') + sleep(3) + kill_router_daemons(tgen, "rt7", ["ospfd"], save_config=False) + check_routers(exiting="rt7") + + start_router_daemons(tgen, "rt7", ["ospfd"]) + check_routers(restarting="rt7") + + +# Memory leak test template +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)) -- 2.39.5