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 #include "pimd/pim_cmd_clippy.c"
75 static struct cmd_node debug_node
= {
79 .config_write
= pim_debug_config_write
,
82 static struct vrf
*pim_cmd_lookup_vrf(struct vty
*vty
, struct cmd_token
*argv
[],
83 const int argc
, int *idx
)
87 if (argv_find(argv
, argc
, "NAME", idx
))
88 vrf
= vrf_lookup_by_name(argv
[*idx
]->arg
);
90 vrf
= vrf_lookup_by_id(VRF_DEFAULT
);
93 vty_out(vty
, "Specified VRF: %s does not exist\n",
99 static void pim_show_assert_helper(struct vty
*vty
,
100 struct pim_interface
*pim_ifp
,
101 struct pim_ifchannel
*ch
, time_t now
)
103 char winner_str
[INET_ADDRSTRLEN
];
104 struct in_addr ifaddr
;
107 char buf
[PREFIX_STRLEN
];
109 ifaddr
= pim_ifp
->primary_address
;
111 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
, winner_str
,
114 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
115 pim_time_timer_to_mmss(timer
, sizeof(timer
), ch
->t_ifassert_timer
);
117 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-6s %-15s %-8s %-5s\n",
119 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
120 &ch
->sg
.grp
, pim_ifchannel_ifassert_name(ch
->ifassert_state
),
121 winner_str
, uptime
, timer
);
124 static void pim_show_assert(struct pim_instance
*pim
, struct vty
*vty
)
126 struct pim_interface
*pim_ifp
;
127 struct pim_ifchannel
*ch
;
128 struct interface
*ifp
;
131 now
= pim_time_monotonic_sec();
134 "Interface Address Source Group State Winner Uptime Timer\n");
136 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
141 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
142 if (ch
->ifassert_state
== PIM_IFASSERT_NOINFO
)
145 pim_show_assert_helper(vty
, pim_ifp
, ch
, now
);
146 } /* scan interface channels */
150 static void pim_show_assert_internal_helper(struct vty
*vty
,
151 struct pim_interface
*pim_ifp
,
152 struct pim_ifchannel
*ch
)
154 struct in_addr ifaddr
;
155 char buf
[PREFIX_STRLEN
];
157 ifaddr
= pim_ifp
->primary_address
;
159 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-3s %-3s %-4s\n",
161 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
163 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
164 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
165 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes"
167 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no");
170 static void pim_show_assert_internal(struct pim_instance
*pim
, struct vty
*vty
)
172 struct pim_interface
*pim_ifp
;
173 struct pim_ifchannel
*ch
;
174 struct interface
*ifp
;
178 "ECA: Evaluate CouldAssert\n"
179 "ATD: AssertTrackingDesired\n"
180 "eATD: Evaluate AssertTrackingDesired\n\n");
183 "Interface Address Source Group CA eCA ATD eATD\n");
184 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
189 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
190 pim_show_assert_internal_helper(vty
, pim_ifp
, ch
);
191 } /* scan interface channels */
195 static void pim_show_assert_metric_helper(struct vty
*vty
,
196 struct pim_interface
*pim_ifp
,
197 struct pim_ifchannel
*ch
)
199 char addr_str
[INET_ADDRSTRLEN
];
200 struct pim_assert_metric am
;
201 struct in_addr ifaddr
;
202 char buf
[PREFIX_STRLEN
];
204 ifaddr
= pim_ifp
->primary_address
;
206 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
,
207 pim_ifp
->primary_address
);
209 pim_inet4_dump("<addr?>", am
.ip_address
, addr_str
, sizeof(addr_str
));
211 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %4u %6u %-15s\n",
213 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
214 &ch
->sg
.grp
, am
.rpt_bit_flag
? "yes" : "no",
215 am
.metric_preference
, am
.route_metric
, addr_str
);
218 static void pim_show_assert_metric(struct pim_instance
*pim
, struct vty
*vty
)
220 struct pim_interface
*pim_ifp
;
221 struct pim_ifchannel
*ch
;
222 struct interface
*ifp
;
225 "Interface Address Source Group RPT Pref Metric Address \n");
227 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
232 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
233 pim_show_assert_metric_helper(vty
, pim_ifp
, ch
);
234 } /* scan interface channels */
238 static void pim_show_assert_winner_metric_helper(struct vty
*vty
,
239 struct pim_interface
*pim_ifp
,
240 struct pim_ifchannel
*ch
)
242 char addr_str
[INET_ADDRSTRLEN
];
243 struct pim_assert_metric
*am
;
244 struct in_addr ifaddr
;
247 char buf
[PREFIX_STRLEN
];
249 ifaddr
= pim_ifp
->primary_address
;
251 am
= &ch
->ifassert_winner_metric
;
253 pim_inet4_dump("<addr?>", am
->ip_address
, addr_str
, sizeof(addr_str
));
255 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
256 snprintf(pref_str
, sizeof(pref_str
), "INFI");
258 snprintf(pref_str
, sizeof(pref_str
), "%4u",
259 am
->metric_preference
);
261 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
262 snprintf(metr_str
, sizeof(metr_str
), "INFI");
264 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
266 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-4s %-6s %-15s\n",
268 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
269 &ch
->sg
.grp
, am
->rpt_bit_flag
? "yes" : "no", pref_str
,
273 static void pim_show_assert_winner_metric(struct pim_instance
*pim
,
276 struct pim_interface
*pim_ifp
;
277 struct pim_ifchannel
*ch
;
278 struct interface
*ifp
;
281 "Interface Address Source Group RPT Pref Metric Address \n");
283 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
288 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
289 pim_show_assert_winner_metric_helper(vty
, pim_ifp
, ch
);
290 } /* scan interface channels */
294 static void igmp_show_interfaces(struct pim_instance
*pim
, struct vty
*vty
,
297 struct interface
*ifp
;
299 char buf
[PREFIX_STRLEN
];
300 json_object
*json
= NULL
;
301 json_object
*json_row
= NULL
;
303 now
= pim_time_monotonic_sec();
306 json
= json_object_new_object();
309 "Interface State Address V Querier QuerierIp Query Timer Uptime\n");
311 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
312 struct pim_interface
*pim_ifp
;
313 struct listnode
*sock_node
;
314 struct gm_sock
*igmp
;
321 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
324 char query_hhmmss
[10];
326 pim_time_uptime(uptime
, sizeof(uptime
),
327 now
- igmp
->sock_creation
);
328 pim_time_timer_to_hhmmss(query_hhmmss
,
329 sizeof(query_hhmmss
),
330 igmp
->t_igmp_query_timer
);
333 json_row
= json_object_new_object();
334 json_object_pim_ifp_add(json_row
, ifp
);
335 json_object_string_add(json_row
, "upTime",
337 json_object_int_add(json_row
, "version",
338 pim_ifp
->igmp_version
);
340 if (igmp
->t_igmp_query_timer
) {
341 json_object_boolean_true_add(json_row
,
343 json_object_string_add(json_row
,
347 json_object_string_addf(json_row
, "querierIp",
349 &igmp
->querier_addr
);
351 json_object_object_add(json
, ifp
->name
,
354 if (igmp
->mtrace_only
) {
355 json_object_boolean_true_add(
356 json_row
, "mtraceOnly");
360 "%-16s %5s %15s %d %7s %17pI4 %11s %8s\n",
363 ? (igmp
->mtrace_only
? "mtrc"
366 inet_ntop(AF_INET
, &igmp
->ifaddr
, buf
,
368 pim_ifp
->igmp_version
,
369 igmp
->t_igmp_query_timer
? "local"
371 &igmp
->querier_addr
, query_hhmmss
,
381 static void igmp_show_interfaces_single(struct pim_instance
*pim
,
382 struct vty
*vty
, const char *ifname
,
385 struct gm_sock
*igmp
;
386 struct interface
*ifp
;
387 struct listnode
*sock_node
;
388 struct pim_interface
*pim_ifp
;
390 char query_hhmmss
[10];
391 char other_hhmmss
[10];
392 int found_ifname
= 0;
394 long gmi_msec
; /* Group Membership Interval */
397 long oqpi_msec
; /* Other Querier Present Interval */
402 json_object
*json
= NULL
;
403 json_object
*json_row
= NULL
;
406 json
= json_object_new_object();
408 now
= pim_time_monotonic_sec();
410 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
416 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
419 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
422 pim_time_uptime(uptime
, sizeof(uptime
),
423 now
- igmp
->sock_creation
);
424 pim_time_timer_to_hhmmss(query_hhmmss
,
425 sizeof(query_hhmmss
),
426 igmp
->t_igmp_query_timer
);
427 pim_time_timer_to_hhmmss(other_hhmmss
,
428 sizeof(other_hhmmss
),
429 igmp
->t_other_querier_timer
);
431 gmi_msec
= PIM_IGMP_GMI_MSEC(
432 igmp
->querier_robustness_variable
,
433 igmp
->querier_query_interval
,
434 pim_ifp
->gm_query_max_response_time_dsec
);
436 sqi
= PIM_IGMP_SQI(pim_ifp
->gm_default_query_interval
);
438 oqpi_msec
= PIM_IGMP_OQPI_MSEC(
439 igmp
->querier_robustness_variable
,
440 igmp
->querier_query_interval
,
441 pim_ifp
->gm_query_max_response_time_dsec
);
443 lmqt_msec
= PIM_IGMP_LMQT_MSEC(
444 pim_ifp
->gm_specific_query_max_response_time_dsec
,
445 pim_ifp
->gm_last_member_query_count
);
449 igmp
->querier_robustness_variable
,
450 igmp
->querier_query_interval
,
451 pim_ifp
->gm_query_max_response_time_dsec
) *
455 pim_ifp
->gm_query_max_response_time_dsec
* 100;
456 lmqc
= pim_ifp
->gm_last_member_query_count
;
459 json_row
= json_object_new_object();
460 json_object_pim_ifp_add(json_row
, ifp
);
461 json_object_string_add(json_row
, "upTime",
463 json_object_string_add(json_row
, "querier",
464 igmp
->t_igmp_query_timer
467 json_object_string_addf(json_row
, "querierIp",
469 &igmp
->querier_addr
);
470 json_object_int_add(json_row
, "queryStartCount",
471 igmp
->startup_query_count
);
472 json_object_string_add(json_row
,
475 json_object_string_add(json_row
,
478 json_object_int_add(json_row
, "version",
479 pim_ifp
->igmp_version
);
482 "timerGroupMembershipIntervalMsec",
484 json_object_int_add(json_row
,
485 "lastMemberQueryCount",
487 json_object_int_add(json_row
,
488 "timerLastMemberQueryMsec",
492 "timerOlderHostPresentIntervalMsec",
496 "timerOtherQuerierPresentIntervalMsec",
499 json_row
, "timerQueryInterval",
500 igmp
->querier_query_interval
);
503 "timerQueryResponseIntervalMsec",
506 json_row
, "timerRobustnessVariable",
507 igmp
->querier_robustness_variable
);
508 json_object_int_add(json_row
,
509 "timerStartupQueryInterval",
512 json_object_object_add(json
, ifp
->name
,
515 if (igmp
->mtrace_only
) {
516 json_object_boolean_true_add(
517 json_row
, "mtraceOnly");
520 vty_out(vty
, "Interface : %s\n", ifp
->name
);
521 vty_out(vty
, "State : %s\n",
522 if_is_up(ifp
) ? (igmp
->mtrace_only
?
526 vty_out(vty
, "Address : %pI4\n",
527 &pim_ifp
->primary_address
);
528 vty_out(vty
, "Uptime : %s\n", uptime
);
529 vty_out(vty
, "Version : %d\n",
530 pim_ifp
->igmp_version
);
534 vty_out(vty
, "Querier\n");
535 vty_out(vty
, "-------\n");
536 vty_out(vty
, "Querier : %s\n",
537 igmp
->t_igmp_query_timer
? "local"
539 vty_out(vty
, "QuerierIp : %pI4",
540 &igmp
->querier_addr
);
541 if (pim_ifp
->primary_address
.s_addr
542 == igmp
->querier_addr
.s_addr
)
543 vty_out(vty
, " (this router)\n");
547 vty_out(vty
, "Start Count : %d\n",
548 igmp
->startup_query_count
);
549 vty_out(vty
, "Query Timer : %s\n",
551 vty_out(vty
, "Other Timer : %s\n",
556 vty_out(vty
, "Timers\n");
557 vty_out(vty
, "------\n");
559 "Group Membership Interval : %lis\n",
562 "Last Member Query Count : %d\n",
565 "Last Member Query Time : %lis\n",
568 "Older Host Present Interval : %lis\n",
571 "Other Querier Present Interval : %lis\n",
574 "Query Interval : %ds\n",
575 igmp
->querier_query_interval
);
577 "Query Response Interval : %lis\n",
580 "Robustness Variable : %d\n",
581 igmp
->querier_robustness_variable
);
583 "Startup Query Interval : %ds\n",
588 pim_print_ifp_flags(vty
, ifp
);
595 else if (!found_ifname
)
596 vty_out(vty
, "%% No such interface\n");
599 static void igmp_show_interface_join(struct pim_instance
*pim
, struct vty
*vty
,
602 struct interface
*ifp
;
604 json_object
*json
= NULL
;
605 json_object
*json_iface
= NULL
;
606 json_object
*json_grp
= NULL
;
607 json_object
*json_grp_arr
= NULL
;
609 now
= pim_time_monotonic_sec();
612 json
= json_object_new_object();
613 json_object_string_add(json
, "vrf",
614 vrf_id_to_name(pim
->vrf
->vrf_id
));
617 "Interface Address Source Group Socket Uptime \n");
620 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
621 struct pim_interface
*pim_ifp
;
622 struct listnode
*join_node
;
624 struct in_addr pri_addr
;
625 char pri_addr_str
[INET_ADDRSTRLEN
];
632 if (!pim_ifp
->gm_join_list
)
635 pri_addr
= pim_find_primary_addr(ifp
);
636 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
,
637 sizeof(pri_addr_str
));
639 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_join_list
, join_node
,
641 char group_str
[INET_ADDRSTRLEN
];
642 char source_str
[INET_ADDRSTRLEN
];
645 pim_time_uptime(uptime
, sizeof(uptime
),
646 now
- ij
->sock_creation
);
647 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
,
649 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
,
653 json_object_object_get_ex(json
, ifp
->name
,
657 json_iface
= json_object_new_object();
658 json_object_string_add(
659 json_iface
, "name", ifp
->name
);
660 json_object_object_add(json
, ifp
->name
,
662 json_grp_arr
= json_object_new_array();
663 json_object_object_add(json_iface
,
668 json_grp
= json_object_new_object();
669 json_object_string_add(json_grp
, "source",
671 json_object_string_add(json_grp
, "group",
673 json_object_string_add(json_grp
, "primaryAddr",
675 json_object_int_add(json_grp
, "sockFd",
677 json_object_string_add(json_grp
, "upTime",
679 json_object_array_add(json_grp_arr
, json_grp
);
682 "%-16s %-15s %-15s %-15s %6d %8s\n",
683 ifp
->name
, pri_addr_str
, source_str
,
684 group_str
, ij
->sock_fd
, uptime
);
686 } /* for (pim_ifp->gm_join_list) */
694 static void igmp_show_statistics(struct pim_instance
*pim
, struct vty
*vty
,
695 const char *ifname
, bool uj
)
697 struct interface
*ifp
;
698 struct igmp_stats igmp_stats
;
699 bool found_ifname
= false;
700 json_object
*json
= NULL
;
702 igmp_stats_init(&igmp_stats
);
705 json
= json_object_new_object();
707 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
708 struct pim_interface
*pim_ifp
;
709 struct listnode
*sock_node
, *source_node
, *group_node
;
710 struct gm_sock
*igmp
;
711 struct gm_group
*group
;
712 struct gm_source
*src
;
719 if (ifname
&& strcmp(ifname
, ifp
->name
))
724 igmp_stats
.joins_failed
+= pim_ifp
->igmp_ifstat_joins_failed
;
725 igmp_stats
.joins_sent
+= pim_ifp
->igmp_ifstat_joins_sent
;
726 igmp_stats
.total_groups
+=
727 pim_ifp
->gm_group_list
728 ? listcount(pim_ifp
->gm_group_list
)
730 igmp_stats
.peak_groups
+= pim_ifp
->igmp_peak_group_count
;
733 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, group_node
,
735 for (ALL_LIST_ELEMENTS_RO(group
->group_source_list
,
737 if (pim_addr_is_any(src
->source_addr
))
740 igmp_stats
.total_source_groups
++;
744 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
746 igmp_stats_add(&igmp_stats
, &igmp
->igmp_stats
);
754 vty_out(vty
, "%% No such interface\n");
759 json_object
*json_row
= json_object_new_object();
761 json_object_string_add(json_row
, "name",
762 ifname
? ifname
: "global");
763 json_object_int_add(json_row
, "queryV1", igmp_stats
.query_v1
);
764 json_object_int_add(json_row
, "queryV2", igmp_stats
.query_v2
);
765 json_object_int_add(json_row
, "queryV3", igmp_stats
.query_v3
);
766 json_object_int_add(json_row
, "leaveV2", igmp_stats
.leave_v2
);
767 json_object_int_add(json_row
, "reportV1", igmp_stats
.report_v1
);
768 json_object_int_add(json_row
, "reportV2", igmp_stats
.report_v2
);
769 json_object_int_add(json_row
, "reportV3", igmp_stats
.report_v3
);
770 json_object_int_add(json_row
, "mtraceResponse",
771 igmp_stats
.mtrace_rsp
);
772 json_object_int_add(json_row
, "mtraceRequest",
773 igmp_stats
.mtrace_req
);
774 json_object_int_add(json_row
, "unsupported",
775 igmp_stats
.unsupported
);
776 json_object_int_add(json_row
, "totalReceivedMessages",
777 igmp_stats
.total_recv_messages
);
778 json_object_int_add(json_row
, "peakGroups",
779 igmp_stats
.peak_groups
);
780 json_object_int_add(json_row
, "totalGroups",
781 igmp_stats
.total_groups
);
782 json_object_int_add(json_row
, "totalSourceGroups",
783 igmp_stats
.total_source_groups
);
784 json_object_int_add(json_row
, "joinsFailed",
785 igmp_stats
.joins_failed
);
786 json_object_int_add(json_row
, "joinsSent",
787 igmp_stats
.joins_sent
);
788 json_object_int_add(json_row
, "generalQueriesSent",
789 igmp_stats
.general_queries_sent
);
790 json_object_int_add(json_row
, "groupQueriesSent",
791 igmp_stats
.group_queries_sent
);
792 json_object_object_add(json
, ifname
? ifname
: "global",
796 vty_out(vty
, "IGMP statistics\n");
797 vty_out(vty
, "Interface : %s\n",
798 ifname
? ifname
: "global");
799 vty_out(vty
, "V1 query : %u\n",
800 igmp_stats
.query_v1
);
801 vty_out(vty
, "V2 query : %u\n",
802 igmp_stats
.query_v2
);
803 vty_out(vty
, "V3 query : %u\n",
804 igmp_stats
.query_v3
);
805 vty_out(vty
, "V2 leave : %u\n",
806 igmp_stats
.leave_v2
);
807 vty_out(vty
, "V1 report : %u\n",
808 igmp_stats
.report_v1
);
809 vty_out(vty
, "V2 report : %u\n",
810 igmp_stats
.report_v2
);
811 vty_out(vty
, "V3 report : %u\n",
812 igmp_stats
.report_v3
);
813 vty_out(vty
, "mtrace response : %u\n",
814 igmp_stats
.mtrace_rsp
);
815 vty_out(vty
, "mtrace request : %u\n",
816 igmp_stats
.mtrace_req
);
817 vty_out(vty
, "unsupported : %u\n",
818 igmp_stats
.unsupported
);
819 vty_out(vty
, "total received messages : %u\n",
820 igmp_stats
.total_recv_messages
);
821 vty_out(vty
, "joins failed : %u\n",
822 igmp_stats
.joins_failed
);
823 vty_out(vty
, "joins sent : %u\n",
824 igmp_stats
.joins_sent
);
825 vty_out(vty
, "general queries sent : %u\n",
826 igmp_stats
.general_queries_sent
);
827 vty_out(vty
, "group queries sent : %u\n",
828 igmp_stats
.group_queries_sent
);
829 vty_out(vty
, "peak groups : %u\n",
830 igmp_stats
.peak_groups
);
831 vty_out(vty
, "total groups : %u\n",
832 igmp_stats
.total_groups
);
833 vty_out(vty
, "total source groups : %u\n",
834 igmp_stats
.total_source_groups
);
838 static void igmp_show_groups(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
840 struct interface
*ifp
;
842 json_object
*json
= NULL
;
843 json_object
*json_iface
= NULL
;
844 json_object
*json_group
= NULL
;
845 json_object
*json_groups
= NULL
;
847 now
= pim_time_monotonic_sec();
850 json
= json_object_new_object();
851 json_object_int_add(json
, "totalGroups", pim
->gm_group_count
);
852 json_object_int_add(json
, "watermarkLimit",
853 pim
->gm_watermark_limit
);
855 vty_out(vty
, "Total IGMP groups: %u\n", pim
->gm_group_count
);
856 vty_out(vty
, "Watermark warn limit(%s): %u\n",
857 pim
->gm_watermark_limit
? "Set" : "Not Set",
858 pim
->gm_watermark_limit
);
860 "Interface Group Mode Timer Srcs V Uptime \n");
863 /* scan interfaces */
864 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
865 struct pim_interface
*pim_ifp
= ifp
->info
;
866 struct listnode
*grpnode
;
867 struct gm_group
*grp
;
872 /* scan igmp groups */
873 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
875 char group_str
[INET_ADDRSTRLEN
];
879 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
881 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
),
883 pim_time_uptime(uptime
, sizeof(uptime
),
884 now
- grp
->group_creation
);
887 json_object_object_get_ex(json
, ifp
->name
,
891 json_iface
= json_object_new_object();
892 json_object_pim_ifp_add(json_iface
,
894 json_object_object_add(json
, ifp
->name
,
896 json_groups
= json_object_new_array();
897 json_object_object_add(json_iface
,
902 json_group
= json_object_new_object();
903 json_object_string_add(json_group
, "group",
906 if (grp
->igmp_version
== 3)
907 json_object_string_add(
909 grp
->group_filtermode_isexcl
913 json_object_string_add(json_group
, "timer",
916 json_group
, "sourcesCount",
917 grp
->group_source_list
? listcount(
918 grp
->group_source_list
)
920 json_object_int_add(json_group
, "version",
922 json_object_string_add(json_group
, "uptime",
924 json_object_array_add(json_groups
, json_group
);
926 vty_out(vty
, "%-16s %-15s %4s %8s %4d %d %8s\n",
927 ifp
->name
, group_str
,
928 grp
->igmp_version
== 3
929 ? (grp
->group_filtermode_isexcl
934 grp
->group_source_list
? listcount(
935 grp
->group_source_list
)
937 grp
->igmp_version
, uptime
);
939 } /* scan igmp groups */
940 } /* scan interfaces */
946 static void igmp_show_group_retransmission(struct pim_instance
*pim
,
949 struct interface
*ifp
;
952 "Interface Group RetTimer Counter RetSrcs\n");
954 /* scan interfaces */
955 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
956 struct pim_interface
*pim_ifp
= ifp
->info
;
957 struct listnode
*grpnode
;
958 struct gm_group
*grp
;
963 /* scan igmp groups */
964 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
966 char group_str
[INET_ADDRSTRLEN
];
967 char grp_retr_mmss
[10];
968 struct listnode
*src_node
;
969 struct gm_source
*src
;
970 int grp_retr_sources
= 0;
972 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
974 pim_time_timer_to_mmss(
975 grp_retr_mmss
, sizeof(grp_retr_mmss
),
976 grp
->t_group_query_retransmit_timer
);
979 /* count group sources with retransmission state
981 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
983 if (src
->source_query_retransmit_count
> 0) {
988 vty_out(vty
, "%-16s %-15s %-8s %7d %7d\n", ifp
->name
,
989 group_str
, grp_retr_mmss
,
990 grp
->group_specific_query_retransmit_count
,
993 } /* scan igmp groups */
994 } /* scan interfaces */
997 static void igmp_show_sources(struct pim_instance
*pim
, struct vty
*vty
,
1000 struct interface
*ifp
;
1002 json_object
*json
= NULL
;
1003 json_object
*json_iface
= NULL
;
1004 json_object
*json_group
= NULL
;
1005 json_object
*json_source
= NULL
;
1006 json_object
*json_sources
= NULL
;
1008 now
= pim_time_monotonic_sec();
1011 json
= json_object_new_object();
1014 "Interface Group Source Timer Fwd Uptime \n");
1016 /* scan interfaces */
1017 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1018 struct pim_interface
*pim_ifp
= ifp
->info
;
1019 struct listnode
*grpnode
;
1020 struct gm_group
*grp
;
1025 /* scan igmp groups */
1026 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1028 char group_str
[INET_ADDRSTRLEN
];
1029 struct listnode
*srcnode
;
1030 struct gm_source
*src
;
1032 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1035 /* scan group sources */
1036 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1038 char source_str
[INET_ADDRSTRLEN
];
1042 pim_inet4_dump("<source?>", src
->source_addr
,
1043 source_str
, sizeof(source_str
));
1045 pim_time_timer_to_mmss(mmss
, sizeof(mmss
),
1046 src
->t_source_timer
);
1048 pim_time_uptime(uptime
, sizeof(uptime
),
1049 now
- src
->source_creation
);
1052 json_object_object_get_ex(
1053 json
, ifp
->name
, &json_iface
);
1056 json_object_new_object();
1057 json_object_string_add(
1060 json_object_object_add(
1064 json_object_object_get_ex(json_iface
,
1070 json_object_new_object();
1071 json_object_string_add(
1072 json_group
, "group",
1074 json_object_object_add(
1075 json_iface
, group_str
,
1078 json_object_new_array();
1079 json_object_object_add(
1080 json_group
, "sources",
1083 json_source
= json_object_new_object();
1084 json_object_string_add(json_source
,
1087 json_object_string_add(json_source
,
1089 json_object_boolean_add(
1090 json_source
, "forwarded",
1091 IGMP_SOURCE_TEST_FORWARDING(
1092 src
->source_flags
));
1093 json_object_string_add(
1094 json_source
, "uptime", uptime
);
1095 json_object_array_add(json_sources
,
1100 "%-16s %-15s %-15s %5s %3s %8s\n",
1101 ifp
->name
, group_str
,
1103 IGMP_SOURCE_TEST_FORWARDING(
1110 } /* scan group sources */
1111 } /* scan igmp groups */
1112 } /* scan interfaces */
1114 vty_json(vty
, json
);
1117 static void igmp_show_source_retransmission(struct pim_instance
*pim
,
1120 struct interface
*ifp
;
1123 "Interface Group Source Counter\n");
1125 /* scan interfaces */
1126 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1127 struct pim_interface
*pim_ifp
= ifp
->info
;
1128 struct listnode
*grpnode
;
1129 struct gm_group
*grp
;
1134 /* scan igmp groups */
1135 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1137 char group_str
[INET_ADDRSTRLEN
];
1138 struct listnode
*srcnode
;
1139 struct gm_source
*src
;
1141 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1144 /* scan group sources */
1145 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1147 char source_str
[INET_ADDRSTRLEN
];
1149 pim_inet4_dump("<source?>", src
->source_addr
,
1150 source_str
, sizeof(source_str
));
1152 vty_out(vty
, "%-16s %-15s %-15s %7d\n",
1153 ifp
->name
, group_str
, source_str
,
1154 src
->source_query_retransmit_count
);
1156 } /* scan group sources */
1157 } /* scan igmp groups */
1158 } /* scan interfaces */
1161 static void clear_igmp_interfaces(struct pim_instance
*pim
)
1163 struct interface
*ifp
;
1165 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1166 pim_if_addr_del_all_igmp(ifp
);
1168 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1169 pim_if_addr_add_all(ifp
);
1172 static void clear_interfaces(struct pim_instance
*pim
)
1174 clear_igmp_interfaces(pim
);
1175 clear_pim_interfaces(pim
);
1178 #define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \
1179 pim_ifp = ifp->info; \
1182 "%% Enable PIM and/or IGMP on this interface first\n"); \
1183 return CMD_WARNING_CONFIG_FAILED; \
1187 * Compatibility function to keep the legacy mesh group CLI behavior:
1188 * Delete group when there are no more configurations in it.
1191 * Don't forget to call `nb_cli_apply_changes` after this.
1193 static void pim_cli_legacy_mesh_group_behavior(struct vty
*vty
,
1196 const char *vrfname
;
1197 char xpath_value
[XPATH_MAXLEN
];
1198 char xpath_member_value
[XPATH_MAXLEN
];
1199 const struct lyd_node
*member_dnode
;
1201 vrfname
= pim_cli_get_vrf_name(vty
);
1202 if (vrfname
== NULL
)
1205 /* Get mesh group base XPath. */
1206 snprintf(xpath_value
, sizeof(xpath_value
),
1207 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
1208 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
1209 /* Group must exists, otherwise just quit. */
1210 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
1213 /* Group members check: */
1214 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1215 strlcat(xpath_member_value
, "/members", sizeof(xpath_member_value
));
1216 if (yang_dnode_exists(vty
->candidate_config
->dnode
,
1217 xpath_member_value
)) {
1218 member_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
1219 xpath_member_value
);
1220 if (!member_dnode
|| !yang_is_last_list_dnode(member_dnode
))
1224 /* Source address check: */
1225 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1226 strlcat(xpath_member_value
, "/source", sizeof(xpath_member_value
));
1227 if (yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_member_value
))
1230 /* No configurations found: delete it. */
1231 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
1234 DEFUN (clear_ip_interfaces
,
1235 clear_ip_interfaces_cmd
,
1236 "clear ip interfaces [vrf NAME]",
1239 "Reset interfaces\n"
1243 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1248 clear_interfaces(vrf
->info
);
1253 DEFUN (clear_ip_igmp_interfaces
,
1254 clear_ip_igmp_interfaces_cmd
,
1255 "clear ip igmp [vrf NAME] interfaces",
1260 "Reset IGMP interfaces\n")
1263 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1268 clear_igmp_interfaces(vrf
->info
);
1273 DEFPY (clear_ip_pim_statistics
,
1274 clear_ip_pim_statistics_cmd
,
1275 "clear ip pim statistics [vrf NAME]$name",
1280 "Reset PIM statistics\n")
1282 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1287 clear_pim_statistics(v
->info
);
1292 DEFPY (clear_ip_mroute
,
1293 clear_ip_mroute_cmd
,
1294 "clear ip mroute [vrf NAME]$name",
1300 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1305 clear_mroute(v
->info
);
1310 DEFPY (clear_ip_pim_interfaces
,
1311 clear_ip_pim_interfaces_cmd
,
1312 "clear ip pim [vrf NAME] interfaces",
1317 "Reset PIM interfaces\n")
1319 struct vrf
*v
= pim_cmd_lookup(vty
, vrf
);
1324 clear_pim_interfaces(v
->info
);
1329 DEFPY (clear_ip_pim_interface_traffic
,
1330 clear_ip_pim_interface_traffic_cmd
,
1331 "clear ip pim [vrf NAME] interface traffic",
1336 "Reset PIM interfaces\n"
1337 "Reset Protocol Packet counters\n")
1339 return clear_pim_interface_traffic(vrf
, vty
);
1342 DEFPY (clear_ip_pim_oil
,
1343 clear_ip_pim_oil_cmd
,
1344 "clear ip pim [vrf NAME]$name oil",
1349 "Rescan PIM OIL (output interface list)\n")
1351 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1356 pim_scan_oil(v
->info
);
1361 DEFUN (clear_ip_pim_bsr_db
,
1362 clear_ip_pim_bsr_db_cmd
,
1363 "clear ip pim [vrf NAME] bsr-data",
1368 "Reset pim bsr data\n")
1371 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1376 pim_bsm_clear(vrf
->info
);
1381 DEFUN (show_ip_igmp_interface
,
1382 show_ip_igmp_interface_cmd
,
1383 "show ip igmp [vrf NAME] interface [detail|WORD] [json]",
1388 "IGMP interface information\n"
1394 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1395 bool uj
= use_json(argc
, argv
);
1400 if (argv_find(argv
, argc
, "detail", &idx
)
1401 || argv_find(argv
, argc
, "WORD", &idx
))
1402 igmp_show_interfaces_single(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1404 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1409 DEFUN (show_ip_igmp_interface_vrf_all
,
1410 show_ip_igmp_interface_vrf_all_cmd
,
1411 "show ip igmp vrf all interface [detail|WORD] [json]",
1416 "IGMP interface information\n"
1422 bool uj
= use_json(argc
, argv
);
1428 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1432 vty_out(vty
, " \"%s\": ", vrf
->name
);
1435 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1436 if (argv_find(argv
, argc
, "detail", &idx
)
1437 || argv_find(argv
, argc
, "WORD", &idx
))
1438 igmp_show_interfaces_single(vrf
->info
, vty
,
1439 argv
[idx
]->arg
, uj
);
1441 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1444 vty_out(vty
, "}\n");
1449 DEFUN (show_ip_igmp_join
,
1450 show_ip_igmp_join_cmd
,
1451 "show ip igmp [vrf NAME] join [json]",
1456 "IGMP static join information\n"
1460 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1461 bool uj
= use_json(argc
, argv
);
1466 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1471 DEFUN (show_ip_igmp_join_vrf_all
,
1472 show_ip_igmp_join_vrf_all_cmd
,
1473 "show ip igmp vrf all join [json]",
1478 "IGMP static join information\n"
1481 bool uj
= use_json(argc
, argv
);
1487 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1491 vty_out(vty
, " \"%s\": ", vrf
->name
);
1494 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1495 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1498 vty_out(vty
, "}\n");
1503 DEFUN (show_ip_igmp_groups
,
1504 show_ip_igmp_groups_cmd
,
1505 "show ip igmp [vrf NAME] groups [json]",
1514 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1515 bool uj
= use_json(argc
, argv
);
1520 igmp_show_groups(vrf
->info
, vty
, uj
);
1525 DEFUN (show_ip_igmp_groups_vrf_all
,
1526 show_ip_igmp_groups_vrf_all_cmd
,
1527 "show ip igmp vrf all groups [json]",
1535 bool uj
= use_json(argc
, argv
);
1541 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1545 vty_out(vty
, " \"%s\": ", vrf
->name
);
1548 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1549 igmp_show_groups(vrf
->info
, vty
, uj
);
1552 vty_out(vty
, "}\n");
1557 DEFUN (show_ip_igmp_groups_retransmissions
,
1558 show_ip_igmp_groups_retransmissions_cmd
,
1559 "show ip igmp [vrf NAME] groups retransmissions",
1565 "IGMP group retransmissions\n")
1568 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1573 igmp_show_group_retransmission(vrf
->info
, vty
);
1578 DEFUN (show_ip_igmp_sources
,
1579 show_ip_igmp_sources_cmd
,
1580 "show ip igmp [vrf NAME] sources [json]",
1589 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1594 igmp_show_sources(vrf
->info
, vty
, use_json(argc
, argv
));
1599 DEFUN (show_ip_igmp_sources_retransmissions
,
1600 show_ip_igmp_sources_retransmissions_cmd
,
1601 "show ip igmp [vrf NAME] sources retransmissions",
1607 "IGMP source retransmissions\n")
1610 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1615 igmp_show_source_retransmission(vrf
->info
, vty
);
1620 DEFUN (show_ip_igmp_statistics
,
1621 show_ip_igmp_statistics_cmd
,
1622 "show ip igmp [vrf NAME] statistics [interface WORD] [json]",
1633 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1634 bool uj
= use_json(argc
, argv
);
1639 if (argv_find(argv
, argc
, "WORD", &idx
))
1640 igmp_show_statistics(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1642 igmp_show_statistics(vrf
->info
, vty
, NULL
, uj
);
1647 DEFUN (show_ip_pim_mlag_summary
,
1648 show_ip_pim_mlag_summary_cmd
,
1649 "show ip pim mlag summary [json]",
1654 "status and stats\n"
1657 bool uj
= use_json(argc
, argv
);
1658 char role_buf
[MLAG_ROLE_STRSIZE
];
1659 char addr_buf
[INET_ADDRSTRLEN
];
1662 json_object
*json
= NULL
;
1663 json_object
*json_stat
= NULL
;
1665 json
= json_object_new_object();
1666 if (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
1667 json_object_boolean_true_add(json
, "mlagConnUp");
1668 if (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
1669 json_object_boolean_true_add(json
, "mlagPeerConnUp");
1670 if (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
1671 json_object_boolean_true_add(json
, "mlagPeerZebraUp");
1672 json_object_string_add(json
, "mlagRole",
1673 mlag_role2str(router
->mlag_role
,
1674 role_buf
, sizeof(role_buf
)));
1675 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
1676 addr_buf
, INET_ADDRSTRLEN
);
1677 json_object_string_add(json
, "localVtepIp", addr_buf
);
1678 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
1679 addr_buf
, INET_ADDRSTRLEN
);
1680 json_object_string_add(json
, "anycastVtepIp", addr_buf
);
1681 json_object_string_add(json
, "peerlinkRif",
1682 router
->peerlink_rif
);
1684 json_stat
= json_object_new_object();
1685 json_object_int_add(json_stat
, "mlagConnFlaps",
1686 router
->mlag_stats
.mlagd_session_downs
);
1687 json_object_int_add(json_stat
, "mlagPeerConnFlaps",
1688 router
->mlag_stats
.peer_session_downs
);
1689 json_object_int_add(json_stat
, "mlagPeerZebraFlaps",
1690 router
->mlag_stats
.peer_zebra_downs
);
1691 json_object_int_add(json_stat
, "mrouteAddRx",
1692 router
->mlag_stats
.msg
.mroute_add_rx
);
1693 json_object_int_add(json_stat
, "mrouteAddTx",
1694 router
->mlag_stats
.msg
.mroute_add_tx
);
1695 json_object_int_add(json_stat
, "mrouteDelRx",
1696 router
->mlag_stats
.msg
.mroute_del_rx
);
1697 json_object_int_add(json_stat
, "mrouteDelTx",
1698 router
->mlag_stats
.msg
.mroute_del_tx
);
1699 json_object_int_add(json_stat
, "mlagStatusUpdates",
1700 router
->mlag_stats
.msg
.mlag_status_updates
);
1701 json_object_int_add(json_stat
, "peerZebraStatusUpdates",
1702 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
1703 json_object_int_add(json_stat
, "pimStatusUpdates",
1704 router
->mlag_stats
.msg
.pim_status_updates
);
1705 json_object_int_add(json_stat
, "vxlanUpdates",
1706 router
->mlag_stats
.msg
.vxlan_updates
);
1707 json_object_object_add(json
, "connStats", json_stat
);
1709 vty_json(vty
, json
);
1713 vty_out(vty
, "MLAG daemon connection: %s\n",
1714 (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
1716 vty_out(vty
, "MLAG peer state: %s\n",
1717 (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
1719 vty_out(vty
, "Zebra peer state: %s\n",
1720 (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
1722 vty_out(vty
, "MLAG role: %s\n",
1723 mlag_role2str(router
->mlag_role
, role_buf
, sizeof(role_buf
)));
1724 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
1725 addr_buf
, INET_ADDRSTRLEN
);
1726 vty_out(vty
, "Local VTEP IP: %s\n", addr_buf
);
1727 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
1728 addr_buf
, INET_ADDRSTRLEN
);
1729 vty_out(vty
, "Anycast VTEP IP: %s\n", addr_buf
);
1730 vty_out(vty
, "Peerlink: %s\n", router
->peerlink_rif
);
1731 vty_out(vty
, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n",
1732 router
->mlag_stats
.mlagd_session_downs
,
1733 router
->mlag_stats
.peer_session_downs
,
1734 router
->mlag_stats
.peer_zebra_downs
);
1735 vty_out(vty
, "Message Statistics:\n");
1736 vty_out(vty
, " mroute adds: rx: %d, tx: %d\n",
1737 router
->mlag_stats
.msg
.mroute_add_rx
,
1738 router
->mlag_stats
.msg
.mroute_add_tx
);
1739 vty_out(vty
, " mroute dels: rx: %d, tx: %d\n",
1740 router
->mlag_stats
.msg
.mroute_del_rx
,
1741 router
->mlag_stats
.msg
.mroute_del_tx
);
1742 vty_out(vty
, " peer zebra status updates: %d\n",
1743 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
1744 vty_out(vty
, " PIM status updates: %d\n",
1745 router
->mlag_stats
.msg
.pim_status_updates
);
1746 vty_out(vty
, " VxLAN updates: %d\n",
1747 router
->mlag_stats
.msg
.vxlan_updates
);
1752 DEFUN (show_ip_pim_assert
,
1753 show_ip_pim_assert_cmd
,
1754 "show ip pim [vrf NAME] assert",
1759 "PIM interface assert\n")
1762 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1767 pim_show_assert(vrf
->info
, vty
);
1772 DEFUN (show_ip_pim_assert_internal
,
1773 show_ip_pim_assert_internal_cmd
,
1774 "show ip pim [vrf NAME] assert-internal",
1779 "PIM interface internal assert state\n")
1782 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1787 pim_show_assert_internal(vrf
->info
, vty
);
1792 DEFUN (show_ip_pim_assert_metric
,
1793 show_ip_pim_assert_metric_cmd
,
1794 "show ip pim [vrf NAME] assert-metric",
1799 "PIM interface assert metric\n")
1802 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1807 pim_show_assert_metric(vrf
->info
, vty
);
1812 DEFUN (show_ip_pim_assert_winner_metric
,
1813 show_ip_pim_assert_winner_metric_cmd
,
1814 "show ip pim [vrf NAME] assert-winner-metric",
1819 "PIM interface assert winner metric\n")
1822 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1827 pim_show_assert_winner_metric(vrf
->info
, vty
);
1832 DEFPY (show_ip_pim_interface
,
1833 show_ip_pim_interface_cmd
,
1834 "show ip pim [mlag$mlag] [vrf NAME] interface [detail|WORD]$interface [json$json]",
1840 "PIM interface information\n"
1845 return pim_show_interface_cmd_helper(vrf
, vty
, !!json
, !!mlag
,
1849 DEFPY (show_ip_pim_interface_vrf_all
,
1850 show_ip_pim_interface_vrf_all_cmd
,
1851 "show ip pim [mlag$mlag] vrf all interface [detail|WORD]$interface [json$json]",
1857 "PIM interface information\n"
1862 return pim_show_interface_vrf_all_cmd_helper(vty
, !!json
, !!mlag
,
1866 DEFPY (show_ip_pim_join
,
1867 show_ip_pim_join_cmd
,
1868 "show ip pim [vrf NAME] join [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
1873 "PIM interface join information\n"
1874 "The Source or Group\n"
1878 return pim_show_join_cmd_helper(vrf
, vty
, s_or_g
, g
, json
);
1881 DEFPY (show_ip_pim_join_vrf_all
,
1882 show_ip_pim_join_vrf_all_cmd
,
1883 "show ip pim vrf all join [json$json]",
1888 "PIM interface join information\n"
1891 return pim_show_join_vrf_all_cmd_helper(vty
, json
);
1894 DEFPY (show_ip_pim_jp_agg
,
1895 show_ip_pim_jp_agg_cmd
,
1896 "show ip pim [vrf NAME] jp-agg",
1901 "join prune aggregation list\n")
1903 return pim_show_jp_agg_list_cmd_helper(vrf
, vty
);
1906 DEFPY (show_ip_pim_local_membership
,
1907 show_ip_pim_local_membership_cmd
,
1908 "show ip pim [vrf NAME] local-membership [json$json]",
1913 "PIM interface local-membership\n"
1916 return pim_show_membership_cmd_helper(vrf
, vty
, !!json
);
1919 static void pim_show_mlag_up_entry_detail(struct vrf
*vrf
,
1921 struct pim_upstream
*up
,
1922 char *src_str
, char *grp_str
,
1926 json_object
*json_row
= NULL
;
1927 json_object
*own_list
= NULL
;
1928 json_object
*json_group
= NULL
;
1931 json_object_object_get_ex(json
, grp_str
, &json_group
);
1933 json_group
= json_object_new_object();
1934 json_object_object_add(json
, grp_str
,
1938 json_row
= json_object_new_object();
1939 json_object_string_add(json_row
, "source", src_str
);
1940 json_object_string_add(json_row
, "group", grp_str
);
1942 own_list
= json_object_new_array();
1943 if (pim_up_mlag_is_local(up
))
1944 json_object_array_add(own_list
,
1945 json_object_new_string("local"));
1946 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
1947 json_object_array_add(own_list
,
1948 json_object_new_string("peer"));
1949 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
1950 json_object_array_add(
1951 own_list
, json_object_new_string("Interface"));
1952 json_object_object_add(json_row
, "owners", own_list
);
1954 json_object_int_add(json_row
, "localCost",
1955 pim_up_mlag_local_cost(up
));
1956 json_object_int_add(json_row
, "peerCost",
1957 pim_up_mlag_peer_cost(up
));
1958 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
1959 json_object_boolean_false_add(json_row
, "df");
1961 json_object_boolean_true_add(json_row
, "df");
1962 json_object_object_add(json_group
, src_str
, json_row
);
1967 if (pim_up_mlag_is_local(up
))
1968 strlcat(own_str
, "L", sizeof(own_str
));
1969 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
1970 strlcat(own_str
, "P", sizeof(own_str
));
1971 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
1972 strlcat(own_str
, "I", sizeof(own_str
));
1973 /* XXX - fixup, print paragraph output */
1975 "%-15s %-15s %-6s %-11u %-10d %2s\n",
1976 src_str
, grp_str
, own_str
,
1977 pim_up_mlag_local_cost(up
),
1978 pim_up_mlag_peer_cost(up
),
1979 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
1984 static void pim_show_mlag_up_detail(struct vrf
*vrf
,
1985 struct vty
*vty
, const char *src_or_group
,
1986 const char *group
, bool uj
)
1988 char src_str
[PIM_ADDRSTRLEN
];
1989 char grp_str
[PIM_ADDRSTRLEN
];
1990 struct pim_upstream
*up
;
1991 struct pim_instance
*pim
= vrf
->info
;
1992 json_object
*json
= NULL
;
1995 json
= json_object_new_object();
1998 "Source Group Owner Local-cost Peer-cost DF\n");
2000 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2001 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2002 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2003 && !pim_up_mlag_is_local(up
))
2006 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &up
->sg
.grp
);
2007 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &up
->sg
.src
);
2009 /* XXX: strcmps are clearly inefficient. we should do uint comps
2013 if (strcmp(src_str
, src_or_group
) ||
2014 strcmp(grp_str
, group
))
2017 if (strcmp(src_str
, src_or_group
) &&
2018 strcmp(grp_str
, src_or_group
))
2021 pim_show_mlag_up_entry_detail(vrf
, vty
, up
,
2022 src_str
, grp_str
, json
);
2026 vty_json(vty
, json
);
2029 static void pim_show_mlag_up_vrf(struct vrf
*vrf
, struct vty
*vty
, bool uj
)
2031 json_object
*json
= NULL
;
2032 json_object
*json_row
;
2033 struct pim_upstream
*up
;
2034 struct pim_instance
*pim
= vrf
->info
;
2035 json_object
*json_group
= NULL
;
2038 json
= json_object_new_object();
2041 "Source Group Owner Local-cost Peer-cost DF\n");
2044 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2045 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2046 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2047 && !pim_up_mlag_is_local(up
))
2050 char src_str
[PIM_ADDRSTRLEN
];
2051 char grp_str
[PIM_ADDRSTRLEN
];
2052 json_object
*own_list
= NULL
;
2054 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
2056 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
2059 json_object_object_get_ex(json
, grp_str
, &json_group
);
2061 json_group
= json_object_new_object();
2062 json_object_object_add(json
, grp_str
,
2066 json_row
= json_object_new_object();
2067 json_object_string_add(json_row
, "vrf", vrf
->name
);
2068 json_object_string_add(json_row
, "source", src_str
);
2069 json_object_string_add(json_row
, "group", grp_str
);
2071 own_list
= json_object_new_array();
2072 if (pim_up_mlag_is_local(up
)) {
2074 json_object_array_add(own_list
,
2075 json_object_new_string(
2078 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)) {
2079 json_object_array_add(own_list
,
2080 json_object_new_string(
2083 json_object_object_add(json_row
, "owners", own_list
);
2085 json_object_int_add(json_row
, "localCost",
2086 pim_up_mlag_local_cost(up
));
2087 json_object_int_add(json_row
, "peerCost",
2088 pim_up_mlag_peer_cost(up
));
2089 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2090 json_object_boolean_false_add(json_row
, "df");
2092 json_object_boolean_true_add(json_row
, "df");
2093 json_object_object_add(json_group
, src_str
, json_row
);
2098 if (pim_up_mlag_is_local(up
))
2099 strlcat(own_str
, "L", sizeof(own_str
));
2100 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2101 strlcat(own_str
, "P", sizeof(own_str
));
2102 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2103 strlcat(own_str
, "I", sizeof(own_str
));
2105 "%-15pPAs %-15pPAs %-6s %-11u %-10u %2s\n",
2106 &up
->sg
.src
, &up
->sg
.grp
, own_str
,
2107 pim_up_mlag_local_cost(up
),
2108 pim_up_mlag_peer_cost(up
),
2109 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2114 vty_json(vty
, json
);
2117 static void pim_show_mlag_help_string(struct vty
*vty
, bool uj
)
2120 vty_out(vty
, "Owner codes:\n");
2122 "L: EVPN-MLAG Entry, I:PIM-MLAG Entry, P: Peer Entry\n");
2127 DEFUN(show_ip_pim_mlag_up
, show_ip_pim_mlag_up_cmd
,
2128 "show ip pim [vrf NAME] mlag upstream [A.B.C.D [A.B.C.D]] [json]",
2135 "Unicast or Multicast address\n"
2136 "Multicast address\n" JSON_STR
)
2138 const char *src_or_group
= NULL
;
2139 const char *group
= NULL
;
2141 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2142 bool uj
= use_json(argc
, argv
);
2144 if (!vrf
|| !vrf
->info
) {
2145 vty_out(vty
, "%s: VRF or Info missing\n", __func__
);
2152 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
2153 src_or_group
= argv
[idx
]->arg
;
2155 group
= argv
[idx
+ 1]->arg
;
2158 pim_show_mlag_help_string(vty
, uj
);
2161 pim_show_mlag_up_detail(vrf
, vty
, src_or_group
, group
, uj
);
2163 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2169 DEFUN(show_ip_pim_mlag_up_vrf_all
, show_ip_pim_mlag_up_vrf_all_cmd
,
2170 "show ip pim vrf all mlag upstream [json]",
2171 SHOW_STR IP_STR PIM_STR VRF_CMD_HELP_STR
2173 "upstream\n" JSON_STR
)
2176 bool uj
= use_json(argc
, argv
);
2178 pim_show_mlag_help_string(vty
, uj
);
2179 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
2180 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2186 DEFPY (show_ip_pim_neighbor
,
2187 show_ip_pim_neighbor_cmd
,
2188 "show ip pim [vrf NAME] neighbor [detail|WORD]$interface [json$json]",
2193 "PIM neighbor information\n"
2195 "Name of interface or neighbor\n"
2198 return pim_show_neighbors_cmd_helper(vrf
, vty
, json
, interface
);
2201 DEFPY (show_ip_pim_neighbor_vrf_all
,
2202 show_ip_pim_neighbor_vrf_all_cmd
,
2203 "show ip pim vrf all neighbor [detail|WORD]$interface [json$json]",
2208 "PIM neighbor information\n"
2210 "Name of interface or neighbor\n"
2213 return pim_show_neighbors_vrf_all_cmd_helper(vty
, json
, interface
);
2216 DEFPY (show_ip_pim_secondary
,
2217 show_ip_pim_secondary_cmd
,
2218 "show ip pim [vrf NAME] secondary",
2223 "PIM neighbor addresses\n")
2225 return pim_show_secondary_helper(vrf
, vty
);
2228 DEFPY (show_ip_pim_state
,
2229 show_ip_pim_state_cmd
,
2230 "show ip pim [vrf NAME] state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2235 "PIM state information\n"
2236 "Unicast or Multicast address\n"
2237 "Multicast address\n"
2240 return pim_show_state_helper(vrf
, vty
, s_or_g_str
, g_str
, !!json
);
2243 DEFPY (show_ip_pim_state_vrf_all
,
2244 show_ip_pim_state_vrf_all_cmd
,
2245 "show ip pim vrf all state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2250 "PIM state information\n"
2251 "Unicast or Multicast address\n"
2252 "Multicast address\n"
2255 return pim_show_state_vrf_all_helper(vty
, s_or_g_str
, g_str
, !!json
);
2258 DEFPY (show_ip_pim_upstream
,
2259 show_ip_pim_upstream_cmd
,
2260 "show ip pim [vrf NAME] upstream [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2265 "PIM upstream information\n"
2266 "The Source or Group\n"
2270 return pim_show_upstream_helper(vrf
, vty
, s_or_g
, g
, !!json
);
2273 DEFPY (show_ip_pim_upstream_vrf_all
,
2274 show_ip_pim_upstream_vrf_all_cmd
,
2275 "show ip pim vrf all upstream [json$json]",
2280 "PIM upstream information\n"
2283 return pim_show_upstream_vrf_all_helper(vty
, !!json
);
2286 DEFPY (show_ip_pim_channel
,
2287 show_ip_pim_channel_cmd
,
2288 "show ip pim [vrf NAME] channel [json$json]",
2293 "PIM downstream channel info\n"
2296 return pim_show_channel_cmd_helper(vrf
, vty
, !!json
);
2299 DEFPY (show_ip_pim_upstream_join_desired
,
2300 show_ip_pim_upstream_join_desired_cmd
,
2301 "show ip pim [vrf NAME] upstream-join-desired [json$json]",
2306 "PIM upstream join-desired\n"
2309 return pim_show_upstream_join_desired_helper(vrf
, vty
, !!json
);
2312 DEFPY (show_ip_pim_upstream_rpf
,
2313 show_ip_pim_upstream_rpf_cmd
,
2314 "show ip pim [vrf NAME] upstream-rpf [json$json]",
2319 "PIM upstream source rpf\n"
2322 return pim_show_upstream_rpf_helper(vrf
, vty
, !!json
);
2325 DEFPY (show_ip_pim_rp
,
2327 "show ip pim [vrf NAME] rp-info [A.B.C.D/M$group] [json$json]",
2332 "PIM RP information\n"
2333 "Multicast Group range\n"
2336 return pim_show_rp_helper(vrf
, vty
, group_str
, (struct prefix
*)group
,
2340 DEFPY (show_ip_pim_rp_vrf_all
,
2341 show_ip_pim_rp_vrf_all_cmd
,
2342 "show ip pim vrf all rp-info [A.B.C.D/M$group] [json$json]",
2347 "PIM RP information\n"
2348 "Multicast Group range\n"
2351 return pim_show_rp_vrf_all_helper(vty
, group_str
,
2352 (struct prefix
*)group
, !!json
);
2355 DEFPY (show_ip_pim_rpf
,
2356 show_ip_pim_rpf_cmd
,
2357 "show ip pim [vrf NAME] rpf [json$json]",
2362 "PIM cached source rpf information\n"
2365 return pim_show_rpf_helper(vrf
, vty
, !!json
);
2368 DEFPY (show_ip_pim_rpf_vrf_all
,
2369 show_ip_pim_rpf_vrf_all_cmd
,
2370 "show ip pim vrf all rpf [json$json]",
2375 "PIM cached source rpf information\n"
2378 return pim_show_rpf_vrf_all_helper(vty
, !!json
);
2381 DEFPY (show_ip_pim_nexthop
,
2382 show_ip_pim_nexthop_cmd
,
2383 "show ip pim [vrf NAME] nexthop [json$json]",
2388 "PIM cached nexthop rpf information\n"
2391 return pim_show_nexthop_cmd_helper(vrf
, vty
, !!json
);
2394 DEFPY (show_ip_pim_nexthop_lookup
,
2395 show_ip_pim_nexthop_lookup_cmd
,
2396 "show ip pim [vrf NAME] nexthop-lookup A.B.C.D$source A.B.C.D$group",
2401 "PIM cached nexthop rpf lookup\n"
2402 "Source/RP address\n"
2403 "Multicast Group address\n")
2405 return pim_show_nexthop_lookup_cmd_helper(vrf
, vty
, source
, group
);
2408 DEFPY (show_ip_pim_interface_traffic
,
2409 show_ip_pim_interface_traffic_cmd
,
2410 "show ip pim [vrf NAME] interface traffic [WORD$if_name] [json$json]",
2415 "PIM interface information\n"
2416 "Protocol Packet counters\n"
2420 return pim_show_interface_traffic_helper(vrf
, if_name
, vty
, !!json
);
2423 DEFPY (show_ip_pim_bsm_db
,
2424 show_ip_pim_bsm_db_cmd
,
2425 "show ip pim bsm-database [vrf NAME] [json$json]",
2429 "PIM cached bsm packets information\n"
2433 return pim_show_bsm_db_helper(vrf
, vty
, !!json
);
2436 DEFPY (show_ip_pim_bsrp
,
2437 show_ip_pim_bsrp_cmd
,
2438 "show ip pim bsrp-info [vrf NAME] [json$json]",
2442 "PIM cached group-rp mappings information\n"
2446 return pim_show_group_rp_mappings_info_helper(vrf
, vty
, !!json
);
2449 DEFPY (show_ip_pim_statistics
,
2450 show_ip_pim_statistics_cmd
,
2451 "show ip pim [vrf NAME] statistics [interface WORD$word] [json$json]",
2461 return pim_show_statistics_helper(vrf
, vty
, word
, !!json
);
2464 DEFPY (show_ip_multicast
,
2465 show_ip_multicast_cmd
,
2466 "show ip multicast [vrf NAME]",
2469 "Multicast global information\n"
2472 return pim_show_multicast_helper(vrf
, vty
);
2475 DEFPY (show_ip_multicast_vrf_all
,
2476 show_ip_multicast_vrf_all_cmd
,
2477 "show ip multicast vrf all",
2480 "Multicast global information\n"
2483 return pim_show_multicast_vrf_all_helper(vty
);
2486 DEFPY (show_ip_multicast_count
,
2487 show_ip_multicast_count_cmd
,
2488 "show ip multicast count [vrf NAME] [json$json]",
2491 "Multicast global information\n"
2492 "Data packet count\n"
2496 return pim_show_multicast_count_helper(vrf
, vty
, !!json
);
2499 DEFPY (show_ip_multicast_count_vrf_all
,
2500 show_ip_multicast_count_vrf_all_cmd
,
2501 "show ip multicast count vrf all [json$json]",
2504 "Multicast global information\n"
2505 "Data packet count\n"
2509 return pim_show_multicast_count_vrf_all_helper(vty
, !!json
);
2512 DEFPY (show_ip_mroute
,
2514 "show ip mroute [vrf NAME] [A.B.C.D$s_or_g [A.B.C.D$g]] [fill$fill] [json$json]",
2519 "The Source or Group\n"
2521 "Fill in Assumed data\n"
2524 return pim_show_mroute_helper(vrf
, vty
, s_or_g
, g
, !!fill
, !!json
);
2527 DEFPY (show_ip_mroute_vrf_all
,
2528 show_ip_mroute_vrf_all_cmd
,
2529 "show ip mroute vrf all [fill$fill] [json$json]",
2534 "Fill in Assumed data\n"
2537 return pim_show_mroute_vrf_all_helper(vty
, !!fill
, !!json
);
2540 DEFPY (clear_ip_mroute_count
,
2541 clear_ip_mroute_count_cmd
,
2542 "clear ip mroute [vrf NAME]$name count",
2547 "Route and packet count data\n")
2549 return clear_ip_mroute_count_command(vty
, name
);
2552 DEFPY (show_ip_mroute_count
,
2553 show_ip_mroute_count_cmd
,
2554 "show ip mroute [vrf NAME] count [json$json]",
2559 "Route and packet count data\n"
2562 return pim_show_mroute_count_helper(vrf
, vty
, !!json
);
2565 DEFPY (show_ip_mroute_count_vrf_all
,
2566 show_ip_mroute_count_vrf_all_cmd
,
2567 "show ip mroute vrf all count [json$json]",
2572 "Route and packet count data\n"
2575 return pim_show_mroute_count_vrf_all_helper(vty
, !!json
);
2578 DEFPY (show_ip_mroute_summary
,
2579 show_ip_mroute_summary_cmd
,
2580 "show ip mroute [vrf NAME] summary [json$json]",
2585 "Summary of all mroutes\n"
2588 return pim_show_mroute_summary_helper(vrf
, vty
, !!json
);
2591 DEFPY (show_ip_mroute_summary_vrf_all
,
2592 show_ip_mroute_summary_vrf_all_cmd
,
2593 "show ip mroute vrf all summary [json$json]",
2598 "Summary of all mroutes\n"
2601 return pim_show_mroute_summary_vrf_all_helper(vty
, !!json
);
2606 "show ip rib [vrf NAME] A.B.C.D",
2611 "Unicast address\n")
2614 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2615 struct in_addr addr
;
2616 const char *addr_str
;
2617 struct pim_nexthop nexthop
;
2623 memset(&nexthop
, 0, sizeof(nexthop
));
2624 argv_find(argv
, argc
, "A.B.C.D", &idx
);
2625 addr_str
= argv
[idx
]->arg
;
2626 result
= inet_pton(AF_INET
, addr_str
, &addr
);
2628 vty_out(vty
, "Bad unicast address %s: errno=%d: %s\n", addr_str
,
2629 errno
, safe_strerror(errno
));
2633 if (!pim_nexthop_lookup(vrf
->info
, &nexthop
, addr
, 0)) {
2635 "Failure querying RIB nexthop for unicast address %s\n",
2641 "Address NextHop Interface Metric Preference\n");
2643 vty_out(vty
, "%-15s %-15pPAs %-9s %6d %10d\n", addr_str
,
2644 &nexthop
.mrib_nexthop_addr
,
2645 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
2646 nexthop
.mrib_route_metric
, nexthop
.mrib_metric_preference
);
2651 static void show_ssmpingd(struct pim_instance
*pim
, struct vty
*vty
)
2653 struct listnode
*node
;
2654 struct ssmpingd_sock
*ss
;
2658 "Source Socket Address Port Uptime Requests\n");
2660 if (!pim
->ssmpingd_list
)
2663 now
= pim_time_monotonic_sec();
2665 for (ALL_LIST_ELEMENTS_RO(pim
->ssmpingd_list
, node
, ss
)) {
2666 char source_str
[INET_ADDRSTRLEN
];
2668 struct sockaddr_in bind_addr
;
2669 socklen_t len
= sizeof(bind_addr
);
2670 char bind_addr_str
[INET_ADDRSTRLEN
];
2672 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
,
2673 sizeof(source_str
));
2675 if (pim_socket_getsockname(
2676 ss
->sock_fd
, (struct sockaddr
*)&bind_addr
, &len
)) {
2678 "%% Failure reading socket name for ssmpingd source %s on fd=%d\n",
2679 source_str
, ss
->sock_fd
);
2682 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
,
2683 sizeof(bind_addr_str
));
2684 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
),
2685 now
- ss
->creation
);
2687 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld\n", source_str
,
2688 ss
->sock_fd
, bind_addr_str
, ntohs(bind_addr
.sin_port
),
2689 ss_uptime
, (long long)ss
->requests
);
2693 DEFUN (show_ip_ssmpingd
,
2694 show_ip_ssmpingd_cmd
,
2695 "show ip ssmpingd [vrf NAME]",
2702 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2707 show_ssmpingd(vrf
->info
, vty
);
2711 DEFUN (ip_pim_spt_switchover_infinity
,
2712 ip_pim_spt_switchover_infinity_cmd
,
2713 "ip pim spt-switchover infinity-and-beyond",
2717 "Never switch to SPT Tree\n")
2719 return pim_process_spt_switchover_infinity_cmd(vty
);
2722 DEFPY (ip_pim_spt_switchover_infinity_plist
,
2723 ip_pim_spt_switchover_infinity_plist_cmd
,
2724 "ip pim spt-switchover infinity-and-beyond prefix-list WORD$plist",
2728 "Never switch to SPT Tree\n"
2729 "Prefix-List to control which groups to switch\n"
2730 "Prefix-List name\n")
2732 return pim_process_spt_switchover_prefixlist_cmd(vty
, plist
);
2735 DEFUN (no_ip_pim_spt_switchover_infinity
,
2736 no_ip_pim_spt_switchover_infinity_cmd
,
2737 "no ip pim spt-switchover infinity-and-beyond",
2742 "Never switch to SPT Tree\n")
2744 return pim_process_no_spt_switchover_cmd(vty
);
2747 DEFUN (no_ip_pim_spt_switchover_infinity_plist
,
2748 no_ip_pim_spt_switchover_infinity_plist_cmd
,
2749 "no ip pim spt-switchover infinity-and-beyond prefix-list WORD",
2754 "Never switch to SPT Tree\n"
2755 "Prefix-List to control which groups to switch\n"
2756 "Prefix-List name\n")
2758 return pim_process_no_spt_switchover_cmd(vty
);
2761 DEFPY (pim_register_accept_list
,
2762 pim_register_accept_list_cmd
,
2763 "[no] ip pim register-accept-list WORD$word",
2767 "Only accept registers from a specific source prefix list\n"
2768 "Prefix-List name\n")
2770 const char *vrfname
;
2771 char reg_alist_xpath
[XPATH_MAXLEN
];
2773 vrfname
= pim_cli_get_vrf_name(vty
);
2774 if (vrfname
== NULL
)
2775 return CMD_WARNING_CONFIG_FAILED
;
2777 snprintf(reg_alist_xpath
, sizeof(reg_alist_xpath
),
2778 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
2779 "frr-routing:ipv4");
2780 strlcat(reg_alist_xpath
, "/register-accept-list",
2781 sizeof(reg_alist_xpath
));
2784 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
2785 NB_OP_DESTROY
, NULL
);
2787 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
2788 NB_OP_MODIFY
, word
);
2790 return nb_cli_apply_changes(vty
, NULL
);
2793 DEFPY (ip_pim_joinprune_time
,
2794 ip_pim_joinprune_time_cmd
,
2795 "ip pim join-prune-interval (1-65535)$jpi",
2797 "pim multicast routing\n"
2798 "Join Prune Send Interval\n"
2801 return pim_process_join_prune_cmd(vty
, jpi_str
);
2804 DEFUN (no_ip_pim_joinprune_time
,
2805 no_ip_pim_joinprune_time_cmd
,
2806 "no ip pim join-prune-interval [(1-65535)]",
2809 "pim multicast routing\n"
2810 "Join Prune Send Interval\n"
2813 return pim_process_no_join_prune_cmd(vty
);
2816 DEFPY (ip_pim_register_suppress
,
2817 ip_pim_register_suppress_cmd
,
2818 "ip pim register-suppress-time (1-65535)$rst",
2820 "pim multicast routing\n"
2821 "Register Suppress Timer\n"
2824 return pim_process_register_suppress_cmd(vty
, rst_str
);
2827 DEFUN (no_ip_pim_register_suppress
,
2828 no_ip_pim_register_suppress_cmd
,
2829 "no ip pim register-suppress-time [(1-65535)]",
2832 "pim multicast routing\n"
2833 "Register Suppress Timer\n"
2836 return pim_process_no_register_suppress_cmd(vty
);
2839 DEFPY (ip_pim_rp_keep_alive
,
2840 ip_pim_rp_keep_alive_cmd
,
2841 "ip pim rp keep-alive-timer (1-65535)$kat",
2843 "pim multicast routing\n"
2844 "Rendezvous Point\n"
2845 "Keep alive Timer\n"
2848 return pim_process_rp_kat_cmd(vty
, kat_str
);
2851 DEFUN (no_ip_pim_rp_keep_alive
,
2852 no_ip_pim_rp_keep_alive_cmd
,
2853 "no ip pim rp keep-alive-timer [(1-65535)]",
2856 "pim multicast routing\n"
2857 "Rendezvous Point\n"
2858 "Keep alive Timer\n"
2861 return pim_process_no_rp_kat_cmd(vty
);
2864 DEFPY (ip_pim_keep_alive
,
2865 ip_pim_keep_alive_cmd
,
2866 "ip pim keep-alive-timer (1-65535)$kat",
2868 "pim multicast routing\n"
2869 "Keep alive Timer\n"
2872 return pim_process_keepalivetimer_cmd(vty
, kat_str
);
2875 DEFUN (no_ip_pim_keep_alive
,
2876 no_ip_pim_keep_alive_cmd
,
2877 "no ip pim keep-alive-timer [(1-65535)]",
2880 "pim multicast routing\n"
2881 "Keep alive Timer\n"
2884 return pim_process_no_keepalivetimer_cmd(vty
);
2887 DEFPY (ip_pim_packets
,
2889 "ip pim packets (1-255)",
2891 "pim multicast routing\n"
2892 "packets to process at one time per fd\n"
2893 "Number of packets\n")
2895 return pim_process_pim_packet_cmd(vty
, packets_str
);
2898 DEFUN (no_ip_pim_packets
,
2899 no_ip_pim_packets_cmd
,
2900 "no ip pim packets [(1-255)]",
2903 "pim multicast routing\n"
2904 "packets to process at one time per fd\n"
2907 return pim_process_no_pim_packet_cmd(vty
);
2910 DEFPY (ip_igmp_group_watermark
,
2911 ip_igmp_group_watermark_cmd
,
2912 "ip igmp watermark-warn (1-65535)$limit",
2915 "Configure group limit for watermark warning\n"
2916 "Group count to generate watermark warning\n")
2918 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
2919 pim
->gm_watermark_limit
= limit
;
2924 DEFPY (no_ip_igmp_group_watermark
,
2925 no_ip_igmp_group_watermark_cmd
,
2926 "no ip igmp watermark-warn [(1-65535)$limit]",
2930 "Unconfigure group limit for watermark warning\n"
2933 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
2934 pim
->gm_watermark_limit
= 0;
2939 DEFUN (ip_pim_v6_secondary
,
2940 ip_pim_v6_secondary_cmd
,
2941 "ip pim send-v6-secondary",
2943 "pim multicast routing\n"
2944 "Send v6 secondary addresses\n")
2946 const char *vrfname
;
2947 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
2949 vrfname
= pim_cli_get_vrf_name(vty
);
2950 if (vrfname
== NULL
)
2951 return CMD_WARNING_CONFIG_FAILED
;
2953 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
2955 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
2956 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
2957 sizeof(send_v6_secondary_xpath
));
2959 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
2962 return nb_cli_apply_changes(vty
, NULL
);
2965 DEFUN (no_ip_pim_v6_secondary
,
2966 no_ip_pim_v6_secondary_cmd
,
2967 "no ip pim send-v6-secondary",
2970 "pim multicast routing\n"
2971 "Send v6 secondary addresses\n")
2973 const char *vrfname
;
2974 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
2976 vrfname
= pim_cli_get_vrf_name(vty
);
2977 if (vrfname
== NULL
)
2978 return CMD_WARNING_CONFIG_FAILED
;
2980 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
2982 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
2983 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
2984 sizeof(send_v6_secondary_xpath
));
2986 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
2989 return nb_cli_apply_changes(vty
, NULL
);
2994 "ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
2996 "pim multicast routing\n"
2997 "Rendezvous Point\n"
2998 "ip address of RP\n"
2999 "Group Address range to cover\n")
3001 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3003 return pim_process_rp_cmd(vty
, rp_str
, group_str
);
3006 DEFPY (ip_pim_rp_prefix_list
,
3007 ip_pim_rp_prefix_list_cmd
,
3008 "ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3010 "pim multicast routing\n"
3011 "Rendezvous Point\n"
3012 "ip address of RP\n"
3013 "group prefix-list filter\n"
3014 "Name of a prefix-list\n")
3016 return pim_process_rp_plist_cmd(vty
, rp_str
, plist
);
3019 DEFPY (no_ip_pim_rp
,
3021 "no ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3024 "pim multicast routing\n"
3025 "Rendezvous Point\n"
3026 "ip address of RP\n"
3027 "Group Address range to cover\n")
3029 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3031 return pim_process_no_rp_cmd(vty
, rp_str
, group_str
);
3034 DEFPY (no_ip_pim_rp_prefix_list
,
3035 no_ip_pim_rp_prefix_list_cmd
,
3036 "no ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3039 "pim multicast routing\n"
3040 "Rendezvous Point\n"
3041 "ip address of RP\n"
3042 "group prefix-list filter\n"
3043 "Name of a prefix-list\n")
3045 return pim_process_no_rp_plist_cmd(vty
, rp_str
, plist
);
3048 DEFUN (ip_pim_ssm_prefix_list
,
3049 ip_pim_ssm_prefix_list_cmd
,
3050 "ip pim ssm prefix-list WORD",
3052 "pim multicast routing\n"
3053 "Source Specific Multicast\n"
3054 "group range prefix-list filter\n"
3055 "Name of a prefix-list\n")
3057 const char *vrfname
;
3058 char ssm_plist_xpath
[XPATH_MAXLEN
];
3060 vrfname
= pim_cli_get_vrf_name(vty
);
3061 if (vrfname
== NULL
)
3062 return CMD_WARNING_CONFIG_FAILED
;
3064 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
), FRR_PIM_VRF_XPATH
,
3065 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3066 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3068 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_MODIFY
, argv
[4]->arg
);
3070 return nb_cli_apply_changes(vty
, NULL
);
3073 DEFUN (no_ip_pim_ssm_prefix_list
,
3074 no_ip_pim_ssm_prefix_list_cmd
,
3075 "no ip pim ssm prefix-list",
3078 "pim multicast routing\n"
3079 "Source Specific Multicast\n"
3080 "group range prefix-list filter\n")
3082 const char *vrfname
;
3083 char ssm_plist_xpath
[XPATH_MAXLEN
];
3085 vrfname
= pim_cli_get_vrf_name(vty
);
3086 if (vrfname
== NULL
)
3087 return CMD_WARNING_CONFIG_FAILED
;
3089 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3091 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3092 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3094 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
, NULL
);
3096 return nb_cli_apply_changes(vty
, NULL
);
3099 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3100 no_ip_pim_ssm_prefix_list_name_cmd
,
3101 "no ip pim ssm prefix-list WORD",
3104 "pim multicast routing\n"
3105 "Source Specific Multicast\n"
3106 "group range prefix-list filter\n"
3107 "Name of a prefix-list\n")
3109 const char *vrfname
;
3110 const struct lyd_node
*ssm_plist_dnode
;
3111 char ssm_plist_xpath
[XPATH_MAXLEN
];
3112 const char *ssm_plist_name
;
3114 vrfname
= pim_cli_get_vrf_name(vty
);
3115 if (vrfname
== NULL
)
3116 return CMD_WARNING_CONFIG_FAILED
;
3118 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3120 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3121 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3122 ssm_plist_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
3125 if (!ssm_plist_dnode
) {
3127 "%% pim ssm prefix-list %s doesn't exist\n",
3129 return CMD_WARNING_CONFIG_FAILED
;
3132 ssm_plist_name
= yang_dnode_get_string(ssm_plist_dnode
, ".");
3134 if (ssm_plist_name
&& !strcmp(ssm_plist_name
, argv
[5]->arg
)) {
3135 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
,
3138 return nb_cli_apply_changes(vty
, NULL
);
3141 vty_out(vty
, "%% pim ssm prefix-list %s doesn't exist\n", argv
[5]->arg
);
3143 return CMD_WARNING_CONFIG_FAILED
;
3146 DEFUN (show_ip_pim_ssm_range
,
3147 show_ip_pim_ssm_range_cmd
,
3148 "show ip pim [vrf NAME] group-type [json]",
3157 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3158 bool uj
= use_json(argc
, argv
);
3163 ip_pim_ssm_show_group_range(vrf
->info
, vty
, uj
);
3168 static void ip_pim_ssm_show_group_type(struct pim_instance
*pim
,
3169 struct vty
*vty
, bool uj
,
3172 struct in_addr group_addr
;
3173 const char *type_str
;
3176 result
= inet_pton(AF_INET
, group
, &group_addr
);
3178 type_str
= "invalid";
3180 if (pim_is_group_224_4(group_addr
))
3182 pim_is_grp_ssm(pim
, group_addr
) ? "SSM" : "ASM";
3184 type_str
= "not-multicast";
3189 json
= json_object_new_object();
3190 json_object_string_add(json
, "groupType", type_str
);
3191 vty_json(vty
, json
);
3193 vty_out(vty
, "Group type : %s\n", type_str
);
3196 DEFUN (show_ip_pim_group_type
,
3197 show_ip_pim_group_type_cmd
,
3198 "show ip pim [vrf NAME] group-type A.B.C.D [json]",
3203 "multicast group type\n"
3208 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3209 bool uj
= use_json(argc
, argv
);
3214 argv_find(argv
, argc
, "A.B.C.D", &idx
);
3215 ip_pim_ssm_show_group_type(vrf
->info
, vty
, uj
, argv
[idx
]->arg
);
3220 DEFPY (show_ip_pim_bsr
,
3221 show_ip_pim_bsr_cmd
,
3222 "show ip pim bsr [vrf NAME] [json$json]",
3226 "boot-strap router information\n"
3230 return pim_show_bsr_helper(vrf
, vty
, !!json
);
3235 "ip ssmpingd [A.B.C.D]",
3241 const char *src_str
= (argc
== 3) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3243 return pim_process_ssmpingd_cmd(vty
, NB_OP_CREATE
, src_str
);
3246 DEFUN (no_ip_ssmpingd
,
3248 "no ip ssmpingd [A.B.C.D]",
3255 const char *src_str
= (argc
== 4) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3257 return pim_process_ssmpingd_cmd(vty
, NB_OP_DESTROY
, src_str
);
3264 "pim multicast routing\n"
3265 "Enable PIM ECMP \n")
3267 const char *vrfname
;
3268 char ecmp_xpath
[XPATH_MAXLEN
];
3270 vrfname
= pim_cli_get_vrf_name(vty
);
3271 if (vrfname
== NULL
)
3272 return CMD_WARNING_CONFIG_FAILED
;
3274 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3275 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3276 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3278 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3279 return nb_cli_apply_changes(vty
, NULL
);
3282 DEFUN (no_ip_pim_ecmp
,
3287 "pim multicast routing\n"
3288 "Disable PIM ECMP \n")
3290 const char *vrfname
;
3291 char ecmp_xpath
[XPATH_MAXLEN
];
3293 vrfname
= pim_cli_get_vrf_name(vty
);
3294 if (vrfname
== NULL
)
3295 return CMD_WARNING_CONFIG_FAILED
;
3297 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3298 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3299 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3301 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "false");
3303 return nb_cli_apply_changes(vty
, NULL
);
3306 DEFUN (ip_pim_ecmp_rebalance
,
3307 ip_pim_ecmp_rebalance_cmd
,
3308 "ip pim ecmp rebalance",
3310 "pim multicast routing\n"
3311 "Enable PIM ECMP \n"
3312 "Enable PIM ECMP Rebalance\n")
3314 const char *vrfname
;
3315 char ecmp_xpath
[XPATH_MAXLEN
];
3316 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3318 vrfname
= pim_cli_get_vrf_name(vty
);
3319 if (vrfname
== NULL
)
3320 return CMD_WARNING_CONFIG_FAILED
;
3322 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3323 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3324 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3325 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3327 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3328 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3329 sizeof(ecmp_rebalance_xpath
));
3331 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3332 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "true");
3334 return nb_cli_apply_changes(vty
, NULL
);
3337 DEFUN (no_ip_pim_ecmp_rebalance
,
3338 no_ip_pim_ecmp_rebalance_cmd
,
3339 "no ip pim ecmp rebalance",
3342 "pim multicast routing\n"
3343 "Disable PIM ECMP \n"
3344 "Disable PIM ECMP Rebalance\n")
3346 const char *vrfname
;
3347 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3349 vrfname
= pim_cli_get_vrf_name(vty
);
3350 if (vrfname
== NULL
)
3351 return CMD_WARNING_CONFIG_FAILED
;
3353 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3355 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3356 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3357 sizeof(ecmp_rebalance_xpath
));
3359 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "false");
3361 return nb_cli_apply_changes(vty
, NULL
);
3364 DEFUN (interface_ip_igmp
,
3365 interface_ip_igmp_cmd
,
3370 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
, "true");
3372 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3373 "frr-routing:ipv4");
3376 DEFUN (interface_no_ip_igmp
,
3377 interface_no_ip_igmp_cmd
,
3383 const struct lyd_node
*pim_enable_dnode
;
3384 char pim_if_xpath
[XPATH_MAXLEN
];
3387 snprintf(pim_if_xpath
, sizeof(pim_if_xpath
),
3388 "%s/frr-pim:pim/address-family[address-family='%s']",
3389 VTY_CURR_XPATH
, "frr-routing:ipv4");
3391 if (printed
>= (int)(sizeof(pim_if_xpath
))) {
3392 vty_out(vty
, "Xpath too long (%d > %u)", printed
+ 1,
3394 return CMD_WARNING_CONFIG_FAILED
;
3397 pim_enable_dnode
= yang_dnode_getf(vty
->candidate_config
->dnode
,
3398 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3399 "frr-routing:ipv4");
3400 if (!pim_enable_dnode
) {
3401 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
, NULL
);
3402 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3404 if (!yang_dnode_get_bool(pim_enable_dnode
, ".")) {
3405 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
,
3407 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3409 nb_cli_enqueue_change(vty
, "./enable",
3410 NB_OP_MODIFY
, "false");
3413 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3414 "frr-routing:ipv4");
3417 DEFUN (interface_ip_igmp_join
,
3418 interface_ip_igmp_join_cmd
,
3419 "ip igmp join A.B.C.D [A.B.C.D]",
3422 "IGMP join multicast group\n"
3423 "Multicast group address\n"
3428 const char *source_str
;
3429 char xpath
[XPATH_MAXLEN
];
3432 source_str
= argv
[idx_source
]->arg
;
3434 if (strcmp(source_str
, "0.0.0.0") == 0) {
3435 vty_out(vty
, "Bad source address %s\n",
3436 argv
[idx_source
]->arg
);
3437 return CMD_WARNING_CONFIG_FAILED
;
3440 source_str
= "0.0.0.0";
3442 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3443 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3445 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
3447 return nb_cli_apply_changes(vty
, NULL
);
3450 DEFUN (interface_no_ip_igmp_join
,
3451 interface_no_ip_igmp_join_cmd
,
3452 "no ip igmp join A.B.C.D [A.B.C.D]",
3456 "IGMP join multicast group\n"
3457 "Multicast group address\n"
3462 const char *source_str
;
3463 char xpath
[XPATH_MAXLEN
];
3466 source_str
= argv
[idx_source
]->arg
;
3468 if (strcmp(source_str
, "0.0.0.0") == 0) {
3469 vty_out(vty
, "Bad source address %s\n",
3470 argv
[idx_source
]->arg
);
3471 return CMD_WARNING_CONFIG_FAILED
;
3474 source_str
= "0.0.0.0";
3476 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3477 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3479 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
3481 return nb_cli_apply_changes(vty
, NULL
);
3484 DEFUN (interface_ip_igmp_query_interval
,
3485 interface_ip_igmp_query_interval_cmd
,
3486 "ip igmp query-interval (1-65535)",
3489 IFACE_IGMP_QUERY_INTERVAL_STR
3490 "Query interval in seconds\n")
3492 const struct lyd_node
*pim_enable_dnode
;
3495 yang_dnode_getf(vty
->candidate_config
->dnode
,
3496 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3497 "frr-routing:ipv4");
3498 if (!pim_enable_dnode
) {
3499 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3502 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3503 nb_cli_enqueue_change(vty
, "./enable",
3504 NB_OP_MODIFY
, "true");
3507 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_MODIFY
,
3510 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3511 "frr-routing:ipv4");
3514 DEFUN (interface_no_ip_igmp_query_interval
,
3515 interface_no_ip_igmp_query_interval_cmd
,
3516 "no ip igmp query-interval [(1-65535)]",
3520 IFACE_IGMP_QUERY_INTERVAL_STR
3523 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_DESTROY
, NULL
);
3525 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3526 "frr-routing:ipv4");
3529 DEFUN (interface_ip_igmp_version
,
3530 interface_ip_igmp_version_cmd
,
3531 "ip igmp version (2-3)",
3535 "IGMP version number\n")
3537 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3539 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_MODIFY
,
3542 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3543 "frr-routing:ipv4");
3546 DEFUN (interface_no_ip_igmp_version
,
3547 interface_no_ip_igmp_version_cmd
,
3548 "no ip igmp version (2-3)",
3553 "IGMP version number\n")
3555 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_DESTROY
, NULL
);
3557 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3558 "frr-routing:ipv4");
3561 DEFPY (interface_ip_igmp_query_max_response_time
,
3562 interface_ip_igmp_query_max_response_time_cmd
,
3563 "ip igmp query-max-response-time (1-65535)$qmrt",
3566 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3567 "Query response value in deci-seconds\n")
3569 return gm_process_query_max_response_time_cmd(vty
, qmrt_str
);
3572 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3573 interface_no_ip_igmp_query_max_response_time_cmd
,
3574 "no ip igmp query-max-response-time [(1-65535)]",
3578 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3581 return gm_process_no_query_max_response_time_cmd(vty
);
3584 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
3585 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3586 "ip igmp query-max-response-time-dsec (1-65535)",
3589 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3590 "Query response value in deciseconds\n")
3592 const struct lyd_node
*pim_enable_dnode
;
3595 yang_dnode_getf(vty
->candidate_config
->dnode
,
3596 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3597 "frr-routing:ipv4");
3598 if (!pim_enable_dnode
) {
3599 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3602 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3603 nb_cli_enqueue_change(vty
, "./enable",
3604 NB_OP_MODIFY
, "true");
3607 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_MODIFY
,
3610 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3611 "frr-routing:ipv4");
3614 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
3615 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
3616 "no ip igmp query-max-response-time-dsec [(1-65535)]",
3620 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3623 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_DESTROY
,
3626 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3627 "frr-routing:ipv4");
3630 DEFPY (interface_ip_igmp_last_member_query_count
,
3631 interface_ip_igmp_last_member_query_count_cmd
,
3632 "ip igmp last-member-query-count (1-255)$lmqc",
3635 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
3636 "Last member query count\n")
3638 return gm_process_last_member_query_count_cmd(vty
, lmqc_str
);
3641 DEFUN (interface_no_ip_igmp_last_member_query_count
,
3642 interface_no_ip_igmp_last_member_query_count_cmd
,
3643 "no ip igmp last-member-query-count [(1-255)]",
3647 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
3650 return gm_process_no_last_member_query_count_cmd(vty
);
3653 DEFPY (interface_ip_igmp_last_member_query_interval
,
3654 interface_ip_igmp_last_member_query_interval_cmd
,
3655 "ip igmp last-member-query-interval (1-65535)$lmqi",
3658 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
3659 "Last member query interval in deciseconds\n")
3661 return gm_process_last_member_query_interval_cmd(vty
, lmqi_str
);
3664 DEFUN (interface_no_ip_igmp_last_member_query_interval
,
3665 interface_no_ip_igmp_last_member_query_interval_cmd
,
3666 "no ip igmp last-member-query-interval [(1-65535)]",
3670 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
3673 return gm_process_no_last_member_query_interval_cmd(vty
);
3676 DEFUN (interface_ip_pim_drprio
,
3677 interface_ip_pim_drprio_cmd
,
3678 "ip pim drpriority (1-4294967295)",
3681 "Set the Designated Router Election Priority\n"
3682 "Value of the new DR Priority\n")
3686 return pim_process_ip_pim_drprio_cmd(vty
, argv
[idx_number
]->arg
);
3689 DEFUN (interface_no_ip_pim_drprio
,
3690 interface_no_ip_pim_drprio_cmd
,
3691 "no ip pim drpriority [(1-4294967295)]",
3695 "Revert the Designated Router Priority to default\n"
3696 "Old Value of the Priority\n")
3698 return pim_process_no_ip_pim_drprio_cmd(vty
);
3701 DEFPY_HIDDEN (interface_ip_igmp_query_generate
,
3702 interface_ip_igmp_query_generate_cmd
,
3703 "ip igmp generate-query-once [version (2-3)]",
3706 "Generate igmp general query once\n"
3708 "IGMP version number\n")
3711 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3713 struct pim_interface
*pim_ifp
= ifp
->info
;
3716 vty_out(vty
, "IGMP/PIM is not enabled on the interface %s\n",
3718 return CMD_WARNING_CONFIG_FAILED
;
3721 /* It takes the igmp version configured on the interface as default */
3722 igmp_version
= pim_ifp
->igmp_version
;
3725 igmp_version
= atoi(argv
[4]->arg
);
3727 igmp_send_query_on_intf(ifp
, igmp_version
);
3732 DEFPY_HIDDEN (pim_test_sg_keepalive
,
3733 pim_test_sg_keepalive_cmd
,
3734 "test pim [vrf NAME$name] keepalive-reset A.B.C.D$source A.B.C.D$group",
3738 "Reset the Keepalive Timer\n"
3739 "The Source we are resetting\n"
3740 "The Group we are resetting\n")
3742 struct pim_upstream
*up
;
3744 struct pim_instance
*pim
;
3750 vrf
= vrf_lookup_by_name(name
? name
: VRF_DEFAULT_NAME
);
3752 vty_out(vty
, "%% Vrf specified: %s does not exist\n", name
);
3759 vty_out(vty
, "%% Unable to find pim instance\n");
3763 up
= pim_upstream_find(pim
, &sg
);
3765 vty_out(vty
, "%% Unable to find %pSG specified\n", &sg
);
3769 vty_out(vty
, "Setting %pSG to current keep alive time: %d\n", &sg
,
3770 pim
->keep_alive_time
);
3771 pim_upstream_keep_alive_timer_start(up
, pim
->keep_alive_time
);
3776 DEFPY (interface_ip_pim_activeactive
,
3777 interface_ip_pim_activeactive_cmd
,
3778 "[no$no] ip pim active-active",
3782 "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
3784 return pim_process_ip_pim_activeactive_cmd(vty
, no
);
3787 DEFUN_HIDDEN (interface_ip_pim_ssm
,
3788 interface_ip_pim_ssm_cmd
,
3796 ret
= pim_process_ip_pim_cmd(vty
);
3802 "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed\n");
3807 DEFUN_HIDDEN (interface_ip_pim_sm
,
3808 interface_ip_pim_sm_cmd
,
3814 return pim_process_ip_pim_cmd(vty
);
3817 DEFPY (interface_ip_pim
,
3818 interface_ip_pim_cmd
,
3819 "ip pim [passive$passive]",
3822 "Disable exchange of protocol packets\n")
3826 ret
= pim_process_ip_pim_cmd(vty
);
3832 return pim_process_ip_pim_passive_cmd(vty
, true);
3837 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
3838 interface_no_ip_pim_ssm_cmd
,
3845 return pim_process_no_ip_pim_cmd(vty
);
3848 DEFUN_HIDDEN (interface_no_ip_pim_sm
,
3849 interface_no_ip_pim_sm_cmd
,
3856 return pim_process_no_ip_pim_cmd(vty
);
3859 DEFPY (interface_no_ip_pim
,
3860 interface_no_ip_pim_cmd
,
3861 "no ip pim [passive$passive]",
3865 "Disable exchange of protocol packets\n")
3868 return pim_process_ip_pim_passive_cmd(vty
, false);
3870 return pim_process_no_ip_pim_cmd(vty
);
3874 DEFUN(interface_ip_pim_boundary_oil
,
3875 interface_ip_pim_boundary_oil_cmd
,
3876 "ip multicast boundary oil WORD",
3878 "Generic multicast configuration options\n"
3879 "Define multicast boundary\n"
3880 "Filter OIL by group using prefix list\n"
3881 "Prefix list to filter OIL with\n")
3883 return pim_process_ip_pim_boundary_oil_cmd(vty
, argv
[4]->arg
);
3886 DEFUN(interface_no_ip_pim_boundary_oil
,
3887 interface_no_ip_pim_boundary_oil_cmd
,
3888 "no ip multicast boundary oil [WORD]",
3891 "Generic multicast configuration options\n"
3892 "Define multicast boundary\n"
3893 "Filter OIL by group using prefix list\n"
3894 "Prefix list to filter OIL with\n")
3896 return pim_process_no_ip_pim_boundary_oil_cmd(vty
);
3899 DEFUN (interface_ip_mroute
,
3900 interface_ip_mroute_cmd
,
3901 "ip mroute INTERFACE A.B.C.D [A.B.C.D]",
3903 "Add multicast route\n"
3904 "Outgoing interface name\n"
3908 int idx_interface
= 2;
3910 const char *source_str
;
3912 if (argc
== (idx_ipv4
+ 1))
3913 source_str
= "0.0.0.0";
3915 source_str
= argv
[idx_ipv4
+ 1]->arg
;
3917 return pim_process_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
3918 argv
[idx_ipv4
]->arg
, source_str
);
3921 DEFUN (interface_no_ip_mroute
,
3922 interface_no_ip_mroute_cmd
,
3923 "no ip mroute INTERFACE A.B.C.D [A.B.C.D]",
3926 "Add multicast route\n"
3927 "Outgoing interface name\n"
3931 int idx_interface
= 3;
3933 const char *source_str
;
3935 if (argc
== (idx_ipv4
+ 1))
3936 source_str
= "0.0.0.0";
3938 source_str
= argv
[idx_ipv4
+ 1]->arg
;
3940 return pim_process_no_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
3941 argv
[idx_ipv4
]->arg
, source_str
);
3944 DEFUN (interface_ip_pim_hello
,
3945 interface_ip_pim_hello_cmd
,
3946 "ip pim hello (1-65535) [(1-65535)]",
3950 IFACE_PIM_HELLO_TIME_STR
3951 IFACE_PIM_HELLO_HOLD_STR
)
3956 if (argc
== idx_hold
+ 1)
3957 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
3958 argv
[idx_hold
]->arg
);
3961 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
3965 DEFUN (interface_no_ip_pim_hello
,
3966 interface_no_ip_pim_hello_cmd
,
3967 "no ip pim hello [(1-65535) [(1-65535)]]",
3975 return pim_process_no_ip_pim_hello_cmd(vty
);
3984 PIM_DO_DEBUG_GM_EVENTS
;
3985 PIM_DO_DEBUG_GM_PACKETS
;
3986 PIM_DO_DEBUG_GM_TRACE
;
3990 DEFUN (no_debug_igmp
,
3997 PIM_DONT_DEBUG_GM_EVENTS
;
3998 PIM_DONT_DEBUG_GM_PACKETS
;
3999 PIM_DONT_DEBUG_GM_TRACE
;
4004 DEFUN (debug_igmp_events
,
4005 debug_igmp_events_cmd
,
4006 "debug igmp events",
4009 DEBUG_IGMP_EVENTS_STR
)
4011 PIM_DO_DEBUG_GM_EVENTS
;
4015 DEFUN (no_debug_igmp_events
,
4016 no_debug_igmp_events_cmd
,
4017 "no debug igmp events",
4021 DEBUG_IGMP_EVENTS_STR
)
4023 PIM_DONT_DEBUG_GM_EVENTS
;
4028 DEFUN (debug_igmp_packets
,
4029 debug_igmp_packets_cmd
,
4030 "debug igmp packets",
4033 DEBUG_IGMP_PACKETS_STR
)
4035 PIM_DO_DEBUG_GM_PACKETS
;
4039 DEFUN (no_debug_igmp_packets
,
4040 no_debug_igmp_packets_cmd
,
4041 "no debug igmp packets",
4045 DEBUG_IGMP_PACKETS_STR
)
4047 PIM_DONT_DEBUG_GM_PACKETS
;
4052 DEFUN (debug_igmp_trace
,
4053 debug_igmp_trace_cmd
,
4057 DEBUG_IGMP_TRACE_STR
)
4059 PIM_DO_DEBUG_GM_TRACE
;
4063 DEFUN (no_debug_igmp_trace
,
4064 no_debug_igmp_trace_cmd
,
4065 "no debug igmp trace",
4069 DEBUG_IGMP_TRACE_STR
)
4071 PIM_DONT_DEBUG_GM_TRACE
;
4076 DEFUN (debug_igmp_trace_detail
,
4077 debug_igmp_trace_detail_cmd
,
4078 "debug igmp trace detail",
4081 DEBUG_IGMP_TRACE_STR
4084 PIM_DO_DEBUG_GM_TRACE_DETAIL
;
4088 DEFUN (no_debug_igmp_trace_detail
,
4089 no_debug_igmp_trace_detail_cmd
,
4090 "no debug igmp trace detail",
4094 DEBUG_IGMP_TRACE_STR
4097 PIM_DONT_DEBUG_GM_TRACE_DETAIL
;
4102 DEFUN (debug_mroute
,
4108 PIM_DO_DEBUG_MROUTE
;
4112 DEFUN (debug_mroute_detail
,
4113 debug_mroute_detail_cmd
,
4114 "debug mroute detail",
4119 PIM_DO_DEBUG_MROUTE_DETAIL
;
4123 DEFUN (no_debug_mroute
,
4124 no_debug_mroute_cmd
,
4130 PIM_DONT_DEBUG_MROUTE
;
4134 DEFUN (no_debug_mroute_detail
,
4135 no_debug_mroute_detail_cmd
,
4136 "no debug mroute detail",
4142 PIM_DONT_DEBUG_MROUTE_DETAIL
;
4146 DEFUN (debug_pim_static
,
4147 debug_pim_static_cmd
,
4153 PIM_DO_DEBUG_STATIC
;
4157 DEFUN (no_debug_pim_static
,
4158 no_debug_pim_static_cmd
,
4159 "no debug pim static",
4165 PIM_DONT_DEBUG_STATIC
;
4178 return pim_debug_pim_cmd();
4180 return pim_no_debug_pim_cmd();
4183 DEFPY (debug_pim_nht
,
4185 "[no] debug pim nht",
4189 "Nexthop Tracking\n")
4192 PIM_DO_DEBUG_PIM_NHT
;
4194 PIM_DONT_DEBUG_PIM_NHT
;
4198 DEFPY (debug_pim_nht_det
,
4199 debug_pim_nht_det_cmd
,
4200 "[no] debug pim nht detail",
4204 "Nexthop Tracking\n"
4205 "Detailed Information\n")
4208 PIM_DO_DEBUG_PIM_NHT_DETAIL
;
4210 PIM_DONT_DEBUG_PIM_NHT_DETAIL
;
4214 DEFUN (debug_pim_nht_rp
,
4215 debug_pim_nht_rp_cmd
,
4219 "Nexthop Tracking\n"
4220 "RP Nexthop Tracking\n")
4222 PIM_DO_DEBUG_PIM_NHT_RP
;
4226 DEFUN (no_debug_pim_nht_rp
,
4227 no_debug_pim_nht_rp_cmd
,
4228 "no debug pim nht rp",
4232 "Nexthop Tracking\n"
4233 "RP Nexthop Tracking\n")
4235 PIM_DONT_DEBUG_PIM_NHT_RP
;
4239 DEFPY (debug_pim_events
,
4240 debug_pim_events_cmd
,
4241 "[no] debug pim events",
4245 DEBUG_PIM_EVENTS_STR
)
4248 PIM_DO_DEBUG_PIM_EVENTS
;
4250 PIM_DONT_DEBUG_PIM_EVENTS
;
4254 DEFPY (debug_pim_packets
,
4255 debug_pim_packets_cmd
,
4256 "[no] debug pim packets [<hello$hello|joins$joins|register$registers>]",
4259 DEBUG_PIM_PACKETS_STR
4260 DEBUG_PIM_HELLO_PACKETS_STR
4261 DEBUG_PIM_J_P_PACKETS_STR
4262 DEBUG_PIM_PIM_REG_PACKETS_STR
)
4265 return pim_debug_pim_packets_cmd(hello
, joins
, registers
, vty
);
4267 return pim_no_debug_pim_packets_cmd(hello
, joins
, registers
,
4271 DEFPY (debug_pim_packetdump_send
,
4272 debug_pim_packetdump_send_cmd
,
4273 "[no] debug pim packet-dump send",
4277 DEBUG_PIM_PACKETDUMP_STR
4278 DEBUG_PIM_PACKETDUMP_SEND_STR
)
4281 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
4283 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
4287 DEFPY (debug_pim_packetdump_recv
,
4288 debug_pim_packetdump_recv_cmd
,
4289 "[no] debug pim packet-dump receive",
4293 DEBUG_PIM_PACKETDUMP_STR
4294 DEBUG_PIM_PACKETDUMP_RECV_STR
)
4297 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
4299 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
4303 DEFPY (debug_pim_trace
,
4304 debug_pim_trace_cmd
,
4305 "[no] debug pim trace",
4309 DEBUG_PIM_TRACE_STR
)
4312 PIM_DO_DEBUG_PIM_TRACE
;
4314 PIM_DONT_DEBUG_PIM_TRACE
;
4318 DEFPY (debug_pim_trace_detail
,
4319 debug_pim_trace_detail_cmd
,
4320 "[no] debug pim trace detail",
4325 "Detailed Information\n")
4328 PIM_DO_DEBUG_PIM_TRACE_DETAIL
;
4330 PIM_DONT_DEBUG_PIM_TRACE_DETAIL
;
4334 DEFUN (debug_ssmpingd
,
4340 PIM_DO_DEBUG_SSMPINGD
;
4344 DEFUN (no_debug_ssmpingd
,
4345 no_debug_ssmpingd_cmd
,
4346 "no debug ssmpingd",
4351 PIM_DONT_DEBUG_SSMPINGD
;
4355 DEFPY (debug_pim_zebra
,
4356 debug_pim_zebra_cmd
,
4357 "[no] debug pim zebra",
4361 DEBUG_PIM_ZEBRA_STR
)
4366 PIM_DONT_DEBUG_ZEBRA
;
4370 DEFUN(debug_pim_mlag
, debug_pim_mlag_cmd
, "debug pim mlag",
4371 DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4377 DEFUN(no_debug_pim_mlag
, no_debug_pim_mlag_cmd
, "no debug pim mlag",
4378 NO_STR DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4380 PIM_DONT_DEBUG_MLAG
;
4384 DEFUN (debug_pim_vxlan
,
4385 debug_pim_vxlan_cmd
,
4389 DEBUG_PIM_VXLAN_STR
)
4395 DEFUN (no_debug_pim_vxlan
,
4396 no_debug_pim_vxlan_cmd
,
4397 "no debug pim vxlan",
4401 DEBUG_PIM_VXLAN_STR
)
4403 PIM_DONT_DEBUG_VXLAN
;
4413 PIM_DO_DEBUG_MSDP_EVENTS
;
4414 PIM_DO_DEBUG_MSDP_PACKETS
;
4418 DEFUN (no_debug_msdp
,
4425 PIM_DONT_DEBUG_MSDP_EVENTS
;
4426 PIM_DONT_DEBUG_MSDP_PACKETS
;
4430 DEFUN (debug_msdp_events
,
4431 debug_msdp_events_cmd
,
4432 "debug msdp events",
4435 DEBUG_MSDP_EVENTS_STR
)
4437 PIM_DO_DEBUG_MSDP_EVENTS
;
4441 DEFUN (no_debug_msdp_events
,
4442 no_debug_msdp_events_cmd
,
4443 "no debug msdp events",
4447 DEBUG_MSDP_EVENTS_STR
)
4449 PIM_DONT_DEBUG_MSDP_EVENTS
;
4453 DEFUN (debug_msdp_packets
,
4454 debug_msdp_packets_cmd
,
4455 "debug msdp packets",
4458 DEBUG_MSDP_PACKETS_STR
)
4460 PIM_DO_DEBUG_MSDP_PACKETS
;
4464 DEFUN (no_debug_msdp_packets
,
4465 no_debug_msdp_packets_cmd
,
4466 "no debug msdp packets",
4470 DEBUG_MSDP_PACKETS_STR
)
4472 PIM_DONT_DEBUG_MSDP_PACKETS
;
4476 DEFUN (debug_mtrace
,
4482 PIM_DO_DEBUG_MTRACE
;
4486 DEFUN (no_debug_mtrace
,
4487 no_debug_mtrace_cmd
,
4493 PIM_DONT_DEBUG_MTRACE
;
4508 DEFUN (no_debug_bsm
,
4521 DEFUN_NOSH (show_debugging_pim
,
4522 show_debugging_pim_cmd
,
4523 "show debugging [pim]",
4528 vty_out(vty
, "PIM debugging status\n");
4530 pim_debug_config_write(vty
);
4532 cmd_show_lib_debugs(vty
);
4536 DEFUN (interface_pim_use_source
,
4537 interface_pim_use_source_cmd
,
4538 "ip pim use-source A.B.C.D",
4541 "Configure primary IP address\n"
4542 "source ip address\n")
4544 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, argv
[3]->arg
);
4546 return nb_cli_apply_changes(vty
,
4547 FRR_PIM_INTERFACE_XPATH
,
4548 "frr-routing:ipv4");
4551 DEFUN (interface_no_pim_use_source
,
4552 interface_no_pim_use_source_cmd
,
4553 "no ip pim use-source [A.B.C.D]",
4557 "Delete source IP address\n"
4558 "source ip address\n")
4560 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, "0.0.0.0");
4562 return nb_cli_apply_changes(vty
,
4563 FRR_PIM_INTERFACE_XPATH
,
4564 "frr-routing:ipv4");
4569 "ip pim bfd [profile BFDPROF$prof]",
4572 "Enables BFD support\n"
4574 "Use BFD profile name\n")
4576 const struct lyd_node
*igmp_enable_dnode
;
4579 yang_dnode_getf(vty
->candidate_config
->dnode
,
4580 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
4581 "frr-routing:ipv4");
4582 if (!igmp_enable_dnode
)
4583 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4586 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
4587 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4591 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
4593 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_MODIFY
, prof
);
4595 return nb_cli_apply_changes(vty
,
4596 FRR_PIM_INTERFACE_XPATH
,
4597 "frr-routing:ipv4");
4600 DEFPY(no_ip_pim_bfd_profile
, no_ip_pim_bfd_profile_cmd
,
4601 "no ip pim bfd profile [BFDPROF]",
4605 "Enables BFD support\n"
4606 "Disable BFD profile\n"
4607 "BFD Profile name\n")
4609 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_DESTROY
, NULL
);
4611 return nb_cli_apply_changes(vty
,
4612 FRR_PIM_INTERFACE_XPATH
,
4613 "frr-routing:ipv4");
4616 DEFUN (no_ip_pim_bfd
,
4622 "Disables BFD support\n")
4624 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_DESTROY
, NULL
);
4626 return nb_cli_apply_changes(vty
,
4627 FRR_PIM_INTERFACE_XPATH
,
4628 "frr-routing:ipv4");
4636 "Enable BSM support on the interface\n")
4638 return pim_process_bsm_cmd(vty
);
4640 DEFUN (no_ip_pim_bsm
,
4646 "Enable BSM support on the interface\n")
4648 return pim_process_no_bsm_cmd(vty
);
4651 DEFUN (ip_pim_ucast_bsm
,
4652 ip_pim_ucast_bsm_cmd
,
4653 "ip pim unicast-bsm",
4656 "Accept/Send unicast BSM on the interface\n")
4658 return pim_process_unicast_bsm_cmd(vty
);
4661 DEFUN (no_ip_pim_ucast_bsm
,
4662 no_ip_pim_ucast_bsm_cmd
,
4663 "no ip pim unicast-bsm",
4667 "Accept/Send unicast BSM on the interface\n")
4669 return pim_process_no_unicast_bsm_cmd(vty
);
4675 ip_pim_bfd_param_cmd
,
4676 "ip pim bfd (2-255) (1-65535) (1-65535)",
4679 "Enables BFD support\n"
4680 "Detect Multiplier\n"
4681 "Required min receive interval\n"
4682 "Desired min transmit interval\n")
4686 ip_pim_bfd_param_cmd
,
4687 "ip pim bfd (2-255) (1-65535) (1-65535)",
4690 "Enables BFD support\n"
4691 "Detect Multiplier\n"
4692 "Required min receive interval\n"
4693 "Desired min transmit interval\n")
4694 #endif /* HAVE_BFDD */
4697 int idx_number_2
= 4;
4698 int idx_number_3
= 5;
4699 const struct lyd_node
*igmp_enable_dnode
;
4702 yang_dnode_getf(vty
->candidate_config
->dnode
,
4703 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
4704 "frr-routing:ipv4");
4705 if (!igmp_enable_dnode
)
4706 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4709 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
4710 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4714 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
4715 nb_cli_enqueue_change(vty
, "./bfd/min-rx-interval", NB_OP_MODIFY
,
4716 argv
[idx_number_2
]->arg
);
4717 nb_cli_enqueue_change(vty
, "./bfd/min-tx-interval", NB_OP_MODIFY
,
4718 argv
[idx_number_3
]->arg
);
4719 nb_cli_enqueue_change(vty
, "./bfd/detect_mult", NB_OP_MODIFY
,
4720 argv
[idx_number
]->arg
);
4722 return nb_cli_apply_changes(vty
,
4723 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
4727 ALIAS(no_ip_pim_bfd
, no_ip_pim_bfd_param_cmd
,
4728 "no ip pim bfd (2-255) (1-65535) (1-65535)",
4732 "Enables BFD support\n"
4733 "Detect Multiplier\n"
4734 "Required min receive interval\n"
4735 "Desired min transmit interval\n")
4736 #endif /* !HAVE_BFDD */
4738 DEFPY(ip_msdp_peer
, ip_msdp_peer_cmd
,
4739 "ip msdp peer A.B.C.D$peer source A.B.C.D$source",
4742 "Configure MSDP peer\n"
4744 "Source address for TCP connection\n"
4745 "Local IP address\n")
4747 const char *vrfname
;
4748 char temp_xpath
[XPATH_MAXLEN
];
4749 char msdp_peer_source_xpath
[XPATH_MAXLEN
];
4751 vrfname
= pim_cli_get_vrf_name(vty
);
4752 if (vrfname
== NULL
)
4753 return CMD_WARNING_CONFIG_FAILED
;
4755 snprintf(msdp_peer_source_xpath
, sizeof(msdp_peer_source_xpath
),
4756 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
4757 "frr-routing:ipv4");
4758 snprintf(temp_xpath
, sizeof(temp_xpath
),
4759 "/msdp-peer[peer-ip='%s']/source-ip", peer_str
);
4760 strlcat(msdp_peer_source_xpath
, temp_xpath
,
4761 sizeof(msdp_peer_source_xpath
));
4763 nb_cli_enqueue_change(vty
, msdp_peer_source_xpath
, NB_OP_MODIFY
,
4766 return nb_cli_apply_changes(vty
,
4767 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
4770 DEFPY(ip_msdp_timers
, ip_msdp_timers_cmd
,
4771 "ip msdp timers (1-65535)$keepalive (1-65535)$holdtime [(1-65535)$connretry]",
4774 "MSDP timers configuration\n"
4775 "Keep alive period (in seconds)\n"
4776 "Hold time period (in seconds)\n"
4777 "Connection retry period (in seconds)\n")
4779 const char *vrfname
;
4780 char xpath
[XPATH_MAXLEN
];
4782 vrfname
= pim_cli_get_vrf_name(vty
);
4783 if (vrfname
== NULL
)
4784 return CMD_WARNING_CONFIG_FAILED
;
4786 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
4787 "pim", vrfname
, "frr-routing:ipv4");
4788 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_MODIFY
, holdtime_str
);
4789 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_MODIFY
, keepalive_str
);
4791 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_MODIFY
,
4794 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
,
4797 nb_cli_apply_changes(vty
, xpath
);
4802 DEFPY(no_ip_msdp_timers
, no_ip_msdp_timers_cmd
,
4803 "no ip msdp timers [(1-65535) (1-65535) [(1-65535)]]",
4807 "MSDP timers configuration\n"
4812 const char *vrfname
;
4813 char xpath
[XPATH_MAXLEN
];
4815 vrfname
= pim_cli_get_vrf_name(vty
);
4816 if (vrfname
== NULL
)
4817 return CMD_WARNING_CONFIG_FAILED
;
4819 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
4820 "pim", vrfname
, "frr-routing:ipv4");
4822 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_DESTROY
, NULL
);
4823 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_DESTROY
, NULL
);
4824 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
, NULL
);
4826 nb_cli_apply_changes(vty
, xpath
);
4831 DEFUN (no_ip_msdp_peer
,
4832 no_ip_msdp_peer_cmd
,
4833 "no ip msdp peer A.B.C.D",
4837 "Delete MSDP peer\n"
4838 "peer ip address\n")
4840 const char *vrfname
;
4841 char msdp_peer_xpath
[XPATH_MAXLEN
];
4842 char temp_xpath
[XPATH_MAXLEN
];
4844 vrfname
= pim_cli_get_vrf_name(vty
);
4845 if (vrfname
== NULL
)
4846 return CMD_WARNING_CONFIG_FAILED
;
4848 snprintf(msdp_peer_xpath
, sizeof(msdp_peer_xpath
),
4850 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
4851 snprintf(temp_xpath
, sizeof(temp_xpath
),
4852 "/msdp-peer[peer-ip='%s']",
4855 strlcat(msdp_peer_xpath
, temp_xpath
, sizeof(msdp_peer_xpath
));
4857 nb_cli_enqueue_change(vty
, msdp_peer_xpath
, NB_OP_DESTROY
, NULL
);
4859 return nb_cli_apply_changes(vty
, NULL
);
4862 DEFPY(ip_msdp_mesh_group_member
,
4863 ip_msdp_mesh_group_member_cmd
,
4864 "ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
4867 "Configure MSDP mesh-group\n"
4869 "Mesh group member\n"
4870 "Peer IP address\n")
4872 const char *vrfname
;
4873 char xpath_value
[XPATH_MAXLEN
];
4875 vrfname
= pim_cli_get_vrf_name(vty
);
4876 if (vrfname
== NULL
)
4877 return CMD_WARNING_CONFIG_FAILED
;
4879 /* Create mesh group. */
4880 snprintf(xpath_value
, sizeof(xpath_value
),
4881 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4882 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
4883 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
4885 /* Create mesh group member. */
4886 strlcat(xpath_value
, "/members[address='", sizeof(xpath_value
));
4887 strlcat(xpath_value
, maddr_str
, sizeof(xpath_value
));
4888 strlcat(xpath_value
, "']", sizeof(xpath_value
));
4889 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
4891 return nb_cli_apply_changes(vty
, NULL
);
4894 DEFPY(no_ip_msdp_mesh_group_member
,
4895 no_ip_msdp_mesh_group_member_cmd
,
4896 "no ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
4900 "Delete MSDP mesh-group member\n"
4902 "Mesh group member\n"
4903 "Peer IP address\n")
4905 const char *vrfname
;
4906 char xpath_value
[XPATH_MAXLEN
];
4907 char xpath_member_value
[XPATH_MAXLEN
];
4909 vrfname
= pim_cli_get_vrf_name(vty
);
4910 if (vrfname
== NULL
)
4911 return CMD_WARNING_CONFIG_FAILED
;
4913 /* Get mesh group base XPath. */
4914 snprintf(xpath_value
, sizeof(xpath_value
),
4915 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4916 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
4918 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
)) {
4919 vty_out(vty
, "%% mesh-group does not exist\n");
4920 return CMD_WARNING_CONFIG_FAILED
;
4923 /* Remove mesh group member. */
4924 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
4925 strlcat(xpath_member_value
, "/members[address='",
4926 sizeof(xpath_member_value
));
4927 strlcat(xpath_member_value
, maddr_str
, sizeof(xpath_member_value
));
4928 strlcat(xpath_member_value
, "']", sizeof(xpath_member_value
));
4929 if (!yang_dnode_exists(vty
->candidate_config
->dnode
,
4930 xpath_member_value
)) {
4931 vty_out(vty
, "%% mesh-group member does not exist\n");
4932 return CMD_WARNING_CONFIG_FAILED
;
4935 nb_cli_enqueue_change(vty
, xpath_member_value
, NB_OP_DESTROY
, NULL
);
4938 * If this is the last member, then we must remove the group altogether
4939 * to not break legacy CLI behaviour.
4941 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
4943 return nb_cli_apply_changes(vty
, NULL
);
4946 DEFPY(ip_msdp_mesh_group_source
,
4947 ip_msdp_mesh_group_source_cmd
,
4948 "ip msdp mesh-group WORD$gname source A.B.C.D$saddr",
4951 "Configure MSDP mesh-group\n"
4953 "Mesh group local address\n"
4954 "Source IP address for the TCP connection\n")
4956 const char *vrfname
;
4957 char xpath_value
[XPATH_MAXLEN
];
4959 vrfname
= pim_cli_get_vrf_name(vty
);
4960 if (vrfname
== NULL
)
4961 return CMD_WARNING_CONFIG_FAILED
;
4963 /* Create mesh group. */
4964 snprintf(xpath_value
, sizeof(xpath_value
),
4965 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4966 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
4967 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
4969 /* Create mesh group source. */
4970 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
4971 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_MODIFY
, saddr_str
);
4973 return nb_cli_apply_changes(vty
, NULL
);
4976 DEFPY(no_ip_msdp_mesh_group_source
,
4977 no_ip_msdp_mesh_group_source_cmd
,
4978 "no ip msdp mesh-group WORD$gname source [A.B.C.D]",
4982 "Delete MSDP mesh-group source\n"
4984 "Mesh group source\n"
4985 "Mesh group local address\n")
4987 const char *vrfname
;
4988 char xpath_value
[XPATH_MAXLEN
];
4990 vrfname
= pim_cli_get_vrf_name(vty
);
4991 if (vrfname
== NULL
)
4992 return CMD_WARNING_CONFIG_FAILED
;
4994 /* Get mesh group base XPath. */
4995 snprintf(xpath_value
, sizeof(xpath_value
),
4996 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
4997 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
4998 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5000 /* Create mesh group source. */
5001 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5002 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5005 * If this is the last member, then we must remove the group altogether
5006 * to not break legacy CLI behaviour.
5008 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5010 return nb_cli_apply_changes(vty
, NULL
);
5013 DEFPY(no_ip_msdp_mesh_group
,
5014 no_ip_msdp_mesh_group_cmd
,
5015 "no ip msdp mesh-group WORD$gname",
5019 "Delete MSDP mesh-group\n"
5020 "Mesh group name\n")
5022 const char *vrfname
;
5023 char xpath_value
[XPATH_MAXLEN
];
5025 vrfname
= pim_cli_get_vrf_name(vty
);
5026 if (vrfname
== NULL
)
5027 return CMD_WARNING_CONFIG_FAILED
;
5029 /* Get mesh group base XPath. */
5030 snprintf(xpath_value
, sizeof(xpath_value
),
5031 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5032 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5033 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
5036 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5037 return nb_cli_apply_changes(vty
, NULL
);
5040 static void ip_msdp_show_mesh_group(struct vty
*vty
, struct pim_msdp_mg
*mg
,
5041 struct json_object
*json
)
5043 struct listnode
*mbrnode
;
5044 struct pim_msdp_mg_mbr
*mbr
;
5045 char mbr_str
[INET_ADDRSTRLEN
];
5046 char src_str
[INET_ADDRSTRLEN
];
5047 char state_str
[PIM_MSDP_STATE_STRLEN
];
5048 enum pim_msdp_peer_state state
;
5049 json_object
*json_mg_row
= NULL
;
5050 json_object
*json_members
= NULL
;
5051 json_object
*json_row
= NULL
;
5053 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
5055 /* currently there is only one mesh group but we should still
5057 * it a dict with mg-name as key */
5058 json_mg_row
= json_object_new_object();
5059 json_object_string_add(json_mg_row
, "name",
5060 mg
->mesh_group_name
);
5061 json_object_string_add(json_mg_row
, "source", src_str
);
5063 vty_out(vty
, "Mesh group : %s\n", mg
->mesh_group_name
);
5064 vty_out(vty
, " Source : %s\n", src_str
);
5065 vty_out(vty
, " Member State\n");
5068 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
5069 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
5071 state
= mbr
->mp
->state
;
5073 state
= PIM_MSDP_DISABLED
;
5075 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
5077 json_row
= json_object_new_object();
5078 json_object_string_add(json_row
, "member", mbr_str
);
5079 json_object_string_add(json_row
, "state", state_str
);
5080 if (!json_members
) {
5081 json_members
= json_object_new_object();
5082 json_object_object_add(json_mg_row
, "members",
5085 json_object_object_add(json_members
, mbr_str
, json_row
);
5087 vty_out(vty
, " %-15s %11s\n", mbr_str
, state_str
);
5092 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
5095 DEFUN (show_ip_msdp_mesh_group
,
5096 show_ip_msdp_mesh_group_cmd
,
5097 "show ip msdp [vrf NAME] mesh-group [json]",
5102 "MSDP mesh-group information\n"
5105 bool uj
= use_json(argc
, argv
);
5107 struct pim_msdp_mg
*mg
;
5108 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5109 struct pim_instance
*pim
;
5110 struct json_object
*json
= NULL
;
5116 /* Quick case: list is empty. */
5117 if (SLIST_EMPTY(&pim
->msdp
.mglist
)) {
5119 vty_out(vty
, "{}\n");
5125 json
= json_object_new_object();
5127 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5128 ip_msdp_show_mesh_group(vty
, mg
, json
);
5131 vty_json(vty
, json
);
5136 DEFUN (show_ip_msdp_mesh_group_vrf_all
,
5137 show_ip_msdp_mesh_group_vrf_all_cmd
,
5138 "show ip msdp vrf all mesh-group [json]",
5143 "MSDP mesh-group information\n"
5146 bool uj
= use_json(argc
, argv
);
5147 struct json_object
*json
= NULL
, *vrf_json
= NULL
;
5148 struct pim_instance
*pim
;
5149 struct pim_msdp_mg
*mg
;
5153 json
= json_object_new_object();
5155 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5157 vrf_json
= json_object_new_object();
5158 json_object_object_add(json
, vrf
->name
, vrf_json
);
5160 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5163 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5164 ip_msdp_show_mesh_group(vty
, mg
, vrf_json
);
5168 vty_json(vty
, json
);
5174 static void ip_msdp_show_peers(struct pim_instance
*pim
, struct vty
*vty
,
5177 struct listnode
*mpnode
;
5178 struct pim_msdp_peer
*mp
;
5179 char peer_str
[INET_ADDRSTRLEN
];
5180 char local_str
[INET_ADDRSTRLEN
];
5181 char state_str
[PIM_MSDP_STATE_STRLEN
];
5182 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5184 json_object
*json
= NULL
;
5185 json_object
*json_row
= NULL
;
5189 json
= json_object_new_object();
5192 "Peer Local State Uptime SaCnt\n");
5195 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5196 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5197 now
= pim_time_monotonic_sec();
5198 pim_time_uptime(timebuf
, sizeof(timebuf
),
5201 strlcpy(timebuf
, "-", sizeof(timebuf
));
5203 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5204 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5206 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5208 json_row
= json_object_new_object();
5209 json_object_string_add(json_row
, "peer", peer_str
);
5210 json_object_string_add(json_row
, "local", local_str
);
5211 json_object_string_add(json_row
, "state", state_str
);
5212 json_object_string_add(json_row
, "upTime", timebuf
);
5213 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5214 json_object_object_add(json
, peer_str
, json_row
);
5216 vty_out(vty
, "%-15s %15s %11s %8s %6d\n", peer_str
,
5217 local_str
, state_str
, timebuf
, mp
->sa_cnt
);
5222 vty_json(vty
, json
);
5225 static void ip_msdp_show_peers_detail(struct pim_instance
*pim
, struct vty
*vty
,
5226 const char *peer
, bool uj
)
5228 struct listnode
*mpnode
;
5229 struct pim_msdp_peer
*mp
;
5230 char peer_str
[INET_ADDRSTRLEN
];
5231 char local_str
[INET_ADDRSTRLEN
];
5232 char state_str
[PIM_MSDP_STATE_STRLEN
];
5233 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5234 char katimer
[PIM_MSDP_TIMER_STRLEN
];
5235 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
5236 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
5238 json_object
*json
= NULL
;
5239 json_object
*json_row
= NULL
;
5242 json
= json_object_new_object();
5245 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5246 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5247 if (strcmp(peer
, "detail") && strcmp(peer
, peer_str
))
5250 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5251 now
= pim_time_monotonic_sec();
5252 pim_time_uptime(timebuf
, sizeof(timebuf
),
5255 strlcpy(timebuf
, "-", sizeof(timebuf
));
5257 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5259 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5260 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
),
5262 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
),
5264 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
),
5268 json_row
= json_object_new_object();
5269 json_object_string_add(json_row
, "peer", peer_str
);
5270 json_object_string_add(json_row
, "local", local_str
);
5271 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5272 json_object_string_add(json_row
,
5274 mp
->mesh_group_name
);
5275 json_object_string_add(json_row
, "state", state_str
);
5276 json_object_string_add(json_row
, "upTime", timebuf
);
5277 json_object_string_add(json_row
, "keepAliveTimer",
5279 json_object_string_add(json_row
, "connRetryTimer",
5281 json_object_string_add(json_row
, "holdTimer",
5283 json_object_string_add(json_row
, "lastReset",
5285 json_object_int_add(json_row
, "connAttempts",
5287 json_object_int_add(json_row
, "establishedChanges",
5289 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5290 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
5291 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
5292 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
5293 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
5294 json_object_object_add(json
, peer_str
, json_row
);
5296 vty_out(vty
, "Peer : %s\n", peer_str
);
5297 vty_out(vty
, " Local : %s\n", local_str
);
5298 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5299 vty_out(vty
, " Mesh Group : %s\n",
5300 mp
->mesh_group_name
);
5301 vty_out(vty
, " State : %s\n", state_str
);
5302 vty_out(vty
, " Uptime : %s\n", timebuf
);
5304 vty_out(vty
, " Keepalive Timer : %s\n", katimer
);
5305 vty_out(vty
, " Conn Retry Timer : %s\n", crtimer
);
5306 vty_out(vty
, " Hold Timer : %s\n", holdtimer
);
5307 vty_out(vty
, " Last Reset : %s\n",
5309 vty_out(vty
, " Conn Attempts : %d\n",
5311 vty_out(vty
, " Established Changes : %d\n",
5313 vty_out(vty
, " SA Count : %d\n",
5315 vty_out(vty
, " Statistics :\n");
5318 vty_out(vty
, " Keepalives : %10d %10d\n",
5319 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
);
5320 vty_out(vty
, " SAs : %10d %10d\n",
5321 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
);
5327 vty_json(vty
, json
);
5330 DEFUN (show_ip_msdp_peer_detail
,
5331 show_ip_msdp_peer_detail_cmd
,
5332 "show ip msdp [vrf NAME] peer [detail|A.B.C.D] [json]",
5337 "MSDP peer information\n"
5342 bool uj
= use_json(argc
, argv
);
5344 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5351 if (argv_find(argv
, argc
, "detail", &idx
))
5352 arg
= argv
[idx
]->text
;
5353 else if (argv_find(argv
, argc
, "A.B.C.D", &idx
))
5354 arg
= argv
[idx
]->arg
;
5357 ip_msdp_show_peers_detail(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
5359 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5364 DEFUN (show_ip_msdp_peer_detail_vrf_all
,
5365 show_ip_msdp_peer_detail_vrf_all_cmd
,
5366 "show ip msdp vrf all peer [detail|A.B.C.D] [json]",
5371 "MSDP peer information\n"
5377 bool uj
= use_json(argc
, argv
);
5383 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5387 vty_out(vty
, " \"%s\": ", vrf
->name
);
5390 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5391 if (argv_find(argv
, argc
, "detail", &idx
)
5392 || argv_find(argv
, argc
, "A.B.C.D", &idx
))
5393 ip_msdp_show_peers_detail(vrf
->info
, vty
,
5394 argv
[idx
]->arg
, uj
);
5396 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5399 vty_out(vty
, "}\n");
5404 static void ip_msdp_show_sa(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
5406 struct listnode
*sanode
;
5407 struct pim_msdp_sa
*sa
;
5408 char rp_str
[INET_ADDRSTRLEN
];
5409 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5413 json_object
*json
= NULL
;
5414 json_object
*json_group
= NULL
;
5415 json_object
*json_row
= NULL
;
5418 json
= json_object_new_object();
5421 "Source Group RP Local SPT Uptime\n");
5424 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5425 now
= pim_time_monotonic_sec();
5426 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5427 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5428 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5430 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5432 strlcpy(spt_str
, "no", sizeof(spt_str
));
5435 strlcpy(rp_str
, "-", sizeof(rp_str
));
5436 strlcpy(spt_str
, "-", sizeof(spt_str
));
5438 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5439 strlcpy(local_str
, "yes", sizeof(local_str
));
5441 strlcpy(local_str
, "no", sizeof(local_str
));
5444 char src_str
[PIM_ADDRSTRLEN
];
5445 char grp_str
[PIM_ADDRSTRLEN
];
5447 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
5449 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
5452 json_object_object_get_ex(json
, grp_str
, &json_group
);
5455 json_group
= json_object_new_object();
5456 json_object_object_add(json
, grp_str
,
5460 json_row
= json_object_new_object();
5461 json_object_string_add(json_row
, "source", src_str
);
5462 json_object_string_add(json_row
, "group", grp_str
);
5463 json_object_string_add(json_row
, "rp", rp_str
);
5464 json_object_string_add(json_row
, "local", local_str
);
5465 json_object_string_add(json_row
, "sptSetup", spt_str
);
5466 json_object_string_add(json_row
, "upTime", timebuf
);
5467 json_object_object_add(json_group
, src_str
, json_row
);
5469 vty_out(vty
, "%-15pPAs %15pPAs %15s %5c %3c %8s\n",
5470 &sa
->sg
.src
, &sa
->sg
.grp
, rp_str
, local_str
[0],
5471 spt_str
[0], timebuf
);
5476 vty_json(vty
, json
);
5479 static void ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
,
5480 const char *src_str
,
5481 const char *grp_str
, struct vty
*vty
,
5482 bool uj
, json_object
*json
)
5484 char rp_str
[INET_ADDRSTRLEN
];
5485 char peer_str
[INET_ADDRSTRLEN
];
5486 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5489 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
5491 json_object
*json_group
= NULL
;
5492 json_object
*json_row
= NULL
;
5494 now
= pim_time_monotonic_sec();
5495 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5496 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5497 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5498 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
5500 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5502 strlcpy(spt_str
, "no", sizeof(spt_str
));
5505 strlcpy(rp_str
, "-", sizeof(rp_str
));
5506 strlcpy(peer_str
, "-", sizeof(peer_str
));
5507 strlcpy(spt_str
, "-", sizeof(spt_str
));
5509 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5510 strlcpy(local_str
, "yes", sizeof(local_str
));
5512 strlcpy(local_str
, "no", sizeof(local_str
));
5514 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
),
5515 sa
->sa_state_timer
);
5517 json_object_object_get_ex(json
, grp_str
, &json_group
);
5520 json_group
= json_object_new_object();
5521 json_object_object_add(json
, grp_str
, json_group
);
5524 json_row
= json_object_new_object();
5525 json_object_string_add(json_row
, "source", src_str
);
5526 json_object_string_add(json_row
, "group", grp_str
);
5527 json_object_string_add(json_row
, "rp", rp_str
);
5528 json_object_string_add(json_row
, "local", local_str
);
5529 json_object_string_add(json_row
, "sptSetup", spt_str
);
5530 json_object_string_add(json_row
, "upTime", timebuf
);
5531 json_object_string_add(json_row
, "stateTimer", statetimer
);
5532 json_object_object_add(json_group
, src_str
, json_row
);
5534 vty_out(vty
, "SA : %s\n", sa
->sg_str
);
5535 vty_out(vty
, " RP : %s\n", rp_str
);
5536 vty_out(vty
, " Peer : %s\n", peer_str
);
5537 vty_out(vty
, " Local : %s\n", local_str
);
5538 vty_out(vty
, " SPT Setup : %s\n", spt_str
);
5539 vty_out(vty
, " Uptime : %s\n", timebuf
);
5540 vty_out(vty
, " State Timer : %s\n", statetimer
);
5545 static void ip_msdp_show_sa_detail(struct pim_instance
*pim
, struct vty
*vty
,
5548 struct listnode
*sanode
;
5549 struct pim_msdp_sa
*sa
;
5550 json_object
*json
= NULL
;
5553 json
= json_object_new_object();
5556 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5557 char src_str
[PIM_ADDRSTRLEN
];
5558 char grp_str
[PIM_ADDRSTRLEN
];
5560 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5561 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5563 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
,
5568 vty_json(vty
, json
);
5571 DEFUN (show_ip_msdp_sa_detail
,
5572 show_ip_msdp_sa_detail_cmd
,
5573 "show ip msdp [vrf NAME] sa detail [json]",
5578 "MSDP active-source information\n"
5582 bool uj
= use_json(argc
, argv
);
5584 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5589 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
5594 DEFUN (show_ip_msdp_sa_detail_vrf_all
,
5595 show_ip_msdp_sa_detail_vrf_all_cmd
,
5596 "show ip msdp vrf all sa detail [json]",
5601 "MSDP active-source information\n"
5605 bool uj
= use_json(argc
, argv
);
5611 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5615 vty_out(vty
, " \"%s\": ", vrf
->name
);
5618 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5619 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
5622 vty_out(vty
, "}\n");
5627 static void ip_msdp_show_sa_addr(struct pim_instance
*pim
, struct vty
*vty
,
5628 const char *addr
, bool uj
)
5630 struct listnode
*sanode
;
5631 struct pim_msdp_sa
*sa
;
5632 json_object
*json
= NULL
;
5635 json
= json_object_new_object();
5638 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5639 char src_str
[PIM_ADDRSTRLEN
];
5640 char grp_str
[PIM_ADDRSTRLEN
];
5642 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5643 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5645 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
5646 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
5652 vty_json(vty
, json
);
5655 static void ip_msdp_show_sa_sg(struct pim_instance
*pim
, struct vty
*vty
,
5656 const char *src
, const char *grp
, bool uj
)
5658 struct listnode
*sanode
;
5659 struct pim_msdp_sa
*sa
;
5660 json_object
*json
= NULL
;
5663 json
= json_object_new_object();
5666 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5667 char src_str
[PIM_ADDRSTRLEN
];
5668 char grp_str
[PIM_ADDRSTRLEN
];
5670 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5671 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5673 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
5674 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
5680 vty_json(vty
, json
);
5683 DEFUN (show_ip_msdp_sa_sg
,
5684 show_ip_msdp_sa_sg_cmd
,
5685 "show ip msdp [vrf NAME] sa [A.B.C.D [A.B.C.D]] [json]",
5690 "MSDP active-source information\n"
5691 "source or group ip\n"
5695 bool uj
= use_json(argc
, argv
);
5699 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5704 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
5706 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
5710 if (src_ip
&& grp_ip
)
5711 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
5713 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
5715 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
5720 DEFUN (show_ip_msdp_sa_sg_vrf_all
,
5721 show_ip_msdp_sa_sg_vrf_all_cmd
,
5722 "show ip msdp vrf all sa [A.B.C.D [A.B.C.D]] [json]",
5727 "MSDP active-source information\n"
5728 "source or group ip\n"
5732 bool uj
= use_json(argc
, argv
);
5737 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
5739 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
5745 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5749 vty_out(vty
, " \"%s\": ", vrf
->name
);
5752 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5754 if (src_ip
&& grp_ip
)
5755 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
5757 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
5759 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
5762 vty_out(vty
, "}\n");
5767 struct pim_sg_cache_walk_data
{
5770 json_object
*json_group
;
5771 struct in_addr addr
;
5775 static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg
*vxlan_sg
,
5776 struct pim_sg_cache_walk_data
*cwd
)
5778 struct vty
*vty
= cwd
->vty
;
5779 json_object
*json
= cwd
->json
;
5780 json_object
*json_row
;
5781 bool installed
= (vxlan_sg
->up
) ? true : false;
5782 const char *iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
5783 const char *oif_name
;
5785 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
5786 oif_name
= vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
5788 oif_name
= vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
5790 if (cwd
->addr_match
&& pim_addr_cmp(vxlan_sg
->sg
.src
, cwd
->addr
) &&
5791 pim_addr_cmp(vxlan_sg
->sg
.grp
, cwd
->addr
)) {
5795 char src_str
[PIM_ADDRSTRLEN
];
5796 char grp_str
[PIM_ADDRSTRLEN
];
5798 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
5800 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
5803 json_object_object_get_ex(json
, grp_str
, &cwd
->json_group
);
5805 if (!cwd
->json_group
) {
5806 cwd
->json_group
= json_object_new_object();
5807 json_object_object_add(json
, grp_str
,
5811 json_row
= json_object_new_object();
5812 json_object_string_add(json_row
, "source", src_str
);
5813 json_object_string_add(json_row
, "group", grp_str
);
5814 json_object_string_add(json_row
, "input", iif_name
);
5815 json_object_string_add(json_row
, "output", oif_name
);
5817 json_object_boolean_true_add(json_row
, "installed");
5819 json_object_boolean_false_add(json_row
, "installed");
5820 json_object_object_add(cwd
->json_group
, src_str
, json_row
);
5822 vty_out(vty
, "%-15pPAs %-15pPAs %-15s %-15s %-5s\n",
5823 &vxlan_sg
->sg
.src
, &vxlan_sg
->sg
.grp
, iif_name
,
5824 oif_name
, installed
? "I" : "");
5828 static void pim_show_vxlan_sg_hash_entry(struct hash_bucket
*bucket
, void *arg
)
5830 pim_show_vxlan_sg_entry((struct pim_vxlan_sg
*)bucket
->data
,
5831 (struct pim_sg_cache_walk_data
*)arg
);
5834 static void pim_show_vxlan_sg(struct pim_instance
*pim
,
5835 struct vty
*vty
, bool uj
)
5837 json_object
*json
= NULL
;
5838 struct pim_sg_cache_walk_data cwd
;
5841 json
= json_object_new_object();
5843 vty_out(vty
, "Codes: I -> installed\n");
5845 "Source Group Input Output Flags\n");
5848 memset(&cwd
, 0, sizeof(cwd
));
5851 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
5854 vty_json(vty
, json
);
5857 static void pim_show_vxlan_sg_match_addr(struct pim_instance
*pim
,
5858 struct vty
*vty
, char *addr_str
,
5861 json_object
*json
= NULL
;
5862 struct pim_sg_cache_walk_data cwd
;
5865 memset(&cwd
, 0, sizeof(cwd
));
5866 result
= inet_pton(AF_INET
, addr_str
, &cwd
.addr
);
5868 vty_out(vty
, "Bad address %s: errno=%d: %s\n", addr_str
,
5869 errno
, safe_strerror(errno
));
5874 json
= json_object_new_object();
5876 vty_out(vty
, "Codes: I -> installed\n");
5878 "Source Group Input Output Flags\n");
5883 cwd
.addr_match
= true;
5884 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
5887 vty_json(vty
, json
);
5890 static void pim_show_vxlan_sg_one(struct pim_instance
*pim
,
5891 struct vty
*vty
, char *src_str
, char *grp_str
,
5894 json_object
*json
= NULL
;
5897 struct pim_vxlan_sg
*vxlan_sg
;
5898 const char *iif_name
;
5900 const char *oif_name
;
5902 result
= inet_pton(AF_INET
, src_str
, &sg
.src
);
5904 vty_out(vty
, "Bad src address %s: errno=%d: %s\n", src_str
,
5905 errno
, safe_strerror(errno
));
5908 result
= inet_pton(AF_INET
, grp_str
, &sg
.grp
);
5910 vty_out(vty
, "Bad grp address %s: errno=%d: %s\n", grp_str
,
5911 errno
, safe_strerror(errno
));
5916 json
= json_object_new_object();
5918 vxlan_sg
= pim_vxlan_sg_find(pim
, &sg
);
5920 installed
= (vxlan_sg
->up
) ? true : false;
5921 iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
5923 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
5925 vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
5928 vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
5931 json_object_string_add(json
, "source", src_str
);
5932 json_object_string_add(json
, "group", grp_str
);
5933 json_object_string_add(json
, "input", iif_name
);
5934 json_object_string_add(json
, "output", oif_name
);
5936 json_object_boolean_true_add(json
, "installed");
5938 json_object_boolean_false_add(json
,
5941 vty_out(vty
, "SG : %s\n", vxlan_sg
->sg_str
);
5942 vty_out(vty
, " Input : %s\n", iif_name
);
5943 vty_out(vty
, " Output : %s\n", oif_name
);
5944 vty_out(vty
, " installed : %s\n",
5945 installed
?"yes":"no");
5950 vty_json(vty
, json
);
5953 DEFUN (show_ip_pim_vxlan_sg
,
5954 show_ip_pim_vxlan_sg_cmd
,
5955 "show ip pim [vrf NAME] vxlan-groups [A.B.C.D [A.B.C.D]] [json]",
5960 "VxLAN BUM groups\n"
5961 "source or group ip\n"
5965 bool uj
= use_json(argc
, argv
);
5969 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5974 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
5975 argv
[idx
++]->arg
:NULL
;
5976 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
5977 argv
[idx
]->arg
:NULL
;
5979 if (src_ip
&& grp_ip
)
5980 pim_show_vxlan_sg_one(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
5982 pim_show_vxlan_sg_match_addr(vrf
->info
, vty
, src_ip
, uj
);
5984 pim_show_vxlan_sg(vrf
->info
, vty
, uj
);
5989 static void pim_show_vxlan_sg_work(struct pim_instance
*pim
,
5990 struct vty
*vty
, bool uj
)
5992 json_object
*json
= NULL
;
5993 struct pim_sg_cache_walk_data cwd
;
5994 struct listnode
*node
;
5995 struct pim_vxlan_sg
*vxlan_sg
;
5998 json
= json_object_new_object();
6000 vty_out(vty
, "Codes: I -> installed\n");
6002 "Source Group Input Flags\n");
6005 memset(&cwd
, 0, sizeof(cwd
));
6008 for (ALL_LIST_ELEMENTS_RO(pim_vxlan_p
->work_list
, node
, vxlan_sg
))
6009 pim_show_vxlan_sg_entry(vxlan_sg
, &cwd
);
6012 vty_json(vty
, json
);
6015 DEFUN_HIDDEN (show_ip_pim_vxlan_sg_work
,
6016 show_ip_pim_vxlan_sg_work_cmd
,
6017 "show ip pim [vrf NAME] vxlan-work [json]",
6025 bool uj
= use_json(argc
, argv
);
6029 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6034 pim_show_vxlan_sg_work(vrf
->info
, vty
, uj
);
6039 DEFUN_HIDDEN (no_ip_pim_mlag
,
6047 char mlag_xpath
[XPATH_MAXLEN
];
6049 snprintf(mlag_xpath
, sizeof(mlag_xpath
), FRR_PIM_VRF_XPATH
,
6050 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6051 strlcat(mlag_xpath
, "/mlag", sizeof(mlag_xpath
));
6053 nb_cli_enqueue_change(vty
, mlag_xpath
, NB_OP_DESTROY
, NULL
);
6056 return nb_cli_apply_changes(vty
, NULL
);
6059 DEFUN_HIDDEN (ip_pim_mlag
,
6061 "ip pim mlag INTERFACE role [primary|secondary] state [up|down] addr A.B.C.D",
6065 "peerlink sub interface\n"
6067 "MLAG role primary\n"
6068 "MLAG role secondary\n"
6069 "peer session state\n"
6070 "peer session state up\n"
6071 "peer session state down\n"
6073 "unique ip address\n")
6076 char mlag_peerlink_rif_xpath
[XPATH_MAXLEN
];
6077 char mlag_my_role_xpath
[XPATH_MAXLEN
];
6078 char mlag_peer_state_xpath
[XPATH_MAXLEN
];
6079 char mlag_reg_address_xpath
[XPATH_MAXLEN
];
6081 snprintf(mlag_peerlink_rif_xpath
, sizeof(mlag_peerlink_rif_xpath
),
6083 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6084 strlcat(mlag_peerlink_rif_xpath
, "/mlag/peerlink-rif",
6085 sizeof(mlag_peerlink_rif_xpath
));
6088 nb_cli_enqueue_change(vty
, mlag_peerlink_rif_xpath
, NB_OP_MODIFY
,
6091 snprintf(mlag_my_role_xpath
, sizeof(mlag_my_role_xpath
),
6093 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6094 strlcat(mlag_my_role_xpath
, "/mlag/my-role",
6095 sizeof(mlag_my_role_xpath
));
6098 if (!strcmp(argv
[idx
]->arg
, "primary")) {
6099 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6100 "MLAG_ROLE_PRIMARY");
6102 } else if (!strcmp(argv
[idx
]->arg
, "secondary")) {
6103 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6104 "MLAG_ROLE_SECONDARY");
6107 vty_out(vty
, "unknown MLAG role %s\n", argv
[idx
]->arg
);
6111 snprintf(mlag_peer_state_xpath
, sizeof(mlag_peer_state_xpath
),
6113 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6114 strlcat(mlag_peer_state_xpath
, "/mlag/peer-state",
6115 sizeof(mlag_peer_state_xpath
));
6118 if (!strcmp(argv
[idx
]->arg
, "up")) {
6119 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6122 } else if (strcmp(argv
[idx
]->arg
, "down")) {
6123 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6127 vty_out(vty
, "unknown MLAG state %s\n", argv
[idx
]->arg
);
6131 snprintf(mlag_reg_address_xpath
, sizeof(mlag_reg_address_xpath
),
6133 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6134 strlcat(mlag_reg_address_xpath
, "/mlag/reg-address",
6135 sizeof(mlag_reg_address_xpath
));
6138 nb_cli_enqueue_change(vty
, mlag_reg_address_xpath
, NB_OP_MODIFY
,
6141 return nb_cli_apply_changes(vty
, NULL
);
6144 void pim_cmd_init(void)
6146 if_cmd_init(pim_interface_config_write
);
6148 install_node(&debug_node
);
6150 install_element(ENABLE_NODE
, &pim_test_sg_keepalive_cmd
);
6152 install_element(CONFIG_NODE
, &ip_pim_rp_cmd
);
6153 install_element(VRF_NODE
, &ip_pim_rp_cmd
);
6154 install_element(CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6155 install_element(VRF_NODE
, &no_ip_pim_rp_cmd
);
6156 install_element(CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6157 install_element(VRF_NODE
, &ip_pim_rp_prefix_list_cmd
);
6158 install_element(CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6159 install_element(VRF_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6160 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6161 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6162 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6163 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6164 install_element(CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6165 install_element(VRF_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6166 install_element(CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6167 install_element(CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6168 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6169 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6170 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6171 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6172 install_element(CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6173 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6174 install_element(CONFIG_NODE
,
6175 &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6176 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6177 install_element(CONFIG_NODE
, &pim_register_accept_list_cmd
);
6178 install_element(VRF_NODE
, &pim_register_accept_list_cmd
);
6179 install_element(CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6180 install_element(CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6181 install_element(CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6182 install_element(VRF_NODE
, &ip_pim_keep_alive_cmd
);
6183 install_element(CONFIG_NODE
, &ip_pim_rp_keep_alive_cmd
);
6184 install_element(VRF_NODE
, &ip_pim_rp_keep_alive_cmd
);
6185 install_element(CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6186 install_element(VRF_NODE
, &no_ip_pim_keep_alive_cmd
);
6187 install_element(CONFIG_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6188 install_element(VRF_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6189 install_element(CONFIG_NODE
, &ip_pim_packets_cmd
);
6190 install_element(CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6191 install_element(CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6192 install_element(VRF_NODE
, &ip_pim_v6_secondary_cmd
);
6193 install_element(CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6194 install_element(VRF_NODE
, &no_ip_pim_v6_secondary_cmd
);
6195 install_element(CONFIG_NODE
, &ip_ssmpingd_cmd
);
6196 install_element(VRF_NODE
, &ip_ssmpingd_cmd
);
6197 install_element(CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6198 install_element(VRF_NODE
, &no_ip_ssmpingd_cmd
);
6199 install_element(CONFIG_NODE
, &ip_msdp_peer_cmd
);
6200 install_element(VRF_NODE
, &ip_msdp_peer_cmd
);
6201 install_element(CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6202 install_element(VRF_NODE
, &no_ip_msdp_peer_cmd
);
6203 install_element(CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6204 install_element(VRF_NODE
, &ip_pim_ecmp_cmd
);
6205 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6206 install_element(VRF_NODE
, &no_ip_pim_ecmp_cmd
);
6207 install_element(CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6208 install_element(VRF_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6209 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6210 install_element(VRF_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6211 install_element(CONFIG_NODE
, &ip_pim_mlag_cmd
);
6212 install_element(CONFIG_NODE
, &no_ip_pim_mlag_cmd
);
6213 install_element(CONFIG_NODE
, &ip_igmp_group_watermark_cmd
);
6214 install_element(VRF_NODE
, &ip_igmp_group_watermark_cmd
);
6215 install_element(CONFIG_NODE
, &no_ip_igmp_group_watermark_cmd
);
6216 install_element(VRF_NODE
, &no_ip_igmp_group_watermark_cmd
);
6218 install_element(INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6219 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6220 install_element(INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6221 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6222 install_element(INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6223 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6224 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6225 install_element(INTERFACE_NODE
,
6226 &interface_no_ip_igmp_query_interval_cmd
);
6227 install_element(INTERFACE_NODE
,
6228 &interface_ip_igmp_query_max_response_time_cmd
);
6229 install_element(INTERFACE_NODE
,
6230 &interface_no_ip_igmp_query_max_response_time_cmd
);
6231 install_element(INTERFACE_NODE
,
6232 &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6233 install_element(INTERFACE_NODE
,
6234 &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6235 install_element(INTERFACE_NODE
,
6236 &interface_ip_igmp_last_member_query_count_cmd
);
6237 install_element(INTERFACE_NODE
,
6238 &interface_no_ip_igmp_last_member_query_count_cmd
);
6239 install_element(INTERFACE_NODE
,
6240 &interface_ip_igmp_last_member_query_interval_cmd
);
6241 install_element(INTERFACE_NODE
,
6242 &interface_no_ip_igmp_last_member_query_interval_cmd
);
6243 install_element(INTERFACE_NODE
, &interface_ip_pim_activeactive_cmd
);
6244 install_element(INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6245 install_element(INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6246 install_element(INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6247 install_element(INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6248 install_element(INTERFACE_NODE
, &interface_ip_pim_cmd
);
6249 install_element(INTERFACE_NODE
, &interface_no_ip_pim_cmd
);
6250 install_element(INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6251 install_element(INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6252 install_element(INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6253 install_element(INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6254 install_element(INTERFACE_NODE
, &interface_ip_pim_boundary_oil_cmd
);
6255 install_element(INTERFACE_NODE
, &interface_no_ip_pim_boundary_oil_cmd
);
6256 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_generate_cmd
);
6258 // Static mroutes NEB
6259 install_element(INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6260 install_element(INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6262 install_element(VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6263 install_element(VIEW_NODE
, &show_ip_igmp_interface_vrf_all_cmd
);
6264 install_element(VIEW_NODE
, &show_ip_igmp_join_cmd
);
6265 install_element(VIEW_NODE
, &show_ip_igmp_join_vrf_all_cmd
);
6266 install_element(VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6267 install_element(VIEW_NODE
, &show_ip_igmp_groups_vrf_all_cmd
);
6268 install_element(VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6269 install_element(VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6270 install_element(VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6271 install_element(VIEW_NODE
, &show_ip_igmp_statistics_cmd
);
6272 install_element(VIEW_NODE
, &show_ip_pim_assert_cmd
);
6273 install_element(VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6274 install_element(VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6275 install_element(VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6276 install_element(VIEW_NODE
, &show_ip_pim_interface_traffic_cmd
);
6277 install_element(VIEW_NODE
, &show_ip_pim_interface_cmd
);
6278 install_element(VIEW_NODE
, &show_ip_pim_interface_vrf_all_cmd
);
6279 install_element(VIEW_NODE
, &show_ip_pim_join_cmd
);
6280 install_element(VIEW_NODE
, &show_ip_pim_join_vrf_all_cmd
);
6281 install_element(VIEW_NODE
, &show_ip_pim_jp_agg_cmd
);
6282 install_element(VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6283 install_element(VIEW_NODE
, &show_ip_pim_mlag_summary_cmd
);
6284 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_cmd
);
6285 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_vrf_all_cmd
);
6286 install_element(VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6287 install_element(VIEW_NODE
, &show_ip_pim_neighbor_vrf_all_cmd
);
6288 install_element(VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6289 install_element(VIEW_NODE
, &show_ip_pim_rpf_vrf_all_cmd
);
6290 install_element(VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6291 install_element(VIEW_NODE
, &show_ip_pim_state_cmd
);
6292 install_element(VIEW_NODE
, &show_ip_pim_state_vrf_all_cmd
);
6293 install_element(VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6294 install_element(VIEW_NODE
, &show_ip_pim_upstream_vrf_all_cmd
);
6295 install_element(VIEW_NODE
, &show_ip_pim_channel_cmd
);
6296 install_element(VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6297 install_element(VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6298 install_element(VIEW_NODE
, &show_ip_pim_rp_cmd
);
6299 install_element(VIEW_NODE
, &show_ip_pim_rp_vrf_all_cmd
);
6300 install_element(VIEW_NODE
, &show_ip_pim_bsr_cmd
);
6301 install_element(VIEW_NODE
, &show_ip_multicast_cmd
);
6302 install_element(VIEW_NODE
, &show_ip_multicast_vrf_all_cmd
);
6303 install_element(VIEW_NODE
, &show_ip_multicast_count_cmd
);
6304 install_element(VIEW_NODE
, &show_ip_multicast_count_vrf_all_cmd
);
6305 install_element(VIEW_NODE
, &show_ip_mroute_cmd
);
6306 install_element(VIEW_NODE
, &show_ip_mroute_vrf_all_cmd
);
6307 install_element(VIEW_NODE
, &show_ip_mroute_count_cmd
);
6308 install_element(VIEW_NODE
, &show_ip_mroute_count_vrf_all_cmd
);
6309 install_element(VIEW_NODE
, &show_ip_mroute_summary_cmd
);
6310 install_element(VIEW_NODE
, &show_ip_mroute_summary_vrf_all_cmd
);
6311 install_element(VIEW_NODE
, &show_ip_rib_cmd
);
6312 install_element(VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6313 install_element(VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6314 install_element(VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6315 install_element(VIEW_NODE
, &show_ip_pim_bsrp_cmd
);
6316 install_element(VIEW_NODE
, &show_ip_pim_bsm_db_cmd
);
6317 install_element(VIEW_NODE
, &show_ip_pim_statistics_cmd
);
6319 install_element(ENABLE_NODE
, &clear_ip_mroute_count_cmd
);
6320 install_element(ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6321 install_element(ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6322 install_element(ENABLE_NODE
, &clear_ip_mroute_cmd
);
6323 install_element(ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6324 install_element(ENABLE_NODE
, &clear_ip_pim_interface_traffic_cmd
);
6325 install_element(ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6326 install_element(ENABLE_NODE
, &clear_ip_pim_statistics_cmd
);
6327 install_element(ENABLE_NODE
, &clear_ip_pim_bsr_db_cmd
);
6329 install_element(ENABLE_NODE
, &show_debugging_pim_cmd
);
6331 install_element(ENABLE_NODE
, &debug_igmp_cmd
);
6332 install_element(ENABLE_NODE
, &no_debug_igmp_cmd
);
6333 install_element(ENABLE_NODE
, &debug_igmp_events_cmd
);
6334 install_element(ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6335 install_element(ENABLE_NODE
, &debug_igmp_packets_cmd
);
6336 install_element(ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6337 install_element(ENABLE_NODE
, &debug_igmp_trace_cmd
);
6338 install_element(ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6339 install_element(ENABLE_NODE
, &debug_igmp_trace_detail_cmd
);
6340 install_element(ENABLE_NODE
, &no_debug_igmp_trace_detail_cmd
);
6341 install_element(ENABLE_NODE
, &debug_mroute_cmd
);
6342 install_element(ENABLE_NODE
, &debug_mroute_detail_cmd
);
6343 install_element(ENABLE_NODE
, &no_debug_mroute_cmd
);
6344 install_element(ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6345 install_element(ENABLE_NODE
, &debug_pim_static_cmd
);
6346 install_element(ENABLE_NODE
, &no_debug_pim_static_cmd
);
6347 install_element(ENABLE_NODE
, &debug_pim_cmd
);
6348 install_element(ENABLE_NODE
, &debug_pim_nht_cmd
);
6349 install_element(ENABLE_NODE
, &debug_pim_nht_det_cmd
);
6350 install_element(ENABLE_NODE
, &debug_pim_nht_rp_cmd
);
6351 install_element(ENABLE_NODE
, &no_debug_pim_nht_rp_cmd
);
6352 install_element(ENABLE_NODE
, &debug_pim_events_cmd
);
6353 install_element(ENABLE_NODE
, &debug_pim_packets_cmd
);
6354 install_element(ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6355 install_element(ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6356 install_element(ENABLE_NODE
, &debug_pim_trace_cmd
);
6357 install_element(ENABLE_NODE
, &debug_pim_trace_detail_cmd
);
6358 install_element(ENABLE_NODE
, &debug_ssmpingd_cmd
);
6359 install_element(ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6360 install_element(ENABLE_NODE
, &debug_pim_zebra_cmd
);
6361 install_element(ENABLE_NODE
, &debug_pim_mlag_cmd
);
6362 install_element(ENABLE_NODE
, &no_debug_pim_mlag_cmd
);
6363 install_element(ENABLE_NODE
, &debug_pim_vxlan_cmd
);
6364 install_element(ENABLE_NODE
, &no_debug_pim_vxlan_cmd
);
6365 install_element(ENABLE_NODE
, &debug_msdp_cmd
);
6366 install_element(ENABLE_NODE
, &no_debug_msdp_cmd
);
6367 install_element(ENABLE_NODE
, &debug_msdp_events_cmd
);
6368 install_element(ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6369 install_element(ENABLE_NODE
, &debug_msdp_packets_cmd
);
6370 install_element(ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6371 install_element(ENABLE_NODE
, &debug_mtrace_cmd
);
6372 install_element(ENABLE_NODE
, &no_debug_mtrace_cmd
);
6373 install_element(ENABLE_NODE
, &debug_bsm_cmd
);
6374 install_element(ENABLE_NODE
, &no_debug_bsm_cmd
);
6376 install_element(CONFIG_NODE
, &debug_igmp_cmd
);
6377 install_element(CONFIG_NODE
, &no_debug_igmp_cmd
);
6378 install_element(CONFIG_NODE
, &debug_igmp_events_cmd
);
6379 install_element(CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6380 install_element(CONFIG_NODE
, &debug_igmp_packets_cmd
);
6381 install_element(CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6382 install_element(CONFIG_NODE
, &debug_igmp_trace_cmd
);
6383 install_element(CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6384 install_element(CONFIG_NODE
, &debug_igmp_trace_detail_cmd
);
6385 install_element(CONFIG_NODE
, &no_debug_igmp_trace_detail_cmd
);
6386 install_element(CONFIG_NODE
, &debug_mroute_cmd
);
6387 install_element(CONFIG_NODE
, &debug_mroute_detail_cmd
);
6388 install_element(CONFIG_NODE
, &no_debug_mroute_cmd
);
6389 install_element(CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6390 install_element(CONFIG_NODE
, &debug_pim_static_cmd
);
6391 install_element(CONFIG_NODE
, &no_debug_pim_static_cmd
);
6392 install_element(CONFIG_NODE
, &debug_pim_cmd
);
6393 install_element(CONFIG_NODE
, &debug_pim_nht_cmd
);
6394 install_element(CONFIG_NODE
, &debug_pim_nht_det_cmd
);
6395 install_element(CONFIG_NODE
, &debug_pim_nht_rp_cmd
);
6396 install_element(CONFIG_NODE
, &no_debug_pim_nht_rp_cmd
);
6397 install_element(CONFIG_NODE
, &debug_pim_events_cmd
);
6398 install_element(CONFIG_NODE
, &debug_pim_packets_cmd
);
6399 install_element(CONFIG_NODE
, &debug_pim_packetdump_send_cmd
);
6400 install_element(CONFIG_NODE
, &debug_pim_packetdump_recv_cmd
);
6401 install_element(CONFIG_NODE
, &debug_pim_trace_cmd
);
6402 install_element(CONFIG_NODE
, &debug_pim_trace_detail_cmd
);
6403 install_element(CONFIG_NODE
, &debug_ssmpingd_cmd
);
6404 install_element(CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6405 install_element(CONFIG_NODE
, &debug_pim_zebra_cmd
);
6406 install_element(CONFIG_NODE
, &debug_pim_mlag_cmd
);
6407 install_element(CONFIG_NODE
, &no_debug_pim_mlag_cmd
);
6408 install_element(CONFIG_NODE
, &debug_pim_vxlan_cmd
);
6409 install_element(CONFIG_NODE
, &no_debug_pim_vxlan_cmd
);
6410 install_element(CONFIG_NODE
, &debug_msdp_cmd
);
6411 install_element(CONFIG_NODE
, &no_debug_msdp_cmd
);
6412 install_element(CONFIG_NODE
, &debug_msdp_events_cmd
);
6413 install_element(CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6414 install_element(CONFIG_NODE
, &debug_msdp_packets_cmd
);
6415 install_element(CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6416 install_element(CONFIG_NODE
, &debug_mtrace_cmd
);
6417 install_element(CONFIG_NODE
, &no_debug_mtrace_cmd
);
6418 install_element(CONFIG_NODE
, &debug_bsm_cmd
);
6419 install_element(CONFIG_NODE
, &no_debug_bsm_cmd
);
6421 install_element(CONFIG_NODE
, &ip_msdp_timers_cmd
);
6422 install_element(VRF_NODE
, &ip_msdp_timers_cmd
);
6423 install_element(CONFIG_NODE
, &no_ip_msdp_timers_cmd
);
6424 install_element(VRF_NODE
, &no_ip_msdp_timers_cmd
);
6425 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6426 install_element(VRF_NODE
, &ip_msdp_mesh_group_member_cmd
);
6427 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6428 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6429 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6430 install_element(VRF_NODE
, &ip_msdp_mesh_group_source_cmd
);
6431 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6432 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6433 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_cmd
);
6434 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_cmd
);
6435 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6436 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_vrf_all_cmd
);
6437 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6438 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_vrf_all_cmd
);
6439 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6440 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_vrf_all_cmd
);
6441 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6442 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_vrf_all_cmd
);
6443 install_element(VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6444 install_element(VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6445 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_cmd
);
6446 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_work_cmd
);
6447 install_element(INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6448 install_element(INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);
6449 /* Install BSM command */
6450 install_element(INTERFACE_NODE
, &ip_pim_bsm_cmd
);
6451 install_element(INTERFACE_NODE
, &no_ip_pim_bsm_cmd
);
6452 install_element(INTERFACE_NODE
, &ip_pim_ucast_bsm_cmd
);
6453 install_element(INTERFACE_NODE
, &no_ip_pim_ucast_bsm_cmd
);
6454 /* Install BFD command */
6455 install_element(INTERFACE_NODE
, &ip_pim_bfd_cmd
);
6456 install_element(INTERFACE_NODE
, &ip_pim_bfd_param_cmd
);
6457 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_profile_cmd
);
6458 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_cmd
);
6460 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_param_cmd
);
6461 #endif /* !HAVE_BFDD */