zebra: update protodown display

protodown state is a combination of the dplane and zebra states.
protodown reason is maintained exclusively by zebra. Display this
information on two separate lines to make that ownership clearer.

Also display n/a for bonds as the dplane doesn't support protodowning
the bond device.

Sample output -
==============
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"|grep -i protodown
  protodown: off (n/a)
  protodown reasons: (uplinks-down)
root@torm-11:mgmt:~# vtysh -c "show interface swp5"|grep -i protodown
  protodown: on
  protodown reasons: (uplinks-down)
root@torm-11:mgmt:~#

PS: Cosmetic changes only, no functional change.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
Anuradha Karuppiah 2020-06-14 07:31:45 -07:00 committed by Anuradha Karuppiah
parent 5c84327054
commit 26ba45e33d
2 changed files with 13 additions and 6 deletions

View File

@ -1428,6 +1428,14 @@ const char *zebra_protodown_rc_str(enum protodown_reasons protodown_rc,
return pd_buf; return pd_buf;
} }
static inline bool if_is_protodown_applicable(struct interface *ifp)
{
if (IS_ZEBRA_IF_BOND(ifp))
return false;
return true;
}
/* Interface's information print out to vty interface. */ /* Interface's information print out to vty interface. */
static void if_dump_vty(struct vty *vty, struct interface *ifp) static void if_dump_vty(struct vty *vty, struct interface *ifp)
{ {
@ -1592,14 +1600,13 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
} }
zebra_evpn_if_es_print(vty, zebra_if); zebra_evpn_if_es_print(vty, zebra_if);
vty_out(vty, " protodown: %s", vty_out(vty, " protodown: %s %s\n",
(zebra_if->flags & ZIF_FLAG_PROTODOWN) ? "on" : "off"); (zebra_if->flags & ZIF_FLAG_PROTODOWN) ? "on" : "off",
if_is_protodown_applicable(ifp) ? "" : "(n/a)");
if (zebra_if->protodown_rc) if (zebra_if->protodown_rc)
vty_out(vty, " rc: %s\n", vty_out(vty, " protodown reasons: %s\n",
zebra_protodown_rc_str(zebra_if->protodown_rc, pd_buf, zebra_protodown_rc_str(zebra_if->protodown_rc, pd_buf,
sizeof(pd_buf))); sizeof(pd_buf)));
else
vty_out(vty, "\n");
if (zebra_if->link_ifindex != IFINDEX_INTERNAL) { if (zebra_if->link_ifindex != IFINDEX_INTERNAL) {
if (zebra_if->link) if (zebra_if->link)

View File

@ -3029,7 +3029,7 @@ void zebra_evpn_mh_print(struct vty *vty)
vty_out(vty, " uplink-cfg-cnt: %u, uplink-active-cnt: %u\n", vty_out(vty, " uplink-cfg-cnt: %u, uplink-active-cnt: %u\n",
zmh_info->uplink_cfg_cnt, zmh_info->uplink_oper_up_cnt); zmh_info->uplink_cfg_cnt, zmh_info->uplink_oper_up_cnt);
if (zmh_info->protodown_rc) if (zmh_info->protodown_rc)
vty_out(vty, " protodown: %s\n", vty_out(vty, " protodown reasons: %s\n",
zebra_protodown_rc_str(zmh_info->protodown_rc, pd_buf, zebra_protodown_rc_str(zmh_info->protodown_rc, pd_buf,
sizeof(pd_buf))); sizeof(pd_buf)));
} }