From 16dc582638c6f266295cee2d177673139685c49f Mon Sep 17 00:00:00 2001 From: Manpreet Kaur Date: Thu, 13 Jun 2024 00:48:20 -0700 Subject: [PATCH] ospfd:[clear] nv action clear should give error when there is no OSPF config If ospf config is not applied on interface, clear ospf on that interface should return error. Ticket: #3942003 Signed-off-by: Manpreet Kaur --- ospfd/ospf_vty.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index f5babf501e37..639109c03e4f 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -13474,8 +13474,14 @@ DEFUN (clear_ip_ospf_interface, ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id); if (ifp == NULL) vty_out(vty, "No such interface name\n"); - else - ospf_interface_clear(ifp); + else { + if (ospf_oi_count(ifp) == 0) { + vty_out(vty, + "OSPF not enabled on this interface\n"); + } else { + ospf_interface_clear(ifp); + } + } } return CMD_SUCCESS;