From eb47c1bee12c5163e11c6c157543a74543f8cf2d Mon Sep 17 00:00:00 2001 From: lynne Date: Fri, 18 Sep 2020 14:29:30 -0400 Subject: [PATCH 1/3] isisd: updates to ldp-sync isis commands Improve the output of the show isis mpls ldp-sync command. Signed-off-by: Lynne Morrison --- isisd/isis_ldp_sync.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c index 42928e069a..51123568fc 100644 --- a/isisd/isis_ldp_sync.c +++ b/isisd/isis_ldp_sync.c @@ -698,7 +698,12 @@ static void isis_circuit_ldp_sync_print_vty(struct isis_circuit *circuit, return; ldp_sync_info = circuit->ldp_sync_info; - vty_out(vty, "%-10s\n", circuit->interface->name); + vty_out(vty, "%-16s\n", circuit->interface->name); + if (circuit->state == C_STATE_CONF) { + vty_out(vty, " Interface down\n"); + return; + } + vty_out(vty, " LDP-IGP Synchronization enabled: %s\n", ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED ? "yes" @@ -751,6 +756,7 @@ DEFUN (show_isis_mpls_ldp_interface, struct isis_area *area; struct isis_circuit *circuit; struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); + bool found = false; if (!isis) { vty_out(vty, "IS-IS Routing Process not enabled\n"); @@ -769,10 +775,16 @@ DEFUN (show_isis_mpls_ldp_interface, for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) if (!ifname) isis_circuit_ldp_sync_print_vty(circuit, vty); - else if (strcmp(circuit->interface->name, ifname) == 0) + else if (strcmp(circuit->interface->name, ifname) + == 0) { isis_circuit_ldp_sync_print_vty(circuit, vty); + found = true; + } } + if (found == false && ifname) + vty_out(vty, "%-16s\n ISIS not enabled\n", ifname); + return CMD_SUCCESS; } From 9919bec70a65e68577fca31bf81217545858ce47 Mon Sep 17 00:00:00 2001 From: lynne Date: Fri, 18 Sep 2020 14:32:24 -0400 Subject: [PATCH 2/3] ospfd: updates to the ldp-sync ospf commands Improve the output of the show ip ospf mpls ldp-sync command. Signed-off-by: Lynne Morrison --- ospfd/ospf_ldp_sync.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index a8c9df1c56..2c3b6705a3 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -710,8 +710,12 @@ static int show_ip_ospf_mpls_ldp_interface_common(struct vty *vty, struct route_node *rn; struct ospf_interface *oi; - if (ospf_oi_count(ifp) == 0) + if (ospf_oi_count(ifp) == 0 && !use_json) { + if (!if_is_up(ifp)) + vty_out(vty, "%s\n Interface down\n", + ifp->name); continue; + } for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) { oi = rn->info; @@ -739,9 +743,12 @@ static int show_ip_ospf_mpls_ldp_interface_common(struct vty *vty, struct ospf_interface *oi; if (ospf_oi_count(ifp) == 0 && !use_json) { - vty_out(vty, - " OSPF not enabled on this interface %s\n", - ifp->name); + if (if_is_up(ifp)) + vty_out(vty, "%s\n OSPF not enabled\n", + ifp->name); + else + vty_out(vty, "%s\n Interface down\n", + ifp->name); return CMD_SUCCESS; } for (rn = route_top(IF_OIFS(ifp)); rn; From e82329ef204cdfb35f67f9a4975691c9a81e96ad Mon Sep 17 00:00:00 2001 From: lynne Date: Mon, 21 Sep 2020 11:55:47 -0400 Subject: [PATCH 3/3] ldpd: update topo tests for new show isis ldp-sync command output Signed-off-by: Lynne Morrison --- .../r1/show_isis_ldp_sync_r1_eth1_shutdown.ref | 4 +--- .../r2/show_isis_ldp_sync_r2_eth1_shutdown.ref | 4 +--- .../test_ldp_sync_isis_topo1.py | 15 ++++++++------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/topotests/ldp-sync-isis-topo1/r1/show_isis_ldp_sync_r1_eth1_shutdown.ref b/tests/topotests/ldp-sync-isis-topo1/r1/show_isis_ldp_sync_r1_eth1_shutdown.ref index c63bbea77f..c28cd4cc7d 100644 --- a/tests/topotests/ldp-sync-isis-topo1/r1/show_isis_ldp_sync_r1_eth1_shutdown.ref +++ b/tests/topotests/ldp-sync-isis-topo1/r1/show_isis_ldp_sync_r1_eth1_shutdown.ref @@ -1,8 +1,6 @@ { "r1-eth1":{ - "ldpIgpSyncEnabled":true, - "holdDownTimeInSec":0, - "ldpIgpSyncState":"Sync not achieved" + "Interface":true }, "r1-eth2":{ "ldpIgpSyncEnabled":true, diff --git a/tests/topotests/ldp-sync-isis-topo1/r2/show_isis_ldp_sync_r2_eth1_shutdown.ref b/tests/topotests/ldp-sync-isis-topo1/r2/show_isis_ldp_sync_r2_eth1_shutdown.ref index 2f3eae47c8..c3d97a3c73 100644 --- a/tests/topotests/ldp-sync-isis-topo1/r2/show_isis_ldp_sync_r2_eth1_shutdown.ref +++ b/tests/topotests/ldp-sync-isis-topo1/r2/show_isis_ldp_sync_r2_eth1_shutdown.ref @@ -1,8 +1,6 @@ { "r2-eth1":{ - "ldpIgpSyncEnabled":true, - "holdDownTimeInSec":0, - "ldpIgpSyncState":"Sync not achieved" + "Interface":true }, "r2-eth2":{ "ldpIgpSyncEnabled":false, diff --git a/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py b/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py index 1dce698c17..807b00ffa1 100755 --- a/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py +++ b/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py @@ -470,16 +470,17 @@ def parse_show_isis_ldp_sync(lines, rname): if line.startswith(" LDP-IGP Synchronization enabled: "): interface["ldpIgpSyncEnabled"] = line.endswith("yes") + line = it.next(); - line = it.next(); + if line.startswith(" holddown timer in seconds: "): + interface["holdDownTimeInSec"] = int(line.split(": ")[-1]) + line = it.next(); - if line.startswith(" holddown timer in seconds: "): - interface["holdDownTimeInSec"] = int(line.split(": ")[-1]) + if line.startswith(" State: "): + interface["ldpIgpSyncState"] = line.split(": ")[-1] - line = it.next(); - - if line.startswith(" State: "): - interface["ldpIgpSyncState"] = line.split(": ")[-1] + elif line.startswith(" Interface "): + interface["Interface"] = line.endswith("down") interfaces[interface_name] = interface