From 5ac69ec52a6eb92141deac6d930dddc6ac053e8e Mon Sep 17 00:00:00 2001 From: ckishimo Date: Tue, 16 Mar 2021 23:47:18 +0100 Subject: [PATCH 1/5] ospf6d: fix iface commands lost when removing from area In OSPFv3 when removing the interface from an area, all ospf6 interface commands are lost, so when changing the area you need to reconfigure all ospf6 interface commands again r1# sh run interface r1-r2-eth0 ipv6 address 2013:12::1/64 ipv6 ospf6 dead-interval 4 ipv6 ospf6 hello-interval 1 ipv6 ospf6 network point-to-point ! router ospf6 ospf6 router-id 1.1.1.1 interface r1-r2-eth0 area 0.0.0.0 ! r1# conf t r1(config)# router ospf6 r1(config-ospf6)# no interface r1-r2-eth0 area 0.0.0.0 r1(config-ospf6)# exit r1# sh run interface r1-r2-eth0 ipv6 address 2013:12::1/64 ! <----- missing all ipv6 ospf6 commands router ospf6 ospf6 router-id 1.1.1.1 ! This is because the interface is being deleted instead of disabled (see PR#7717) I believe the interface should be left as disabled (not deleted) when removing the interface from the area Signed-off-by: ckishimo --- ospf6d/ospf6_top.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 3f72ec828e..88c242e79e 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -830,7 +830,6 @@ DEFUN (no_ospf6_interface_area, UNSET_FLAG(oa->flag, OSPF6_AREA_ENABLE); ospf6_abr_disable_area(oa); } - ospf6_interface_delete(oi); return CMD_SUCCESS; } From d100d0b00c91af7ce38cc25139563201a1fbfb42 Mon Sep 17 00:00:00 2001 From: ckishimo Date: Wed, 17 Mar 2021 00:01:19 +0100 Subject: [PATCH 2/5] ospf6d: remove interface prefix when area is removed This bug was first reported in PR#7717. When removing an interface from the area, the interface prefix is still shown r1# sh ipv6 ospf6 interface prefix *N IA 2013:12::/64 ::1 r1-r2-eth0 00:00:12 r1# conf t r1(config)# router ospf6 r1(config-ospf6)# no interface r1-r2-eth0 area 0.0.0.0 r1(config-ospf6)# exit r1# sh ipv6 ospf6 interface prefix *N IA 2013:12::/64 ::1 r1-r2-eth0 00:00:22 This fix will check if the interface is disabled so the prefix is not shown Signed-off-by: ckishimo --- ospf6d/ospf6_interface.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index a5d9138743..f1226edfa7 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1449,6 +1449,12 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix, return CMD_WARNING; } + if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) { + vty_out(vty, "Interface %s not attached to area\n", + argv[idx_ifname]->arg); + return CMD_WARNING; + } + ospf6_route_table_show(vty, idx_prefix, argc, argv, oi->route_connected, uj); @@ -1482,7 +1488,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix, FOR_ALL_INTERFACES (vrf, ifp) { oi = (struct ospf6_interface *)ifp->info; - if (oi == NULL) + if (oi == NULL || CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) continue; ospf6_route_table_show(vty, idx_prefix, argc, argv, From 800cc91882b1ec4aaa01fbd6c570f15310160dec Mon Sep 17 00:00:00 2001 From: ckishimo Date: Wed, 17 Mar 2021 00:14:26 +0100 Subject: [PATCH 3/5] ospf6d: fix warning message when interfae disabled When removing an interface from an existing area, the warning message we get is not correct interface r1-r2-eth0 ipv6 address 2013:12::1/64 ipv6 ospf6 dead-interval 4 ipv6 ospf6 hello-interval 1 ! interface dummy ipv6 ospf6 dead-interval 4 ipv6 ospf6 hello-interval 1 ipv6 ospf6 network point-to-point ! router ospf6 ospf6 router-id 1.1.1.1 interface r1-r2-eth0 area 0.0.0.0 ! r1(config-if)# router ospf6 r1(config-ospf6)# no interface dummy area 0.0.0.0 No such Area-ID: 0.0.0.0 <--- area 0.0.0.0 exists This is fixing the error message Signed-off-by: ckishimo --- ospf6d/ospf6_top.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 88c242e79e..efa4bfb420 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -809,7 +809,8 @@ DEFUN (no_ospf6_interface_area, /* Verify Area */ if (oi->area == NULL) { - vty_out(vty, "No such Area-ID: %s\n", argv[idx_ipv4]->arg); + vty_out(vty, "%s not attached to area %s\n", + oi->interface->name, oi->area->name); return CMD_SUCCESS; } From 9b1bb522e09ccaad7165ff4cda54b04c2985b6c6 Mon Sep 17 00:00:00 2001 From: ckishimo Date: Wed, 17 Mar 2021 00:19:50 +0100 Subject: [PATCH 4/5] tests: fix warning when checking ospfv3 convergence The following error is shown when running the OSPFv3 tests 2021-03-16 23:37:44,792 INFO: Function returned global name 'data_rid' is not defined 2021-03-16 23:37:44,792 INFO: Retry [#1] after sleeping for 2s 2021-03-16 23:37:46,794 INFO: Verifying OSPF6 neighborship on router r1: 2021-03-16 23:37:46,993 INFO: Output for command [ show ipv6 ospf6 neighbor ] on router r1: Neighbor ID Pri DeadTime State/IfState Duration I/F[State] 2.2.2.2 1 00:00:03 Full/PointToPoint 00:00:01 r1-r2-eth0[PointToPoint] Fix the "data_rid" warning by using the correct variable Signed-off-by: ckishimo --- tests/topotests/lib/ospf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py index 79e4d97448..9bbae95095 100644 --- a/tests/topotests/lib/ospf.py +++ b/tests/topotests/lib/ospf.py @@ -724,7 +724,7 @@ def verify_ospf6_neighbor(tgen, topo): nh_state = neighbor["state"] break else: - return "[DUT: {}] OSPF6 peer {} missing".format(router, data_rid) + return "[DUT: {}] OSPF6 peer {} missing".format(router, ospf_nbr_rid) if nh_state == "Full": no_of_peer += 1 From d205f01e1d5641ed81f37ccf081e1a93af9da34c Mon Sep 17 00:00:00 2001 From: ckishimo Date: Wed, 17 Mar 2021 09:35:47 +0100 Subject: [PATCH 5/5] tests: fix too many arguments for logging Signed-off-by: ckishimo --- tests/topotests/lib/ospf.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py index 9bbae95095..9f642411b5 100644 --- a/tests/topotests/lib/ospf.py +++ b/tests/topotests/lib/ospf.py @@ -344,10 +344,9 @@ def config_ospf_interface(tgen, topo, input_dict=None, build=False, load_config= for lnk in input_dict[router]["links"].keys(): if "ospf" not in input_dict[router]["links"][lnk]: logger.debug( - "Router %s: ospf configs is not present in" - "input_dict, passed input_dict", - router, - input_dict, + "Router %s: ospf config is not present in" + "input_dict", + router ) continue ospf_data = input_dict[router]["links"][lnk]["ospf"]