3 * Copyright (C) 2008 Everton da Silva Marques
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 #include "pim_mroute.h"
36 #include "pim_iface.h"
38 #include "pim_mroute.h"
41 #include "pim_igmpv3.h"
46 #include "pim_neighbor.h"
48 #include "pim_ifchannel.h"
49 #include "pim_hello.h"
51 #include "pim_upstream.h"
53 #include "pim_macro.h"
54 #include "pim_ssmpingd.h"
55 #include "pim_zebra.h"
56 #include "pim_static.h"
58 #include "pim_zlookup.h"
63 #include "pim_vxlan.h"
67 #include "lib/northbound_cli.h"
68 #include "pim_errors.h"
71 #include "pim_cmd_common.h"
73 #ifndef VTYSH_EXTRACT_PL
74 #include "pimd/pim_cmd_clippy.c"
77 static struct cmd_node debug_node
= {
81 .config_write
= pim_debug_config_write
,
84 static struct vrf
*pim_cmd_lookup_vrf(struct vty
*vty
, struct cmd_token
*argv
[],
85 const int argc
, int *idx
)
89 if (argv_find(argv
, argc
, "NAME", idx
))
90 vrf
= vrf_lookup_by_name(argv
[*idx
]->arg
);
92 vrf
= vrf_lookup_by_id(VRF_DEFAULT
);
95 vty_out(vty
, "Specified VRF: %s does not exist\n",
101 static void pim_show_assert_helper(struct vty
*vty
,
102 struct pim_interface
*pim_ifp
,
103 struct pim_ifchannel
*ch
, time_t now
)
105 char winner_str
[INET_ADDRSTRLEN
];
106 struct in_addr ifaddr
;
109 char buf
[PREFIX_STRLEN
];
111 ifaddr
= pim_ifp
->primary_address
;
113 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
, winner_str
,
116 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
117 pim_time_timer_to_mmss(timer
, sizeof(timer
), ch
->t_ifassert_timer
);
119 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-6s %-15s %-8s %-5s\n",
121 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
122 &ch
->sg
.grp
, pim_ifchannel_ifassert_name(ch
->ifassert_state
),
123 winner_str
, uptime
, timer
);
126 static void pim_show_assert(struct pim_instance
*pim
, struct vty
*vty
)
128 struct pim_interface
*pim_ifp
;
129 struct pim_ifchannel
*ch
;
130 struct interface
*ifp
;
133 now
= pim_time_monotonic_sec();
136 "Interface Address Source Group State Winner Uptime Timer\n");
138 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
143 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
144 if (ch
->ifassert_state
== PIM_IFASSERT_NOINFO
)
147 pim_show_assert_helper(vty
, pim_ifp
, ch
, now
);
148 } /* scan interface channels */
152 static void pim_show_assert_internal_helper(struct vty
*vty
,
153 struct pim_interface
*pim_ifp
,
154 struct pim_ifchannel
*ch
)
156 struct in_addr ifaddr
;
157 char buf
[PREFIX_STRLEN
];
159 ifaddr
= pim_ifp
->primary_address
;
161 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-3s %-3s %-4s\n",
163 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
165 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
166 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
167 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes"
169 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no");
172 static void pim_show_assert_internal(struct pim_instance
*pim
, struct vty
*vty
)
174 struct pim_interface
*pim_ifp
;
175 struct pim_ifchannel
*ch
;
176 struct interface
*ifp
;
180 "ECA: Evaluate CouldAssert\n"
181 "ATD: AssertTrackingDesired\n"
182 "eATD: Evaluate AssertTrackingDesired\n\n");
185 "Interface Address Source Group CA eCA ATD eATD\n");
186 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
191 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
192 pim_show_assert_internal_helper(vty
, pim_ifp
, ch
);
193 } /* scan interface channels */
197 static void pim_show_assert_metric_helper(struct vty
*vty
,
198 struct pim_interface
*pim_ifp
,
199 struct pim_ifchannel
*ch
)
201 char addr_str
[INET_ADDRSTRLEN
];
202 struct pim_assert_metric am
;
203 struct in_addr ifaddr
;
204 char buf
[PREFIX_STRLEN
];
206 ifaddr
= pim_ifp
->primary_address
;
208 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
,
209 pim_ifp
->primary_address
);
211 pim_inet4_dump("<addr?>", am
.ip_address
, addr_str
, sizeof(addr_str
));
213 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %4u %6u %-15s\n",
215 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
216 &ch
->sg
.grp
, am
.rpt_bit_flag
? "yes" : "no",
217 am
.metric_preference
, am
.route_metric
, addr_str
);
220 static void pim_show_assert_metric(struct pim_instance
*pim
, struct vty
*vty
)
222 struct pim_interface
*pim_ifp
;
223 struct pim_ifchannel
*ch
;
224 struct interface
*ifp
;
227 "Interface Address Source Group RPT Pref Metric Address \n");
229 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
234 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
235 pim_show_assert_metric_helper(vty
, pim_ifp
, ch
);
236 } /* scan interface channels */
240 static void pim_show_assert_winner_metric_helper(struct vty
*vty
,
241 struct pim_interface
*pim_ifp
,
242 struct pim_ifchannel
*ch
)
244 char addr_str
[INET_ADDRSTRLEN
];
245 struct pim_assert_metric
*am
;
246 struct in_addr ifaddr
;
249 char buf
[PREFIX_STRLEN
];
251 ifaddr
= pim_ifp
->primary_address
;
253 am
= &ch
->ifassert_winner_metric
;
255 pim_inet4_dump("<addr?>", am
->ip_address
, addr_str
, sizeof(addr_str
));
257 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
258 snprintf(pref_str
, sizeof(pref_str
), "INFI");
260 snprintf(pref_str
, sizeof(pref_str
), "%4u",
261 am
->metric_preference
);
263 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
264 snprintf(metr_str
, sizeof(metr_str
), "INFI");
266 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
268 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-4s %-6s %-15s\n",
270 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
271 &ch
->sg
.grp
, am
->rpt_bit_flag
? "yes" : "no", pref_str
,
275 static void pim_show_assert_winner_metric(struct pim_instance
*pim
,
278 struct pim_interface
*pim_ifp
;
279 struct pim_ifchannel
*ch
;
280 struct interface
*ifp
;
283 "Interface Address Source Group RPT Pref Metric Address \n");
285 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
290 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
291 pim_show_assert_winner_metric_helper(vty
, pim_ifp
, ch
);
292 } /* scan interface channels */
296 static void igmp_show_interfaces(struct pim_instance
*pim
, struct vty
*vty
,
299 struct interface
*ifp
;
301 char buf
[PREFIX_STRLEN
];
302 json_object
*json
= NULL
;
303 json_object
*json_row
= NULL
;
305 now
= pim_time_monotonic_sec();
308 json
= json_object_new_object();
311 "Interface State Address V Querier QuerierIp Query Timer Uptime\n");
313 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
314 struct pim_interface
*pim_ifp
;
315 struct listnode
*sock_node
;
316 struct gm_sock
*igmp
;
323 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
326 char query_hhmmss
[10];
328 pim_time_uptime(uptime
, sizeof(uptime
),
329 now
- igmp
->sock_creation
);
330 pim_time_timer_to_hhmmss(query_hhmmss
,
331 sizeof(query_hhmmss
),
332 igmp
->t_igmp_query_timer
);
335 json_row
= json_object_new_object();
336 json_object_pim_ifp_add(json_row
, ifp
);
337 json_object_string_add(json_row
, "upTime",
339 json_object_int_add(json_row
, "version",
340 pim_ifp
->igmp_version
);
342 if (igmp
->t_igmp_query_timer
) {
343 json_object_boolean_true_add(json_row
,
345 json_object_string_add(json_row
,
349 json_object_string_addf(json_row
, "querierIp",
351 &igmp
->querier_addr
);
353 json_object_object_add(json
, ifp
->name
,
356 if (igmp
->mtrace_only
) {
357 json_object_boolean_true_add(
358 json_row
, "mtraceOnly");
362 "%-16s %5s %15s %d %7s %17pI4 %11s %8s\n",
365 ? (igmp
->mtrace_only
? "mtrc"
368 inet_ntop(AF_INET
, &igmp
->ifaddr
, buf
,
370 pim_ifp
->igmp_version
,
371 igmp
->t_igmp_query_timer
? "local"
373 &igmp
->querier_addr
, query_hhmmss
,
383 static void igmp_show_interfaces_single(struct pim_instance
*pim
,
384 struct vty
*vty
, const char *ifname
,
387 struct gm_sock
*igmp
;
388 struct interface
*ifp
;
389 struct listnode
*sock_node
;
390 struct pim_interface
*pim_ifp
;
392 char query_hhmmss
[10];
393 char other_hhmmss
[10];
394 int found_ifname
= 0;
396 long gmi_msec
; /* Group Membership Interval */
399 long oqpi_msec
; /* Other Querier Present Interval */
404 json_object
*json
= NULL
;
405 json_object
*json_row
= NULL
;
408 json
= json_object_new_object();
410 now
= pim_time_monotonic_sec();
412 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
418 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
421 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
424 pim_time_uptime(uptime
, sizeof(uptime
),
425 now
- igmp
->sock_creation
);
426 pim_time_timer_to_hhmmss(query_hhmmss
,
427 sizeof(query_hhmmss
),
428 igmp
->t_igmp_query_timer
);
429 pim_time_timer_to_hhmmss(other_hhmmss
,
430 sizeof(other_hhmmss
),
431 igmp
->t_other_querier_timer
);
433 gmi_msec
= PIM_IGMP_GMI_MSEC(
434 igmp
->querier_robustness_variable
,
435 igmp
->querier_query_interval
,
436 pim_ifp
->gm_query_max_response_time_dsec
);
438 sqi
= PIM_IGMP_SQI(pim_ifp
->gm_default_query_interval
);
440 oqpi_msec
= PIM_IGMP_OQPI_MSEC(
441 igmp
->querier_robustness_variable
,
442 igmp
->querier_query_interval
,
443 pim_ifp
->gm_query_max_response_time_dsec
);
445 lmqt_msec
= PIM_IGMP_LMQT_MSEC(
446 pim_ifp
->gm_specific_query_max_response_time_dsec
,
447 pim_ifp
->gm_last_member_query_count
);
451 igmp
->querier_robustness_variable
,
452 igmp
->querier_query_interval
,
453 pim_ifp
->gm_query_max_response_time_dsec
) *
457 pim_ifp
->gm_query_max_response_time_dsec
* 100;
458 lmqc
= pim_ifp
->gm_last_member_query_count
;
461 json_row
= json_object_new_object();
462 json_object_pim_ifp_add(json_row
, ifp
);
463 json_object_string_add(json_row
, "upTime",
465 json_object_string_add(json_row
, "querier",
466 igmp
->t_igmp_query_timer
469 json_object_string_addf(json_row
, "querierIp",
471 &igmp
->querier_addr
);
472 json_object_int_add(json_row
, "queryStartCount",
473 igmp
->startup_query_count
);
474 json_object_string_add(json_row
,
477 json_object_string_add(json_row
,
480 json_object_int_add(json_row
, "version",
481 pim_ifp
->igmp_version
);
484 "timerGroupMembershipIntervalMsec",
486 json_object_int_add(json_row
,
487 "lastMemberQueryCount",
489 json_object_int_add(json_row
,
490 "timerLastMemberQueryMsec",
494 "timerOlderHostPresentIntervalMsec",
498 "timerOtherQuerierPresentIntervalMsec",
501 json_row
, "timerQueryInterval",
502 igmp
->querier_query_interval
);
505 "timerQueryResponseIntervalMsec",
508 json_row
, "timerRobustnessVariable",
509 igmp
->querier_robustness_variable
);
510 json_object_int_add(json_row
,
511 "timerStartupQueryInterval",
514 json_object_object_add(json
, ifp
->name
,
517 if (igmp
->mtrace_only
) {
518 json_object_boolean_true_add(
519 json_row
, "mtraceOnly");
522 vty_out(vty
, "Interface : %s\n", ifp
->name
);
523 vty_out(vty
, "State : %s\n",
524 if_is_up(ifp
) ? (igmp
->mtrace_only
?
528 vty_out(vty
, "Address : %pI4\n",
529 &pim_ifp
->primary_address
);
530 vty_out(vty
, "Uptime : %s\n", uptime
);
531 vty_out(vty
, "Version : %d\n",
532 pim_ifp
->igmp_version
);
536 vty_out(vty
, "Querier\n");
537 vty_out(vty
, "-------\n");
538 vty_out(vty
, "Querier : %s\n",
539 igmp
->t_igmp_query_timer
? "local"
541 vty_out(vty
, "QuerierIp : %pI4",
542 &igmp
->querier_addr
);
543 if (pim_ifp
->primary_address
.s_addr
544 == igmp
->querier_addr
.s_addr
)
545 vty_out(vty
, " (this router)\n");
549 vty_out(vty
, "Start Count : %d\n",
550 igmp
->startup_query_count
);
551 vty_out(vty
, "Query Timer : %s\n",
553 vty_out(vty
, "Other Timer : %s\n",
558 vty_out(vty
, "Timers\n");
559 vty_out(vty
, "------\n");
561 "Group Membership Interval : %lis\n",
564 "Last Member Query Count : %d\n",
567 "Last Member Query Time : %lis\n",
570 "Older Host Present Interval : %lis\n",
573 "Other Querier Present Interval : %lis\n",
576 "Query Interval : %ds\n",
577 igmp
->querier_query_interval
);
579 "Query Response Interval : %lis\n",
582 "Robustness Variable : %d\n",
583 igmp
->querier_robustness_variable
);
585 "Startup Query Interval : %ds\n",
590 pim_print_ifp_flags(vty
, ifp
);
597 else if (!found_ifname
)
598 vty_out(vty
, "%% No such interface\n");
601 static void igmp_show_interface_join(struct pim_instance
*pim
, struct vty
*vty
,
604 struct interface
*ifp
;
606 json_object
*json
= NULL
;
607 json_object
*json_iface
= NULL
;
608 json_object
*json_grp
= NULL
;
609 json_object
*json_grp_arr
= NULL
;
611 now
= pim_time_monotonic_sec();
614 json
= json_object_new_object();
615 json_object_string_add(json
, "vrf",
616 vrf_id_to_name(pim
->vrf
->vrf_id
));
619 "Interface Address Source Group Socket Uptime \n");
622 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
623 struct pim_interface
*pim_ifp
;
624 struct listnode
*join_node
;
626 struct in_addr pri_addr
;
627 char pri_addr_str
[INET_ADDRSTRLEN
];
634 if (!pim_ifp
->gm_join_list
)
637 pri_addr
= pim_find_primary_addr(ifp
);
638 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
,
639 sizeof(pri_addr_str
));
641 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_join_list
, join_node
,
643 char group_str
[INET_ADDRSTRLEN
];
644 char source_str
[INET_ADDRSTRLEN
];
647 pim_time_uptime(uptime
, sizeof(uptime
),
648 now
- ij
->sock_creation
);
649 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
,
651 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
,
655 json_object_object_get_ex(json
, ifp
->name
,
659 json_iface
= json_object_new_object();
660 json_object_string_add(
661 json_iface
, "name", ifp
->name
);
662 json_object_object_add(json
, ifp
->name
,
664 json_grp_arr
= json_object_new_array();
665 json_object_object_add(json_iface
,
670 json_grp
= json_object_new_object();
671 json_object_string_add(json_grp
, "source",
673 json_object_string_add(json_grp
, "group",
675 json_object_string_add(json_grp
, "primaryAddr",
677 json_object_int_add(json_grp
, "sockFd",
679 json_object_string_add(json_grp
, "upTime",
681 json_object_array_add(json_grp_arr
, json_grp
);
684 "%-16s %-15s %-15s %-15s %6d %8s\n",
685 ifp
->name
, pri_addr_str
, source_str
,
686 group_str
, ij
->sock_fd
, uptime
);
688 } /* for (pim_ifp->gm_join_list) */
696 static void igmp_show_statistics(struct pim_instance
*pim
, struct vty
*vty
,
697 const char *ifname
, bool uj
)
699 struct interface
*ifp
;
700 struct igmp_stats igmp_stats
;
701 bool found_ifname
= false;
702 json_object
*json
= NULL
;
704 igmp_stats_init(&igmp_stats
);
707 json
= json_object_new_object();
709 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
710 struct pim_interface
*pim_ifp
;
711 struct listnode
*sock_node
, *source_node
, *group_node
;
712 struct gm_sock
*igmp
;
713 struct gm_group
*group
;
714 struct gm_source
*src
;
721 if (ifname
&& strcmp(ifname
, ifp
->name
))
726 igmp_stats
.joins_failed
+= pim_ifp
->igmp_ifstat_joins_failed
;
727 igmp_stats
.joins_sent
+= pim_ifp
->igmp_ifstat_joins_sent
;
728 igmp_stats
.total_groups
+=
729 pim_ifp
->gm_group_list
730 ? listcount(pim_ifp
->gm_group_list
)
732 igmp_stats
.peak_groups
+= pim_ifp
->igmp_peak_group_count
;
735 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, group_node
,
737 for (ALL_LIST_ELEMENTS_RO(group
->group_source_list
,
739 if (pim_addr_is_any(src
->source_addr
))
742 igmp_stats
.total_source_groups
++;
746 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
748 igmp_stats_add(&igmp_stats
, &igmp
->igmp_stats
);
756 vty_out(vty
, "%% No such interface\n");
761 json_object
*json_row
= json_object_new_object();
763 json_object_string_add(json_row
, "name",
764 ifname
? ifname
: "global");
765 json_object_int_add(json_row
, "queryV1", igmp_stats
.query_v1
);
766 json_object_int_add(json_row
, "queryV2", igmp_stats
.query_v2
);
767 json_object_int_add(json_row
, "queryV3", igmp_stats
.query_v3
);
768 json_object_int_add(json_row
, "leaveV2", igmp_stats
.leave_v2
);
769 json_object_int_add(json_row
, "reportV1", igmp_stats
.report_v1
);
770 json_object_int_add(json_row
, "reportV2", igmp_stats
.report_v2
);
771 json_object_int_add(json_row
, "reportV3", igmp_stats
.report_v3
);
772 json_object_int_add(json_row
, "mtraceResponse",
773 igmp_stats
.mtrace_rsp
);
774 json_object_int_add(json_row
, "mtraceRequest",
775 igmp_stats
.mtrace_req
);
776 json_object_int_add(json_row
, "unsupported",
777 igmp_stats
.unsupported
);
778 json_object_int_add(json_row
, "totalReceivedMessages",
779 igmp_stats
.total_recv_messages
);
780 json_object_int_add(json_row
, "peakGroups",
781 igmp_stats
.peak_groups
);
782 json_object_int_add(json_row
, "totalGroups",
783 igmp_stats
.total_groups
);
784 json_object_int_add(json_row
, "totalSourceGroups",
785 igmp_stats
.total_source_groups
);
786 json_object_int_add(json_row
, "joinsFailed",
787 igmp_stats
.joins_failed
);
788 json_object_int_add(json_row
, "joinsSent",
789 igmp_stats
.joins_sent
);
790 json_object_int_add(json_row
, "generalQueriesSent",
791 igmp_stats
.general_queries_sent
);
792 json_object_int_add(json_row
, "groupQueriesSent",
793 igmp_stats
.group_queries_sent
);
794 json_object_object_add(json
, ifname
? ifname
: "global",
798 vty_out(vty
, "IGMP statistics\n");
799 vty_out(vty
, "Interface : %s\n",
800 ifname
? ifname
: "global");
801 vty_out(vty
, "V1 query : %u\n",
802 igmp_stats
.query_v1
);
803 vty_out(vty
, "V2 query : %u\n",
804 igmp_stats
.query_v2
);
805 vty_out(vty
, "V3 query : %u\n",
806 igmp_stats
.query_v3
);
807 vty_out(vty
, "V2 leave : %u\n",
808 igmp_stats
.leave_v2
);
809 vty_out(vty
, "V1 report : %u\n",
810 igmp_stats
.report_v1
);
811 vty_out(vty
, "V2 report : %u\n",
812 igmp_stats
.report_v2
);
813 vty_out(vty
, "V3 report : %u\n",
814 igmp_stats
.report_v3
);
815 vty_out(vty
, "mtrace response : %u\n",
816 igmp_stats
.mtrace_rsp
);
817 vty_out(vty
, "mtrace request : %u\n",
818 igmp_stats
.mtrace_req
);
819 vty_out(vty
, "unsupported : %u\n",
820 igmp_stats
.unsupported
);
821 vty_out(vty
, "total received messages : %u\n",
822 igmp_stats
.total_recv_messages
);
823 vty_out(vty
, "joins failed : %u\n",
824 igmp_stats
.joins_failed
);
825 vty_out(vty
, "joins sent : %u\n",
826 igmp_stats
.joins_sent
);
827 vty_out(vty
, "general queries sent : %u\n",
828 igmp_stats
.general_queries_sent
);
829 vty_out(vty
, "group queries sent : %u\n",
830 igmp_stats
.group_queries_sent
);
831 vty_out(vty
, "peak groups : %u\n",
832 igmp_stats
.peak_groups
);
833 vty_out(vty
, "total groups : %u\n",
834 igmp_stats
.total_groups
);
835 vty_out(vty
, "total source groups : %u\n",
836 igmp_stats
.total_source_groups
);
840 static void igmp_show_groups(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
842 struct interface
*ifp
;
844 json_object
*json
= NULL
;
845 json_object
*json_iface
= NULL
;
846 json_object
*json_group
= NULL
;
847 json_object
*json_groups
= NULL
;
849 now
= pim_time_monotonic_sec();
852 json
= json_object_new_object();
853 json_object_int_add(json
, "totalGroups", pim
->gm_group_count
);
854 json_object_int_add(json
, "watermarkLimit",
855 pim
->gm_watermark_limit
);
857 vty_out(vty
, "Total IGMP groups: %u\n", pim
->gm_group_count
);
858 vty_out(vty
, "Watermark warn limit(%s): %u\n",
859 pim
->gm_watermark_limit
? "Set" : "Not Set",
860 pim
->gm_watermark_limit
);
862 "Interface Group Mode Timer Srcs V Uptime \n");
865 /* scan interfaces */
866 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
867 struct pim_interface
*pim_ifp
= ifp
->info
;
868 struct listnode
*grpnode
;
869 struct gm_group
*grp
;
874 /* scan igmp groups */
875 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
877 char group_str
[INET_ADDRSTRLEN
];
881 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
883 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
),
885 pim_time_uptime(uptime
, sizeof(uptime
),
886 now
- grp
->group_creation
);
889 json_object_object_get_ex(json
, ifp
->name
,
893 json_iface
= json_object_new_object();
894 json_object_pim_ifp_add(json_iface
,
896 json_object_object_add(json
, ifp
->name
,
898 json_groups
= json_object_new_array();
899 json_object_object_add(json_iface
,
904 json_group
= json_object_new_object();
905 json_object_string_add(json_group
, "group",
908 if (grp
->igmp_version
== 3)
909 json_object_string_add(
911 grp
->group_filtermode_isexcl
915 json_object_string_add(json_group
, "timer",
918 json_group
, "sourcesCount",
919 grp
->group_source_list
? listcount(
920 grp
->group_source_list
)
922 json_object_int_add(json_group
, "version",
924 json_object_string_add(json_group
, "uptime",
926 json_object_array_add(json_groups
, json_group
);
928 vty_out(vty
, "%-16s %-15s %4s %8s %4d %d %8s\n",
929 ifp
->name
, group_str
,
930 grp
->igmp_version
== 3
931 ? (grp
->group_filtermode_isexcl
936 grp
->group_source_list
? listcount(
937 grp
->group_source_list
)
939 grp
->igmp_version
, uptime
);
941 } /* scan igmp groups */
942 } /* scan interfaces */
948 static void igmp_show_group_retransmission(struct pim_instance
*pim
,
951 struct interface
*ifp
;
954 "Interface Group RetTimer Counter RetSrcs\n");
956 /* scan interfaces */
957 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
958 struct pim_interface
*pim_ifp
= ifp
->info
;
959 struct listnode
*grpnode
;
960 struct gm_group
*grp
;
965 /* scan igmp groups */
966 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
968 char group_str
[INET_ADDRSTRLEN
];
969 char grp_retr_mmss
[10];
970 struct listnode
*src_node
;
971 struct gm_source
*src
;
972 int grp_retr_sources
= 0;
974 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
976 pim_time_timer_to_mmss(
977 grp_retr_mmss
, sizeof(grp_retr_mmss
),
978 grp
->t_group_query_retransmit_timer
);
981 /* count group sources with retransmission state
983 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
985 if (src
->source_query_retransmit_count
> 0) {
990 vty_out(vty
, "%-16s %-15s %-8s %7d %7d\n", ifp
->name
,
991 group_str
, grp_retr_mmss
,
992 grp
->group_specific_query_retransmit_count
,
995 } /* scan igmp groups */
996 } /* scan interfaces */
999 static void igmp_show_sources(struct pim_instance
*pim
, struct vty
*vty
,
1002 struct interface
*ifp
;
1004 json_object
*json
= NULL
;
1005 json_object
*json_iface
= NULL
;
1006 json_object
*json_group
= NULL
;
1007 json_object
*json_source
= NULL
;
1008 json_object
*json_sources
= NULL
;
1010 now
= pim_time_monotonic_sec();
1013 json
= json_object_new_object();
1016 "Interface Group Source Timer Fwd Uptime \n");
1018 /* scan interfaces */
1019 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1020 struct pim_interface
*pim_ifp
= ifp
->info
;
1021 struct listnode
*grpnode
;
1022 struct gm_group
*grp
;
1027 /* scan igmp groups */
1028 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1030 char group_str
[INET_ADDRSTRLEN
];
1031 struct listnode
*srcnode
;
1032 struct gm_source
*src
;
1034 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1037 /* scan group sources */
1038 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1040 char source_str
[INET_ADDRSTRLEN
];
1044 pim_inet4_dump("<source?>", src
->source_addr
,
1045 source_str
, sizeof(source_str
));
1047 pim_time_timer_to_mmss(mmss
, sizeof(mmss
),
1048 src
->t_source_timer
);
1050 pim_time_uptime(uptime
, sizeof(uptime
),
1051 now
- src
->source_creation
);
1054 json_object_object_get_ex(
1055 json
, ifp
->name
, &json_iface
);
1058 json_object_new_object();
1059 json_object_string_add(
1062 json_object_object_add(
1066 json_object_object_get_ex(json_iface
,
1072 json_object_new_object();
1073 json_object_string_add(
1074 json_group
, "group",
1076 json_object_object_add(
1077 json_iface
, group_str
,
1080 json_object_new_array();
1081 json_object_object_add(
1082 json_group
, "sources",
1085 json_source
= json_object_new_object();
1086 json_object_string_add(json_source
,
1089 json_object_string_add(json_source
,
1091 json_object_boolean_add(
1092 json_source
, "forwarded",
1093 IGMP_SOURCE_TEST_FORWARDING(
1094 src
->source_flags
));
1095 json_object_string_add(
1096 json_source
, "uptime", uptime
);
1097 json_object_array_add(json_sources
,
1102 "%-16s %-15s %-15s %5s %3s %8s\n",
1103 ifp
->name
, group_str
,
1105 IGMP_SOURCE_TEST_FORWARDING(
1112 } /* scan group sources */
1113 } /* scan igmp groups */
1114 } /* scan interfaces */
1116 vty_json(vty
, json
);
1119 static void igmp_show_source_retransmission(struct pim_instance
*pim
,
1122 struct interface
*ifp
;
1125 "Interface Group Source Counter\n");
1127 /* scan interfaces */
1128 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1129 struct pim_interface
*pim_ifp
= ifp
->info
;
1130 struct listnode
*grpnode
;
1131 struct gm_group
*grp
;
1136 /* scan igmp groups */
1137 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1139 char group_str
[INET_ADDRSTRLEN
];
1140 struct listnode
*srcnode
;
1141 struct gm_source
*src
;
1143 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1146 /* scan group sources */
1147 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1149 char source_str
[INET_ADDRSTRLEN
];
1151 pim_inet4_dump("<source?>", src
->source_addr
,
1152 source_str
, sizeof(source_str
));
1154 vty_out(vty
, "%-16s %-15s %-15s %7d\n",
1155 ifp
->name
, group_str
, source_str
,
1156 src
->source_query_retransmit_count
);
1158 } /* scan group sources */
1159 } /* scan igmp groups */
1160 } /* scan interfaces */
1163 static void clear_igmp_interfaces(struct pim_instance
*pim
)
1165 struct interface
*ifp
;
1167 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1168 pim_if_addr_del_all_igmp(ifp
);
1170 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1171 pim_if_addr_add_all(ifp
);
1174 static void clear_interfaces(struct pim_instance
*pim
)
1176 clear_igmp_interfaces(pim
);
1177 clear_pim_interfaces(pim
);
1180 #define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \
1181 pim_ifp = ifp->info; \
1184 "%% Enable PIM and/or IGMP on this interface first\n"); \
1185 return CMD_WARNING_CONFIG_FAILED; \
1189 * Compatibility function to keep the legacy mesh group CLI behavior:
1190 * Delete group when there are no more configurations in it.
1193 * Don't forget to call `nb_cli_apply_changes` after this.
1195 static void pim_cli_legacy_mesh_group_behavior(struct vty
*vty
,
1198 const char *vrfname
;
1199 char xpath_value
[XPATH_MAXLEN
];
1200 char xpath_member_value
[XPATH_MAXLEN
];
1201 const struct lyd_node
*member_dnode
;
1203 vrfname
= pim_cli_get_vrf_name(vty
);
1204 if (vrfname
== NULL
)
1207 /* Get mesh group base XPath. */
1208 snprintf(xpath_value
, sizeof(xpath_value
),
1209 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
1210 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
1211 /* Group must exists, otherwise just quit. */
1212 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
1215 /* Group members check: */
1216 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1217 strlcat(xpath_member_value
, "/members", sizeof(xpath_member_value
));
1218 if (yang_dnode_exists(vty
->candidate_config
->dnode
,
1219 xpath_member_value
)) {
1220 member_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
1221 xpath_member_value
);
1222 if (!member_dnode
|| !yang_is_last_list_dnode(member_dnode
))
1226 /* Source address check: */
1227 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1228 strlcat(xpath_member_value
, "/source", sizeof(xpath_member_value
));
1229 if (yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_member_value
))
1232 /* No configurations found: delete it. */
1233 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
1236 DEFUN (clear_ip_interfaces
,
1237 clear_ip_interfaces_cmd
,
1238 "clear ip interfaces [vrf NAME]",
1241 "Reset interfaces\n"
1245 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1250 clear_interfaces(vrf
->info
);
1255 DEFUN (clear_ip_igmp_interfaces
,
1256 clear_ip_igmp_interfaces_cmd
,
1257 "clear ip igmp [vrf NAME] interfaces",
1262 "Reset IGMP interfaces\n")
1265 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1270 clear_igmp_interfaces(vrf
->info
);
1275 DEFPY (clear_ip_pim_statistics
,
1276 clear_ip_pim_statistics_cmd
,
1277 "clear ip pim statistics [vrf NAME]$name",
1282 "Reset PIM statistics\n")
1284 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1289 clear_pim_statistics(v
->info
);
1294 DEFPY (clear_ip_mroute
,
1295 clear_ip_mroute_cmd
,
1296 "clear ip mroute [vrf NAME]$name",
1302 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1307 clear_mroute(v
->info
);
1312 DEFPY (clear_ip_pim_interfaces
,
1313 clear_ip_pim_interfaces_cmd
,
1314 "clear ip pim [vrf NAME] interfaces",
1319 "Reset PIM interfaces\n")
1321 struct vrf
*v
= pim_cmd_lookup(vty
, vrf
);
1326 clear_pim_interfaces(v
->info
);
1331 DEFPY (clear_ip_pim_interface_traffic
,
1332 clear_ip_pim_interface_traffic_cmd
,
1333 "clear ip pim [vrf NAME] interface traffic",
1338 "Reset PIM interfaces\n"
1339 "Reset Protocol Packet counters\n")
1341 return clear_pim_interface_traffic(vrf
, vty
);
1344 DEFPY (clear_ip_pim_oil
,
1345 clear_ip_pim_oil_cmd
,
1346 "clear ip pim [vrf NAME]$name oil",
1351 "Rescan PIM OIL (output interface list)\n")
1353 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1358 pim_scan_oil(v
->info
);
1363 DEFUN (clear_ip_pim_bsr_db
,
1364 clear_ip_pim_bsr_db_cmd
,
1365 "clear ip pim [vrf NAME] bsr-data",
1370 "Reset pim bsr data\n")
1373 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1378 pim_bsm_clear(vrf
->info
);
1383 DEFUN (show_ip_igmp_interface
,
1384 show_ip_igmp_interface_cmd
,
1385 "show ip igmp [vrf NAME] interface [detail|WORD] [json]",
1390 "IGMP interface information\n"
1396 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1397 bool uj
= use_json(argc
, argv
);
1402 if (argv_find(argv
, argc
, "detail", &idx
)
1403 || argv_find(argv
, argc
, "WORD", &idx
))
1404 igmp_show_interfaces_single(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1406 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1411 DEFUN (show_ip_igmp_interface_vrf_all
,
1412 show_ip_igmp_interface_vrf_all_cmd
,
1413 "show ip igmp vrf all interface [detail|WORD] [json]",
1418 "IGMP interface information\n"
1424 bool uj
= use_json(argc
, argv
);
1430 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1434 vty_out(vty
, " \"%s\": ", vrf
->name
);
1437 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1438 if (argv_find(argv
, argc
, "detail", &idx
)
1439 || argv_find(argv
, argc
, "WORD", &idx
))
1440 igmp_show_interfaces_single(vrf
->info
, vty
,
1441 argv
[idx
]->arg
, uj
);
1443 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1446 vty_out(vty
, "}\n");
1451 DEFUN (show_ip_igmp_join
,
1452 show_ip_igmp_join_cmd
,
1453 "show ip igmp [vrf NAME] join [json]",
1458 "IGMP static join information\n"
1462 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1463 bool uj
= use_json(argc
, argv
);
1468 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1473 DEFUN (show_ip_igmp_join_vrf_all
,
1474 show_ip_igmp_join_vrf_all_cmd
,
1475 "show ip igmp vrf all join [json]",
1480 "IGMP static join information\n"
1483 bool uj
= use_json(argc
, argv
);
1489 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1493 vty_out(vty
, " \"%s\": ", vrf
->name
);
1496 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1497 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1500 vty_out(vty
, "}\n");
1505 DEFUN (show_ip_igmp_groups
,
1506 show_ip_igmp_groups_cmd
,
1507 "show ip igmp [vrf NAME] groups [json]",
1516 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1517 bool uj
= use_json(argc
, argv
);
1522 igmp_show_groups(vrf
->info
, vty
, uj
);
1527 DEFUN (show_ip_igmp_groups_vrf_all
,
1528 show_ip_igmp_groups_vrf_all_cmd
,
1529 "show ip igmp vrf all groups [json]",
1537 bool uj
= use_json(argc
, argv
);
1543 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1547 vty_out(vty
, " \"%s\": ", vrf
->name
);
1550 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1551 igmp_show_groups(vrf
->info
, vty
, uj
);
1554 vty_out(vty
, "}\n");
1559 DEFUN (show_ip_igmp_groups_retransmissions
,
1560 show_ip_igmp_groups_retransmissions_cmd
,
1561 "show ip igmp [vrf NAME] groups retransmissions",
1567 "IGMP group retransmissions\n")
1570 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1575 igmp_show_group_retransmission(vrf
->info
, vty
);
1580 DEFUN (show_ip_igmp_sources
,
1581 show_ip_igmp_sources_cmd
,
1582 "show ip igmp [vrf NAME] sources [json]",
1591 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1596 igmp_show_sources(vrf
->info
, vty
, use_json(argc
, argv
));
1601 DEFUN (show_ip_igmp_sources_retransmissions
,
1602 show_ip_igmp_sources_retransmissions_cmd
,
1603 "show ip igmp [vrf NAME] sources retransmissions",
1609 "IGMP source retransmissions\n")
1612 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1617 igmp_show_source_retransmission(vrf
->info
, vty
);
1622 DEFUN (show_ip_igmp_statistics
,
1623 show_ip_igmp_statistics_cmd
,
1624 "show ip igmp [vrf NAME] statistics [interface WORD] [json]",
1635 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1636 bool uj
= use_json(argc
, argv
);
1641 if (argv_find(argv
, argc
, "WORD", &idx
))
1642 igmp_show_statistics(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1644 igmp_show_statistics(vrf
->info
, vty
, NULL
, uj
);
1649 DEFUN (show_ip_pim_mlag_summary
,
1650 show_ip_pim_mlag_summary_cmd
,
1651 "show ip pim mlag summary [json]",
1656 "status and stats\n"
1659 bool uj
= use_json(argc
, argv
);
1660 char role_buf
[MLAG_ROLE_STRSIZE
];
1661 char addr_buf
[INET_ADDRSTRLEN
];
1664 json_object
*json
= NULL
;
1665 json_object
*json_stat
= NULL
;
1667 json
= json_object_new_object();
1668 if (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
1669 json_object_boolean_true_add(json
, "mlagConnUp");
1670 if (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
1671 json_object_boolean_true_add(json
, "mlagPeerConnUp");
1672 if (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
1673 json_object_boolean_true_add(json
, "mlagPeerZebraUp");
1674 json_object_string_add(json
, "mlagRole",
1675 mlag_role2str(router
->mlag_role
,
1676 role_buf
, sizeof(role_buf
)));
1677 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
1678 addr_buf
, INET_ADDRSTRLEN
);
1679 json_object_string_add(json
, "localVtepIp", addr_buf
);
1680 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
1681 addr_buf
, INET_ADDRSTRLEN
);
1682 json_object_string_add(json
, "anycastVtepIp", addr_buf
);
1683 json_object_string_add(json
, "peerlinkRif",
1684 router
->peerlink_rif
);
1686 json_stat
= json_object_new_object();
1687 json_object_int_add(json_stat
, "mlagConnFlaps",
1688 router
->mlag_stats
.mlagd_session_downs
);
1689 json_object_int_add(json_stat
, "mlagPeerConnFlaps",
1690 router
->mlag_stats
.peer_session_downs
);
1691 json_object_int_add(json_stat
, "mlagPeerZebraFlaps",
1692 router
->mlag_stats
.peer_zebra_downs
);
1693 json_object_int_add(json_stat
, "mrouteAddRx",
1694 router
->mlag_stats
.msg
.mroute_add_rx
);
1695 json_object_int_add(json_stat
, "mrouteAddTx",
1696 router
->mlag_stats
.msg
.mroute_add_tx
);
1697 json_object_int_add(json_stat
, "mrouteDelRx",
1698 router
->mlag_stats
.msg
.mroute_del_rx
);
1699 json_object_int_add(json_stat
, "mrouteDelTx",
1700 router
->mlag_stats
.msg
.mroute_del_tx
);
1701 json_object_int_add(json_stat
, "mlagStatusUpdates",
1702 router
->mlag_stats
.msg
.mlag_status_updates
);
1703 json_object_int_add(json_stat
, "peerZebraStatusUpdates",
1704 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
1705 json_object_int_add(json_stat
, "pimStatusUpdates",
1706 router
->mlag_stats
.msg
.pim_status_updates
);
1707 json_object_int_add(json_stat
, "vxlanUpdates",
1708 router
->mlag_stats
.msg
.vxlan_updates
);
1709 json_object_object_add(json
, "connStats", json_stat
);
1711 vty_json(vty
, json
);
1715 vty_out(vty
, "MLAG daemon connection: %s\n",
1716 (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
1718 vty_out(vty
, "MLAG peer state: %s\n",
1719 (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
1721 vty_out(vty
, "Zebra peer state: %s\n",
1722 (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
1724 vty_out(vty
, "MLAG role: %s\n",
1725 mlag_role2str(router
->mlag_role
, role_buf
, sizeof(role_buf
)));
1726 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
1727 addr_buf
, INET_ADDRSTRLEN
);
1728 vty_out(vty
, "Local VTEP IP: %s\n", addr_buf
);
1729 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
1730 addr_buf
, INET_ADDRSTRLEN
);
1731 vty_out(vty
, "Anycast VTEP IP: %s\n", addr_buf
);
1732 vty_out(vty
, "Peerlink: %s\n", router
->peerlink_rif
);
1733 vty_out(vty
, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n",
1734 router
->mlag_stats
.mlagd_session_downs
,
1735 router
->mlag_stats
.peer_session_downs
,
1736 router
->mlag_stats
.peer_zebra_downs
);
1737 vty_out(vty
, "Message Statistics:\n");
1738 vty_out(vty
, " mroute adds: rx: %d, tx: %d\n",
1739 router
->mlag_stats
.msg
.mroute_add_rx
,
1740 router
->mlag_stats
.msg
.mroute_add_tx
);
1741 vty_out(vty
, " mroute dels: rx: %d, tx: %d\n",
1742 router
->mlag_stats
.msg
.mroute_del_rx
,
1743 router
->mlag_stats
.msg
.mroute_del_tx
);
1744 vty_out(vty
, " peer zebra status updates: %d\n",
1745 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
1746 vty_out(vty
, " PIM status updates: %d\n",
1747 router
->mlag_stats
.msg
.pim_status_updates
);
1748 vty_out(vty
, " VxLAN updates: %d\n",
1749 router
->mlag_stats
.msg
.vxlan_updates
);
1754 DEFUN (show_ip_pim_assert
,
1755 show_ip_pim_assert_cmd
,
1756 "show ip pim [vrf NAME] assert",
1761 "PIM interface assert\n")
1764 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1769 pim_show_assert(vrf
->info
, vty
);
1774 DEFUN (show_ip_pim_assert_internal
,
1775 show_ip_pim_assert_internal_cmd
,
1776 "show ip pim [vrf NAME] assert-internal",
1781 "PIM interface internal assert state\n")
1784 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1789 pim_show_assert_internal(vrf
->info
, vty
);
1794 DEFUN (show_ip_pim_assert_metric
,
1795 show_ip_pim_assert_metric_cmd
,
1796 "show ip pim [vrf NAME] assert-metric",
1801 "PIM interface assert metric\n")
1804 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1809 pim_show_assert_metric(vrf
->info
, vty
);
1814 DEFUN (show_ip_pim_assert_winner_metric
,
1815 show_ip_pim_assert_winner_metric_cmd
,
1816 "show ip pim [vrf NAME] assert-winner-metric",
1821 "PIM interface assert winner metric\n")
1824 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1829 pim_show_assert_winner_metric(vrf
->info
, vty
);
1834 DEFPY (show_ip_pim_interface
,
1835 show_ip_pim_interface_cmd
,
1836 "show ip pim [mlag$mlag] [vrf NAME] interface [detail|WORD]$interface [json$json]",
1842 "PIM interface information\n"
1847 return pim_show_interface_cmd_helper(vrf
, vty
, !!json
, !!mlag
,
1851 DEFPY (show_ip_pim_interface_vrf_all
,
1852 show_ip_pim_interface_vrf_all_cmd
,
1853 "show ip pim [mlag$mlag] vrf all interface [detail|WORD]$interface [json$json]",
1859 "PIM interface information\n"
1864 return pim_show_interface_vrf_all_cmd_helper(vty
, !!json
, !!mlag
,
1868 DEFPY (show_ip_pim_join
,
1869 show_ip_pim_join_cmd
,
1870 "show ip pim [vrf NAME] join [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
1875 "PIM interface join information\n"
1876 "The Source or Group\n"
1880 return pim_show_join_cmd_helper(vrf
, vty
, s_or_g
, g
, json
);
1883 DEFPY (show_ip_pim_join_vrf_all
,
1884 show_ip_pim_join_vrf_all_cmd
,
1885 "show ip pim vrf all join [json$json]",
1890 "PIM interface join information\n"
1893 return pim_show_join_vrf_all_cmd_helper(vty
, json
);
1896 DEFPY (show_ip_pim_jp_agg
,
1897 show_ip_pim_jp_agg_cmd
,
1898 "show ip pim [vrf NAME] jp-agg",
1903 "join prune aggregation list\n")
1905 return pim_show_jp_agg_list_cmd_helper(vrf
, vty
);
1908 DEFPY (show_ip_pim_local_membership
,
1909 show_ip_pim_local_membership_cmd
,
1910 "show ip pim [vrf NAME] local-membership [json$json]",
1915 "PIM interface local-membership\n"
1918 return pim_show_membership_cmd_helper(vrf
, vty
, !!json
);
1921 static void pim_show_mlag_up_entry_detail(struct vrf
*vrf
,
1923 struct pim_upstream
*up
,
1924 char *src_str
, char *grp_str
,
1928 json_object
*json_row
= NULL
;
1929 json_object
*own_list
= NULL
;
1930 json_object
*json_group
= NULL
;
1933 json_object_object_get_ex(json
, grp_str
, &json_group
);
1935 json_group
= json_object_new_object();
1936 json_object_object_add(json
, grp_str
,
1940 json_row
= json_object_new_object();
1941 json_object_string_add(json_row
, "source", src_str
);
1942 json_object_string_add(json_row
, "group", grp_str
);
1944 own_list
= json_object_new_array();
1945 if (pim_up_mlag_is_local(up
))
1946 json_object_array_add(own_list
,
1947 json_object_new_string("local"));
1948 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
1949 json_object_array_add(own_list
,
1950 json_object_new_string("peer"));
1951 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
1952 json_object_array_add(
1953 own_list
, json_object_new_string("Interface"));
1954 json_object_object_add(json_row
, "owners", own_list
);
1956 json_object_int_add(json_row
, "localCost",
1957 pim_up_mlag_local_cost(up
));
1958 json_object_int_add(json_row
, "peerCost",
1959 pim_up_mlag_peer_cost(up
));
1960 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
1961 json_object_boolean_false_add(json_row
, "df");
1963 json_object_boolean_true_add(json_row
, "df");
1964 json_object_object_add(json_group
, src_str
, json_row
);
1969 if (pim_up_mlag_is_local(up
))
1970 strlcat(own_str
, "L", sizeof(own_str
));
1971 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
1972 strlcat(own_str
, "P", sizeof(own_str
));
1973 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
1974 strlcat(own_str
, "I", sizeof(own_str
));
1975 /* XXX - fixup, print paragraph output */
1977 "%-15s %-15s %-6s %-11u %-10d %2s\n",
1978 src_str
, grp_str
, own_str
,
1979 pim_up_mlag_local_cost(up
),
1980 pim_up_mlag_peer_cost(up
),
1981 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
1986 static void pim_show_mlag_up_detail(struct vrf
*vrf
,
1987 struct vty
*vty
, const char *src_or_group
,
1988 const char *group
, bool uj
)
1990 char src_str
[PIM_ADDRSTRLEN
];
1991 char grp_str
[PIM_ADDRSTRLEN
];
1992 struct pim_upstream
*up
;
1993 struct pim_instance
*pim
= vrf
->info
;
1994 json_object
*json
= NULL
;
1997 json
= json_object_new_object();
2000 "Source Group Owner Local-cost Peer-cost DF\n");
2002 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2003 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2004 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2005 && !pim_up_mlag_is_local(up
))
2008 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &up
->sg
.grp
);
2009 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &up
->sg
.src
);
2011 /* XXX: strcmps are clearly inefficient. we should do uint comps
2015 if (strcmp(src_str
, src_or_group
) ||
2016 strcmp(grp_str
, group
))
2019 if (strcmp(src_str
, src_or_group
) &&
2020 strcmp(grp_str
, src_or_group
))
2023 pim_show_mlag_up_entry_detail(vrf
, vty
, up
,
2024 src_str
, grp_str
, json
);
2028 vty_json(vty
, json
);
2031 static void pim_show_mlag_up_vrf(struct vrf
*vrf
, struct vty
*vty
, bool uj
)
2033 json_object
*json
= NULL
;
2034 json_object
*json_row
;
2035 struct pim_upstream
*up
;
2036 struct pim_instance
*pim
= vrf
->info
;
2037 json_object
*json_group
= NULL
;
2040 json
= json_object_new_object();
2043 "Source Group Owner Local-cost Peer-cost DF\n");
2046 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2047 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2048 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2049 && !pim_up_mlag_is_local(up
))
2052 char src_str
[PIM_ADDRSTRLEN
];
2053 char grp_str
[PIM_ADDRSTRLEN
];
2054 json_object
*own_list
= NULL
;
2056 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
2058 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
2061 json_object_object_get_ex(json
, grp_str
, &json_group
);
2063 json_group
= json_object_new_object();
2064 json_object_object_add(json
, grp_str
,
2068 json_row
= json_object_new_object();
2069 json_object_string_add(json_row
, "vrf", vrf
->name
);
2070 json_object_string_add(json_row
, "source", src_str
);
2071 json_object_string_add(json_row
, "group", grp_str
);
2073 own_list
= json_object_new_array();
2074 if (pim_up_mlag_is_local(up
)) {
2076 json_object_array_add(own_list
,
2077 json_object_new_string(
2080 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)) {
2081 json_object_array_add(own_list
,
2082 json_object_new_string(
2085 json_object_object_add(json_row
, "owners", own_list
);
2087 json_object_int_add(json_row
, "localCost",
2088 pim_up_mlag_local_cost(up
));
2089 json_object_int_add(json_row
, "peerCost",
2090 pim_up_mlag_peer_cost(up
));
2091 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2092 json_object_boolean_false_add(json_row
, "df");
2094 json_object_boolean_true_add(json_row
, "df");
2095 json_object_object_add(json_group
, src_str
, json_row
);
2100 if (pim_up_mlag_is_local(up
))
2101 strlcat(own_str
, "L", sizeof(own_str
));
2102 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2103 strlcat(own_str
, "P", sizeof(own_str
));
2104 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2105 strlcat(own_str
, "I", sizeof(own_str
));
2107 "%-15pPAs %-15pPAs %-6s %-11u %-10u %2s\n",
2108 &up
->sg
.src
, &up
->sg
.grp
, own_str
,
2109 pim_up_mlag_local_cost(up
),
2110 pim_up_mlag_peer_cost(up
),
2111 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2116 vty_json(vty
, json
);
2119 static void pim_show_mlag_help_string(struct vty
*vty
, bool uj
)
2122 vty_out(vty
, "Owner codes:\n");
2124 "L: EVPN-MLAG Entry, I:PIM-MLAG Entry, P: Peer Entry\n");
2129 DEFUN(show_ip_pim_mlag_up
, show_ip_pim_mlag_up_cmd
,
2130 "show ip pim [vrf NAME] mlag upstream [A.B.C.D [A.B.C.D]] [json]",
2137 "Unicast or Multicast address\n"
2138 "Multicast address\n" JSON_STR
)
2140 const char *src_or_group
= NULL
;
2141 const char *group
= NULL
;
2143 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2144 bool uj
= use_json(argc
, argv
);
2146 if (!vrf
|| !vrf
->info
) {
2147 vty_out(vty
, "%s: VRF or Info missing\n", __func__
);
2154 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
2155 src_or_group
= argv
[idx
]->arg
;
2157 group
= argv
[idx
+ 1]->arg
;
2160 pim_show_mlag_help_string(vty
, uj
);
2163 pim_show_mlag_up_detail(vrf
, vty
, src_or_group
, group
, uj
);
2165 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2171 DEFUN(show_ip_pim_mlag_up_vrf_all
, show_ip_pim_mlag_up_vrf_all_cmd
,
2172 "show ip pim vrf all mlag upstream [json]",
2173 SHOW_STR IP_STR PIM_STR VRF_CMD_HELP_STR
2175 "upstream\n" JSON_STR
)
2178 bool uj
= use_json(argc
, argv
);
2180 pim_show_mlag_help_string(vty
, uj
);
2181 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
2182 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2188 DEFPY (show_ip_pim_neighbor
,
2189 show_ip_pim_neighbor_cmd
,
2190 "show ip pim [vrf NAME] neighbor [detail|WORD]$interface [json$json]",
2195 "PIM neighbor information\n"
2197 "Name of interface or neighbor\n"
2200 return pim_show_neighbors_cmd_helper(vrf
, vty
, json
, interface
);
2203 DEFPY (show_ip_pim_neighbor_vrf_all
,
2204 show_ip_pim_neighbor_vrf_all_cmd
,
2205 "show ip pim vrf all neighbor [detail|WORD]$interface [json$json]",
2210 "PIM neighbor information\n"
2212 "Name of interface or neighbor\n"
2215 return pim_show_neighbors_vrf_all_cmd_helper(vty
, json
, interface
);
2218 DEFPY (show_ip_pim_secondary
,
2219 show_ip_pim_secondary_cmd
,
2220 "show ip pim [vrf NAME] secondary",
2225 "PIM neighbor addresses\n")
2227 return pim_show_secondary_helper(vrf
, vty
);
2230 DEFPY (show_ip_pim_state
,
2231 show_ip_pim_state_cmd
,
2232 "show ip pim [vrf NAME] state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2237 "PIM state information\n"
2238 "Unicast or Multicast address\n"
2239 "Multicast address\n"
2242 return pim_show_state_helper(vrf
, vty
, s_or_g_str
, g_str
, !!json
);
2245 DEFPY (show_ip_pim_state_vrf_all
,
2246 show_ip_pim_state_vrf_all_cmd
,
2247 "show ip pim vrf all state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2252 "PIM state information\n"
2253 "Unicast or Multicast address\n"
2254 "Multicast address\n"
2257 return pim_show_state_vrf_all_helper(vty
, s_or_g_str
, g_str
, !!json
);
2260 DEFPY (show_ip_pim_upstream
,
2261 show_ip_pim_upstream_cmd
,
2262 "show ip pim [vrf NAME] upstream [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2267 "PIM upstream information\n"
2268 "The Source or Group\n"
2272 return pim_show_upstream_helper(vrf
, vty
, s_or_g
, g
, !!json
);
2275 DEFPY (show_ip_pim_upstream_vrf_all
,
2276 show_ip_pim_upstream_vrf_all_cmd
,
2277 "show ip pim vrf all upstream [json$json]",
2282 "PIM upstream information\n"
2285 return pim_show_upstream_vrf_all_helper(vty
, !!json
);
2288 DEFPY (show_ip_pim_channel
,
2289 show_ip_pim_channel_cmd
,
2290 "show ip pim [vrf NAME] channel [json$json]",
2295 "PIM downstream channel info\n"
2298 return pim_show_channel_cmd_helper(vrf
, vty
, !!json
);
2301 DEFPY (show_ip_pim_upstream_join_desired
,
2302 show_ip_pim_upstream_join_desired_cmd
,
2303 "show ip pim [vrf NAME] upstream-join-desired [json$json]",
2308 "PIM upstream join-desired\n"
2311 return pim_show_upstream_join_desired_helper(vrf
, vty
, !!json
);
2314 DEFPY (show_ip_pim_upstream_rpf
,
2315 show_ip_pim_upstream_rpf_cmd
,
2316 "show ip pim [vrf NAME] upstream-rpf [json$json]",
2321 "PIM upstream source rpf\n"
2324 return pim_show_upstream_rpf_helper(vrf
, vty
, !!json
);
2327 DEFPY (show_ip_pim_rp
,
2329 "show ip pim [vrf NAME] rp-info [A.B.C.D/M$group] [json$json]",
2334 "PIM RP information\n"
2335 "Multicast Group range\n"
2338 return pim_show_rp_helper(vrf
, vty
, group_str
, (struct prefix
*)group
,
2342 DEFPY (show_ip_pim_rp_vrf_all
,
2343 show_ip_pim_rp_vrf_all_cmd
,
2344 "show ip pim vrf all rp-info [A.B.C.D/M$group] [json$json]",
2349 "PIM RP information\n"
2350 "Multicast Group range\n"
2353 return pim_show_rp_vrf_all_helper(vty
, group_str
,
2354 (struct prefix
*)group
, !!json
);
2357 DEFPY (show_ip_pim_rpf
,
2358 show_ip_pim_rpf_cmd
,
2359 "show ip pim [vrf NAME] rpf [json$json]",
2364 "PIM cached source rpf information\n"
2367 return pim_show_rpf_helper(vrf
, vty
, !!json
);
2370 DEFPY (show_ip_pim_rpf_vrf_all
,
2371 show_ip_pim_rpf_vrf_all_cmd
,
2372 "show ip pim vrf all rpf [json$json]",
2377 "PIM cached source rpf information\n"
2380 return pim_show_rpf_vrf_all_helper(vty
, !!json
);
2383 DEFPY (show_ip_pim_nexthop
,
2384 show_ip_pim_nexthop_cmd
,
2385 "show ip pim [vrf NAME] nexthop [json$json]",
2390 "PIM cached nexthop rpf information\n"
2393 return pim_show_nexthop_cmd_helper(vrf
, vty
, !!json
);
2396 DEFPY (show_ip_pim_nexthop_lookup
,
2397 show_ip_pim_nexthop_lookup_cmd
,
2398 "show ip pim [vrf NAME] nexthop-lookup A.B.C.D$source A.B.C.D$group",
2403 "PIM cached nexthop rpf lookup\n"
2404 "Source/RP address\n"
2405 "Multicast Group address\n")
2407 return pim_show_nexthop_lookup_cmd_helper(vrf
, vty
, source
, group
);
2410 DEFPY (show_ip_pim_interface_traffic
,
2411 show_ip_pim_interface_traffic_cmd
,
2412 "show ip pim [vrf NAME] interface traffic [WORD$if_name] [json$json]",
2417 "PIM interface information\n"
2418 "Protocol Packet counters\n"
2422 return pim_show_interface_traffic_helper(vrf
, if_name
, vty
, !!json
);
2425 DEFPY (show_ip_pim_bsm_db
,
2426 show_ip_pim_bsm_db_cmd
,
2427 "show ip pim bsm-database [vrf NAME] [json$json]",
2431 "PIM cached bsm packets information\n"
2435 return pim_show_bsm_db_helper(vrf
, vty
, !!json
);
2438 DEFPY (show_ip_pim_bsrp
,
2439 show_ip_pim_bsrp_cmd
,
2440 "show ip pim bsrp-info [vrf NAME] [json$json]",
2444 "PIM cached group-rp mappings information\n"
2448 return pim_show_group_rp_mappings_info_helper(vrf
, vty
, !!json
);
2451 DEFPY (show_ip_pim_statistics
,
2452 show_ip_pim_statistics_cmd
,
2453 "show ip pim [vrf NAME] statistics [interface WORD$word] [json$json]",
2463 return pim_show_statistics_helper(vrf
, vty
, word
, !!json
);
2466 DEFPY (show_ip_multicast
,
2467 show_ip_multicast_cmd
,
2468 "show ip multicast [vrf NAME]",
2471 "Multicast global information\n"
2474 return pim_show_multicast_helper(vrf
, vty
);
2477 DEFPY (show_ip_multicast_vrf_all
,
2478 show_ip_multicast_vrf_all_cmd
,
2479 "show ip multicast vrf all",
2482 "Multicast global information\n"
2485 return pim_show_multicast_vrf_all_helper(vty
);
2488 DEFPY (show_ip_multicast_count
,
2489 show_ip_multicast_count_cmd
,
2490 "show ip multicast count [vrf NAME] [json$json]",
2493 "Multicast global information\n"
2494 "Data packet count\n"
2498 return pim_show_multicast_count_helper(vrf
, vty
, !!json
);
2501 DEFPY (show_ip_multicast_count_vrf_all
,
2502 show_ip_multicast_count_vrf_all_cmd
,
2503 "show ip multicast count vrf all [json$json]",
2506 "Multicast global information\n"
2507 "Data packet count\n"
2511 return pim_show_multicast_count_vrf_all_helper(vty
, !!json
);
2514 DEFPY (show_ip_mroute
,
2516 "show ip mroute [vrf NAME] [A.B.C.D$s_or_g [A.B.C.D$g]] [fill$fill] [json$json]",
2521 "The Source or Group\n"
2523 "Fill in Assumed data\n"
2526 return pim_show_mroute_helper(vrf
, vty
, s_or_g
, g
, !!fill
, !!json
);
2529 DEFPY (show_ip_mroute_vrf_all
,
2530 show_ip_mroute_vrf_all_cmd
,
2531 "show ip mroute vrf all [fill$fill] [json$json]",
2536 "Fill in Assumed data\n"
2539 return pim_show_mroute_vrf_all_helper(vty
, !!fill
, !!json
);
2542 DEFPY (clear_ip_mroute_count
,
2543 clear_ip_mroute_count_cmd
,
2544 "clear ip mroute [vrf NAME]$name count",
2549 "Route and packet count data\n")
2551 return clear_ip_mroute_count_command(vty
, name
);
2554 DEFPY (show_ip_mroute_count
,
2555 show_ip_mroute_count_cmd
,
2556 "show ip mroute [vrf NAME] count [json$json]",
2561 "Route and packet count data\n"
2564 return pim_show_mroute_count_helper(vrf
, vty
, !!json
);
2567 DEFPY (show_ip_mroute_count_vrf_all
,
2568 show_ip_mroute_count_vrf_all_cmd
,
2569 "show ip mroute vrf all count [json$json]",
2574 "Route and packet count data\n"
2577 return pim_show_mroute_count_vrf_all_helper(vty
, !!json
);
2580 DEFPY (show_ip_mroute_summary
,
2581 show_ip_mroute_summary_cmd
,
2582 "show ip mroute [vrf NAME] summary [json$json]",
2587 "Summary of all mroutes\n"
2590 return pim_show_mroute_summary_helper(vrf
, vty
, !!json
);
2593 DEFPY (show_ip_mroute_summary_vrf_all
,
2594 show_ip_mroute_summary_vrf_all_cmd
,
2595 "show ip mroute vrf all summary [json$json]",
2600 "Summary of all mroutes\n"
2603 return pim_show_mroute_summary_vrf_all_helper(vty
, !!json
);
2608 "show ip rib [vrf NAME] A.B.C.D",
2613 "Unicast address\n")
2616 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2617 struct in_addr addr
;
2618 const char *addr_str
;
2619 struct pim_nexthop nexthop
;
2625 memset(&nexthop
, 0, sizeof(nexthop
));
2626 argv_find(argv
, argc
, "A.B.C.D", &idx
);
2627 addr_str
= argv
[idx
]->arg
;
2628 result
= inet_pton(AF_INET
, addr_str
, &addr
);
2630 vty_out(vty
, "Bad unicast address %s: errno=%d: %s\n", addr_str
,
2631 errno
, safe_strerror(errno
));
2635 if (!pim_nexthop_lookup(vrf
->info
, &nexthop
, addr
, 0)) {
2637 "Failure querying RIB nexthop for unicast address %s\n",
2643 "Address NextHop Interface Metric Preference\n");
2645 vty_out(vty
, "%-15s %-15pPAs %-9s %6d %10d\n", addr_str
,
2646 &nexthop
.mrib_nexthop_addr
,
2647 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
2648 nexthop
.mrib_route_metric
, nexthop
.mrib_metric_preference
);
2653 static void show_ssmpingd(struct pim_instance
*pim
, struct vty
*vty
)
2655 struct listnode
*node
;
2656 struct ssmpingd_sock
*ss
;
2660 "Source Socket Address Port Uptime Requests\n");
2662 if (!pim
->ssmpingd_list
)
2665 now
= pim_time_monotonic_sec();
2667 for (ALL_LIST_ELEMENTS_RO(pim
->ssmpingd_list
, node
, ss
)) {
2668 char source_str
[INET_ADDRSTRLEN
];
2670 struct sockaddr_in bind_addr
;
2671 socklen_t len
= sizeof(bind_addr
);
2672 char bind_addr_str
[INET_ADDRSTRLEN
];
2674 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
,
2675 sizeof(source_str
));
2677 if (pim_socket_getsockname(
2678 ss
->sock_fd
, (struct sockaddr
*)&bind_addr
, &len
)) {
2680 "%% Failure reading socket name for ssmpingd source %s on fd=%d\n",
2681 source_str
, ss
->sock_fd
);
2684 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
,
2685 sizeof(bind_addr_str
));
2686 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
),
2687 now
- ss
->creation
);
2689 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld\n", source_str
,
2690 ss
->sock_fd
, bind_addr_str
, ntohs(bind_addr
.sin_port
),
2691 ss_uptime
, (long long)ss
->requests
);
2695 DEFUN (show_ip_ssmpingd
,
2696 show_ip_ssmpingd_cmd
,
2697 "show ip ssmpingd [vrf NAME]",
2704 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2709 show_ssmpingd(vrf
->info
, vty
);
2713 DEFUN (ip_pim_spt_switchover_infinity
,
2714 ip_pim_spt_switchover_infinity_cmd
,
2715 "ip pim spt-switchover infinity-and-beyond",
2719 "Never switch to SPT Tree\n")
2721 return pim_process_spt_switchover_infinity_cmd(vty
);
2724 DEFPY (ip_pim_spt_switchover_infinity_plist
,
2725 ip_pim_spt_switchover_infinity_plist_cmd
,
2726 "ip pim spt-switchover infinity-and-beyond prefix-list WORD$plist",
2730 "Never switch to SPT Tree\n"
2731 "Prefix-List to control which groups to switch\n"
2732 "Prefix-List name\n")
2734 return pim_process_spt_switchover_prefixlist_cmd(vty
, plist
);
2737 DEFUN (no_ip_pim_spt_switchover_infinity
,
2738 no_ip_pim_spt_switchover_infinity_cmd
,
2739 "no ip pim spt-switchover infinity-and-beyond",
2744 "Never switch to SPT Tree\n")
2746 return pim_process_no_spt_switchover_cmd(vty
);
2749 DEFUN (no_ip_pim_spt_switchover_infinity_plist
,
2750 no_ip_pim_spt_switchover_infinity_plist_cmd
,
2751 "no ip pim spt-switchover infinity-and-beyond prefix-list WORD",
2756 "Never switch to SPT Tree\n"
2757 "Prefix-List to control which groups to switch\n"
2758 "Prefix-List name\n")
2760 return pim_process_no_spt_switchover_cmd(vty
);
2763 DEFPY (pim_register_accept_list
,
2764 pim_register_accept_list_cmd
,
2765 "[no] ip pim register-accept-list WORD$word",
2769 "Only accept registers from a specific source prefix list\n"
2770 "Prefix-List name\n")
2772 const char *vrfname
;
2773 char reg_alist_xpath
[XPATH_MAXLEN
];
2775 vrfname
= pim_cli_get_vrf_name(vty
);
2776 if (vrfname
== NULL
)
2777 return CMD_WARNING_CONFIG_FAILED
;
2779 snprintf(reg_alist_xpath
, sizeof(reg_alist_xpath
),
2780 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
2781 "frr-routing:ipv4");
2782 strlcat(reg_alist_xpath
, "/register-accept-list",
2783 sizeof(reg_alist_xpath
));
2786 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
2787 NB_OP_DESTROY
, NULL
);
2789 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
2790 NB_OP_MODIFY
, word
);
2792 return nb_cli_apply_changes(vty
, NULL
);
2795 DEFPY (ip_pim_joinprune_time
,
2796 ip_pim_joinprune_time_cmd
,
2797 "ip pim join-prune-interval (1-65535)$jpi",
2799 "pim multicast routing\n"
2800 "Join Prune Send Interval\n"
2803 return pim_process_join_prune_cmd(vty
, jpi_str
);
2806 DEFUN (no_ip_pim_joinprune_time
,
2807 no_ip_pim_joinprune_time_cmd
,
2808 "no ip pim join-prune-interval [(1-65535)]",
2811 "pim multicast routing\n"
2812 "Join Prune Send Interval\n"
2815 return pim_process_no_join_prune_cmd(vty
);
2818 DEFPY (ip_pim_register_suppress
,
2819 ip_pim_register_suppress_cmd
,
2820 "ip pim register-suppress-time (1-65535)$rst",
2822 "pim multicast routing\n"
2823 "Register Suppress Timer\n"
2826 return pim_process_register_suppress_cmd(vty
, rst_str
);
2829 DEFUN (no_ip_pim_register_suppress
,
2830 no_ip_pim_register_suppress_cmd
,
2831 "no ip pim register-suppress-time [(1-65535)]",
2834 "pim multicast routing\n"
2835 "Register Suppress Timer\n"
2838 return pim_process_no_register_suppress_cmd(vty
);
2841 DEFPY (ip_pim_rp_keep_alive
,
2842 ip_pim_rp_keep_alive_cmd
,
2843 "ip pim rp keep-alive-timer (1-65535)$kat",
2845 "pim multicast routing\n"
2846 "Rendezvous Point\n"
2847 "Keep alive Timer\n"
2850 return pim_process_rp_kat_cmd(vty
, kat_str
);
2853 DEFUN (no_ip_pim_rp_keep_alive
,
2854 no_ip_pim_rp_keep_alive_cmd
,
2855 "no ip pim rp keep-alive-timer [(1-65535)]",
2858 "pim multicast routing\n"
2859 "Rendezvous Point\n"
2860 "Keep alive Timer\n"
2863 return pim_process_no_rp_kat_cmd(vty
);
2866 DEFPY (ip_pim_keep_alive
,
2867 ip_pim_keep_alive_cmd
,
2868 "ip pim keep-alive-timer (1-65535)$kat",
2870 "pim multicast routing\n"
2871 "Keep alive Timer\n"
2874 return pim_process_keepalivetimer_cmd(vty
, kat_str
);
2877 DEFUN (no_ip_pim_keep_alive
,
2878 no_ip_pim_keep_alive_cmd
,
2879 "no ip pim keep-alive-timer [(1-65535)]",
2882 "pim multicast routing\n"
2883 "Keep alive Timer\n"
2886 return pim_process_no_keepalivetimer_cmd(vty
);
2889 DEFPY (ip_pim_packets
,
2891 "ip pim packets (1-255)",
2893 "pim multicast routing\n"
2894 "packets to process at one time per fd\n"
2895 "Number of packets\n")
2897 return pim_process_pim_packet_cmd(vty
, packets_str
);
2900 DEFUN (no_ip_pim_packets
,
2901 no_ip_pim_packets_cmd
,
2902 "no ip pim packets [(1-255)]",
2905 "pim multicast routing\n"
2906 "packets to process at one time per fd\n"
2909 return pim_process_no_pim_packet_cmd(vty
);
2912 DEFPY (ip_igmp_group_watermark
,
2913 ip_igmp_group_watermark_cmd
,
2914 "ip igmp watermark-warn (1-65535)$limit",
2917 "Configure group limit for watermark warning\n"
2918 "Group count to generate watermark warning\n")
2920 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
2921 pim
->gm_watermark_limit
= limit
;
2926 DEFPY (no_ip_igmp_group_watermark
,
2927 no_ip_igmp_group_watermark_cmd
,
2928 "no ip igmp watermark-warn [(1-65535)$limit]",
2932 "Unconfigure group limit for watermark warning\n"
2935 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
2936 pim
->gm_watermark_limit
= 0;
2941 DEFUN (ip_pim_v6_secondary
,
2942 ip_pim_v6_secondary_cmd
,
2943 "ip pim send-v6-secondary",
2945 "pim multicast routing\n"
2946 "Send v6 secondary addresses\n")
2948 const char *vrfname
;
2949 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
2951 vrfname
= pim_cli_get_vrf_name(vty
);
2952 if (vrfname
== NULL
)
2953 return CMD_WARNING_CONFIG_FAILED
;
2955 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
2957 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
2958 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
2959 sizeof(send_v6_secondary_xpath
));
2961 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
2964 return nb_cli_apply_changes(vty
, NULL
);
2967 DEFUN (no_ip_pim_v6_secondary
,
2968 no_ip_pim_v6_secondary_cmd
,
2969 "no ip pim send-v6-secondary",
2972 "pim multicast routing\n"
2973 "Send v6 secondary addresses\n")
2975 const char *vrfname
;
2976 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
2978 vrfname
= pim_cli_get_vrf_name(vty
);
2979 if (vrfname
== NULL
)
2980 return CMD_WARNING_CONFIG_FAILED
;
2982 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
2984 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
2985 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
2986 sizeof(send_v6_secondary_xpath
));
2988 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
2991 return nb_cli_apply_changes(vty
, NULL
);
2996 "ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
2998 "pim multicast routing\n"
2999 "Rendezvous Point\n"
3000 "ip address of RP\n"
3001 "Group Address range to cover\n")
3003 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3005 return pim_process_rp_cmd(vty
, rp_str
, group_str
);
3008 DEFPY (ip_pim_rp_prefix_list
,
3009 ip_pim_rp_prefix_list_cmd
,
3010 "ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3012 "pim multicast routing\n"
3013 "Rendezvous Point\n"
3014 "ip address of RP\n"
3015 "group prefix-list filter\n"
3016 "Name of a prefix-list\n")
3018 return pim_process_rp_plist_cmd(vty
, rp_str
, plist
);
3021 DEFPY (no_ip_pim_rp
,
3023 "no ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3026 "pim multicast routing\n"
3027 "Rendezvous Point\n"
3028 "ip address of RP\n"
3029 "Group Address range to cover\n")
3031 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3033 return pim_process_no_rp_cmd(vty
, rp_str
, group_str
);
3036 DEFPY (no_ip_pim_rp_prefix_list
,
3037 no_ip_pim_rp_prefix_list_cmd
,
3038 "no ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3041 "pim multicast routing\n"
3042 "Rendezvous Point\n"
3043 "ip address of RP\n"
3044 "group prefix-list filter\n"
3045 "Name of a prefix-list\n")
3047 return pim_process_no_rp_plist_cmd(vty
, rp_str
, plist
);
3050 DEFUN (ip_pim_ssm_prefix_list
,
3051 ip_pim_ssm_prefix_list_cmd
,
3052 "ip pim ssm prefix-list WORD",
3054 "pim multicast routing\n"
3055 "Source Specific Multicast\n"
3056 "group range prefix-list filter\n"
3057 "Name of a prefix-list\n")
3059 const char *vrfname
;
3060 char ssm_plist_xpath
[XPATH_MAXLEN
];
3062 vrfname
= pim_cli_get_vrf_name(vty
);
3063 if (vrfname
== NULL
)
3064 return CMD_WARNING_CONFIG_FAILED
;
3066 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
), FRR_PIM_VRF_XPATH
,
3067 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3068 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3070 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_MODIFY
, argv
[4]->arg
);
3072 return nb_cli_apply_changes(vty
, NULL
);
3075 DEFUN (no_ip_pim_ssm_prefix_list
,
3076 no_ip_pim_ssm_prefix_list_cmd
,
3077 "no ip pim ssm prefix-list",
3080 "pim multicast routing\n"
3081 "Source Specific Multicast\n"
3082 "group range prefix-list filter\n")
3084 const char *vrfname
;
3085 char ssm_plist_xpath
[XPATH_MAXLEN
];
3087 vrfname
= pim_cli_get_vrf_name(vty
);
3088 if (vrfname
== NULL
)
3089 return CMD_WARNING_CONFIG_FAILED
;
3091 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3093 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3094 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3096 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
, NULL
);
3098 return nb_cli_apply_changes(vty
, NULL
);
3101 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3102 no_ip_pim_ssm_prefix_list_name_cmd
,
3103 "no ip pim ssm prefix-list WORD",
3106 "pim multicast routing\n"
3107 "Source Specific Multicast\n"
3108 "group range prefix-list filter\n"
3109 "Name of a prefix-list\n")
3111 const char *vrfname
;
3112 const struct lyd_node
*ssm_plist_dnode
;
3113 char ssm_plist_xpath
[XPATH_MAXLEN
];
3114 const char *ssm_plist_name
;
3116 vrfname
= pim_cli_get_vrf_name(vty
);
3117 if (vrfname
== NULL
)
3118 return CMD_WARNING_CONFIG_FAILED
;
3120 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3122 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3123 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3124 ssm_plist_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
3127 if (!ssm_plist_dnode
) {
3129 "%% pim ssm prefix-list %s doesn't exist\n",
3131 return CMD_WARNING_CONFIG_FAILED
;
3134 ssm_plist_name
= yang_dnode_get_string(ssm_plist_dnode
, ".");
3136 if (ssm_plist_name
&& !strcmp(ssm_plist_name
, argv
[5]->arg
)) {
3137 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
,
3140 return nb_cli_apply_changes(vty
, NULL
);
3143 vty_out(vty
, "%% pim ssm prefix-list %s doesn't exist\n", argv
[5]->arg
);
3145 return CMD_WARNING_CONFIG_FAILED
;
3148 DEFUN (show_ip_pim_ssm_range
,
3149 show_ip_pim_ssm_range_cmd
,
3150 "show ip pim [vrf NAME] group-type [json]",
3159 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3160 bool uj
= use_json(argc
, argv
);
3165 ip_pim_ssm_show_group_range(vrf
->info
, vty
, uj
);
3170 static void ip_pim_ssm_show_group_type(struct pim_instance
*pim
,
3171 struct vty
*vty
, bool uj
,
3174 struct in_addr group_addr
;
3175 const char *type_str
;
3178 result
= inet_pton(AF_INET
, group
, &group_addr
);
3180 type_str
= "invalid";
3182 if (pim_is_group_224_4(group_addr
))
3184 pim_is_grp_ssm(pim
, group_addr
) ? "SSM" : "ASM";
3186 type_str
= "not-multicast";
3191 json
= json_object_new_object();
3192 json_object_string_add(json
, "groupType", type_str
);
3193 vty_json(vty
, json
);
3195 vty_out(vty
, "Group type : %s\n", type_str
);
3198 DEFUN (show_ip_pim_group_type
,
3199 show_ip_pim_group_type_cmd
,
3200 "show ip pim [vrf NAME] group-type A.B.C.D [json]",
3205 "multicast group type\n"
3210 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3211 bool uj
= use_json(argc
, argv
);
3216 argv_find(argv
, argc
, "A.B.C.D", &idx
);
3217 ip_pim_ssm_show_group_type(vrf
->info
, vty
, uj
, argv
[idx
]->arg
);
3222 DEFPY (show_ip_pim_bsr
,
3223 show_ip_pim_bsr_cmd
,
3224 "show ip pim bsr [vrf NAME] [json$json]",
3228 "boot-strap router information\n"
3232 return pim_show_bsr_helper(vrf
, vty
, !!json
);
3237 "ip ssmpingd [A.B.C.D]",
3243 const char *src_str
= (argc
== 3) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3245 return pim_process_ssmpingd_cmd(vty
, NB_OP_CREATE
, src_str
);
3248 DEFUN (no_ip_ssmpingd
,
3250 "no ip ssmpingd [A.B.C.D]",
3257 const char *src_str
= (argc
== 4) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3259 return pim_process_ssmpingd_cmd(vty
, NB_OP_DESTROY
, src_str
);
3266 "pim multicast routing\n"
3267 "Enable PIM ECMP \n")
3269 const char *vrfname
;
3270 char ecmp_xpath
[XPATH_MAXLEN
];
3272 vrfname
= pim_cli_get_vrf_name(vty
);
3273 if (vrfname
== NULL
)
3274 return CMD_WARNING_CONFIG_FAILED
;
3276 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3277 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3278 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3280 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3281 return nb_cli_apply_changes(vty
, NULL
);
3284 DEFUN (no_ip_pim_ecmp
,
3289 "pim multicast routing\n"
3290 "Disable PIM ECMP \n")
3292 const char *vrfname
;
3293 char ecmp_xpath
[XPATH_MAXLEN
];
3295 vrfname
= pim_cli_get_vrf_name(vty
);
3296 if (vrfname
== NULL
)
3297 return CMD_WARNING_CONFIG_FAILED
;
3299 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3300 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3301 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3303 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "false");
3305 return nb_cli_apply_changes(vty
, NULL
);
3308 DEFUN (ip_pim_ecmp_rebalance
,
3309 ip_pim_ecmp_rebalance_cmd
,
3310 "ip pim ecmp rebalance",
3312 "pim multicast routing\n"
3313 "Enable PIM ECMP \n"
3314 "Enable PIM ECMP Rebalance\n")
3316 const char *vrfname
;
3317 char ecmp_xpath
[XPATH_MAXLEN
];
3318 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3320 vrfname
= pim_cli_get_vrf_name(vty
);
3321 if (vrfname
== NULL
)
3322 return CMD_WARNING_CONFIG_FAILED
;
3324 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3325 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3326 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3327 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3329 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3330 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3331 sizeof(ecmp_rebalance_xpath
));
3333 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3334 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "true");
3336 return nb_cli_apply_changes(vty
, NULL
);
3339 DEFUN (no_ip_pim_ecmp_rebalance
,
3340 no_ip_pim_ecmp_rebalance_cmd
,
3341 "no ip pim ecmp rebalance",
3344 "pim multicast routing\n"
3345 "Disable PIM ECMP \n"
3346 "Disable PIM ECMP Rebalance\n")
3348 const char *vrfname
;
3349 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3351 vrfname
= pim_cli_get_vrf_name(vty
);
3352 if (vrfname
== NULL
)
3353 return CMD_WARNING_CONFIG_FAILED
;
3355 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3357 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3358 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3359 sizeof(ecmp_rebalance_xpath
));
3361 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "false");
3363 return nb_cli_apply_changes(vty
, NULL
);
3366 DEFUN (interface_ip_igmp
,
3367 interface_ip_igmp_cmd
,
3372 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
, "true");
3374 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3375 "frr-routing:ipv4");
3378 DEFUN (interface_no_ip_igmp
,
3379 interface_no_ip_igmp_cmd
,
3385 const struct lyd_node
*pim_enable_dnode
;
3386 char pim_if_xpath
[XPATH_MAXLEN
];
3389 snprintf(pim_if_xpath
, sizeof(pim_if_xpath
),
3390 "%s/frr-pim:pim/address-family[address-family='%s']",
3391 VTY_CURR_XPATH
, "frr-routing:ipv4");
3393 if (printed
>= (int)(sizeof(pim_if_xpath
))) {
3394 vty_out(vty
, "Xpath too long (%d > %u)", printed
+ 1,
3396 return CMD_WARNING_CONFIG_FAILED
;
3399 pim_enable_dnode
= yang_dnode_getf(vty
->candidate_config
->dnode
,
3400 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3401 "frr-routing:ipv4");
3402 if (!pim_enable_dnode
) {
3403 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
, NULL
);
3404 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3406 if (!yang_dnode_get_bool(pim_enable_dnode
, ".")) {
3407 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
,
3409 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3411 nb_cli_enqueue_change(vty
, "./enable",
3412 NB_OP_MODIFY
, "false");
3415 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3416 "frr-routing:ipv4");
3419 DEFUN (interface_ip_igmp_join
,
3420 interface_ip_igmp_join_cmd
,
3421 "ip igmp join A.B.C.D [A.B.C.D]",
3424 "IGMP join multicast group\n"
3425 "Multicast group address\n"
3430 const char *source_str
;
3431 char xpath
[XPATH_MAXLEN
];
3434 source_str
= argv
[idx_source
]->arg
;
3436 if (strcmp(source_str
, "0.0.0.0") == 0) {
3437 vty_out(vty
, "Bad source address %s\n",
3438 argv
[idx_source
]->arg
);
3439 return CMD_WARNING_CONFIG_FAILED
;
3442 source_str
= "0.0.0.0";
3444 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3445 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3447 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
3449 return nb_cli_apply_changes(vty
, NULL
);
3452 DEFUN (interface_no_ip_igmp_join
,
3453 interface_no_ip_igmp_join_cmd
,
3454 "no ip igmp join A.B.C.D [A.B.C.D]",
3458 "IGMP join multicast group\n"
3459 "Multicast group address\n"
3464 const char *source_str
;
3465 char xpath
[XPATH_MAXLEN
];
3468 source_str
= argv
[idx_source
]->arg
;
3470 if (strcmp(source_str
, "0.0.0.0") == 0) {
3471 vty_out(vty
, "Bad source address %s\n",
3472 argv
[idx_source
]->arg
);
3473 return CMD_WARNING_CONFIG_FAILED
;
3476 source_str
= "0.0.0.0";
3478 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3479 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3481 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
3483 return nb_cli_apply_changes(vty
, NULL
);
3486 DEFUN (interface_ip_igmp_query_interval
,
3487 interface_ip_igmp_query_interval_cmd
,
3488 "ip igmp query-interval (1-65535)",
3491 IFACE_IGMP_QUERY_INTERVAL_STR
3492 "Query interval in seconds\n")
3494 const struct lyd_node
*pim_enable_dnode
;
3497 yang_dnode_getf(vty
->candidate_config
->dnode
,
3498 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3499 "frr-routing:ipv4");
3500 if (!pim_enable_dnode
) {
3501 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3504 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3505 nb_cli_enqueue_change(vty
, "./enable",
3506 NB_OP_MODIFY
, "true");
3509 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_MODIFY
,
3512 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3513 "frr-routing:ipv4");
3516 DEFUN (interface_no_ip_igmp_query_interval
,
3517 interface_no_ip_igmp_query_interval_cmd
,
3518 "no ip igmp query-interval [(1-65535)]",
3522 IFACE_IGMP_QUERY_INTERVAL_STR
3525 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_DESTROY
, NULL
);
3527 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3528 "frr-routing:ipv4");
3531 DEFUN (interface_ip_igmp_version
,
3532 interface_ip_igmp_version_cmd
,
3533 "ip igmp version (2-3)",
3537 "IGMP version number\n")
3539 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3541 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_MODIFY
,
3544 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3545 "frr-routing:ipv4");
3548 DEFUN (interface_no_ip_igmp_version
,
3549 interface_no_ip_igmp_version_cmd
,
3550 "no ip igmp version (2-3)",
3555 "IGMP version number\n")
3557 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_DESTROY
, NULL
);
3559 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3560 "frr-routing:ipv4");
3563 DEFPY (interface_ip_igmp_query_max_response_time
,
3564 interface_ip_igmp_query_max_response_time_cmd
,
3565 "ip igmp query-max-response-time (1-65535)$qmrt",
3568 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3569 "Query response value in deci-seconds\n")
3571 return gm_process_query_max_response_time_cmd(vty
, qmrt_str
);
3574 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3575 interface_no_ip_igmp_query_max_response_time_cmd
,
3576 "no ip igmp query-max-response-time [(1-65535)]",
3580 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3583 return gm_process_no_query_max_response_time_cmd(vty
);
3586 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
3587 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3588 "ip igmp query-max-response-time-dsec (1-65535)",
3591 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3592 "Query response value in deciseconds\n")
3594 const struct lyd_node
*pim_enable_dnode
;
3597 yang_dnode_getf(vty
->candidate_config
->dnode
,
3598 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3599 "frr-routing:ipv4");
3600 if (!pim_enable_dnode
) {
3601 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3604 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3605 nb_cli_enqueue_change(vty
, "./enable",
3606 NB_OP_MODIFY
, "true");
3609 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_MODIFY
,
3612 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3613 "frr-routing:ipv4");
3616 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
3617 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
3618 "no ip igmp query-max-response-time-dsec [(1-65535)]",
3622 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3625 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_DESTROY
,
3628 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3629 "frr-routing:ipv4");
3632 DEFPY (interface_ip_igmp_last_member_query_count
,
3633 interface_ip_igmp_last_member_query_count_cmd
,
3634 "ip igmp last-member-query-count (1-255)$lmqc",
3637 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
3638 "Last member query count\n")
3640 return gm_process_last_member_query_count_cmd(vty
, lmqc_str
);
3643 DEFUN (interface_no_ip_igmp_last_member_query_count
,
3644 interface_no_ip_igmp_last_member_query_count_cmd
,
3645 "no ip igmp last-member-query-count [(1-255)]",
3649 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
3652 return gm_process_no_last_member_query_count_cmd(vty
);
3655 DEFPY (interface_ip_igmp_last_member_query_interval
,
3656 interface_ip_igmp_last_member_query_interval_cmd
,
3657 "ip igmp last-member-query-interval (1-65535)$lmqi",
3660 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
3661 "Last member query interval in deciseconds\n")
3663 return gm_process_last_member_query_interval_cmd(vty
, lmqi_str
);
3666 DEFUN (interface_no_ip_igmp_last_member_query_interval
,
3667 interface_no_ip_igmp_last_member_query_interval_cmd
,
3668 "no ip igmp last-member-query-interval [(1-65535)]",
3672 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
3675 return gm_process_no_last_member_query_interval_cmd(vty
);
3678 DEFUN (interface_ip_pim_drprio
,
3679 interface_ip_pim_drprio_cmd
,
3680 "ip pim drpriority (1-4294967295)",
3683 "Set the Designated Router Election Priority\n"
3684 "Value of the new DR Priority\n")
3688 return pim_process_ip_pim_drprio_cmd(vty
, argv
[idx_number
]->arg
);
3691 DEFUN (interface_no_ip_pim_drprio
,
3692 interface_no_ip_pim_drprio_cmd
,
3693 "no ip pim drpriority [(1-4294967295)]",
3697 "Revert the Designated Router Priority to default\n"
3698 "Old Value of the Priority\n")
3700 return pim_process_no_ip_pim_drprio_cmd(vty
);
3703 DEFPY_HIDDEN (interface_ip_igmp_query_generate
,
3704 interface_ip_igmp_query_generate_cmd
,
3705 "ip igmp generate-query-once [version (2-3)]",
3708 "Generate igmp general query once\n"
3710 "IGMP version number\n")
3713 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3715 struct pim_interface
*pim_ifp
= ifp
->info
;
3718 vty_out(vty
, "IGMP/PIM is not enabled on the interface %s\n",
3720 return CMD_WARNING_CONFIG_FAILED
;
3723 /* It takes the igmp version configured on the interface as default */
3724 igmp_version
= pim_ifp
->igmp_version
;
3727 igmp_version
= atoi(argv
[4]->arg
);
3729 igmp_send_query_on_intf(ifp
, igmp_version
);
3734 DEFPY_HIDDEN (pim_test_sg_keepalive
,
3735 pim_test_sg_keepalive_cmd
,
3736 "test pim [vrf NAME$name] keepalive-reset A.B.C.D$source A.B.C.D$group",
3740 "Reset the Keepalive Timer\n"
3741 "The Source we are resetting\n"
3742 "The Group we are resetting\n")
3744 struct pim_upstream
*up
;
3746 struct pim_instance
*pim
;
3752 vrf
= vrf_lookup_by_name(name
? name
: VRF_DEFAULT_NAME
);
3754 vty_out(vty
, "%% Vrf specified: %s does not exist\n", name
);
3761 vty_out(vty
, "%% Unable to find pim instance\n");
3765 up
= pim_upstream_find(pim
, &sg
);
3767 vty_out(vty
, "%% Unable to find %pSG specified\n", &sg
);
3771 vty_out(vty
, "Setting %pSG to current keep alive time: %d\n", &sg
,
3772 pim
->keep_alive_time
);
3773 pim_upstream_keep_alive_timer_start(up
, pim
->keep_alive_time
);
3778 DEFPY (interface_ip_pim_activeactive
,
3779 interface_ip_pim_activeactive_cmd
,
3780 "[no$no] ip pim active-active",
3784 "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
3786 return pim_process_ip_pim_activeactive_cmd(vty
, no
);
3789 DEFUN_HIDDEN (interface_ip_pim_ssm
,
3790 interface_ip_pim_ssm_cmd
,
3798 ret
= pim_process_ip_pim_cmd(vty
);
3804 "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed\n");
3809 DEFUN_HIDDEN (interface_ip_pim_sm
,
3810 interface_ip_pim_sm_cmd
,
3816 return pim_process_ip_pim_cmd(vty
);
3819 DEFPY (interface_ip_pim
,
3820 interface_ip_pim_cmd
,
3821 "ip pim [passive$passive]",
3824 "Disable exchange of protocol packets\n")
3828 ret
= pim_process_ip_pim_cmd(vty
);
3834 return pim_process_ip_pim_passive_cmd(vty
, true);
3839 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
3840 interface_no_ip_pim_ssm_cmd
,
3847 return pim_process_no_ip_pim_cmd(vty
);
3850 DEFUN_HIDDEN (interface_no_ip_pim_sm
,
3851 interface_no_ip_pim_sm_cmd
,
3858 return pim_process_no_ip_pim_cmd(vty
);
3861 DEFPY (interface_no_ip_pim
,
3862 interface_no_ip_pim_cmd
,
3863 "no ip pim [passive$passive]",
3867 "Disable exchange of protocol packets\n")
3870 return pim_process_ip_pim_passive_cmd(vty
, false);
3872 return pim_process_no_ip_pim_cmd(vty
);
3876 DEFUN(interface_ip_pim_boundary_oil
,
3877 interface_ip_pim_boundary_oil_cmd
,
3878 "ip multicast boundary oil WORD",
3880 "Generic multicast configuration options\n"
3881 "Define multicast boundary\n"
3882 "Filter OIL by group using prefix list\n"
3883 "Prefix list to filter OIL with\n")
3885 return pim_process_ip_pim_boundary_oil_cmd(vty
, argv
[4]->arg
);
3888 DEFUN(interface_no_ip_pim_boundary_oil
,
3889 interface_no_ip_pim_boundary_oil_cmd
,
3890 "no ip multicast boundary oil [WORD]",
3893 "Generic multicast configuration options\n"
3894 "Define multicast boundary\n"
3895 "Filter OIL by group using prefix list\n"
3896 "Prefix list to filter OIL with\n")
3898 return pim_process_no_ip_pim_boundary_oil_cmd(vty
);
3901 DEFUN (interface_ip_mroute
,
3902 interface_ip_mroute_cmd
,
3903 "ip mroute INTERFACE A.B.C.D [A.B.C.D]",
3905 "Add multicast route\n"
3906 "Outgoing interface name\n"
3910 int idx_interface
= 2;
3912 const char *source_str
;
3914 if (argc
== (idx_ipv4
+ 1))
3915 source_str
= "0.0.0.0";
3917 source_str
= argv
[idx_ipv4
+ 1]->arg
;
3919 return pim_process_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
3920 argv
[idx_ipv4
]->arg
, source_str
);
3923 DEFUN (interface_no_ip_mroute
,
3924 interface_no_ip_mroute_cmd
,
3925 "no ip mroute INTERFACE A.B.C.D [A.B.C.D]",
3928 "Add multicast route\n"
3929 "Outgoing interface name\n"
3933 int idx_interface
= 3;
3935 const char *source_str
;
3937 if (argc
== (idx_ipv4
+ 1))
3938 source_str
= "0.0.0.0";
3940 source_str
= argv
[idx_ipv4
+ 1]->arg
;
3942 return pim_process_no_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
3943 argv
[idx_ipv4
]->arg
, source_str
);
3946 DEFUN (interface_ip_pim_hello
,
3947 interface_ip_pim_hello_cmd
,
3948 "ip pim hello (1-65535) [(1-65535)]",
3952 IFACE_PIM_HELLO_TIME_STR
3953 IFACE_PIM_HELLO_HOLD_STR
)
3958 if (argc
== idx_hold
+ 1)
3959 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
3960 argv
[idx_hold
]->arg
);
3963 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
3967 DEFUN (interface_no_ip_pim_hello
,
3968 interface_no_ip_pim_hello_cmd
,
3969 "no ip pim hello [(1-65535) [(1-65535)]]",
3977 return pim_process_no_ip_pim_hello_cmd(vty
);
3986 PIM_DO_DEBUG_GM_EVENTS
;
3987 PIM_DO_DEBUG_GM_PACKETS
;
3988 PIM_DO_DEBUG_GM_TRACE
;
3992 DEFUN (no_debug_igmp
,
3999 PIM_DONT_DEBUG_GM_EVENTS
;
4000 PIM_DONT_DEBUG_GM_PACKETS
;
4001 PIM_DONT_DEBUG_GM_TRACE
;
4006 DEFUN (debug_igmp_events
,
4007 debug_igmp_events_cmd
,
4008 "debug igmp events",
4011 DEBUG_IGMP_EVENTS_STR
)
4013 PIM_DO_DEBUG_GM_EVENTS
;
4017 DEFUN (no_debug_igmp_events
,
4018 no_debug_igmp_events_cmd
,
4019 "no debug igmp events",
4023 DEBUG_IGMP_EVENTS_STR
)
4025 PIM_DONT_DEBUG_GM_EVENTS
;
4030 DEFUN (debug_igmp_packets
,
4031 debug_igmp_packets_cmd
,
4032 "debug igmp packets",
4035 DEBUG_IGMP_PACKETS_STR
)
4037 PIM_DO_DEBUG_GM_PACKETS
;
4041 DEFUN (no_debug_igmp_packets
,
4042 no_debug_igmp_packets_cmd
,
4043 "no debug igmp packets",
4047 DEBUG_IGMP_PACKETS_STR
)
4049 PIM_DONT_DEBUG_GM_PACKETS
;
4054 DEFUN (debug_igmp_trace
,
4055 debug_igmp_trace_cmd
,
4059 DEBUG_IGMP_TRACE_STR
)
4061 PIM_DO_DEBUG_GM_TRACE
;
4065 DEFUN (no_debug_igmp_trace
,
4066 no_debug_igmp_trace_cmd
,
4067 "no debug igmp trace",
4071 DEBUG_IGMP_TRACE_STR
)
4073 PIM_DONT_DEBUG_GM_TRACE
;
4078 DEFUN (debug_igmp_trace_detail
,
4079 debug_igmp_trace_detail_cmd
,
4080 "debug igmp trace detail",
4083 DEBUG_IGMP_TRACE_STR
4086 PIM_DO_DEBUG_GM_TRACE_DETAIL
;
4090 DEFUN (no_debug_igmp_trace_detail
,
4091 no_debug_igmp_trace_detail_cmd
,
4092 "no debug igmp trace detail",
4096 DEBUG_IGMP_TRACE_STR
4099 PIM_DONT_DEBUG_GM_TRACE_DETAIL
;
4104 DEFUN (debug_mroute
,
4110 PIM_DO_DEBUG_MROUTE
;
4114 DEFUN (debug_mroute_detail
,
4115 debug_mroute_detail_cmd
,
4116 "debug mroute detail",
4121 PIM_DO_DEBUG_MROUTE_DETAIL
;
4125 DEFUN (no_debug_mroute
,
4126 no_debug_mroute_cmd
,
4132 PIM_DONT_DEBUG_MROUTE
;
4136 DEFUN (no_debug_mroute_detail
,
4137 no_debug_mroute_detail_cmd
,
4138 "no debug mroute detail",
4144 PIM_DONT_DEBUG_MROUTE_DETAIL
;
4148 DEFUN (debug_pim_static
,
4149 debug_pim_static_cmd
,
4155 PIM_DO_DEBUG_STATIC
;
4159 DEFUN (no_debug_pim_static
,
4160 no_debug_pim_static_cmd
,
4161 "no debug pim static",
4167 PIM_DONT_DEBUG_STATIC
;
4180 return pim_debug_pim_cmd();
4182 return pim_no_debug_pim_cmd();
4185 DEFPY (debug_pim_nht
,
4187 "[no] debug pim nht",
4191 "Nexthop Tracking\n")
4194 PIM_DO_DEBUG_PIM_NHT
;
4196 PIM_DONT_DEBUG_PIM_NHT
;
4200 DEFPY (debug_pim_nht_det
,
4201 debug_pim_nht_det_cmd
,
4202 "[no] debug pim nht detail",
4206 "Nexthop Tracking\n"
4207 "Detailed Information\n")
4210 PIM_DO_DEBUG_PIM_NHT_DETAIL
;
4212 PIM_DONT_DEBUG_PIM_NHT_DETAIL
;
4216 DEFUN (debug_pim_nht_rp
,
4217 debug_pim_nht_rp_cmd
,
4221 "Nexthop Tracking\n"
4222 "RP Nexthop Tracking\n")
4224 PIM_DO_DEBUG_PIM_NHT_RP
;
4228 DEFUN (no_debug_pim_nht_rp
,
4229 no_debug_pim_nht_rp_cmd
,
4230 "no debug pim nht rp",
4234 "Nexthop Tracking\n"
4235 "RP Nexthop Tracking\n")
4237 PIM_DONT_DEBUG_PIM_NHT_RP
;
4241 DEFPY (debug_pim_events
,
4242 debug_pim_events_cmd
,
4243 "[no] debug pim events",
4247 DEBUG_PIM_EVENTS_STR
)
4250 PIM_DO_DEBUG_PIM_EVENTS
;
4252 PIM_DONT_DEBUG_PIM_EVENTS
;
4256 DEFPY (debug_pim_packets
,
4257 debug_pim_packets_cmd
,
4258 "[no] debug pim packets [<hello$hello|joins$joins|register$registers>]",
4261 DEBUG_PIM_PACKETS_STR
4262 DEBUG_PIM_HELLO_PACKETS_STR
4263 DEBUG_PIM_J_P_PACKETS_STR
4264 DEBUG_PIM_PIM_REG_PACKETS_STR
)
4267 return pim_debug_pim_packets_cmd(hello
, joins
, registers
, vty
);
4269 return pim_no_debug_pim_packets_cmd(hello
, joins
, registers
,
4273 DEFPY (debug_pim_packetdump_send
,
4274 debug_pim_packetdump_send_cmd
,
4275 "[no] debug pim packet-dump send",
4279 DEBUG_PIM_PACKETDUMP_STR
4280 DEBUG_PIM_PACKETDUMP_SEND_STR
)
4283 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
4285 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
4289 DEFPY (debug_pim_packetdump_recv
,
4290 debug_pim_packetdump_recv_cmd
,
4291 "[no] debug pim packet-dump receive",
4295 DEBUG_PIM_PACKETDUMP_STR
4296 DEBUG_PIM_PACKETDUMP_RECV_STR
)
4299 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
4301 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
4305 DEFPY (debug_pim_trace
,
4306 debug_pim_trace_cmd
,
4307 "[no] debug pim trace",
4311 DEBUG_PIM_TRACE_STR
)
4314 PIM_DO_DEBUG_PIM_TRACE
;
4316 PIM_DONT_DEBUG_PIM_TRACE
;
4320 DEFPY (debug_pim_trace_detail
,
4321 debug_pim_trace_detail_cmd
,
4322 "[no] debug pim trace detail",
4327 "Detailed Information\n")
4330 PIM_DO_DEBUG_PIM_TRACE_DETAIL
;
4332 PIM_DONT_DEBUG_PIM_TRACE_DETAIL
;
4336 DEFUN (debug_ssmpingd
,
4342 PIM_DO_DEBUG_SSMPINGD
;
4346 DEFUN (no_debug_ssmpingd
,
4347 no_debug_ssmpingd_cmd
,
4348 "no debug ssmpingd",
4353 PIM_DONT_DEBUG_SSMPINGD
;
4357 DEFPY (debug_pim_zebra
,
4358 debug_pim_zebra_cmd
,
4359 "[no] debug pim zebra",
4363 DEBUG_PIM_ZEBRA_STR
)
4368 PIM_DONT_DEBUG_ZEBRA
;
4372 DEFUN(debug_pim_mlag
, debug_pim_mlag_cmd
, "debug pim mlag",
4373 DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4379 DEFUN(no_debug_pim_mlag
, no_debug_pim_mlag_cmd
, "no debug pim mlag",
4380 NO_STR DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4382 PIM_DONT_DEBUG_MLAG
;
4386 DEFUN (debug_pim_vxlan
,
4387 debug_pim_vxlan_cmd
,
4391 DEBUG_PIM_VXLAN_STR
)
4397 DEFUN (no_debug_pim_vxlan
,
4398 no_debug_pim_vxlan_cmd
,
4399 "no debug pim vxlan",
4403 DEBUG_PIM_VXLAN_STR
)
4405 PIM_DONT_DEBUG_VXLAN
;
4415 PIM_DO_DEBUG_MSDP_EVENTS
;
4416 PIM_DO_DEBUG_MSDP_PACKETS
;
4420 DEFUN (no_debug_msdp
,
4427 PIM_DONT_DEBUG_MSDP_EVENTS
;
4428 PIM_DONT_DEBUG_MSDP_PACKETS
;
4432 DEFUN (debug_msdp_events
,
4433 debug_msdp_events_cmd
,
4434 "debug msdp events",
4437 DEBUG_MSDP_EVENTS_STR
)
4439 PIM_DO_DEBUG_MSDP_EVENTS
;
4443 DEFUN (no_debug_msdp_events
,
4444 no_debug_msdp_events_cmd
,
4445 "no debug msdp events",
4449 DEBUG_MSDP_EVENTS_STR
)
4451 PIM_DONT_DEBUG_MSDP_EVENTS
;
4455 DEFUN (debug_msdp_packets
,
4456 debug_msdp_packets_cmd
,
4457 "debug msdp packets",
4460 DEBUG_MSDP_PACKETS_STR
)
4462 PIM_DO_DEBUG_MSDP_PACKETS
;
4466 DEFUN (no_debug_msdp_packets
,
4467 no_debug_msdp_packets_cmd
,
4468 "no debug msdp packets",
4472 DEBUG_MSDP_PACKETS_STR
)
4474 PIM_DONT_DEBUG_MSDP_PACKETS
;
4478 DEFUN (debug_mtrace
,
4484 PIM_DO_DEBUG_MTRACE
;
4488 DEFUN (no_debug_mtrace
,
4489 no_debug_mtrace_cmd
,
4495 PIM_DONT_DEBUG_MTRACE
;
4510 DEFUN (no_debug_bsm
,
4523 DEFUN_NOSH (show_debugging_pim
,
4524 show_debugging_pim_cmd
,
4525 "show debugging [pim]",
4530 vty_out(vty
, "PIM debugging status\n");
4532 pim_debug_config_write(vty
);
4534 cmd_show_lib_debugs(vty
);
4538 DEFUN (interface_pim_use_source
,
4539 interface_pim_use_source_cmd
,
4540 "ip pim use-source A.B.C.D",
4543 "Configure primary IP address\n"
4544 "source ip address\n")
4546 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, argv
[3]->arg
);
4548 return nb_cli_apply_changes(vty
,
4549 FRR_PIM_INTERFACE_XPATH
,
4550 "frr-routing:ipv4");
4553 DEFUN (interface_no_pim_use_source
,
4554 interface_no_pim_use_source_cmd
,
4555 "no ip pim use-source [A.B.C.D]",
4559 "Delete source IP address\n"
4560 "source ip address\n")
4562 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, "0.0.0.0");
4564 return nb_cli_apply_changes(vty
,
4565 FRR_PIM_INTERFACE_XPATH
,
4566 "frr-routing:ipv4");
4571 "ip pim bfd [profile BFDPROF$prof]",
4574 "Enables BFD support\n"
4576 "Use BFD profile name\n")
4578 const struct lyd_node
*igmp_enable_dnode
;
4581 yang_dnode_getf(vty
->candidate_config
->dnode
,
4582 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
4583 "frr-routing:ipv4");
4584 if (!igmp_enable_dnode
)
4585 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4588 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
4589 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4593 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
4595 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_MODIFY
, prof
);
4597 return nb_cli_apply_changes(vty
,
4598 FRR_PIM_INTERFACE_XPATH
,
4599 "frr-routing:ipv4");
4602 DEFPY(no_ip_pim_bfd_profile
, no_ip_pim_bfd_profile_cmd
,
4603 "no ip pim bfd profile [BFDPROF]",
4607 "Enables BFD support\n"
4608 "Disable BFD profile\n"
4609 "BFD Profile name\n")
4611 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_DESTROY
, NULL
);
4613 return nb_cli_apply_changes(vty
,
4614 FRR_PIM_INTERFACE_XPATH
,
4615 "frr-routing:ipv4");
4618 DEFUN (no_ip_pim_bfd
,
4624 "Disables BFD support\n")
4626 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_DESTROY
, NULL
);
4628 return nb_cli_apply_changes(vty
,
4629 FRR_PIM_INTERFACE_XPATH
,
4630 "frr-routing:ipv4");
4638 "Enable BSM support on the interface\n")
4640 return pim_process_bsm_cmd(vty
);
4642 DEFUN (no_ip_pim_bsm
,
4648 "Enable BSM support on the interface\n")
4650 return pim_process_no_bsm_cmd(vty
);
4653 DEFUN (ip_pim_ucast_bsm
,
4654 ip_pim_ucast_bsm_cmd
,
4655 "ip pim unicast-bsm",
4658 "Accept/Send unicast BSM on the interface\n")
4660 return pim_process_unicast_bsm_cmd(vty
);
4663 DEFUN (no_ip_pim_ucast_bsm
,
4664 no_ip_pim_ucast_bsm_cmd
,
4665 "no ip pim unicast-bsm",
4669 "Accept/Send unicast BSM on the interface\n")
4671 return pim_process_no_unicast_bsm_cmd(vty
);
4677 ip_pim_bfd_param_cmd
,
4678 "ip pim bfd (2-255) (1-65535) (1-65535)",
4681 "Enables BFD support\n"
4682 "Detect Multiplier\n"
4683 "Required min receive interval\n"
4684 "Desired min transmit interval\n")
4688 ip_pim_bfd_param_cmd
,
4689 "ip pim bfd (2-255) (1-65535) (1-65535)",
4692 "Enables BFD support\n"
4693 "Detect Multiplier\n"
4694 "Required min receive interval\n"
4695 "Desired min transmit interval\n")
4696 #endif /* HAVE_BFDD */
4699 int idx_number_2
= 4;
4700 int idx_number_3
= 5;
4701 const struct lyd_node
*igmp_enable_dnode
;
4704 yang_dnode_getf(vty
->candidate_config
->dnode
,
4705 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
4706 "frr-routing:ipv4");
4707 if (!igmp_enable_dnode
)
4708 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4711 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
4712 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4716 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
4717 nb_cli_enqueue_change(vty
, "./bfd/min-rx-interval", NB_OP_MODIFY
,
4718 argv
[idx_number_2
]->arg
);
4719 nb_cli_enqueue_change(vty
, "./bfd/min-tx-interval", NB_OP_MODIFY
,
4720 argv
[idx_number_3
]->arg
);
4721 nb_cli_enqueue_change(vty
, "./bfd/detect_mult", NB_OP_MODIFY
,
4722 argv
[idx_number
]->arg
);
4724 return nb_cli_apply_changes(vty
,
4725 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
4729 ALIAS(no_ip_pim_bfd
, no_ip_pim_bfd_param_cmd
,
4730 "no ip pim bfd (2-255) (1-65535) (1-65535)",
4734 "Enables BFD support\n"
4735 "Detect Multiplier\n"
4736 "Required min receive interval\n"
4737 "Desired min transmit interval\n")
4738 #endif /* !HAVE_BFDD */
4740 DEFPY(ip_msdp_peer
, ip_msdp_peer_cmd
,
4741 "ip msdp peer A.B.C.D$peer source A.B.C.D$source",
4744 "Configure MSDP peer\n"
4746 "Source address for TCP connection\n"
4747 "Local IP address\n")
4749 const char *vrfname
;
4750 char temp_xpath
[XPATH_MAXLEN
];
4751 char msdp_peer_source_xpath
[XPATH_MAXLEN
];
4753 vrfname
= pim_cli_get_vrf_name(vty
);
4754 if (vrfname
== NULL
)
4755 return CMD_WARNING_CONFIG_FAILED
;
4757 snprintf(msdp_peer_source_xpath
, sizeof(msdp_peer_source_xpath
),
4758 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
4759 "frr-routing:ipv4");
4760 snprintf(temp_xpath
, sizeof(temp_xpath
),
4761 "/msdp-peer[peer-ip='%s']/source-ip", peer_str
);
4762 strlcat(msdp_peer_source_xpath
, temp_xpath
,
4763 sizeof(msdp_peer_source_xpath
));
4765 nb_cli_enqueue_change(vty
, msdp_peer_source_xpath
, NB_OP_MODIFY
,
4768 return nb_cli_apply_changes(vty
,
4769 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
4772 DEFPY(ip_msdp_timers
, ip_msdp_timers_cmd
,
4773 "ip msdp timers (1-65535)$keepalive (1-65535)$holdtime [(1-65535)$connretry]",
4776 "MSDP timers configuration\n"
4777 "Keep alive period (in seconds)\n"
4778 "Hold time period (in seconds)\n"
4779 "Connection retry period (in seconds)\n")
4781 const char *vrfname
;
4782 char xpath
[XPATH_MAXLEN
];
4784 vrfname
= pim_cli_get_vrf_name(vty
);
4785 if (vrfname
== NULL
)
4786 return CMD_WARNING_CONFIG_FAILED
;
4788 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
4789 "pim", vrfname
, "frr-routing:ipv4");
4790 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_MODIFY
, holdtime_str
);
4791 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_MODIFY
, keepalive_str
);
4793 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_MODIFY
,
4796 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
,
4799 nb_cli_apply_changes(vty
, xpath
);
4804 DEFPY(no_ip_msdp_timers
, no_ip_msdp_timers_cmd
,
4805 "no ip msdp timers [(1-65535) (1-65535) [(1-65535)]]",
4809 "MSDP timers configuration\n"
4814 const char *vrfname
;
4815 char xpath
[XPATH_MAXLEN
];
4817 vrfname
= pim_cli_get_vrf_name(vty
);
4818 if (vrfname
== NULL
)
4819 return CMD_WARNING_CONFIG_FAILED
;
4821 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
4822 "pim", vrfname
, "frr-routing:ipv4");
4824 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_DESTROY
, NULL
);
4825 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_DESTROY
, NULL
);
4826 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
, NULL
);
4828 nb_cli_apply_changes(vty
, xpath
);
4833 DEFUN (no_ip_msdp_peer
,
4834 no_ip_msdp_peer_cmd
,
4835 "no ip msdp peer A.B.C.D",
4839 "Delete MSDP peer\n"
4840 "peer ip address\n")
4842 const char *vrfname
;
4843 char msdp_peer_xpath
[XPATH_MAXLEN
];
4844 char temp_xpath
[XPATH_MAXLEN
];
4846 vrfname
= pim_cli_get_vrf_name(vty
);
4847 if (vrfname
== NULL
)
4848 return CMD_WARNING_CONFIG_FAILED
;
4850 snprintf(msdp_peer_xpath
, sizeof(msdp_peer_xpath
),
4852 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
4853 snprintf(temp_xpath
, sizeof(temp_xpath
),
4854 "/msdp-peer[peer-ip='%s']",
4857 strlcat(msdp_peer_xpath
, temp_xpath
, sizeof(msdp_peer_xpath
));
4859 nb_cli_enqueue_change(vty
, msdp_peer_xpath
, NB_OP_DESTROY
, NULL
);
4861 return nb_cli_apply_changes(vty
, NULL
);
4864 DEFPY(ip_msdp_mesh_group_member
,
4865 ip_msdp_mesh_group_member_cmd
,
4866 "ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
4869 "Configure MSDP mesh-group\n"
4871 "Mesh group member\n"
4872 "Peer IP address\n")
4874 const char *vrfname
;
4875 char xpath_value
[XPATH_MAXLEN
];
4877 vrfname
= pim_cli_get_vrf_name(vty
);
4878 if (vrfname
== NULL
)
4879 return CMD_WARNING_CONFIG_FAILED
;
4881 /* Create mesh group. */
4882 snprintf(xpath_value
, sizeof(xpath_value
),
4883 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4884 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
4885 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
4887 /* Create mesh group member. */
4888 strlcat(xpath_value
, "/members[address='", sizeof(xpath_value
));
4889 strlcat(xpath_value
, maddr_str
, sizeof(xpath_value
));
4890 strlcat(xpath_value
, "']", sizeof(xpath_value
));
4891 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
4893 return nb_cli_apply_changes(vty
, NULL
);
4896 DEFPY(no_ip_msdp_mesh_group_member
,
4897 no_ip_msdp_mesh_group_member_cmd
,
4898 "no ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
4902 "Delete MSDP mesh-group member\n"
4904 "Mesh group member\n"
4905 "Peer IP address\n")
4907 const char *vrfname
;
4908 char xpath_value
[XPATH_MAXLEN
];
4909 char xpath_member_value
[XPATH_MAXLEN
];
4911 vrfname
= pim_cli_get_vrf_name(vty
);
4912 if (vrfname
== NULL
)
4913 return CMD_WARNING_CONFIG_FAILED
;
4915 /* Get mesh group base XPath. */
4916 snprintf(xpath_value
, sizeof(xpath_value
),
4917 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4918 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
4920 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
)) {
4921 vty_out(vty
, "%% mesh-group does not exist\n");
4922 return CMD_WARNING_CONFIG_FAILED
;
4925 /* Remove mesh group member. */
4926 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
4927 strlcat(xpath_member_value
, "/members[address='",
4928 sizeof(xpath_member_value
));
4929 strlcat(xpath_member_value
, maddr_str
, sizeof(xpath_member_value
));
4930 strlcat(xpath_member_value
, "']", sizeof(xpath_member_value
));
4931 if (!yang_dnode_exists(vty
->candidate_config
->dnode
,
4932 xpath_member_value
)) {
4933 vty_out(vty
, "%% mesh-group member does not exist\n");
4934 return CMD_WARNING_CONFIG_FAILED
;
4937 nb_cli_enqueue_change(vty
, xpath_member_value
, NB_OP_DESTROY
, NULL
);
4940 * If this is the last member, then we must remove the group altogether
4941 * to not break legacy CLI behaviour.
4943 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
4945 return nb_cli_apply_changes(vty
, NULL
);
4948 DEFPY(ip_msdp_mesh_group_source
,
4949 ip_msdp_mesh_group_source_cmd
,
4950 "ip msdp mesh-group WORD$gname source A.B.C.D$saddr",
4953 "Configure MSDP mesh-group\n"
4955 "Mesh group local address\n"
4956 "Source IP address for the TCP connection\n")
4958 const char *vrfname
;
4959 char xpath_value
[XPATH_MAXLEN
];
4961 vrfname
= pim_cli_get_vrf_name(vty
);
4962 if (vrfname
== NULL
)
4963 return CMD_WARNING_CONFIG_FAILED
;
4965 /* Create mesh group. */
4966 snprintf(xpath_value
, sizeof(xpath_value
),
4967 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4968 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
4969 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
4971 /* Create mesh group source. */
4972 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
4973 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_MODIFY
, saddr_str
);
4975 return nb_cli_apply_changes(vty
, NULL
);
4978 DEFPY(no_ip_msdp_mesh_group_source
,
4979 no_ip_msdp_mesh_group_source_cmd
,
4980 "no ip msdp mesh-group WORD$gname source [A.B.C.D]",
4984 "Delete MSDP mesh-group source\n"
4986 "Mesh group source\n"
4987 "Mesh group local address\n")
4989 const char *vrfname
;
4990 char xpath_value
[XPATH_MAXLEN
];
4992 vrfname
= pim_cli_get_vrf_name(vty
);
4993 if (vrfname
== NULL
)
4994 return CMD_WARNING_CONFIG_FAILED
;
4996 /* Get mesh group base XPath. */
4997 snprintf(xpath_value
, sizeof(xpath_value
),
4998 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4999 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5000 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5002 /* Create mesh group source. */
5003 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5004 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5007 * If this is the last member, then we must remove the group altogether
5008 * to not break legacy CLI behaviour.
5010 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5012 return nb_cli_apply_changes(vty
, NULL
);
5015 DEFPY(no_ip_msdp_mesh_group
,
5016 no_ip_msdp_mesh_group_cmd
,
5017 "no ip msdp mesh-group WORD$gname",
5021 "Delete MSDP mesh-group\n"
5022 "Mesh group name\n")
5024 const char *vrfname
;
5025 char xpath_value
[XPATH_MAXLEN
];
5027 vrfname
= pim_cli_get_vrf_name(vty
);
5028 if (vrfname
== NULL
)
5029 return CMD_WARNING_CONFIG_FAILED
;
5031 /* Get mesh group base XPath. */
5032 snprintf(xpath_value
, sizeof(xpath_value
),
5033 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5034 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5035 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
5038 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5039 return nb_cli_apply_changes(vty
, NULL
);
5042 static void ip_msdp_show_mesh_group(struct vty
*vty
, struct pim_msdp_mg
*mg
,
5043 struct json_object
*json
)
5045 struct listnode
*mbrnode
;
5046 struct pim_msdp_mg_mbr
*mbr
;
5047 char mbr_str
[INET_ADDRSTRLEN
];
5048 char src_str
[INET_ADDRSTRLEN
];
5049 char state_str
[PIM_MSDP_STATE_STRLEN
];
5050 enum pim_msdp_peer_state state
;
5051 json_object
*json_mg_row
= NULL
;
5052 json_object
*json_members
= NULL
;
5053 json_object
*json_row
= NULL
;
5055 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
5057 /* currently there is only one mesh group but we should still
5059 * it a dict with mg-name as key */
5060 json_mg_row
= json_object_new_object();
5061 json_object_string_add(json_mg_row
, "name",
5062 mg
->mesh_group_name
);
5063 json_object_string_add(json_mg_row
, "source", src_str
);
5065 vty_out(vty
, "Mesh group : %s\n", mg
->mesh_group_name
);
5066 vty_out(vty
, " Source : %s\n", src_str
);
5067 vty_out(vty
, " Member State\n");
5070 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
5071 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
5073 state
= mbr
->mp
->state
;
5075 state
= PIM_MSDP_DISABLED
;
5077 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
5079 json_row
= json_object_new_object();
5080 json_object_string_add(json_row
, "member", mbr_str
);
5081 json_object_string_add(json_row
, "state", state_str
);
5082 if (!json_members
) {
5083 json_members
= json_object_new_object();
5084 json_object_object_add(json_mg_row
, "members",
5087 json_object_object_add(json_members
, mbr_str
, json_row
);
5089 vty_out(vty
, " %-15s %11s\n", mbr_str
, state_str
);
5094 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
5097 DEFUN (show_ip_msdp_mesh_group
,
5098 show_ip_msdp_mesh_group_cmd
,
5099 "show ip msdp [vrf NAME] mesh-group [json]",
5104 "MSDP mesh-group information\n"
5107 bool uj
= use_json(argc
, argv
);
5109 struct pim_msdp_mg
*mg
;
5110 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5111 struct pim_instance
*pim
;
5112 struct json_object
*json
= NULL
;
5118 /* Quick case: list is empty. */
5119 if (SLIST_EMPTY(&pim
->msdp
.mglist
)) {
5121 vty_out(vty
, "{}\n");
5127 json
= json_object_new_object();
5129 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5130 ip_msdp_show_mesh_group(vty
, mg
, json
);
5133 vty_json(vty
, json
);
5138 DEFUN (show_ip_msdp_mesh_group_vrf_all
,
5139 show_ip_msdp_mesh_group_vrf_all_cmd
,
5140 "show ip msdp vrf all mesh-group [json]",
5145 "MSDP mesh-group information\n"
5148 bool uj
= use_json(argc
, argv
);
5149 struct json_object
*json
= NULL
, *vrf_json
= NULL
;
5150 struct pim_instance
*pim
;
5151 struct pim_msdp_mg
*mg
;
5155 json
= json_object_new_object();
5157 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5159 vrf_json
= json_object_new_object();
5160 json_object_object_add(json
, vrf
->name
, vrf_json
);
5162 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5165 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5166 ip_msdp_show_mesh_group(vty
, mg
, vrf_json
);
5170 vty_json(vty
, json
);
5176 static void ip_msdp_show_peers(struct pim_instance
*pim
, struct vty
*vty
,
5179 struct listnode
*mpnode
;
5180 struct pim_msdp_peer
*mp
;
5181 char peer_str
[INET_ADDRSTRLEN
];
5182 char local_str
[INET_ADDRSTRLEN
];
5183 char state_str
[PIM_MSDP_STATE_STRLEN
];
5184 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5186 json_object
*json
= NULL
;
5187 json_object
*json_row
= NULL
;
5191 json
= json_object_new_object();
5194 "Peer Local State Uptime SaCnt\n");
5197 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5198 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5199 now
= pim_time_monotonic_sec();
5200 pim_time_uptime(timebuf
, sizeof(timebuf
),
5203 strlcpy(timebuf
, "-", sizeof(timebuf
));
5205 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5206 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5208 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5210 json_row
= json_object_new_object();
5211 json_object_string_add(json_row
, "peer", peer_str
);
5212 json_object_string_add(json_row
, "local", local_str
);
5213 json_object_string_add(json_row
, "state", state_str
);
5214 json_object_string_add(json_row
, "upTime", timebuf
);
5215 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5216 json_object_object_add(json
, peer_str
, json_row
);
5218 vty_out(vty
, "%-15s %15s %11s %8s %6d\n", peer_str
,
5219 local_str
, state_str
, timebuf
, mp
->sa_cnt
);
5224 vty_json(vty
, json
);
5227 static void ip_msdp_show_peers_detail(struct pim_instance
*pim
, struct vty
*vty
,
5228 const char *peer
, bool uj
)
5230 struct listnode
*mpnode
;
5231 struct pim_msdp_peer
*mp
;
5232 char peer_str
[INET_ADDRSTRLEN
];
5233 char local_str
[INET_ADDRSTRLEN
];
5234 char state_str
[PIM_MSDP_STATE_STRLEN
];
5235 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5236 char katimer
[PIM_MSDP_TIMER_STRLEN
];
5237 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
5238 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
5240 json_object
*json
= NULL
;
5241 json_object
*json_row
= NULL
;
5244 json
= json_object_new_object();
5247 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5248 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5249 if (strcmp(peer
, "detail") && strcmp(peer
, peer_str
))
5252 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5253 now
= pim_time_monotonic_sec();
5254 pim_time_uptime(timebuf
, sizeof(timebuf
),
5257 strlcpy(timebuf
, "-", sizeof(timebuf
));
5259 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5261 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5262 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
),
5264 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
),
5266 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
),
5270 json_row
= json_object_new_object();
5271 json_object_string_add(json_row
, "peer", peer_str
);
5272 json_object_string_add(json_row
, "local", local_str
);
5273 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5274 json_object_string_add(json_row
,
5276 mp
->mesh_group_name
);
5277 json_object_string_add(json_row
, "state", state_str
);
5278 json_object_string_add(json_row
, "upTime", timebuf
);
5279 json_object_string_add(json_row
, "keepAliveTimer",
5281 json_object_string_add(json_row
, "connRetryTimer",
5283 json_object_string_add(json_row
, "holdTimer",
5285 json_object_string_add(json_row
, "lastReset",
5287 json_object_int_add(json_row
, "connAttempts",
5289 json_object_int_add(json_row
, "establishedChanges",
5291 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5292 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
5293 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
5294 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
5295 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
5296 json_object_object_add(json
, peer_str
, json_row
);
5298 vty_out(vty
, "Peer : %s\n", peer_str
);
5299 vty_out(vty
, " Local : %s\n", local_str
);
5300 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5301 vty_out(vty
, " Mesh Group : %s\n",
5302 mp
->mesh_group_name
);
5303 vty_out(vty
, " State : %s\n", state_str
);
5304 vty_out(vty
, " Uptime : %s\n", timebuf
);
5306 vty_out(vty
, " Keepalive Timer : %s\n", katimer
);
5307 vty_out(vty
, " Conn Retry Timer : %s\n", crtimer
);
5308 vty_out(vty
, " Hold Timer : %s\n", holdtimer
);
5309 vty_out(vty
, " Last Reset : %s\n",
5311 vty_out(vty
, " Conn Attempts : %d\n",
5313 vty_out(vty
, " Established Changes : %d\n",
5315 vty_out(vty
, " SA Count : %d\n",
5317 vty_out(vty
, " Statistics :\n");
5320 vty_out(vty
, " Keepalives : %10d %10d\n",
5321 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
);
5322 vty_out(vty
, " SAs : %10d %10d\n",
5323 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
);
5329 vty_json(vty
, json
);
5332 DEFUN (show_ip_msdp_peer_detail
,
5333 show_ip_msdp_peer_detail_cmd
,
5334 "show ip msdp [vrf NAME] peer [detail|A.B.C.D] [json]",
5339 "MSDP peer information\n"
5344 bool uj
= use_json(argc
, argv
);
5346 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5353 if (argv_find(argv
, argc
, "detail", &idx
))
5354 arg
= argv
[idx
]->text
;
5355 else if (argv_find(argv
, argc
, "A.B.C.D", &idx
))
5356 arg
= argv
[idx
]->arg
;
5359 ip_msdp_show_peers_detail(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
5361 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5366 DEFUN (show_ip_msdp_peer_detail_vrf_all
,
5367 show_ip_msdp_peer_detail_vrf_all_cmd
,
5368 "show ip msdp vrf all peer [detail|A.B.C.D] [json]",
5373 "MSDP peer information\n"
5379 bool uj
= use_json(argc
, argv
);
5385 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5389 vty_out(vty
, " \"%s\": ", vrf
->name
);
5392 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5393 if (argv_find(argv
, argc
, "detail", &idx
)
5394 || argv_find(argv
, argc
, "A.B.C.D", &idx
))
5395 ip_msdp_show_peers_detail(vrf
->info
, vty
,
5396 argv
[idx
]->arg
, uj
);
5398 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5401 vty_out(vty
, "}\n");
5406 static void ip_msdp_show_sa(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
5408 struct listnode
*sanode
;
5409 struct pim_msdp_sa
*sa
;
5410 char rp_str
[INET_ADDRSTRLEN
];
5411 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5415 json_object
*json
= NULL
;
5416 json_object
*json_group
= NULL
;
5417 json_object
*json_row
= NULL
;
5420 json
= json_object_new_object();
5423 "Source Group RP Local SPT Uptime\n");
5426 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5427 now
= pim_time_monotonic_sec();
5428 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5429 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5430 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5432 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5434 strlcpy(spt_str
, "no", sizeof(spt_str
));
5437 strlcpy(rp_str
, "-", sizeof(rp_str
));
5438 strlcpy(spt_str
, "-", sizeof(spt_str
));
5440 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5441 strlcpy(local_str
, "yes", sizeof(local_str
));
5443 strlcpy(local_str
, "no", sizeof(local_str
));
5446 char src_str
[PIM_ADDRSTRLEN
];
5447 char grp_str
[PIM_ADDRSTRLEN
];
5449 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
5451 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
5454 json_object_object_get_ex(json
, grp_str
, &json_group
);
5457 json_group
= json_object_new_object();
5458 json_object_object_add(json
, grp_str
,
5462 json_row
= json_object_new_object();
5463 json_object_string_add(json_row
, "source", src_str
);
5464 json_object_string_add(json_row
, "group", grp_str
);
5465 json_object_string_add(json_row
, "rp", rp_str
);
5466 json_object_string_add(json_row
, "local", local_str
);
5467 json_object_string_add(json_row
, "sptSetup", spt_str
);
5468 json_object_string_add(json_row
, "upTime", timebuf
);
5469 json_object_object_add(json_group
, src_str
, json_row
);
5471 vty_out(vty
, "%-15pPAs %15pPAs %15s %5c %3c %8s\n",
5472 &sa
->sg
.src
, &sa
->sg
.grp
, rp_str
, local_str
[0],
5473 spt_str
[0], timebuf
);
5478 vty_json(vty
, json
);
5481 static void ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
,
5482 const char *src_str
,
5483 const char *grp_str
, struct vty
*vty
,
5484 bool uj
, json_object
*json
)
5486 char rp_str
[INET_ADDRSTRLEN
];
5487 char peer_str
[INET_ADDRSTRLEN
];
5488 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5491 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
5493 json_object
*json_group
= NULL
;
5494 json_object
*json_row
= NULL
;
5496 now
= pim_time_monotonic_sec();
5497 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5498 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5499 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5500 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
5502 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5504 strlcpy(spt_str
, "no", sizeof(spt_str
));
5507 strlcpy(rp_str
, "-", sizeof(rp_str
));
5508 strlcpy(peer_str
, "-", sizeof(peer_str
));
5509 strlcpy(spt_str
, "-", sizeof(spt_str
));
5511 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5512 strlcpy(local_str
, "yes", sizeof(local_str
));
5514 strlcpy(local_str
, "no", sizeof(local_str
));
5516 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
),
5517 sa
->sa_state_timer
);
5519 json_object_object_get_ex(json
, grp_str
, &json_group
);
5522 json_group
= json_object_new_object();
5523 json_object_object_add(json
, grp_str
, json_group
);
5526 json_row
= json_object_new_object();
5527 json_object_string_add(json_row
, "source", src_str
);
5528 json_object_string_add(json_row
, "group", grp_str
);
5529 json_object_string_add(json_row
, "rp", rp_str
);
5530 json_object_string_add(json_row
, "local", local_str
);
5531 json_object_string_add(json_row
, "sptSetup", spt_str
);
5532 json_object_string_add(json_row
, "upTime", timebuf
);
5533 json_object_string_add(json_row
, "stateTimer", statetimer
);
5534 json_object_object_add(json_group
, src_str
, json_row
);
5536 vty_out(vty
, "SA : %s\n", sa
->sg_str
);
5537 vty_out(vty
, " RP : %s\n", rp_str
);
5538 vty_out(vty
, " Peer : %s\n", peer_str
);
5539 vty_out(vty
, " Local : %s\n", local_str
);
5540 vty_out(vty
, " SPT Setup : %s\n", spt_str
);
5541 vty_out(vty
, " Uptime : %s\n", timebuf
);
5542 vty_out(vty
, " State Timer : %s\n", statetimer
);
5547 static void ip_msdp_show_sa_detail(struct pim_instance
*pim
, struct vty
*vty
,
5550 struct listnode
*sanode
;
5551 struct pim_msdp_sa
*sa
;
5552 json_object
*json
= NULL
;
5555 json
= json_object_new_object();
5558 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5559 char src_str
[PIM_ADDRSTRLEN
];
5560 char grp_str
[PIM_ADDRSTRLEN
];
5562 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5563 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5565 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
,
5570 vty_json(vty
, json
);
5573 DEFUN (show_ip_msdp_sa_detail
,
5574 show_ip_msdp_sa_detail_cmd
,
5575 "show ip msdp [vrf NAME] sa detail [json]",
5580 "MSDP active-source information\n"
5584 bool uj
= use_json(argc
, argv
);
5586 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5591 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
5596 DEFUN (show_ip_msdp_sa_detail_vrf_all
,
5597 show_ip_msdp_sa_detail_vrf_all_cmd
,
5598 "show ip msdp vrf all sa detail [json]",
5603 "MSDP active-source information\n"
5607 bool uj
= use_json(argc
, argv
);
5613 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5617 vty_out(vty
, " \"%s\": ", vrf
->name
);
5620 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5621 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
5624 vty_out(vty
, "}\n");
5629 static void ip_msdp_show_sa_addr(struct pim_instance
*pim
, struct vty
*vty
,
5630 const char *addr
, bool uj
)
5632 struct listnode
*sanode
;
5633 struct pim_msdp_sa
*sa
;
5634 json_object
*json
= NULL
;
5637 json
= json_object_new_object();
5640 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5641 char src_str
[PIM_ADDRSTRLEN
];
5642 char grp_str
[PIM_ADDRSTRLEN
];
5644 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5645 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5647 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
5648 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
5654 vty_json(vty
, json
);
5657 static void ip_msdp_show_sa_sg(struct pim_instance
*pim
, struct vty
*vty
,
5658 const char *src
, const char *grp
, bool uj
)
5660 struct listnode
*sanode
;
5661 struct pim_msdp_sa
*sa
;
5662 json_object
*json
= NULL
;
5665 json
= json_object_new_object();
5668 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5669 char src_str
[PIM_ADDRSTRLEN
];
5670 char grp_str
[PIM_ADDRSTRLEN
];
5672 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5673 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5675 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
5676 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
5682 vty_json(vty
, json
);
5685 DEFUN (show_ip_msdp_sa_sg
,
5686 show_ip_msdp_sa_sg_cmd
,
5687 "show ip msdp [vrf NAME] sa [A.B.C.D [A.B.C.D]] [json]",
5692 "MSDP active-source information\n"
5693 "source or group ip\n"
5697 bool uj
= use_json(argc
, argv
);
5701 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5706 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
5708 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
5712 if (src_ip
&& grp_ip
)
5713 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
5715 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
5717 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
5722 DEFUN (show_ip_msdp_sa_sg_vrf_all
,
5723 show_ip_msdp_sa_sg_vrf_all_cmd
,
5724 "show ip msdp vrf all sa [A.B.C.D [A.B.C.D]] [json]",
5729 "MSDP active-source information\n"
5730 "source or group ip\n"
5734 bool uj
= use_json(argc
, argv
);
5739 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
5741 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
5747 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5751 vty_out(vty
, " \"%s\": ", vrf
->name
);
5754 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5756 if (src_ip
&& grp_ip
)
5757 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
5759 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
5761 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
5764 vty_out(vty
, "}\n");
5769 struct pim_sg_cache_walk_data
{
5772 json_object
*json_group
;
5773 struct in_addr addr
;
5777 static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg
*vxlan_sg
,
5778 struct pim_sg_cache_walk_data
*cwd
)
5780 struct vty
*vty
= cwd
->vty
;
5781 json_object
*json
= cwd
->json
;
5782 json_object
*json_row
;
5783 bool installed
= (vxlan_sg
->up
) ? true : false;
5784 const char *iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
5785 const char *oif_name
;
5787 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
5788 oif_name
= vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
5790 oif_name
= vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
5792 if (cwd
->addr_match
&& pim_addr_cmp(vxlan_sg
->sg
.src
, cwd
->addr
) &&
5793 pim_addr_cmp(vxlan_sg
->sg
.grp
, cwd
->addr
)) {
5797 char src_str
[PIM_ADDRSTRLEN
];
5798 char grp_str
[PIM_ADDRSTRLEN
];
5800 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
5802 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
5805 json_object_object_get_ex(json
, grp_str
, &cwd
->json_group
);
5807 if (!cwd
->json_group
) {
5808 cwd
->json_group
= json_object_new_object();
5809 json_object_object_add(json
, grp_str
,
5813 json_row
= json_object_new_object();
5814 json_object_string_add(json_row
, "source", src_str
);
5815 json_object_string_add(json_row
, "group", grp_str
);
5816 json_object_string_add(json_row
, "input", iif_name
);
5817 json_object_string_add(json_row
, "output", oif_name
);
5819 json_object_boolean_true_add(json_row
, "installed");
5821 json_object_boolean_false_add(json_row
, "installed");
5822 json_object_object_add(cwd
->json_group
, src_str
, json_row
);
5824 vty_out(vty
, "%-15pPAs %-15pPAs %-15s %-15s %-5s\n",
5825 &vxlan_sg
->sg
.src
, &vxlan_sg
->sg
.grp
, iif_name
,
5826 oif_name
, installed
? "I" : "");
5830 static void pim_show_vxlan_sg_hash_entry(struct hash_bucket
*bucket
, void *arg
)
5832 pim_show_vxlan_sg_entry((struct pim_vxlan_sg
*)bucket
->data
,
5833 (struct pim_sg_cache_walk_data
*)arg
);
5836 static void pim_show_vxlan_sg(struct pim_instance
*pim
,
5837 struct vty
*vty
, bool uj
)
5839 json_object
*json
= NULL
;
5840 struct pim_sg_cache_walk_data cwd
;
5843 json
= json_object_new_object();
5845 vty_out(vty
, "Codes: I -> installed\n");
5847 "Source Group Input Output Flags\n");
5850 memset(&cwd
, 0, sizeof(cwd
));
5853 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
5856 vty_json(vty
, json
);
5859 static void pim_show_vxlan_sg_match_addr(struct pim_instance
*pim
,
5860 struct vty
*vty
, char *addr_str
,
5863 json_object
*json
= NULL
;
5864 struct pim_sg_cache_walk_data cwd
;
5867 memset(&cwd
, 0, sizeof(cwd
));
5868 result
= inet_pton(AF_INET
, addr_str
, &cwd
.addr
);
5870 vty_out(vty
, "Bad address %s: errno=%d: %s\n", addr_str
,
5871 errno
, safe_strerror(errno
));
5876 json
= json_object_new_object();
5878 vty_out(vty
, "Codes: I -> installed\n");
5880 "Source Group Input Output Flags\n");
5885 cwd
.addr_match
= true;
5886 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
5889 vty_json(vty
, json
);
5892 static void pim_show_vxlan_sg_one(struct pim_instance
*pim
,
5893 struct vty
*vty
, char *src_str
, char *grp_str
,
5896 json_object
*json
= NULL
;
5899 struct pim_vxlan_sg
*vxlan_sg
;
5900 const char *iif_name
;
5902 const char *oif_name
;
5904 result
= inet_pton(AF_INET
, src_str
, &sg
.src
);
5906 vty_out(vty
, "Bad src address %s: errno=%d: %s\n", src_str
,
5907 errno
, safe_strerror(errno
));
5910 result
= inet_pton(AF_INET
, grp_str
, &sg
.grp
);
5912 vty_out(vty
, "Bad grp address %s: errno=%d: %s\n", grp_str
,
5913 errno
, safe_strerror(errno
));
5918 json
= json_object_new_object();
5920 vxlan_sg
= pim_vxlan_sg_find(pim
, &sg
);
5922 installed
= (vxlan_sg
->up
) ? true : false;
5923 iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
5925 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
5927 vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
5930 vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
5933 json_object_string_add(json
, "source", src_str
);
5934 json_object_string_add(json
, "group", grp_str
);
5935 json_object_string_add(json
, "input", iif_name
);
5936 json_object_string_add(json
, "output", oif_name
);
5938 json_object_boolean_true_add(json
, "installed");
5940 json_object_boolean_false_add(json
,
5943 vty_out(vty
, "SG : %s\n", vxlan_sg
->sg_str
);
5944 vty_out(vty
, " Input : %s\n", iif_name
);
5945 vty_out(vty
, " Output : %s\n", oif_name
);
5946 vty_out(vty
, " installed : %s\n",
5947 installed
?"yes":"no");
5952 vty_json(vty
, json
);
5955 DEFUN (show_ip_pim_vxlan_sg
,
5956 show_ip_pim_vxlan_sg_cmd
,
5957 "show ip pim [vrf NAME] vxlan-groups [A.B.C.D [A.B.C.D]] [json]",
5962 "VxLAN BUM groups\n"
5963 "source or group ip\n"
5967 bool uj
= use_json(argc
, argv
);
5971 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5976 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
5977 argv
[idx
++]->arg
:NULL
;
5978 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
5979 argv
[idx
]->arg
:NULL
;
5981 if (src_ip
&& grp_ip
)
5982 pim_show_vxlan_sg_one(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
5984 pim_show_vxlan_sg_match_addr(vrf
->info
, vty
, src_ip
, uj
);
5986 pim_show_vxlan_sg(vrf
->info
, vty
, uj
);
5991 static void pim_show_vxlan_sg_work(struct pim_instance
*pim
,
5992 struct vty
*vty
, bool uj
)
5994 json_object
*json
= NULL
;
5995 struct pim_sg_cache_walk_data cwd
;
5996 struct listnode
*node
;
5997 struct pim_vxlan_sg
*vxlan_sg
;
6000 json
= json_object_new_object();
6002 vty_out(vty
, "Codes: I -> installed\n");
6004 "Source Group Input Flags\n");
6007 memset(&cwd
, 0, sizeof(cwd
));
6010 for (ALL_LIST_ELEMENTS_RO(pim_vxlan_p
->work_list
, node
, vxlan_sg
))
6011 pim_show_vxlan_sg_entry(vxlan_sg
, &cwd
);
6014 vty_json(vty
, json
);
6017 DEFUN_HIDDEN (show_ip_pim_vxlan_sg_work
,
6018 show_ip_pim_vxlan_sg_work_cmd
,
6019 "show ip pim [vrf NAME] vxlan-work [json]",
6027 bool uj
= use_json(argc
, argv
);
6031 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6036 pim_show_vxlan_sg_work(vrf
->info
, vty
, uj
);
6041 DEFUN_HIDDEN (no_ip_pim_mlag
,
6049 char mlag_xpath
[XPATH_MAXLEN
];
6051 snprintf(mlag_xpath
, sizeof(mlag_xpath
), FRR_PIM_VRF_XPATH
,
6052 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6053 strlcat(mlag_xpath
, "/mlag", sizeof(mlag_xpath
));
6055 nb_cli_enqueue_change(vty
, mlag_xpath
, NB_OP_DESTROY
, NULL
);
6058 return nb_cli_apply_changes(vty
, NULL
);
6061 DEFUN_HIDDEN (ip_pim_mlag
,
6063 "ip pim mlag INTERFACE role [primary|secondary] state [up|down] addr A.B.C.D",
6067 "peerlink sub interface\n"
6069 "MLAG role primary\n"
6070 "MLAG role secondary\n"
6071 "peer session state\n"
6072 "peer session state up\n"
6073 "peer session state down\n"
6075 "unique ip address\n")
6078 char mlag_peerlink_rif_xpath
[XPATH_MAXLEN
];
6079 char mlag_my_role_xpath
[XPATH_MAXLEN
];
6080 char mlag_peer_state_xpath
[XPATH_MAXLEN
];
6081 char mlag_reg_address_xpath
[XPATH_MAXLEN
];
6083 snprintf(mlag_peerlink_rif_xpath
, sizeof(mlag_peerlink_rif_xpath
),
6085 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6086 strlcat(mlag_peerlink_rif_xpath
, "/mlag/peerlink-rif",
6087 sizeof(mlag_peerlink_rif_xpath
));
6090 nb_cli_enqueue_change(vty
, mlag_peerlink_rif_xpath
, NB_OP_MODIFY
,
6093 snprintf(mlag_my_role_xpath
, sizeof(mlag_my_role_xpath
),
6095 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6096 strlcat(mlag_my_role_xpath
, "/mlag/my-role",
6097 sizeof(mlag_my_role_xpath
));
6100 if (!strcmp(argv
[idx
]->arg
, "primary")) {
6101 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6102 "MLAG_ROLE_PRIMARY");
6104 } else if (!strcmp(argv
[idx
]->arg
, "secondary")) {
6105 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6106 "MLAG_ROLE_SECONDARY");
6109 vty_out(vty
, "unknown MLAG role %s\n", argv
[idx
]->arg
);
6113 snprintf(mlag_peer_state_xpath
, sizeof(mlag_peer_state_xpath
),
6115 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6116 strlcat(mlag_peer_state_xpath
, "/mlag/peer-state",
6117 sizeof(mlag_peer_state_xpath
));
6120 if (!strcmp(argv
[idx
]->arg
, "up")) {
6121 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6124 } else if (strcmp(argv
[idx
]->arg
, "down")) {
6125 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6129 vty_out(vty
, "unknown MLAG state %s\n", argv
[idx
]->arg
);
6133 snprintf(mlag_reg_address_xpath
, sizeof(mlag_reg_address_xpath
),
6135 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6136 strlcat(mlag_reg_address_xpath
, "/mlag/reg-address",
6137 sizeof(mlag_reg_address_xpath
));
6140 nb_cli_enqueue_change(vty
, mlag_reg_address_xpath
, NB_OP_MODIFY
,
6143 return nb_cli_apply_changes(vty
, NULL
);
6146 void pim_cmd_init(void)
6148 if_cmd_init(pim_interface_config_write
);
6150 install_node(&debug_node
);
6152 install_element(ENABLE_NODE
, &pim_test_sg_keepalive_cmd
);
6154 install_element(CONFIG_NODE
, &ip_pim_rp_cmd
);
6155 install_element(VRF_NODE
, &ip_pim_rp_cmd
);
6156 install_element(CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6157 install_element(VRF_NODE
, &no_ip_pim_rp_cmd
);
6158 install_element(CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6159 install_element(VRF_NODE
, &ip_pim_rp_prefix_list_cmd
);
6160 install_element(CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6161 install_element(VRF_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6162 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6163 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6164 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6165 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6166 install_element(CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6167 install_element(VRF_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6168 install_element(CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6169 install_element(CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6170 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6171 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6172 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6173 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6174 install_element(CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6175 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6176 install_element(CONFIG_NODE
,
6177 &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6178 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6179 install_element(CONFIG_NODE
, &pim_register_accept_list_cmd
);
6180 install_element(VRF_NODE
, &pim_register_accept_list_cmd
);
6181 install_element(CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6182 install_element(CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6183 install_element(CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6184 install_element(VRF_NODE
, &ip_pim_keep_alive_cmd
);
6185 install_element(CONFIG_NODE
, &ip_pim_rp_keep_alive_cmd
);
6186 install_element(VRF_NODE
, &ip_pim_rp_keep_alive_cmd
);
6187 install_element(CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6188 install_element(VRF_NODE
, &no_ip_pim_keep_alive_cmd
);
6189 install_element(CONFIG_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6190 install_element(VRF_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6191 install_element(CONFIG_NODE
, &ip_pim_packets_cmd
);
6192 install_element(CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6193 install_element(CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6194 install_element(VRF_NODE
, &ip_pim_v6_secondary_cmd
);
6195 install_element(CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6196 install_element(VRF_NODE
, &no_ip_pim_v6_secondary_cmd
);
6197 install_element(CONFIG_NODE
, &ip_ssmpingd_cmd
);
6198 install_element(VRF_NODE
, &ip_ssmpingd_cmd
);
6199 install_element(CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6200 install_element(VRF_NODE
, &no_ip_ssmpingd_cmd
);
6201 install_element(CONFIG_NODE
, &ip_msdp_peer_cmd
);
6202 install_element(VRF_NODE
, &ip_msdp_peer_cmd
);
6203 install_element(CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6204 install_element(VRF_NODE
, &no_ip_msdp_peer_cmd
);
6205 install_element(CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6206 install_element(VRF_NODE
, &ip_pim_ecmp_cmd
);
6207 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6208 install_element(VRF_NODE
, &no_ip_pim_ecmp_cmd
);
6209 install_element(CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6210 install_element(VRF_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6211 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6212 install_element(VRF_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6213 install_element(CONFIG_NODE
, &ip_pim_mlag_cmd
);
6214 install_element(CONFIG_NODE
, &no_ip_pim_mlag_cmd
);
6215 install_element(CONFIG_NODE
, &ip_igmp_group_watermark_cmd
);
6216 install_element(VRF_NODE
, &ip_igmp_group_watermark_cmd
);
6217 install_element(CONFIG_NODE
, &no_ip_igmp_group_watermark_cmd
);
6218 install_element(VRF_NODE
, &no_ip_igmp_group_watermark_cmd
);
6220 install_element(INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6221 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6222 install_element(INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6223 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6224 install_element(INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6225 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6226 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6227 install_element(INTERFACE_NODE
,
6228 &interface_no_ip_igmp_query_interval_cmd
);
6229 install_element(INTERFACE_NODE
,
6230 &interface_ip_igmp_query_max_response_time_cmd
);
6231 install_element(INTERFACE_NODE
,
6232 &interface_no_ip_igmp_query_max_response_time_cmd
);
6233 install_element(INTERFACE_NODE
,
6234 &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6235 install_element(INTERFACE_NODE
,
6236 &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6237 install_element(INTERFACE_NODE
,
6238 &interface_ip_igmp_last_member_query_count_cmd
);
6239 install_element(INTERFACE_NODE
,
6240 &interface_no_ip_igmp_last_member_query_count_cmd
);
6241 install_element(INTERFACE_NODE
,
6242 &interface_ip_igmp_last_member_query_interval_cmd
);
6243 install_element(INTERFACE_NODE
,
6244 &interface_no_ip_igmp_last_member_query_interval_cmd
);
6245 install_element(INTERFACE_NODE
, &interface_ip_pim_activeactive_cmd
);
6246 install_element(INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6247 install_element(INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6248 install_element(INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6249 install_element(INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6250 install_element(INTERFACE_NODE
, &interface_ip_pim_cmd
);
6251 install_element(INTERFACE_NODE
, &interface_no_ip_pim_cmd
);
6252 install_element(INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6253 install_element(INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6254 install_element(INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6255 install_element(INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6256 install_element(INTERFACE_NODE
, &interface_ip_pim_boundary_oil_cmd
);
6257 install_element(INTERFACE_NODE
, &interface_no_ip_pim_boundary_oil_cmd
);
6258 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_generate_cmd
);
6260 // Static mroutes NEB
6261 install_element(INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6262 install_element(INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6264 install_element(VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6265 install_element(VIEW_NODE
, &show_ip_igmp_interface_vrf_all_cmd
);
6266 install_element(VIEW_NODE
, &show_ip_igmp_join_cmd
);
6267 install_element(VIEW_NODE
, &show_ip_igmp_join_vrf_all_cmd
);
6268 install_element(VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6269 install_element(VIEW_NODE
, &show_ip_igmp_groups_vrf_all_cmd
);
6270 install_element(VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6271 install_element(VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6272 install_element(VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6273 install_element(VIEW_NODE
, &show_ip_igmp_statistics_cmd
);
6274 install_element(VIEW_NODE
, &show_ip_pim_assert_cmd
);
6275 install_element(VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6276 install_element(VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6277 install_element(VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6278 install_element(VIEW_NODE
, &show_ip_pim_interface_traffic_cmd
);
6279 install_element(VIEW_NODE
, &show_ip_pim_interface_cmd
);
6280 install_element(VIEW_NODE
, &show_ip_pim_interface_vrf_all_cmd
);
6281 install_element(VIEW_NODE
, &show_ip_pim_join_cmd
);
6282 install_element(VIEW_NODE
, &show_ip_pim_join_vrf_all_cmd
);
6283 install_element(VIEW_NODE
, &show_ip_pim_jp_agg_cmd
);
6284 install_element(VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6285 install_element(VIEW_NODE
, &show_ip_pim_mlag_summary_cmd
);
6286 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_cmd
);
6287 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_vrf_all_cmd
);
6288 install_element(VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6289 install_element(VIEW_NODE
, &show_ip_pim_neighbor_vrf_all_cmd
);
6290 install_element(VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6291 install_element(VIEW_NODE
, &show_ip_pim_rpf_vrf_all_cmd
);
6292 install_element(VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6293 install_element(VIEW_NODE
, &show_ip_pim_state_cmd
);
6294 install_element(VIEW_NODE
, &show_ip_pim_state_vrf_all_cmd
);
6295 install_element(VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6296 install_element(VIEW_NODE
, &show_ip_pim_upstream_vrf_all_cmd
);
6297 install_element(VIEW_NODE
, &show_ip_pim_channel_cmd
);
6298 install_element(VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6299 install_element(VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6300 install_element(VIEW_NODE
, &show_ip_pim_rp_cmd
);
6301 install_element(VIEW_NODE
, &show_ip_pim_rp_vrf_all_cmd
);
6302 install_element(VIEW_NODE
, &show_ip_pim_bsr_cmd
);
6303 install_element(VIEW_NODE
, &show_ip_multicast_cmd
);
6304 install_element(VIEW_NODE
, &show_ip_multicast_vrf_all_cmd
);
6305 install_element(VIEW_NODE
, &show_ip_multicast_count_cmd
);
6306 install_element(VIEW_NODE
, &show_ip_multicast_count_vrf_all_cmd
);
6307 install_element(VIEW_NODE
, &show_ip_mroute_cmd
);
6308 install_element(VIEW_NODE
, &show_ip_mroute_vrf_all_cmd
);
6309 install_element(VIEW_NODE
, &show_ip_mroute_count_cmd
);
6310 install_element(VIEW_NODE
, &show_ip_mroute_count_vrf_all_cmd
);
6311 install_element(VIEW_NODE
, &show_ip_mroute_summary_cmd
);
6312 install_element(VIEW_NODE
, &show_ip_mroute_summary_vrf_all_cmd
);
6313 install_element(VIEW_NODE
, &show_ip_rib_cmd
);
6314 install_element(VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6315 install_element(VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6316 install_element(VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6317 install_element(VIEW_NODE
, &show_ip_pim_bsrp_cmd
);
6318 install_element(VIEW_NODE
, &show_ip_pim_bsm_db_cmd
);
6319 install_element(VIEW_NODE
, &show_ip_pim_statistics_cmd
);
6321 install_element(ENABLE_NODE
, &clear_ip_mroute_count_cmd
);
6322 install_element(ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6323 install_element(ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6324 install_element(ENABLE_NODE
, &clear_ip_mroute_cmd
);
6325 install_element(ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6326 install_element(ENABLE_NODE
, &clear_ip_pim_interface_traffic_cmd
);
6327 install_element(ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6328 install_element(ENABLE_NODE
, &clear_ip_pim_statistics_cmd
);
6329 install_element(ENABLE_NODE
, &clear_ip_pim_bsr_db_cmd
);
6331 install_element(ENABLE_NODE
, &show_debugging_pim_cmd
);
6333 install_element(ENABLE_NODE
, &debug_igmp_cmd
);
6334 install_element(ENABLE_NODE
, &no_debug_igmp_cmd
);
6335 install_element(ENABLE_NODE
, &debug_igmp_events_cmd
);
6336 install_element(ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6337 install_element(ENABLE_NODE
, &debug_igmp_packets_cmd
);
6338 install_element(ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6339 install_element(ENABLE_NODE
, &debug_igmp_trace_cmd
);
6340 install_element(ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6341 install_element(ENABLE_NODE
, &debug_igmp_trace_detail_cmd
);
6342 install_element(ENABLE_NODE
, &no_debug_igmp_trace_detail_cmd
);
6343 install_element(ENABLE_NODE
, &debug_mroute_cmd
);
6344 install_element(ENABLE_NODE
, &debug_mroute_detail_cmd
);
6345 install_element(ENABLE_NODE
, &no_debug_mroute_cmd
);
6346 install_element(ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6347 install_element(ENABLE_NODE
, &debug_pim_static_cmd
);
6348 install_element(ENABLE_NODE
, &no_debug_pim_static_cmd
);
6349 install_element(ENABLE_NODE
, &debug_pim_cmd
);
6350 install_element(ENABLE_NODE
, &debug_pim_nht_cmd
);
6351 install_element(ENABLE_NODE
, &debug_pim_nht_det_cmd
);
6352 install_element(ENABLE_NODE
, &debug_pim_nht_rp_cmd
);
6353 install_element(ENABLE_NODE
, &no_debug_pim_nht_rp_cmd
);
6354 install_element(ENABLE_NODE
, &debug_pim_events_cmd
);
6355 install_element(ENABLE_NODE
, &debug_pim_packets_cmd
);
6356 install_element(ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6357 install_element(ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6358 install_element(ENABLE_NODE
, &debug_pim_trace_cmd
);
6359 install_element(ENABLE_NODE
, &debug_pim_trace_detail_cmd
);
6360 install_element(ENABLE_NODE
, &debug_ssmpingd_cmd
);
6361 install_element(ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6362 install_element(ENABLE_NODE
, &debug_pim_zebra_cmd
);
6363 install_element(ENABLE_NODE
, &debug_pim_mlag_cmd
);
6364 install_element(ENABLE_NODE
, &no_debug_pim_mlag_cmd
);
6365 install_element(ENABLE_NODE
, &debug_pim_vxlan_cmd
);
6366 install_element(ENABLE_NODE
, &no_debug_pim_vxlan_cmd
);
6367 install_element(ENABLE_NODE
, &debug_msdp_cmd
);
6368 install_element(ENABLE_NODE
, &no_debug_msdp_cmd
);
6369 install_element(ENABLE_NODE
, &debug_msdp_events_cmd
);
6370 install_element(ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6371 install_element(ENABLE_NODE
, &debug_msdp_packets_cmd
);
6372 install_element(ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6373 install_element(ENABLE_NODE
, &debug_mtrace_cmd
);
6374 install_element(ENABLE_NODE
, &no_debug_mtrace_cmd
);
6375 install_element(ENABLE_NODE
, &debug_bsm_cmd
);
6376 install_element(ENABLE_NODE
, &no_debug_bsm_cmd
);
6378 install_element(CONFIG_NODE
, &debug_igmp_cmd
);
6379 install_element(CONFIG_NODE
, &no_debug_igmp_cmd
);
6380 install_element(CONFIG_NODE
, &debug_igmp_events_cmd
);
6381 install_element(CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6382 install_element(CONFIG_NODE
, &debug_igmp_packets_cmd
);
6383 install_element(CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6384 install_element(CONFIG_NODE
, &debug_igmp_trace_cmd
);
6385 install_element(CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6386 install_element(CONFIG_NODE
, &debug_igmp_trace_detail_cmd
);
6387 install_element(CONFIG_NODE
, &no_debug_igmp_trace_detail_cmd
);
6388 install_element(CONFIG_NODE
, &debug_mroute_cmd
);
6389 install_element(CONFIG_NODE
, &debug_mroute_detail_cmd
);
6390 install_element(CONFIG_NODE
, &no_debug_mroute_cmd
);
6391 install_element(CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6392 install_element(CONFIG_NODE
, &debug_pim_static_cmd
);
6393 install_element(CONFIG_NODE
, &no_debug_pim_static_cmd
);
6394 install_element(CONFIG_NODE
, &debug_pim_cmd
);
6395 install_element(CONFIG_NODE
, &debug_pim_nht_cmd
);
6396 install_element(CONFIG_NODE
, &debug_pim_nht_det_cmd
);
6397 install_element(CONFIG_NODE
, &debug_pim_nht_rp_cmd
);
6398 install_element(CONFIG_NODE
, &no_debug_pim_nht_rp_cmd
);
6399 install_element(CONFIG_NODE
, &debug_pim_events_cmd
);
6400 install_element(CONFIG_NODE
, &debug_pim_packets_cmd
);
6401 install_element(CONFIG_NODE
, &debug_pim_packetdump_send_cmd
);
6402 install_element(CONFIG_NODE
, &debug_pim_packetdump_recv_cmd
);
6403 install_element(CONFIG_NODE
, &debug_pim_trace_cmd
);
6404 install_element(CONFIG_NODE
, &debug_pim_trace_detail_cmd
);
6405 install_element(CONFIG_NODE
, &debug_ssmpingd_cmd
);
6406 install_element(CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6407 install_element(CONFIG_NODE
, &debug_pim_zebra_cmd
);
6408 install_element(CONFIG_NODE
, &debug_pim_mlag_cmd
);
6409 install_element(CONFIG_NODE
, &no_debug_pim_mlag_cmd
);
6410 install_element(CONFIG_NODE
, &debug_pim_vxlan_cmd
);
6411 install_element(CONFIG_NODE
, &no_debug_pim_vxlan_cmd
);
6412 install_element(CONFIG_NODE
, &debug_msdp_cmd
);
6413 install_element(CONFIG_NODE
, &no_debug_msdp_cmd
);
6414 install_element(CONFIG_NODE
, &debug_msdp_events_cmd
);
6415 install_element(CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6416 install_element(CONFIG_NODE
, &debug_msdp_packets_cmd
);
6417 install_element(CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6418 install_element(CONFIG_NODE
, &debug_mtrace_cmd
);
6419 install_element(CONFIG_NODE
, &no_debug_mtrace_cmd
);
6420 install_element(CONFIG_NODE
, &debug_bsm_cmd
);
6421 install_element(CONFIG_NODE
, &no_debug_bsm_cmd
);
6423 install_element(CONFIG_NODE
, &ip_msdp_timers_cmd
);
6424 install_element(VRF_NODE
, &ip_msdp_timers_cmd
);
6425 install_element(CONFIG_NODE
, &no_ip_msdp_timers_cmd
);
6426 install_element(VRF_NODE
, &no_ip_msdp_timers_cmd
);
6427 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6428 install_element(VRF_NODE
, &ip_msdp_mesh_group_member_cmd
);
6429 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6430 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6431 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6432 install_element(VRF_NODE
, &ip_msdp_mesh_group_source_cmd
);
6433 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6434 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6435 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_cmd
);
6436 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_cmd
);
6437 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6438 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_vrf_all_cmd
);
6439 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6440 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_vrf_all_cmd
);
6441 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6442 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_vrf_all_cmd
);
6443 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6444 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_vrf_all_cmd
);
6445 install_element(VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6446 install_element(VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6447 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_cmd
);
6448 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_work_cmd
);
6449 install_element(INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6450 install_element(INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);
6451 /* Install BSM command */
6452 install_element(INTERFACE_NODE
, &ip_pim_bsm_cmd
);
6453 install_element(INTERFACE_NODE
, &no_ip_pim_bsm_cmd
);
6454 install_element(INTERFACE_NODE
, &ip_pim_ucast_bsm_cmd
);
6455 install_element(INTERFACE_NODE
, &no_ip_pim_ucast_bsm_cmd
);
6456 /* Install BFD command */
6457 install_element(INTERFACE_NODE
, &ip_pim_bfd_cmd
);
6458 install_element(INTERFACE_NODE
, &ip_pim_bfd_param_cmd
);
6459 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_profile_cmd
);
6460 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_cmd
);
6462 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_param_cmd
);
6463 #endif /* !HAVE_BFDD */