diff options
author | anuradhak <anuradhak@cumulusnetworks.com> | 2017-03-09 20:42:55 +0100 |
---|---|---|
committer | anuradhak <anuradhak@cumulusnetworks.com> | 2017-03-10 19:48:47 +0100 |
commit | 755210ab1dea88aa7b41d83b65e2bc75dbabd99e (patch) | |
tree | f497e2c3baddd7317a6197b2114bfe8d9bda50cd /pimd/pim_cmd.c | |
parent | pimd: simplify pim upstream state transitions (diff) | |
download | frr-755210ab1dea88aa7b41d83b65e2bc75dbabd99e.tar.xz frr-755210ab1dea88aa7b41d83b65e2bc75dbabd99e.zip |
pimd: display reg-state and join-state info in the pim_upstream output
Changed the state field in the "sh ip pim upstream" output to include
register and join state info as a comma separated value. Register info
is supressed if reg-state=NoInfo.
Sample output:
=============
root@fhr:/home/cumulus# net show pim upstream
Iif Source Group State Uptime JoinTimer
RSTimer KATimer RefCnt
swp1 33.1.1.1 239.1.1.2 J,RegP 00:00:18 --:--:--
00:00:44 00:03:24 2
root@fhr:/home/cumulus#
root@rp:/home/cumulus# net show pim upstream
Iif Source Group State Uptime JoinTimer
RSTimer KATimer RefCnt
lo * 239.1.1.2 J 00:02:08 00:00:52
--:--:-- --:--:-- 1
swp1 33.1.1.1 239.1.1.2 J 00:00:16 00:00:11
--:--:-- 00:03:26 1
root@rp:/home/cumulus#
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-14700
Testing Done: pim-smoke
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r-- | pimd/pim_cmd.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 0895ce21c..465c368f4 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1643,6 +1643,44 @@ json_object_pim_upstream_add (json_object *json, struct pim_upstream *up) json_object_boolean_true_add(json, "sourceMsdp"); } +static const char * +pim_upstream_state2brief_str (enum pim_upstream_state join_state, char *state_str) +{ + switch (join_state) + { + case PIM_UPSTREAM_NOTJOINED: + strcpy (state_str, "NotJ"); + break; + case PIM_UPSTREAM_JOINED: + strcpy (state_str, "J"); + break; + default: + strcpy (state_str, "Unk"); + } + return state_str; +} + +static const char * +pim_reg_state2brief_str (enum pim_reg_state reg_state, char *state_str) +{ + switch (reg_state) + { + case PIM_REG_NOINFO: + strcpy (state_str, "RegNI"); + break; + case PIM_REG_JOIN: + strcpy (state_str, "RegJ"); + break; + case PIM_REG_JOIN_PENDING: + case PIM_REG_PRUNE: + strcpy (state_str, "RegP"); + break; + default: + strcpy (state_str, "Unk"); + } + return state_str; +} + static void pim_show_upstream(struct vty *vty, u_char uj) { struct listnode *upnode; @@ -1691,10 +1729,13 @@ static void pim_show_upstream(struct vty *vty, u_char uj) pim_time_timer_to_hhmmss (ka_timer, sizeof (ka_timer), up->t_ka_timer); pim_time_timer_to_hhmmss (msdp_reg_timer, sizeof (msdp_reg_timer), up->t_msdp_reg_timer); - if (pim_if_connected_to_source (up->rpf.source_nexthop.interface, up->sg.src)) - pim_reg_state2str (up->reg_state, state_str); - else - strcpy (state_str, pim_upstream_state2str (up->join_state)); + pim_upstream_state2brief_str (up->join_state, state_str); + if (up->reg_state != PIM_REG_NOINFO) { + char tmp_str[PIM_REG_STATE_STR_LEN]; + + sprintf (state_str + strlen (state_str), ",%s", + pim_reg_state2brief_str (up->reg_state, tmp_str)); + } if (uj) { json_object_object_get_ex(json, grp_str, &json_group); |