1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 2008 Everton da Silva Marques
21 #include "pim_mroute.h"
23 #include "pim_iface.h"
25 #include "pim_mroute.h"
28 #include "pim_igmpv3.h"
33 #include "pim_neighbor.h"
35 #include "pim_ifchannel.h"
36 #include "pim_hello.h"
38 #include "pim_upstream.h"
40 #include "pim_macro.h"
41 #include "pim_ssmpingd.h"
42 #include "pim_zebra.h"
43 #include "pim_static.h"
45 #include "pim_zlookup.h"
50 #include "pim_vxlan.h"
54 #include "lib/northbound_cli.h"
55 #include "pim_errors.h"
58 #include "pim_cmd_common.h"
60 #include "pimd/pim_cmd_clippy.c"
62 static struct cmd_node debug_node
= {
66 .config_write
= pim_debug_config_write
,
69 static struct vrf
*pim_cmd_lookup_vrf(struct vty
*vty
, struct cmd_token
*argv
[],
70 const int argc
, int *idx
, bool uj
)
74 if (argv_find(argv
, argc
, "NAME", idx
))
75 vrf
= vrf_lookup_by_name(argv
[*idx
]->arg
);
77 vrf
= vrf_lookup_by_id(VRF_DEFAULT
);
83 vty_out(vty
, "Specified VRF: %s does not exist\n",
90 static void pim_show_assert_helper(struct vty
*vty
,
91 struct pim_interface
*pim_ifp
,
92 struct pim_ifchannel
*ch
, time_t now
)
94 char winner_str
[INET_ADDRSTRLEN
];
95 struct in_addr ifaddr
;
98 char buf
[PREFIX_STRLEN
];
100 ifaddr
= pim_ifp
->primary_address
;
102 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
, winner_str
,
105 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
106 pim_time_timer_to_mmss(timer
, sizeof(timer
), ch
->t_ifassert_timer
);
108 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-6s %-15s %-8s %-5s\n",
110 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
111 &ch
->sg
.grp
, pim_ifchannel_ifassert_name(ch
->ifassert_state
),
112 winner_str
, uptime
, timer
);
115 static void pim_show_assert(struct pim_instance
*pim
, struct vty
*vty
)
117 struct pim_interface
*pim_ifp
;
118 struct pim_ifchannel
*ch
;
119 struct interface
*ifp
;
122 now
= pim_time_monotonic_sec();
125 "Interface Address Source Group State Winner Uptime Timer\n");
127 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
132 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
133 if (ch
->ifassert_state
== PIM_IFASSERT_NOINFO
)
136 pim_show_assert_helper(vty
, pim_ifp
, ch
, now
);
137 } /* scan interface channels */
141 static void pim_show_assert_internal_helper(struct vty
*vty
,
142 struct pim_interface
*pim_ifp
,
143 struct pim_ifchannel
*ch
)
145 struct in_addr ifaddr
;
146 char buf
[PREFIX_STRLEN
];
148 ifaddr
= pim_ifp
->primary_address
;
150 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-3s %-3s %-4s\n",
152 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
154 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
155 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
156 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes"
158 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no");
161 static void pim_show_assert_internal(struct pim_instance
*pim
, struct vty
*vty
)
163 struct pim_interface
*pim_ifp
;
164 struct pim_ifchannel
*ch
;
165 struct interface
*ifp
;
169 "ECA: Evaluate CouldAssert\n"
170 "ATD: AssertTrackingDesired\n"
171 "eATD: Evaluate AssertTrackingDesired\n\n");
174 "Interface Address Source Group CA eCA ATD eATD\n");
175 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
180 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
181 pim_show_assert_internal_helper(vty
, pim_ifp
, ch
);
182 } /* scan interface channels */
186 static void pim_show_assert_metric_helper(struct vty
*vty
,
187 struct pim_interface
*pim_ifp
,
188 struct pim_ifchannel
*ch
)
190 char addr_str
[INET_ADDRSTRLEN
];
191 struct pim_assert_metric am
;
192 struct in_addr ifaddr
;
193 char buf
[PREFIX_STRLEN
];
195 ifaddr
= pim_ifp
->primary_address
;
197 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
,
198 pim_ifp
->primary_address
);
200 pim_inet4_dump("<addr?>", am
.ip_address
, addr_str
, sizeof(addr_str
));
202 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %4u %6u %-15s\n",
204 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
205 &ch
->sg
.grp
, am
.rpt_bit_flag
? "yes" : "no",
206 am
.metric_preference
, am
.route_metric
, addr_str
);
209 static void pim_show_assert_metric(struct pim_instance
*pim
, struct vty
*vty
)
211 struct pim_interface
*pim_ifp
;
212 struct pim_ifchannel
*ch
;
213 struct interface
*ifp
;
216 "Interface Address Source Group RPT Pref Metric Address \n");
218 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
223 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
224 pim_show_assert_metric_helper(vty
, pim_ifp
, ch
);
225 } /* scan interface channels */
229 static void pim_show_assert_winner_metric_helper(struct vty
*vty
,
230 struct pim_interface
*pim_ifp
,
231 struct pim_ifchannel
*ch
)
233 char addr_str
[INET_ADDRSTRLEN
];
234 struct pim_assert_metric
*am
;
235 struct in_addr ifaddr
;
238 char buf
[PREFIX_STRLEN
];
240 ifaddr
= pim_ifp
->primary_address
;
242 am
= &ch
->ifassert_winner_metric
;
244 pim_inet4_dump("<addr?>", am
->ip_address
, addr_str
, sizeof(addr_str
));
246 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
247 snprintf(pref_str
, sizeof(pref_str
), "INFI");
249 snprintf(pref_str
, sizeof(pref_str
), "%4u",
250 am
->metric_preference
);
252 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
253 snprintf(metr_str
, sizeof(metr_str
), "INFI");
255 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
257 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-4s %-6s %-15s\n",
259 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
260 &ch
->sg
.grp
, am
->rpt_bit_flag
? "yes" : "no", pref_str
,
264 static void pim_show_assert_winner_metric(struct pim_instance
*pim
,
267 struct pim_interface
*pim_ifp
;
268 struct pim_ifchannel
*ch
;
269 struct interface
*ifp
;
272 "Interface Address Source Group RPT Pref Metric Address \n");
274 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
279 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
280 pim_show_assert_winner_metric_helper(vty
, pim_ifp
, ch
);
281 } /* scan interface channels */
285 static void igmp_show_interfaces(struct pim_instance
*pim
, struct vty
*vty
,
288 struct interface
*ifp
;
290 char buf
[PREFIX_STRLEN
];
291 json_object
*json
= NULL
;
292 json_object
*json_row
= NULL
;
294 now
= pim_time_monotonic_sec();
297 json
= json_object_new_object();
300 "Interface State Address V Querier QuerierIp Query Timer Uptime\n");
302 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
303 struct pim_interface
*pim_ifp
;
304 struct listnode
*sock_node
;
305 struct gm_sock
*igmp
;
312 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
315 char query_hhmmss
[10];
317 pim_time_uptime(uptime
, sizeof(uptime
),
318 now
- igmp
->sock_creation
);
319 pim_time_timer_to_hhmmss(query_hhmmss
,
320 sizeof(query_hhmmss
),
321 igmp
->t_igmp_query_timer
);
324 json_row
= json_object_new_object();
325 json_object_pim_ifp_add(json_row
, ifp
);
326 json_object_string_add(json_row
, "upTime",
328 json_object_int_add(json_row
, "version",
329 pim_ifp
->igmp_version
);
331 if (igmp
->t_igmp_query_timer
) {
332 json_object_boolean_true_add(json_row
,
334 json_object_string_add(json_row
,
338 json_object_string_addf(json_row
, "querierIp",
340 &igmp
->querier_addr
);
342 json_object_object_add(json
, ifp
->name
,
345 if (igmp
->mtrace_only
) {
346 json_object_boolean_true_add(
347 json_row
, "mtraceOnly");
351 "%-16s %5s %15s %d %7s %17pI4 %11s %8s\n",
354 ? (igmp
->mtrace_only
? "mtrc"
357 inet_ntop(AF_INET
, &igmp
->ifaddr
, buf
,
359 pim_ifp
->igmp_version
,
360 igmp
->t_igmp_query_timer
? "local"
362 &igmp
->querier_addr
, query_hhmmss
,
372 static void igmp_show_interfaces_single(struct pim_instance
*pim
,
373 struct vty
*vty
, const char *ifname
,
376 struct gm_sock
*igmp
;
377 struct interface
*ifp
;
378 struct listnode
*sock_node
;
379 struct pim_interface
*pim_ifp
;
381 char query_hhmmss
[10];
382 char other_hhmmss
[10];
383 int found_ifname
= 0;
385 long gmi_msec
; /* Group Membership Interval */
388 long oqpi_msec
; /* Other Querier Present Interval */
393 json_object
*json
= NULL
;
394 json_object
*json_row
= NULL
;
397 json
= json_object_new_object();
399 now
= pim_time_monotonic_sec();
401 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
407 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
410 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
413 pim_time_uptime(uptime
, sizeof(uptime
),
414 now
- igmp
->sock_creation
);
415 pim_time_timer_to_hhmmss(query_hhmmss
,
416 sizeof(query_hhmmss
),
417 igmp
->t_igmp_query_timer
);
418 pim_time_timer_to_hhmmss(other_hhmmss
,
419 sizeof(other_hhmmss
),
420 igmp
->t_other_querier_timer
);
422 gmi_msec
= PIM_IGMP_GMI_MSEC(
423 igmp
->querier_robustness_variable
,
424 igmp
->querier_query_interval
,
425 pim_ifp
->gm_query_max_response_time_dsec
);
427 sqi
= PIM_IGMP_SQI(pim_ifp
->gm_default_query_interval
);
429 oqpi_msec
= PIM_IGMP_OQPI_MSEC(
430 igmp
->querier_robustness_variable
,
431 igmp
->querier_query_interval
,
432 pim_ifp
->gm_query_max_response_time_dsec
);
434 lmqt_msec
= PIM_IGMP_LMQT_MSEC(
435 pim_ifp
->gm_specific_query_max_response_time_dsec
,
436 pim_ifp
->gm_last_member_query_count
);
440 igmp
->querier_robustness_variable
,
441 igmp
->querier_query_interval
,
442 pim_ifp
->gm_query_max_response_time_dsec
) *
446 pim_ifp
->gm_query_max_response_time_dsec
* 100;
447 lmqc
= pim_ifp
->gm_last_member_query_count
;
450 json_row
= json_object_new_object();
451 json_object_pim_ifp_add(json_row
, ifp
);
452 json_object_string_add(json_row
, "upTime",
454 json_object_string_add(json_row
, "querier",
455 igmp
->t_igmp_query_timer
458 json_object_string_addf(json_row
, "querierIp",
460 &igmp
->querier_addr
);
461 json_object_int_add(json_row
, "queryStartCount",
462 igmp
->startup_query_count
);
463 json_object_string_add(json_row
,
466 json_object_string_add(json_row
,
469 json_object_int_add(json_row
, "version",
470 pim_ifp
->igmp_version
);
473 "timerGroupMembershipIntervalMsec",
475 json_object_int_add(json_row
,
476 "lastMemberQueryCount",
478 json_object_int_add(json_row
,
479 "timerLastMemberQueryMsec",
483 "timerOlderHostPresentIntervalMsec",
487 "timerOtherQuerierPresentIntervalMsec",
490 json_row
, "timerQueryInterval",
491 igmp
->querier_query_interval
);
494 "timerQueryResponseIntervalMsec",
497 json_row
, "timerRobustnessVariable",
498 igmp
->querier_robustness_variable
);
499 json_object_int_add(json_row
,
500 "timerStartupQueryInterval",
503 json_object_object_add(json
, ifp
->name
,
506 if (igmp
->mtrace_only
) {
507 json_object_boolean_true_add(
508 json_row
, "mtraceOnly");
511 vty_out(vty
, "Interface : %s\n", ifp
->name
);
512 vty_out(vty
, "State : %s\n",
513 if_is_up(ifp
) ? (igmp
->mtrace_only
?
517 vty_out(vty
, "Address : %pI4\n",
518 &pim_ifp
->primary_address
);
519 vty_out(vty
, "Uptime : %s\n", uptime
);
520 vty_out(vty
, "Version : %d\n",
521 pim_ifp
->igmp_version
);
525 vty_out(vty
, "Querier\n");
526 vty_out(vty
, "-------\n");
527 vty_out(vty
, "Querier : %s\n",
528 igmp
->t_igmp_query_timer
? "local"
530 vty_out(vty
, "QuerierIp : %pI4",
531 &igmp
->querier_addr
);
532 if (pim_ifp
->primary_address
.s_addr
533 == igmp
->querier_addr
.s_addr
)
534 vty_out(vty
, " (this router)\n");
538 vty_out(vty
, "Start Count : %d\n",
539 igmp
->startup_query_count
);
540 vty_out(vty
, "Query Timer : %s\n",
542 vty_out(vty
, "Other Timer : %s\n",
547 vty_out(vty
, "Timers\n");
548 vty_out(vty
, "------\n");
550 "Group Membership Interval : %lis\n",
553 "Last Member Query Count : %d\n",
556 "Last Member Query Time : %lis\n",
559 "Older Host Present Interval : %lis\n",
562 "Other Querier Present Interval : %lis\n",
565 "Query Interval : %ds\n",
566 igmp
->querier_query_interval
);
568 "Query Response Interval : %lis\n",
571 "Robustness Variable : %d\n",
572 igmp
->querier_robustness_variable
);
574 "Startup Query Interval : %ds\n",
579 pim_print_ifp_flags(vty
, ifp
);
586 else if (!found_ifname
)
587 vty_out(vty
, "%% No such interface\n");
590 static void igmp_show_interface_join(struct pim_instance
*pim
, struct vty
*vty
,
593 struct interface
*ifp
;
595 json_object
*json
= NULL
;
596 json_object
*json_iface
= NULL
;
597 json_object
*json_grp
= NULL
;
598 json_object
*json_grp_arr
= NULL
;
600 now
= pim_time_monotonic_sec();
603 json
= json_object_new_object();
604 json_object_string_add(json
, "vrf",
605 vrf_id_to_name(pim
->vrf
->vrf_id
));
608 "Interface Address Source Group Socket Uptime \n");
611 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
612 struct pim_interface
*pim_ifp
;
613 struct listnode
*join_node
;
615 struct in_addr pri_addr
;
616 char pri_addr_str
[INET_ADDRSTRLEN
];
623 if (!pim_ifp
->gm_join_list
)
626 pri_addr
= pim_find_primary_addr(ifp
);
627 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
,
628 sizeof(pri_addr_str
));
630 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_join_list
, join_node
,
632 char group_str
[INET_ADDRSTRLEN
];
633 char source_str
[INET_ADDRSTRLEN
];
636 pim_time_uptime(uptime
, sizeof(uptime
),
637 now
- ij
->sock_creation
);
638 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
,
640 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
,
644 json_object_object_get_ex(json
, ifp
->name
,
648 json_iface
= json_object_new_object();
649 json_object_string_add(
650 json_iface
, "name", ifp
->name
);
651 json_object_object_add(json
, ifp
->name
,
653 json_grp_arr
= json_object_new_array();
654 json_object_object_add(json_iface
,
659 json_grp
= json_object_new_object();
660 json_object_string_add(json_grp
, "source",
662 json_object_string_add(json_grp
, "group",
664 json_object_string_add(json_grp
, "primaryAddr",
666 json_object_int_add(json_grp
, "sockFd",
668 json_object_string_add(json_grp
, "upTime",
670 json_object_array_add(json_grp_arr
, json_grp
);
673 "%-16s %-15s %-15s %-15s %6d %8s\n",
674 ifp
->name
, pri_addr_str
, source_str
,
675 group_str
, ij
->sock_fd
, uptime
);
677 } /* for (pim_ifp->gm_join_list) */
685 static void igmp_show_statistics(struct pim_instance
*pim
, struct vty
*vty
,
686 const char *ifname
, bool uj
)
688 struct interface
*ifp
;
689 struct igmp_stats igmp_stats
;
690 bool found_ifname
= false;
691 json_object
*json
= NULL
;
693 igmp_stats_init(&igmp_stats
);
696 json
= json_object_new_object();
698 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
699 struct pim_interface
*pim_ifp
;
700 struct listnode
*sock_node
, *source_node
, *group_node
;
701 struct gm_sock
*igmp
;
702 struct gm_group
*group
;
703 struct gm_source
*src
;
710 if (ifname
&& strcmp(ifname
, ifp
->name
))
715 igmp_stats
.joins_failed
+= pim_ifp
->igmp_ifstat_joins_failed
;
716 igmp_stats
.joins_sent
+= pim_ifp
->igmp_ifstat_joins_sent
;
717 igmp_stats
.total_groups
+=
718 pim_ifp
->gm_group_list
719 ? listcount(pim_ifp
->gm_group_list
)
721 igmp_stats
.peak_groups
+= pim_ifp
->igmp_peak_group_count
;
724 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, group_node
,
726 for (ALL_LIST_ELEMENTS_RO(group
->group_source_list
,
728 if (pim_addr_is_any(src
->source_addr
))
731 igmp_stats
.total_source_groups
++;
735 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
737 igmp_stats_add(&igmp_stats
, &igmp
->igmp_stats
);
745 vty_out(vty
, "%% No such interface\n");
750 json_object
*json_row
= json_object_new_object();
752 json_object_string_add(json_row
, "name",
753 ifname
? ifname
: "global");
754 json_object_int_add(json_row
, "queryV1", igmp_stats
.query_v1
);
755 json_object_int_add(json_row
, "queryV2", igmp_stats
.query_v2
);
756 json_object_int_add(json_row
, "queryV3", igmp_stats
.query_v3
);
757 json_object_int_add(json_row
, "leaveV2", igmp_stats
.leave_v2
);
758 json_object_int_add(json_row
, "reportV1", igmp_stats
.report_v1
);
759 json_object_int_add(json_row
, "reportV2", igmp_stats
.report_v2
);
760 json_object_int_add(json_row
, "reportV3", igmp_stats
.report_v3
);
761 json_object_int_add(json_row
, "mtraceResponse",
762 igmp_stats
.mtrace_rsp
);
763 json_object_int_add(json_row
, "mtraceRequest",
764 igmp_stats
.mtrace_req
);
765 json_object_int_add(json_row
, "unsupported",
766 igmp_stats
.unsupported
);
767 json_object_int_add(json_row
, "totalReceivedMessages",
768 igmp_stats
.total_recv_messages
);
769 json_object_int_add(json_row
, "peakGroups",
770 igmp_stats
.peak_groups
);
771 json_object_int_add(json_row
, "totalGroups",
772 igmp_stats
.total_groups
);
773 json_object_int_add(json_row
, "totalSourceGroups",
774 igmp_stats
.total_source_groups
);
775 json_object_int_add(json_row
, "joinsFailed",
776 igmp_stats
.joins_failed
);
777 json_object_int_add(json_row
, "joinsSent",
778 igmp_stats
.joins_sent
);
779 json_object_int_add(json_row
, "generalQueriesSent",
780 igmp_stats
.general_queries_sent
);
781 json_object_int_add(json_row
, "groupQueriesSent",
782 igmp_stats
.group_queries_sent
);
783 json_object_object_add(json
, ifname
? ifname
: "global",
787 vty_out(vty
, "IGMP statistics\n");
788 vty_out(vty
, "Interface : %s\n",
789 ifname
? ifname
: "global");
790 vty_out(vty
, "V1 query : %u\n",
791 igmp_stats
.query_v1
);
792 vty_out(vty
, "V2 query : %u\n",
793 igmp_stats
.query_v2
);
794 vty_out(vty
, "V3 query : %u\n",
795 igmp_stats
.query_v3
);
796 vty_out(vty
, "V2 leave : %u\n",
797 igmp_stats
.leave_v2
);
798 vty_out(vty
, "V1 report : %u\n",
799 igmp_stats
.report_v1
);
800 vty_out(vty
, "V2 report : %u\n",
801 igmp_stats
.report_v2
);
802 vty_out(vty
, "V3 report : %u\n",
803 igmp_stats
.report_v3
);
804 vty_out(vty
, "mtrace response : %u\n",
805 igmp_stats
.mtrace_rsp
);
806 vty_out(vty
, "mtrace request : %u\n",
807 igmp_stats
.mtrace_req
);
808 vty_out(vty
, "unsupported : %u\n",
809 igmp_stats
.unsupported
);
810 vty_out(vty
, "total received messages : %u\n",
811 igmp_stats
.total_recv_messages
);
812 vty_out(vty
, "joins failed : %u\n",
813 igmp_stats
.joins_failed
);
814 vty_out(vty
, "joins sent : %u\n",
815 igmp_stats
.joins_sent
);
816 vty_out(vty
, "general queries sent : %u\n",
817 igmp_stats
.general_queries_sent
);
818 vty_out(vty
, "group queries sent : %u\n",
819 igmp_stats
.group_queries_sent
);
820 vty_out(vty
, "peak groups : %u\n",
821 igmp_stats
.peak_groups
);
822 vty_out(vty
, "total groups : %u\n",
823 igmp_stats
.total_groups
);
824 vty_out(vty
, "total source groups : %u\n",
825 igmp_stats
.total_source_groups
);
829 static void igmp_source_json_helper(struct gm_source
*src
,
830 json_object
*json_sources
, char *source_str
,
831 char *mmss
, char *uptime
)
833 json_object
*json_source
= NULL
;
835 json_source
= json_object_new_object();
839 json_object_string_add(json_source
, "source", source_str
);
840 json_object_string_add(json_source
, "timer", mmss
);
841 json_object_boolean_add(json_source
, "forwarded",
842 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
));
843 json_object_string_add(json_source
, "uptime", uptime
);
844 json_object_array_add(json_sources
, json_source
);
847 static void igmp_group_print(struct interface
*ifp
, struct vty
*vty
, bool uj
,
848 json_object
*json
, struct gm_group
*grp
,
849 time_t now
, bool detail
)
851 json_object
*json_iface
= NULL
;
852 json_object
*json_group
= NULL
;
853 json_object
*json_groups
= NULL
;
854 char group_str
[INET_ADDRSTRLEN
];
855 char hhmmss
[PIM_TIME_STRLEN
];
856 char uptime
[PIM_TIME_STRLEN
];
858 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
860 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
), grp
->t_group_timer
);
861 pim_time_uptime(uptime
, sizeof(uptime
), now
- grp
->group_creation
);
864 json_object_object_get_ex(json
, ifp
->name
, &json_iface
);
866 json_iface
= json_object_new_object();
869 json_object_pim_ifp_add(json_iface
, ifp
);
870 json_object_object_add(json
, ifp
->name
, json_iface
);
871 json_groups
= json_object_new_array();
874 json_object_object_add(json_iface
, "groups",
878 json_object_object_get_ex(json_iface
, "groups", &json_groups
);
880 json_group
= json_object_new_object();
884 json_object_string_add(json_group
, "group", group_str
);
885 if (grp
->igmp_version
== IGMP_DEFAULT_VERSION
)
886 json_object_string_add(
888 grp
->group_filtermode_isexcl
892 json_object_string_add(json_group
, "timer", hhmmss
);
894 json_group
, "sourcesCount",
895 grp
->group_source_list
896 ? listcount(grp
->group_source_list
)
898 json_object_int_add(json_group
, "version",
900 json_object_string_add(json_group
, "uptime", uptime
);
901 json_object_array_add(json_groups
, json_group
);
904 struct listnode
*srcnode
;
905 struct gm_source
*src
;
906 json_object
*json_sources
= NULL
;
908 json_sources
= json_object_new_array();
912 json_object_object_add(json_group
, "sources",
915 for (ALL_LIST_ELEMENTS_RO(
916 grp
->group_source_list
, srcnode
,
918 char source_str
[INET_ADDRSTRLEN
];
919 char mmss
[PIM_TIME_STRLEN
];
920 char src_uptime
[PIM_TIME_STRLEN
];
923 "<source?>", src
->source_addr
,
924 source_str
, sizeof(source_str
));
925 pim_time_timer_to_mmss(
927 src
->t_source_timer
);
929 src_uptime
, sizeof(src_uptime
),
930 now
- src
->source_creation
);
932 igmp_source_json_helper(
933 src
, json_sources
, source_str
,
940 struct listnode
*srcnode
;
941 struct gm_source
*src
;
943 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
945 char source_str
[INET_ADDRSTRLEN
];
947 pim_inet4_dump("<source?>", src
->source_addr
,
948 source_str
, sizeof(source_str
));
951 "%-16s %-15s %4s %8s %-15s %d %8s\n",
952 ifp
->name
, group_str
,
953 grp
->igmp_version
== 3
954 ? (grp
->group_filtermode_isexcl
958 hhmmss
, source_str
, grp
->igmp_version
,
964 vty_out(vty
, "%-16s %-15s %4s %8s %4d %d %8s\n", ifp
->name
,
966 grp
->igmp_version
== 3
967 ? (grp
->group_filtermode_isexcl
? "EXCL"
971 grp
->group_source_list
972 ? listcount(grp
->group_source_list
)
974 grp
->igmp_version
, uptime
);
978 static void igmp_show_groups_interface_single(struct pim_instance
*pim
,
979 struct vty
*vty
, bool uj
,
981 const char *grp_str
, bool detail
)
983 struct interface
*ifp
;
985 json_object
*json
= NULL
;
986 struct pim_interface
*pim_ifp
= NULL
;
987 struct gm_group
*grp
;
989 now
= pim_time_monotonic_sec();
992 json
= json_object_new_object();
995 json_object_int_add(json
, "totalGroups", pim
->gm_group_count
);
996 json_object_int_add(json
, "watermarkLimit",
997 pim
->gm_watermark_limit
);
999 vty_out(vty
, "Total IGMP groups: %u\n", pim
->gm_group_count
);
1000 vty_out(vty
, "Watermark warn limit(%s): %u\n",
1001 pim
->gm_watermark_limit
? "Set" : "Not Set",
1002 pim
->gm_watermark_limit
);
1006 "Interface Group Mode Timer Srcs V Uptime\n");
1009 "Interface Group Mode Timer Source V Uptime\n");
1012 ifp
= if_lookup_by_name(ifname
, pim
->vrf
->vrf_id
);
1015 vty_json(vty
, json
);
1019 pim_ifp
= ifp
->info
;
1022 vty_json(vty
, json
);
1027 struct in_addr group_addr
;
1028 struct gm_sock
*igmp
;
1030 if (inet_pton(AF_INET
, grp_str
, &group_addr
) == 1) {
1031 igmp
= pim_igmp_sock_lookup_ifaddr(
1032 pim_ifp
->gm_socket_list
,
1033 pim_ifp
->primary_address
);
1035 grp
= find_group_by_addr(igmp
, group_addr
);
1037 igmp_group_print(ifp
, vty
, uj
, json
,
1042 struct listnode
*grpnode
;
1044 /* scan igmp groups */
1045 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
, grp
))
1046 igmp_group_print(ifp
, vty
, uj
, json
, grp
, now
, detail
);
1051 vty_json_no_pretty(vty
, json
);
1053 vty_json(vty
, json
);
1057 static void igmp_show_groups(struct pim_instance
*pim
, struct vty
*vty
, bool uj
,
1058 const char *grp_str
, bool detail
)
1060 struct interface
*ifp
;
1062 json_object
*json
= NULL
;
1064 now
= pim_time_monotonic_sec();
1067 json
= json_object_new_object();
1070 json_object_int_add(json
, "totalGroups", pim
->gm_group_count
);
1071 json_object_int_add(json
, "watermarkLimit",
1072 pim
->gm_watermark_limit
);
1074 vty_out(vty
, "Total IGMP groups: %u\n", pim
->gm_group_count
);
1075 vty_out(vty
, "Watermark warn limit(%s): %u\n",
1076 pim
->gm_watermark_limit
? "Set" : "Not Set",
1077 pim
->gm_watermark_limit
);
1080 "Interface Group Mode Timer Srcs V Uptime\n");
1083 "Interface Group Mode Timer Source V Uptime\n");
1086 /* scan interfaces */
1087 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1088 struct pim_interface
*pim_ifp
= ifp
->info
;
1089 struct listnode
*grpnode
;
1090 struct gm_group
*grp
;
1096 struct in_addr group_addr
;
1097 struct gm_sock
*igmp
;
1099 if (inet_pton(AF_INET
, grp_str
, &group_addr
) == 1) {
1100 igmp
= pim_igmp_sock_lookup_ifaddr(
1101 pim_ifp
->gm_socket_list
,
1102 pim_ifp
->primary_address
);
1104 grp
= find_group_by_addr(igmp
,
1107 igmp_group_print(ifp
, vty
, uj
,
1113 /* scan igmp groups */
1114 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
,
1116 igmp_group_print(ifp
, vty
, uj
, json
, grp
, now
,
1119 } /* scan interfaces */
1123 vty_json_no_pretty(vty
, json
);
1125 vty_json(vty
, json
);
1129 static void igmp_show_group_retransmission(struct pim_instance
*pim
,
1132 struct interface
*ifp
;
1135 "Interface Group RetTimer Counter RetSrcs\n");
1137 /* scan interfaces */
1138 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1139 struct pim_interface
*pim_ifp
= ifp
->info
;
1140 struct listnode
*grpnode
;
1141 struct gm_group
*grp
;
1146 /* scan igmp groups */
1147 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1149 char group_str
[INET_ADDRSTRLEN
];
1150 char grp_retr_mmss
[10];
1151 struct listnode
*src_node
;
1152 struct gm_source
*src
;
1153 int grp_retr_sources
= 0;
1155 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1157 pim_time_timer_to_mmss(
1158 grp_retr_mmss
, sizeof(grp_retr_mmss
),
1159 grp
->t_group_query_retransmit_timer
);
1162 /* count group sources with retransmission state
1164 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1166 if (src
->source_query_retransmit_count
> 0) {
1171 vty_out(vty
, "%-16s %-15s %-8s %7d %7d\n", ifp
->name
,
1172 group_str
, grp_retr_mmss
,
1173 grp
->group_specific_query_retransmit_count
,
1176 } /* scan igmp groups */
1177 } /* scan interfaces */
1180 static void igmp_sources_print(struct interface
*ifp
, char *group_str
,
1181 struct gm_source
*src
, time_t now
,
1182 json_object
*json
, struct vty
*vty
, bool uj
)
1184 json_object
*json_iface
= NULL
;
1185 json_object
*json_group
= NULL
;
1186 json_object
*json_sources
= NULL
;
1187 char source_str
[INET_ADDRSTRLEN
];
1188 char mmss
[PIM_TIME_STRLEN
];
1189 char uptime
[PIM_TIME_STRLEN
];
1191 pim_inet4_dump("<source?>", src
->source_addr
, source_str
,
1192 sizeof(source_str
));
1193 pim_time_timer_to_mmss(mmss
, sizeof(mmss
), src
->t_source_timer
);
1194 pim_time_uptime(uptime
, sizeof(uptime
), now
- src
->source_creation
);
1197 json_object_object_get_ex(json
, ifp
->name
, &json_iface
);
1199 json_iface
= json_object_new_object();
1202 json_object_string_add(json_iface
, "name", ifp
->name
);
1203 json_object_object_add(json
, ifp
->name
, json_iface
);
1206 json_object_object_get_ex(json_iface
, group_str
, &json_group
);
1208 json_group
= json_object_new_object();
1211 json_object_string_add(json_group
, "group", group_str
);
1212 json_object_object_add(json_iface
, group_str
,
1214 json_sources
= json_object_new_array();
1217 json_object_object_add(json_group
, "sources",
1221 json_object_object_get_ex(json_group
, "sources", &json_sources
);
1223 igmp_source_json_helper(src
, json_sources
, source_str
,
1226 vty_out(vty
, "%-16s %-15s %-15s %5s %3s %8s\n", ifp
->name
,
1227 group_str
, source_str
, mmss
,
1228 IGMP_SOURCE_TEST_FORWARDING(src
->source_flags
) ? "Y"
1234 static void igmp_show_sources_interface_single(struct pim_instance
*pim
,
1235 struct vty
*vty
, bool uj
,
1237 const char *grp_str
)
1239 struct interface
*ifp
;
1241 json_object
*json
= NULL
;
1242 struct pim_interface
*pim_ifp
;
1243 struct gm_group
*grp
;
1245 now
= pim_time_monotonic_sec();
1248 json
= json_object_new_object();
1253 "Interface Group Source Timer Fwd Uptime \n");
1256 ifp
= if_lookup_by_name(ifname
, pim
->vrf
->vrf_id
);
1259 vty_json(vty
, json
);
1263 pim_ifp
= ifp
->info
;
1266 vty_json(vty
, json
);
1271 struct in_addr group_addr
;
1272 struct gm_sock
*igmp
;
1273 struct listnode
*srcnode
;
1274 struct gm_source
*src
;
1275 char group_str
[INET_ADDRSTRLEN
];
1278 res
= inet_pton(AF_INET
, grp_str
, &group_addr
);
1281 vty_json(vty
, json
);
1285 igmp
= pim_igmp_sock_lookup_ifaddr(pim_ifp
->gm_socket_list
,
1286 pim_ifp
->primary_address
);
1289 vty_json(vty
, json
);
1293 grp
= find_group_by_addr(igmp
, group_addr
);
1296 vty_json(vty
, json
);
1299 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1302 /* scan group sources */
1303 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
, srcnode
, src
))
1304 igmp_sources_print(ifp
, group_str
, src
, now
, json
, vty
,
1307 struct listnode
*grpnode
;
1309 /* scan igmp groups */
1310 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1312 char group_str
[INET_ADDRSTRLEN
];
1313 struct listnode
*srcnode
;
1314 struct gm_source
*src
;
1316 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1319 /* scan group sources */
1320 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1322 igmp_sources_print(ifp
, group_str
, src
, now
,
1325 } /* scan igmp groups */
1329 vty_json(vty
, json
);
1332 static void igmp_show_sources(struct pim_instance
*pim
, struct vty
*vty
,
1335 struct interface
*ifp
;
1337 json_object
*json
= NULL
;
1339 now
= pim_time_monotonic_sec();
1342 json
= json_object_new_object();
1347 "Interface Group Source Timer Fwd Uptime\n");
1350 /* scan interfaces */
1351 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1352 struct pim_interface
*pim_ifp
= ifp
->info
;
1353 struct listnode
*grpnode
;
1354 struct gm_group
*grp
;
1359 /* scan igmp groups */
1360 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1362 char group_str
[INET_ADDRSTRLEN
];
1363 struct listnode
*srcnode
;
1364 struct gm_source
*src
;
1366 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1369 /* scan group sources */
1370 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1372 igmp_sources_print(ifp
, group_str
, src
, now
,
1374 } /* scan igmp groups */
1375 } /* scan interfaces */
1378 vty_json(vty
, json
);
1381 static void igmp_show_source_retransmission(struct pim_instance
*pim
,
1384 struct interface
*ifp
;
1387 "Interface Group Source Counter\n");
1389 /* scan interfaces */
1390 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1391 struct pim_interface
*pim_ifp
= ifp
->info
;
1392 struct listnode
*grpnode
;
1393 struct gm_group
*grp
;
1398 /* scan igmp groups */
1399 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1401 char group_str
[INET_ADDRSTRLEN
];
1402 struct listnode
*srcnode
;
1403 struct gm_source
*src
;
1405 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1408 /* scan group sources */
1409 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1411 char source_str
[INET_ADDRSTRLEN
];
1413 pim_inet4_dump("<source?>", src
->source_addr
,
1414 source_str
, sizeof(source_str
));
1416 vty_out(vty
, "%-16s %-15s %-15s %7d\n",
1417 ifp
->name
, group_str
, source_str
,
1418 src
->source_query_retransmit_count
);
1420 } /* scan group sources */
1421 } /* scan igmp groups */
1422 } /* scan interfaces */
1425 static void clear_igmp_interfaces(struct pim_instance
*pim
)
1427 struct interface
*ifp
;
1429 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1430 pim_if_addr_del_all_igmp(ifp
);
1432 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1433 pim_if_addr_add_all(ifp
);
1436 static void clear_interfaces(struct pim_instance
*pim
)
1438 clear_igmp_interfaces(pim
);
1439 clear_pim_interfaces(pim
);
1442 #define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \
1443 pim_ifp = ifp->info; \
1446 "%% Enable PIM and/or IGMP on this interface first\n"); \
1447 return CMD_WARNING_CONFIG_FAILED; \
1451 * Compatibility function to keep the legacy mesh group CLI behavior:
1452 * Delete group when there are no more configurations in it.
1455 * Don't forget to call `nb_cli_apply_changes` after this.
1457 static void pim_cli_legacy_mesh_group_behavior(struct vty
*vty
,
1460 const char *vrfname
;
1461 char xpath_value
[XPATH_MAXLEN
];
1462 char xpath_member_value
[XPATH_MAXLEN
];
1463 const struct lyd_node
*member_dnode
;
1465 vrfname
= pim_cli_get_vrf_name(vty
);
1466 if (vrfname
== NULL
)
1469 /* Get mesh group base XPath. */
1470 snprintf(xpath_value
, sizeof(xpath_value
),
1471 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
1472 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
1473 /* Group must exists, otherwise just quit. */
1474 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
1477 /* Group members check: */
1478 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1479 strlcat(xpath_member_value
, "/members", sizeof(xpath_member_value
));
1480 if (yang_dnode_exists(vty
->candidate_config
->dnode
,
1481 xpath_member_value
)) {
1482 member_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
1483 xpath_member_value
);
1484 if (!member_dnode
|| !yang_is_last_list_dnode(member_dnode
))
1488 /* Source address check: */
1489 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1490 strlcat(xpath_member_value
, "/source", sizeof(xpath_member_value
));
1491 if (yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_member_value
))
1494 /* No configurations found: delete it. */
1495 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
1498 DEFUN (clear_ip_interfaces
,
1499 clear_ip_interfaces_cmd
,
1500 "clear ip interfaces [vrf NAME]",
1503 "Reset interfaces\n"
1507 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
1512 clear_interfaces(vrf
->info
);
1517 DEFUN (clear_ip_igmp_interfaces
,
1518 clear_ip_igmp_interfaces_cmd
,
1519 "clear ip igmp [vrf NAME] interfaces",
1524 "Reset IGMP interfaces\n")
1527 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
1532 clear_igmp_interfaces(vrf
->info
);
1537 DEFPY (clear_ip_pim_statistics
,
1538 clear_ip_pim_statistics_cmd
,
1539 "clear ip pim statistics [vrf NAME]$name",
1544 "Reset PIM statistics\n")
1546 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1551 clear_pim_statistics(v
->info
);
1556 DEFPY (clear_ip_mroute
,
1557 clear_ip_mroute_cmd
,
1558 "clear ip mroute [vrf NAME]$name",
1564 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1569 clear_mroute(v
->info
);
1574 DEFPY (clear_ip_pim_interfaces
,
1575 clear_ip_pim_interfaces_cmd
,
1576 "clear ip pim [vrf NAME] interfaces",
1581 "Reset PIM interfaces\n")
1583 struct vrf
*v
= pim_cmd_lookup(vty
, vrf
);
1588 clear_pim_interfaces(v
->info
);
1593 DEFPY (clear_ip_pim_interface_traffic
,
1594 clear_ip_pim_interface_traffic_cmd
,
1595 "clear ip pim [vrf NAME] interface traffic",
1600 "Reset PIM interfaces\n"
1601 "Reset Protocol Packet counters\n")
1603 return clear_pim_interface_traffic(vrf
, vty
);
1606 DEFPY (clear_ip_pim_oil
,
1607 clear_ip_pim_oil_cmd
,
1608 "clear ip pim [vrf NAME]$name oil",
1613 "Rescan PIM OIL (output interface list)\n")
1615 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1620 pim_scan_oil(v
->info
);
1625 DEFUN (clear_ip_pim_bsr_db
,
1626 clear_ip_pim_bsr_db_cmd
,
1627 "clear ip pim [vrf NAME] bsr-data",
1632 "Reset pim bsr data\n")
1635 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
1640 pim_bsm_clear(vrf
->info
);
1645 DEFUN (show_ip_igmp_interface
,
1646 show_ip_igmp_interface_cmd
,
1647 "show ip igmp [vrf NAME] interface [detail|WORD] [json]",
1652 "IGMP interface information\n"
1658 bool uj
= use_json(argc
, argv
);
1659 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
1664 if (argv_find(argv
, argc
, "detail", &idx
)
1665 || argv_find(argv
, argc
, "WORD", &idx
))
1666 igmp_show_interfaces_single(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1668 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1673 DEFUN (show_ip_igmp_interface_vrf_all
,
1674 show_ip_igmp_interface_vrf_all_cmd
,
1675 "show ip igmp vrf all interface [detail|WORD] [json]",
1680 "IGMP interface information\n"
1686 bool uj
= use_json(argc
, argv
);
1692 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1696 vty_out(vty
, " \"%s\": ", vrf
->name
);
1699 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1700 if (argv_find(argv
, argc
, "detail", &idx
)
1701 || argv_find(argv
, argc
, "WORD", &idx
))
1702 igmp_show_interfaces_single(vrf
->info
, vty
,
1703 argv
[idx
]->arg
, uj
);
1705 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1708 vty_out(vty
, "}\n");
1713 DEFUN (show_ip_igmp_join
,
1714 show_ip_igmp_join_cmd
,
1715 "show ip igmp [vrf NAME] join [json]",
1720 "IGMP static join information\n"
1724 bool uj
= use_json(argc
, argv
);
1725 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
1730 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1735 DEFUN (show_ip_igmp_join_vrf_all
,
1736 show_ip_igmp_join_vrf_all_cmd
,
1737 "show ip igmp vrf all join [json]",
1742 "IGMP static join information\n"
1745 bool uj
= use_json(argc
, argv
);
1751 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1755 vty_out(vty
, " \"%s\": ", vrf
->name
);
1758 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1759 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1762 vty_out(vty
, "}\n");
1767 DEFPY(show_ip_igmp_groups
,
1768 show_ip_igmp_groups_cmd
,
1769 "show ip igmp [vrf NAME$vrf_name] groups [INTERFACE$ifname [GROUP$grp_str]] [detail$detail] [json$json]",
1777 "Detailed Information\n"
1781 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, !!json
);
1787 igmp_show_groups_interface_single(vrf
->info
, vty
, !!json
,
1788 ifname
, grp_str
, !!detail
);
1790 igmp_show_groups(vrf
->info
, vty
, !!json
, NULL
, !!detail
);
1795 DEFPY(show_ip_igmp_groups_vrf_all
,
1796 show_ip_igmp_groups_vrf_all_cmd
,
1797 "show ip igmp vrf all groups [GROUP$grp_str] [detail$detail] [json$json]",
1804 "Detailed Information\n"
1813 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1817 vty_out(vty
, " \"%s\": ", vrf
->name
);
1820 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1821 igmp_show_groups(vrf
->info
, vty
, uj
, grp_str
, !!detail
);
1824 vty_out(vty
, "}\n");
1829 DEFUN (show_ip_igmp_groups_retransmissions
,
1830 show_ip_igmp_groups_retransmissions_cmd
,
1831 "show ip igmp [vrf NAME] groups retransmissions",
1837 "IGMP group retransmissions\n")
1840 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
1845 igmp_show_group_retransmission(vrf
->info
, vty
);
1850 DEFPY(show_ip_igmp_sources
,
1851 show_ip_igmp_sources_cmd
,
1852 "show ip igmp [vrf NAME$vrf_name] sources [INTERFACE$ifname [GROUP$grp_str]] [json$json]",
1863 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, !!json
);
1869 igmp_show_sources_interface_single(vrf
->info
, vty
, !!json
,
1872 igmp_show_sources(vrf
->info
, vty
, !!json
);
1877 DEFUN (show_ip_igmp_sources_retransmissions
,
1878 show_ip_igmp_sources_retransmissions_cmd
,
1879 "show ip igmp [vrf NAME] sources retransmissions",
1885 "IGMP source retransmissions\n")
1888 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
1893 igmp_show_source_retransmission(vrf
->info
, vty
);
1898 DEFUN (show_ip_igmp_statistics
,
1899 show_ip_igmp_statistics_cmd
,
1900 "show ip igmp [vrf NAME] statistics [interface WORD] [json]",
1911 bool uj
= use_json(argc
, argv
);
1912 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
1917 if (argv_find(argv
, argc
, "WORD", &idx
))
1918 igmp_show_statistics(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1920 igmp_show_statistics(vrf
->info
, vty
, NULL
, uj
);
1925 DEFUN (show_ip_pim_mlag_summary
,
1926 show_ip_pim_mlag_summary_cmd
,
1927 "show ip pim mlag summary [json]",
1932 "status and stats\n"
1935 bool uj
= use_json(argc
, argv
);
1936 char role_buf
[MLAG_ROLE_STRSIZE
];
1937 char addr_buf
[INET_ADDRSTRLEN
];
1940 json_object
*json
= NULL
;
1941 json_object
*json_stat
= NULL
;
1943 json
= json_object_new_object();
1944 if (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
1945 json_object_boolean_true_add(json
, "mlagConnUp");
1946 if (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
1947 json_object_boolean_true_add(json
, "mlagPeerConnUp");
1948 if (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
1949 json_object_boolean_true_add(json
, "mlagPeerZebraUp");
1950 json_object_string_add(json
, "mlagRole",
1951 mlag_role2str(router
->mlag_role
,
1952 role_buf
, sizeof(role_buf
)));
1953 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
1954 addr_buf
, INET_ADDRSTRLEN
);
1955 json_object_string_add(json
, "localVtepIp", addr_buf
);
1956 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
1957 addr_buf
, INET_ADDRSTRLEN
);
1958 json_object_string_add(json
, "anycastVtepIp", addr_buf
);
1959 json_object_string_add(json
, "peerlinkRif",
1960 router
->peerlink_rif
);
1962 json_stat
= json_object_new_object();
1963 json_object_int_add(json_stat
, "mlagConnFlaps",
1964 router
->mlag_stats
.mlagd_session_downs
);
1965 json_object_int_add(json_stat
, "mlagPeerConnFlaps",
1966 router
->mlag_stats
.peer_session_downs
);
1967 json_object_int_add(json_stat
, "mlagPeerZebraFlaps",
1968 router
->mlag_stats
.peer_zebra_downs
);
1969 json_object_int_add(json_stat
, "mrouteAddRx",
1970 router
->mlag_stats
.msg
.mroute_add_rx
);
1971 json_object_int_add(json_stat
, "mrouteAddTx",
1972 router
->mlag_stats
.msg
.mroute_add_tx
);
1973 json_object_int_add(json_stat
, "mrouteDelRx",
1974 router
->mlag_stats
.msg
.mroute_del_rx
);
1975 json_object_int_add(json_stat
, "mrouteDelTx",
1976 router
->mlag_stats
.msg
.mroute_del_tx
);
1977 json_object_int_add(json_stat
, "mlagStatusUpdates",
1978 router
->mlag_stats
.msg
.mlag_status_updates
);
1979 json_object_int_add(json_stat
, "peerZebraStatusUpdates",
1980 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
1981 json_object_int_add(json_stat
, "pimStatusUpdates",
1982 router
->mlag_stats
.msg
.pim_status_updates
);
1983 json_object_int_add(json_stat
, "vxlanUpdates",
1984 router
->mlag_stats
.msg
.vxlan_updates
);
1985 json_object_object_add(json
, "connStats", json_stat
);
1987 vty_json(vty
, json
);
1991 vty_out(vty
, "MLAG daemon connection: %s\n",
1992 (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
1994 vty_out(vty
, "MLAG peer state: %s\n",
1995 (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
1997 vty_out(vty
, "Zebra peer state: %s\n",
1998 (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
2000 vty_out(vty
, "MLAG role: %s\n",
2001 mlag_role2str(router
->mlag_role
, role_buf
, sizeof(role_buf
)));
2002 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
2003 addr_buf
, INET_ADDRSTRLEN
);
2004 vty_out(vty
, "Local VTEP IP: %s\n", addr_buf
);
2005 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
2006 addr_buf
, INET_ADDRSTRLEN
);
2007 vty_out(vty
, "Anycast VTEP IP: %s\n", addr_buf
);
2008 vty_out(vty
, "Peerlink: %s\n", router
->peerlink_rif
);
2009 vty_out(vty
, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n",
2010 router
->mlag_stats
.mlagd_session_downs
,
2011 router
->mlag_stats
.peer_session_downs
,
2012 router
->mlag_stats
.peer_zebra_downs
);
2013 vty_out(vty
, "Message Statistics:\n");
2014 vty_out(vty
, " mroute adds: rx: %d, tx: %d\n",
2015 router
->mlag_stats
.msg
.mroute_add_rx
,
2016 router
->mlag_stats
.msg
.mroute_add_tx
);
2017 vty_out(vty
, " mroute dels: rx: %d, tx: %d\n",
2018 router
->mlag_stats
.msg
.mroute_del_rx
,
2019 router
->mlag_stats
.msg
.mroute_del_tx
);
2020 vty_out(vty
, " peer zebra status updates: %d\n",
2021 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
2022 vty_out(vty
, " PIM status updates: %d\n",
2023 router
->mlag_stats
.msg
.pim_status_updates
);
2024 vty_out(vty
, " VxLAN updates: %d\n",
2025 router
->mlag_stats
.msg
.vxlan_updates
);
2030 DEFUN (show_ip_pim_assert
,
2031 show_ip_pim_assert_cmd
,
2032 "show ip pim [vrf NAME] assert",
2037 "PIM interface assert\n")
2040 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
2045 pim_show_assert(vrf
->info
, vty
);
2050 DEFUN (show_ip_pim_assert_internal
,
2051 show_ip_pim_assert_internal_cmd
,
2052 "show ip pim [vrf NAME] assert-internal",
2057 "PIM interface internal assert state\n")
2060 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
2065 pim_show_assert_internal(vrf
->info
, vty
);
2070 DEFUN (show_ip_pim_assert_metric
,
2071 show_ip_pim_assert_metric_cmd
,
2072 "show ip pim [vrf NAME] assert-metric",
2077 "PIM interface assert metric\n")
2080 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
2085 pim_show_assert_metric(vrf
->info
, vty
);
2090 DEFUN (show_ip_pim_assert_winner_metric
,
2091 show_ip_pim_assert_winner_metric_cmd
,
2092 "show ip pim [vrf NAME] assert-winner-metric",
2097 "PIM interface assert winner metric\n")
2100 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
2105 pim_show_assert_winner_metric(vrf
->info
, vty
);
2110 DEFPY (show_ip_pim_interface
,
2111 show_ip_pim_interface_cmd
,
2112 "show ip pim [mlag$mlag] [vrf NAME] interface [detail|WORD]$interface [json$json]",
2118 "PIM interface information\n"
2123 return pim_show_interface_cmd_helper(vrf
, vty
, !!json
, !!mlag
,
2127 DEFPY (show_ip_pim_interface_vrf_all
,
2128 show_ip_pim_interface_vrf_all_cmd
,
2129 "show ip pim [mlag$mlag] vrf all interface [detail|WORD]$interface [json$json]",
2135 "PIM interface information\n"
2140 return pim_show_interface_vrf_all_cmd_helper(vty
, !!json
, !!mlag
,
2144 DEFPY (show_ip_pim_join
,
2145 show_ip_pim_join_cmd
,
2146 "show ip pim [vrf NAME] join [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2151 "PIM interface join information\n"
2152 "The Source or Group\n"
2156 return pim_show_join_cmd_helper(vrf
, vty
, s_or_g
, g
, json
);
2159 DEFPY (show_ip_pim_join_vrf_all
,
2160 show_ip_pim_join_vrf_all_cmd
,
2161 "show ip pim vrf all join [json$json]",
2166 "PIM interface join information\n"
2169 return pim_show_join_vrf_all_cmd_helper(vty
, json
);
2172 DEFPY (show_ip_pim_jp_agg
,
2173 show_ip_pim_jp_agg_cmd
,
2174 "show ip pim [vrf NAME] jp-agg",
2179 "join prune aggregation list\n")
2181 return pim_show_jp_agg_list_cmd_helper(vrf
, vty
);
2184 DEFPY (show_ip_pim_local_membership
,
2185 show_ip_pim_local_membership_cmd
,
2186 "show ip pim [vrf NAME] local-membership [json$json]",
2191 "PIM interface local-membership\n"
2194 return pim_show_membership_cmd_helper(vrf
, vty
, !!json
);
2197 static void pim_show_mlag_up_entry_detail(struct vrf
*vrf
,
2199 struct pim_upstream
*up
,
2200 char *src_str
, char *grp_str
,
2204 json_object
*json_row
= NULL
;
2205 json_object
*own_list
= NULL
;
2206 json_object
*json_group
= NULL
;
2209 json_object_object_get_ex(json
, grp_str
, &json_group
);
2211 json_group
= json_object_new_object();
2212 json_object_object_add(json
, grp_str
,
2216 json_row
= json_object_new_object();
2217 json_object_string_add(json_row
, "source", src_str
);
2218 json_object_string_add(json_row
, "group", grp_str
);
2220 own_list
= json_object_new_array();
2221 if (pim_up_mlag_is_local(up
))
2222 json_object_array_add(own_list
,
2223 json_object_new_string("local"));
2224 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2225 json_object_array_add(own_list
,
2226 json_object_new_string("peer"));
2227 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2228 json_object_array_add(
2229 own_list
, json_object_new_string("Interface"));
2230 json_object_object_add(json_row
, "owners", own_list
);
2232 json_object_int_add(json_row
, "localCost",
2233 pim_up_mlag_local_cost(up
));
2234 json_object_int_add(json_row
, "peerCost",
2235 pim_up_mlag_peer_cost(up
));
2236 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2237 json_object_boolean_false_add(json_row
, "df");
2239 json_object_boolean_true_add(json_row
, "df");
2240 json_object_object_add(json_group
, src_str
, json_row
);
2245 if (pim_up_mlag_is_local(up
))
2246 strlcat(own_str
, "L", sizeof(own_str
));
2247 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2248 strlcat(own_str
, "P", sizeof(own_str
));
2249 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2250 strlcat(own_str
, "I", sizeof(own_str
));
2251 /* XXX - fixup, print paragraph output */
2253 "%-15s %-15s %-6s %-11u %-10d %2s\n",
2254 src_str
, grp_str
, own_str
,
2255 pim_up_mlag_local_cost(up
),
2256 pim_up_mlag_peer_cost(up
),
2257 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2262 static void pim_show_mlag_up_detail(struct vrf
*vrf
,
2263 struct vty
*vty
, const char *src_or_group
,
2264 const char *group
, bool uj
)
2266 char src_str
[PIM_ADDRSTRLEN
];
2267 char grp_str
[PIM_ADDRSTRLEN
];
2268 struct pim_upstream
*up
;
2269 struct pim_instance
*pim
= vrf
->info
;
2270 json_object
*json
= NULL
;
2273 json
= json_object_new_object();
2276 "Source Group Owner Local-cost Peer-cost DF\n");
2278 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2279 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2280 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2281 && !pim_up_mlag_is_local(up
))
2284 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &up
->sg
.grp
);
2285 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &up
->sg
.src
);
2287 /* XXX: strcmps are clearly inefficient. we should do uint comps
2291 if (strcmp(src_str
, src_or_group
) ||
2292 strcmp(grp_str
, group
))
2295 if (strcmp(src_str
, src_or_group
) &&
2296 strcmp(grp_str
, src_or_group
))
2299 pim_show_mlag_up_entry_detail(vrf
, vty
, up
,
2300 src_str
, grp_str
, json
);
2304 vty_json(vty
, json
);
2307 static void pim_show_mlag_up_vrf(struct vrf
*vrf
, struct vty
*vty
, bool uj
)
2309 json_object
*json
= NULL
;
2310 json_object
*json_row
;
2311 struct pim_upstream
*up
;
2312 struct pim_instance
*pim
= vrf
->info
;
2313 json_object
*json_group
= NULL
;
2316 json
= json_object_new_object();
2319 "Source Group Owner Local-cost Peer-cost DF\n");
2322 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2323 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2324 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2325 && !pim_up_mlag_is_local(up
))
2328 char src_str
[PIM_ADDRSTRLEN
];
2329 char grp_str
[PIM_ADDRSTRLEN
];
2330 json_object
*own_list
= NULL
;
2332 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
2334 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
2337 json_object_object_get_ex(json
, grp_str
, &json_group
);
2339 json_group
= json_object_new_object();
2340 json_object_object_add(json
, grp_str
,
2344 json_row
= json_object_new_object();
2345 json_object_string_add(json_row
, "vrf", vrf
->name
);
2346 json_object_string_add(json_row
, "source", src_str
);
2347 json_object_string_add(json_row
, "group", grp_str
);
2349 own_list
= json_object_new_array();
2350 if (pim_up_mlag_is_local(up
)) {
2352 json_object_array_add(own_list
,
2353 json_object_new_string(
2356 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)) {
2357 json_object_array_add(own_list
,
2358 json_object_new_string(
2361 json_object_object_add(json_row
, "owners", own_list
);
2363 json_object_int_add(json_row
, "localCost",
2364 pim_up_mlag_local_cost(up
));
2365 json_object_int_add(json_row
, "peerCost",
2366 pim_up_mlag_peer_cost(up
));
2367 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2368 json_object_boolean_false_add(json_row
, "df");
2370 json_object_boolean_true_add(json_row
, "df");
2371 json_object_object_add(json_group
, src_str
, json_row
);
2376 if (pim_up_mlag_is_local(up
))
2377 strlcat(own_str
, "L", sizeof(own_str
));
2378 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2379 strlcat(own_str
, "P", sizeof(own_str
));
2380 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2381 strlcat(own_str
, "I", sizeof(own_str
));
2383 "%-15pPAs %-15pPAs %-6s %-11u %-10u %2s\n",
2384 &up
->sg
.src
, &up
->sg
.grp
, own_str
,
2385 pim_up_mlag_local_cost(up
),
2386 pim_up_mlag_peer_cost(up
),
2387 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2392 vty_json(vty
, json
);
2395 static void pim_show_mlag_help_string(struct vty
*vty
, bool uj
)
2398 vty_out(vty
, "Owner codes:\n");
2400 "L: EVPN-MLAG Entry, I:PIM-MLAG Entry, P: Peer Entry\n");
2405 DEFUN(show_ip_pim_mlag_up
, show_ip_pim_mlag_up_cmd
,
2406 "show ip pim [vrf NAME] mlag upstream [A.B.C.D [A.B.C.D]] [json]",
2413 "Unicast or Multicast address\n"
2414 "Multicast address\n" JSON_STR
)
2416 const char *src_or_group
= NULL
;
2417 const char *group
= NULL
;
2419 bool uj
= use_json(argc
, argv
);
2420 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
2422 if (!vrf
|| !vrf
->info
) {
2423 vty_out(vty
, "%s: VRF or Info missing\n", __func__
);
2430 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
2431 src_or_group
= argv
[idx
]->arg
;
2433 group
= argv
[idx
+ 1]->arg
;
2436 pim_show_mlag_help_string(vty
, uj
);
2439 pim_show_mlag_up_detail(vrf
, vty
, src_or_group
, group
, uj
);
2441 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2447 DEFUN(show_ip_pim_mlag_up_vrf_all
, show_ip_pim_mlag_up_vrf_all_cmd
,
2448 "show ip pim vrf all mlag upstream [json]",
2449 SHOW_STR IP_STR PIM_STR VRF_CMD_HELP_STR
2451 "upstream\n" JSON_STR
)
2454 bool uj
= use_json(argc
, argv
);
2456 pim_show_mlag_help_string(vty
, uj
);
2457 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
2458 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2464 DEFPY (show_ip_pim_neighbor
,
2465 show_ip_pim_neighbor_cmd
,
2466 "show ip pim [vrf NAME] neighbor [detail|WORD]$interface [json$json]",
2471 "PIM neighbor information\n"
2473 "Name of interface or neighbor\n"
2476 return pim_show_neighbors_cmd_helper(vrf
, vty
, json
, interface
);
2479 DEFPY (show_ip_pim_neighbor_vrf_all
,
2480 show_ip_pim_neighbor_vrf_all_cmd
,
2481 "show ip pim vrf all neighbor [detail|WORD]$interface [json$json]",
2486 "PIM neighbor information\n"
2488 "Name of interface or neighbor\n"
2491 return pim_show_neighbors_vrf_all_cmd_helper(vty
, json
, interface
);
2494 DEFPY (show_ip_pim_secondary
,
2495 show_ip_pim_secondary_cmd
,
2496 "show ip pim [vrf NAME] secondary",
2501 "PIM neighbor addresses\n")
2503 return pim_show_secondary_helper(vrf
, vty
);
2506 DEFPY (show_ip_pim_state
,
2507 show_ip_pim_state_cmd
,
2508 "show ip pim [vrf NAME] state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2513 "PIM state information\n"
2514 "Unicast or Multicast address\n"
2515 "Multicast address\n"
2518 return pim_show_state_helper(vrf
, vty
, s_or_g_str
, g_str
, !!json
);
2521 DEFPY (show_ip_pim_state_vrf_all
,
2522 show_ip_pim_state_vrf_all_cmd
,
2523 "show ip pim vrf all state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2528 "PIM state information\n"
2529 "Unicast or Multicast address\n"
2530 "Multicast address\n"
2533 return pim_show_state_vrf_all_helper(vty
, s_or_g_str
, g_str
, !!json
);
2536 DEFPY (show_ip_pim_upstream
,
2537 show_ip_pim_upstream_cmd
,
2538 "show ip pim [vrf NAME] upstream [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2543 "PIM upstream information\n"
2544 "The Source or Group\n"
2548 return pim_show_upstream_helper(vrf
, vty
, s_or_g
, g
, !!json
);
2551 DEFPY (show_ip_pim_upstream_vrf_all
,
2552 show_ip_pim_upstream_vrf_all_cmd
,
2553 "show ip pim vrf all upstream [json$json]",
2558 "PIM upstream information\n"
2561 return pim_show_upstream_vrf_all_helper(vty
, !!json
);
2564 DEFPY (show_ip_pim_channel
,
2565 show_ip_pim_channel_cmd
,
2566 "show ip pim [vrf NAME] channel [json$json]",
2571 "PIM downstream channel info\n"
2574 return pim_show_channel_cmd_helper(vrf
, vty
, !!json
);
2577 DEFPY (show_ip_pim_upstream_join_desired
,
2578 show_ip_pim_upstream_join_desired_cmd
,
2579 "show ip pim [vrf NAME] upstream-join-desired [json$json]",
2584 "PIM upstream join-desired\n"
2587 return pim_show_upstream_join_desired_helper(vrf
, vty
, !!json
);
2590 DEFPY (show_ip_pim_upstream_rpf
,
2591 show_ip_pim_upstream_rpf_cmd
,
2592 "show ip pim [vrf NAME] upstream-rpf [json$json]",
2597 "PIM upstream source rpf\n"
2600 return pim_show_upstream_rpf_helper(vrf
, vty
, !!json
);
2603 DEFPY (show_ip_pim_rp
,
2605 "show ip pim [vrf NAME] rp-info [A.B.C.D/M$group] [json$json]",
2610 "PIM RP information\n"
2611 "Multicast Group range\n"
2614 return pim_show_rp_helper(vrf
, vty
, group_str
, (struct prefix
*)group
,
2618 DEFPY (show_ip_pim_rp_vrf_all
,
2619 show_ip_pim_rp_vrf_all_cmd
,
2620 "show ip pim vrf all rp-info [A.B.C.D/M$group] [json$json]",
2625 "PIM RP information\n"
2626 "Multicast Group range\n"
2629 return pim_show_rp_vrf_all_helper(vty
, group_str
,
2630 (struct prefix
*)group
, !!json
);
2633 DEFPY (show_ip_pim_rpf
,
2634 show_ip_pim_rpf_cmd
,
2635 "show ip pim [vrf NAME] rpf [json$json]",
2640 "PIM cached source rpf information\n"
2643 return pim_show_rpf_helper(vrf
, vty
, !!json
);
2646 DEFPY (show_ip_pim_rpf_vrf_all
,
2647 show_ip_pim_rpf_vrf_all_cmd
,
2648 "show ip pim vrf all rpf [json$json]",
2653 "PIM cached source rpf information\n"
2656 return pim_show_rpf_vrf_all_helper(vty
, !!json
);
2659 DEFPY (show_ip_pim_nexthop
,
2660 show_ip_pim_nexthop_cmd
,
2661 "show ip pim [vrf NAME] nexthop [json$json]",
2666 "PIM cached nexthop rpf information\n"
2669 return pim_show_nexthop_cmd_helper(vrf
, vty
, !!json
);
2672 DEFPY (show_ip_pim_nexthop_lookup
,
2673 show_ip_pim_nexthop_lookup_cmd
,
2674 "show ip pim [vrf NAME] nexthop-lookup A.B.C.D$source A.B.C.D$group",
2679 "PIM cached nexthop rpf lookup\n"
2680 "Source/RP address\n"
2681 "Multicast Group address\n")
2683 return pim_show_nexthop_lookup_cmd_helper(vrf
, vty
, source
, group
);
2686 DEFPY (show_ip_pim_interface_traffic
,
2687 show_ip_pim_interface_traffic_cmd
,
2688 "show ip pim [vrf NAME] interface traffic [WORD$if_name] [json$json]",
2693 "PIM interface information\n"
2694 "Protocol Packet counters\n"
2698 return pim_show_interface_traffic_helper(vrf
, if_name
, vty
, !!json
);
2701 DEFPY (show_ip_pim_bsm_db
,
2702 show_ip_pim_bsm_db_cmd
,
2703 "show ip pim bsm-database [vrf NAME] [json$json]",
2707 "PIM cached bsm packets information\n"
2711 return pim_show_bsm_db_helper(vrf
, vty
, !!json
);
2714 DEFPY (show_ip_pim_bsrp
,
2715 show_ip_pim_bsrp_cmd
,
2716 "show ip pim bsrp-info [vrf NAME] [json$json]",
2720 "PIM cached group-rp mappings information\n"
2724 return pim_show_group_rp_mappings_info_helper(vrf
, vty
, !!json
);
2727 DEFPY (show_ip_pim_statistics
,
2728 show_ip_pim_statistics_cmd
,
2729 "show ip pim [vrf NAME] statistics [interface WORD$word] [json$json]",
2739 return pim_show_statistics_helper(vrf
, vty
, word
, !!json
);
2742 DEFPY (show_ip_multicast
,
2743 show_ip_multicast_cmd
,
2744 "show ip multicast [vrf NAME]",
2747 "Multicast global information\n"
2750 return pim_show_multicast_helper(vrf
, vty
);
2753 DEFPY (show_ip_multicast_vrf_all
,
2754 show_ip_multicast_vrf_all_cmd
,
2755 "show ip multicast vrf all",
2758 "Multicast global information\n"
2761 return pim_show_multicast_vrf_all_helper(vty
);
2764 DEFPY (show_ip_multicast_count
,
2765 show_ip_multicast_count_cmd
,
2766 "show ip multicast count [vrf NAME] [json$json]",
2769 "Multicast global information\n"
2770 "Data packet count\n"
2774 return pim_show_multicast_count_helper(vrf
, vty
, !!json
);
2777 DEFPY (show_ip_multicast_count_vrf_all
,
2778 show_ip_multicast_count_vrf_all_cmd
,
2779 "show ip multicast count vrf all [json$json]",
2782 "Multicast global information\n"
2783 "Data packet count\n"
2787 return pim_show_multicast_count_vrf_all_helper(vty
, !!json
);
2790 DEFPY (show_ip_mroute
,
2792 "show ip mroute [vrf NAME] [A.B.C.D$s_or_g [A.B.C.D$g]] [fill$fill] [json$json]",
2797 "The Source or Group\n"
2799 "Fill in Assumed data\n"
2802 return pim_show_mroute_helper(vrf
, vty
, s_or_g
, g
, !!fill
, !!json
);
2805 DEFPY (show_ip_mroute_vrf_all
,
2806 show_ip_mroute_vrf_all_cmd
,
2807 "show ip mroute vrf all [fill$fill] [json$json]",
2812 "Fill in Assumed data\n"
2815 return pim_show_mroute_vrf_all_helper(vty
, !!fill
, !!json
);
2818 DEFPY (clear_ip_mroute_count
,
2819 clear_ip_mroute_count_cmd
,
2820 "clear ip mroute [vrf NAME]$name count",
2825 "Route and packet count data\n")
2827 return clear_ip_mroute_count_command(vty
, name
);
2830 DEFPY (show_ip_mroute_count
,
2831 show_ip_mroute_count_cmd
,
2832 "show ip mroute [vrf NAME] count [json$json]",
2837 "Route and packet count data\n"
2840 return pim_show_mroute_count_helper(vrf
, vty
, !!json
);
2843 DEFPY (show_ip_mroute_count_vrf_all
,
2844 show_ip_mroute_count_vrf_all_cmd
,
2845 "show ip mroute vrf all count [json$json]",
2850 "Route and packet count data\n"
2853 return pim_show_mroute_count_vrf_all_helper(vty
, !!json
);
2856 DEFPY (show_ip_mroute_summary
,
2857 show_ip_mroute_summary_cmd
,
2858 "show ip mroute [vrf NAME] summary [json$json]",
2863 "Summary of all mroutes\n"
2866 return pim_show_mroute_summary_helper(vrf
, vty
, !!json
);
2869 DEFPY (show_ip_mroute_summary_vrf_all
,
2870 show_ip_mroute_summary_vrf_all_cmd
,
2871 "show ip mroute vrf all summary [json$json]",
2876 "Summary of all mroutes\n"
2879 return pim_show_mroute_summary_vrf_all_helper(vty
, !!json
);
2884 "show ip rib [vrf NAME] A.B.C.D",
2889 "Unicast address\n")
2892 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
2893 struct in_addr addr
;
2894 const char *addr_str
;
2895 struct pim_nexthop nexthop
;
2901 memset(&nexthop
, 0, sizeof(nexthop
));
2902 argv_find(argv
, argc
, "A.B.C.D", &idx
);
2903 addr_str
= argv
[idx
]->arg
;
2904 result
= inet_pton(AF_INET
, addr_str
, &addr
);
2906 vty_out(vty
, "Bad unicast address %s: errno=%d: %s\n", addr_str
,
2907 errno
, safe_strerror(errno
));
2911 if (!pim_nexthop_lookup(vrf
->info
, &nexthop
, addr
, 0)) {
2913 "Failure querying RIB nexthop for unicast address %s\n",
2919 "Address NextHop Interface Metric Preference\n");
2921 vty_out(vty
, "%-15s %-15pPAs %-9s %6d %10d\n", addr_str
,
2922 &nexthop
.mrib_nexthop_addr
,
2923 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
2924 nexthop
.mrib_route_metric
, nexthop
.mrib_metric_preference
);
2929 static void show_ssmpingd(struct pim_instance
*pim
, struct vty
*vty
)
2931 struct listnode
*node
;
2932 struct ssmpingd_sock
*ss
;
2936 "Source Socket Address Port Uptime Requests\n");
2938 if (!pim
->ssmpingd_list
)
2941 now
= pim_time_monotonic_sec();
2943 for (ALL_LIST_ELEMENTS_RO(pim
->ssmpingd_list
, node
, ss
)) {
2944 char source_str
[INET_ADDRSTRLEN
];
2946 struct sockaddr_in bind_addr
;
2947 socklen_t len
= sizeof(bind_addr
);
2948 char bind_addr_str
[INET_ADDRSTRLEN
];
2950 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
,
2951 sizeof(source_str
));
2953 if (pim_socket_getsockname(
2954 ss
->sock_fd
, (struct sockaddr
*)&bind_addr
, &len
)) {
2956 "%% Failure reading socket name for ssmpingd source %s on fd=%d\n",
2957 source_str
, ss
->sock_fd
);
2960 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
,
2961 sizeof(bind_addr_str
));
2962 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
),
2963 now
- ss
->creation
);
2965 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld\n", source_str
,
2966 ss
->sock_fd
, bind_addr_str
, ntohs(bind_addr
.sin_port
),
2967 ss_uptime
, (long long)ss
->requests
);
2971 DEFUN (show_ip_ssmpingd
,
2972 show_ip_ssmpingd_cmd
,
2973 "show ip ssmpingd [vrf NAME]",
2980 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, false);
2985 show_ssmpingd(vrf
->info
, vty
);
2989 DEFUN (ip_pim_spt_switchover_infinity
,
2990 ip_pim_spt_switchover_infinity_cmd
,
2991 "ip pim spt-switchover infinity-and-beyond",
2995 "Never switch to SPT Tree\n")
2997 return pim_process_spt_switchover_infinity_cmd(vty
);
3000 DEFPY (ip_pim_spt_switchover_infinity_plist
,
3001 ip_pim_spt_switchover_infinity_plist_cmd
,
3002 "ip pim spt-switchover infinity-and-beyond prefix-list WORD$plist",
3006 "Never switch to SPT Tree\n"
3007 "Prefix-List to control which groups to switch\n"
3008 "Prefix-List name\n")
3010 return pim_process_spt_switchover_prefixlist_cmd(vty
, plist
);
3013 DEFUN (no_ip_pim_spt_switchover_infinity
,
3014 no_ip_pim_spt_switchover_infinity_cmd
,
3015 "no ip pim spt-switchover infinity-and-beyond",
3020 "Never switch to SPT Tree\n")
3022 return pim_process_no_spt_switchover_cmd(vty
);
3025 DEFUN (no_ip_pim_spt_switchover_infinity_plist
,
3026 no_ip_pim_spt_switchover_infinity_plist_cmd
,
3027 "no ip pim spt-switchover infinity-and-beyond prefix-list WORD",
3032 "Never switch to SPT Tree\n"
3033 "Prefix-List to control which groups to switch\n"
3034 "Prefix-List name\n")
3036 return pim_process_no_spt_switchover_cmd(vty
);
3039 DEFPY (pim_register_accept_list
,
3040 pim_register_accept_list_cmd
,
3041 "[no] ip pim register-accept-list WORD$word",
3045 "Only accept registers from a specific source prefix list\n"
3046 "Prefix-List name\n")
3048 const char *vrfname
;
3049 char reg_alist_xpath
[XPATH_MAXLEN
];
3051 vrfname
= pim_cli_get_vrf_name(vty
);
3052 if (vrfname
== NULL
)
3053 return CMD_WARNING_CONFIG_FAILED
;
3055 snprintf(reg_alist_xpath
, sizeof(reg_alist_xpath
),
3056 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
3057 "frr-routing:ipv4");
3058 strlcat(reg_alist_xpath
, "/register-accept-list",
3059 sizeof(reg_alist_xpath
));
3062 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
3063 NB_OP_DESTROY
, NULL
);
3065 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
3066 NB_OP_MODIFY
, word
);
3068 return nb_cli_apply_changes(vty
, NULL
);
3071 DEFPY (ip_pim_joinprune_time
,
3072 ip_pim_joinprune_time_cmd
,
3073 "ip pim join-prune-interval (1-65535)$jpi",
3075 "pim multicast routing\n"
3076 "Join Prune Send Interval\n"
3079 return pim_process_join_prune_cmd(vty
, jpi_str
);
3082 DEFUN (no_ip_pim_joinprune_time
,
3083 no_ip_pim_joinprune_time_cmd
,
3084 "no ip pim join-prune-interval [(1-65535)]",
3087 "pim multicast routing\n"
3088 "Join Prune Send Interval\n"
3091 return pim_process_no_join_prune_cmd(vty
);
3094 DEFPY (ip_pim_register_suppress
,
3095 ip_pim_register_suppress_cmd
,
3096 "ip pim register-suppress-time (1-65535)$rst",
3098 "pim multicast routing\n"
3099 "Register Suppress Timer\n"
3102 return pim_process_register_suppress_cmd(vty
, rst_str
);
3105 DEFUN (no_ip_pim_register_suppress
,
3106 no_ip_pim_register_suppress_cmd
,
3107 "no ip pim register-suppress-time [(1-65535)]",
3110 "pim multicast routing\n"
3111 "Register Suppress Timer\n"
3114 return pim_process_no_register_suppress_cmd(vty
);
3117 DEFPY (ip_pim_rp_keep_alive
,
3118 ip_pim_rp_keep_alive_cmd
,
3119 "ip pim rp keep-alive-timer (1-65535)$kat",
3121 "pim multicast routing\n"
3122 "Rendezvous Point\n"
3123 "Keep alive Timer\n"
3126 return pim_process_rp_kat_cmd(vty
, kat_str
);
3129 DEFUN (no_ip_pim_rp_keep_alive
,
3130 no_ip_pim_rp_keep_alive_cmd
,
3131 "no ip pim rp keep-alive-timer [(1-65535)]",
3134 "pim multicast routing\n"
3135 "Rendezvous Point\n"
3136 "Keep alive Timer\n"
3139 return pim_process_no_rp_kat_cmd(vty
);
3142 DEFPY (ip_pim_keep_alive
,
3143 ip_pim_keep_alive_cmd
,
3144 "ip pim keep-alive-timer (1-65535)$kat",
3146 "pim multicast routing\n"
3147 "Keep alive Timer\n"
3150 return pim_process_keepalivetimer_cmd(vty
, kat_str
);
3153 DEFUN (no_ip_pim_keep_alive
,
3154 no_ip_pim_keep_alive_cmd
,
3155 "no ip pim keep-alive-timer [(1-65535)]",
3158 "pim multicast routing\n"
3159 "Keep alive Timer\n"
3162 return pim_process_no_keepalivetimer_cmd(vty
);
3165 DEFPY (ip_pim_packets
,
3167 "ip pim packets (1-255)",
3169 "pim multicast routing\n"
3170 "packets to process at one time per fd\n"
3171 "Number of packets\n")
3173 return pim_process_pim_packet_cmd(vty
, packets_str
);
3176 DEFUN (no_ip_pim_packets
,
3177 no_ip_pim_packets_cmd
,
3178 "no ip pim packets [(1-255)]",
3181 "pim multicast routing\n"
3182 "packets to process at one time per fd\n"
3185 return pim_process_no_pim_packet_cmd(vty
);
3188 DEFPY (ip_igmp_group_watermark
,
3189 ip_igmp_group_watermark_cmd
,
3190 "ip igmp watermark-warn (1-65535)$limit",
3193 "Configure group limit for watermark warning\n"
3194 "Group count to generate watermark warning\n")
3196 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
3197 pim
->gm_watermark_limit
= limit
;
3202 DEFPY (no_ip_igmp_group_watermark
,
3203 no_ip_igmp_group_watermark_cmd
,
3204 "no ip igmp watermark-warn [(1-65535)$limit]",
3208 "Unconfigure group limit for watermark warning\n"
3211 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
3212 pim
->gm_watermark_limit
= 0;
3217 DEFUN (ip_pim_v6_secondary
,
3218 ip_pim_v6_secondary_cmd
,
3219 "ip pim send-v6-secondary",
3221 "pim multicast routing\n"
3222 "Send v6 secondary addresses\n")
3224 const char *vrfname
;
3225 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
3227 vrfname
= pim_cli_get_vrf_name(vty
);
3228 if (vrfname
== NULL
)
3229 return CMD_WARNING_CONFIG_FAILED
;
3231 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
3233 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3234 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
3235 sizeof(send_v6_secondary_xpath
));
3237 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
3240 return nb_cli_apply_changes(vty
, NULL
);
3243 DEFUN (no_ip_pim_v6_secondary
,
3244 no_ip_pim_v6_secondary_cmd
,
3245 "no ip pim send-v6-secondary",
3248 "pim multicast routing\n"
3249 "Send v6 secondary addresses\n")
3251 const char *vrfname
;
3252 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
3254 vrfname
= pim_cli_get_vrf_name(vty
);
3255 if (vrfname
== NULL
)
3256 return CMD_WARNING_CONFIG_FAILED
;
3258 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
3260 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3261 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
3262 sizeof(send_v6_secondary_xpath
));
3264 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
3267 return nb_cli_apply_changes(vty
, NULL
);
3272 "ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3274 "pim multicast routing\n"
3275 "Rendezvous Point\n"
3276 "ip address of RP\n"
3277 "Group Address range to cover\n")
3279 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3281 return pim_process_rp_cmd(vty
, rp_str
, group_str
);
3284 DEFPY (ip_pim_rp_prefix_list
,
3285 ip_pim_rp_prefix_list_cmd
,
3286 "ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3288 "pim multicast routing\n"
3289 "Rendezvous Point\n"
3290 "ip address of RP\n"
3291 "group prefix-list filter\n"
3292 "Name of a prefix-list\n")
3294 return pim_process_rp_plist_cmd(vty
, rp_str
, plist
);
3297 DEFPY (no_ip_pim_rp
,
3299 "no ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3302 "pim multicast routing\n"
3303 "Rendezvous Point\n"
3304 "ip address of RP\n"
3305 "Group Address range to cover\n")
3307 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3309 return pim_process_no_rp_cmd(vty
, rp_str
, group_str
);
3312 DEFPY (no_ip_pim_rp_prefix_list
,
3313 no_ip_pim_rp_prefix_list_cmd
,
3314 "no ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3317 "pim multicast routing\n"
3318 "Rendezvous Point\n"
3319 "ip address of RP\n"
3320 "group prefix-list filter\n"
3321 "Name of a prefix-list\n")
3323 return pim_process_no_rp_plist_cmd(vty
, rp_str
, plist
);
3326 DEFUN (ip_pim_ssm_prefix_list
,
3327 ip_pim_ssm_prefix_list_cmd
,
3328 "ip pim ssm prefix-list WORD",
3330 "pim multicast routing\n"
3331 "Source Specific Multicast\n"
3332 "group range prefix-list filter\n"
3333 "Name of a prefix-list\n")
3335 const char *vrfname
;
3336 char ssm_plist_xpath
[XPATH_MAXLEN
];
3338 vrfname
= pim_cli_get_vrf_name(vty
);
3339 if (vrfname
== NULL
)
3340 return CMD_WARNING_CONFIG_FAILED
;
3342 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
), FRR_PIM_VRF_XPATH
,
3343 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3344 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3346 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_MODIFY
, argv
[4]->arg
);
3348 return nb_cli_apply_changes(vty
, NULL
);
3351 DEFUN (no_ip_pim_ssm_prefix_list
,
3352 no_ip_pim_ssm_prefix_list_cmd
,
3353 "no ip pim ssm prefix-list",
3356 "pim multicast routing\n"
3357 "Source Specific Multicast\n"
3358 "group range prefix-list filter\n")
3360 const char *vrfname
;
3361 char ssm_plist_xpath
[XPATH_MAXLEN
];
3363 vrfname
= pim_cli_get_vrf_name(vty
);
3364 if (vrfname
== NULL
)
3365 return CMD_WARNING_CONFIG_FAILED
;
3367 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3369 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3370 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3372 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
, NULL
);
3374 return nb_cli_apply_changes(vty
, NULL
);
3377 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3378 no_ip_pim_ssm_prefix_list_name_cmd
,
3379 "no ip pim ssm prefix-list WORD",
3382 "pim multicast routing\n"
3383 "Source Specific Multicast\n"
3384 "group range prefix-list filter\n"
3385 "Name of a prefix-list\n")
3387 const char *vrfname
;
3388 const struct lyd_node
*ssm_plist_dnode
;
3389 char ssm_plist_xpath
[XPATH_MAXLEN
];
3390 const char *ssm_plist_name
;
3392 vrfname
= pim_cli_get_vrf_name(vty
);
3393 if (vrfname
== NULL
)
3394 return CMD_WARNING_CONFIG_FAILED
;
3396 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3398 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3399 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3400 ssm_plist_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
3403 if (!ssm_plist_dnode
) {
3405 "%% pim ssm prefix-list %s doesn't exist\n",
3407 return CMD_WARNING_CONFIG_FAILED
;
3410 ssm_plist_name
= yang_dnode_get_string(ssm_plist_dnode
, ".");
3412 if (ssm_plist_name
&& !strcmp(ssm_plist_name
, argv
[5]->arg
)) {
3413 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
,
3416 return nb_cli_apply_changes(vty
, NULL
);
3419 vty_out(vty
, "%% pim ssm prefix-list %s doesn't exist\n", argv
[5]->arg
);
3421 return CMD_WARNING_CONFIG_FAILED
;
3424 DEFUN (show_ip_pim_ssm_range
,
3425 show_ip_pim_ssm_range_cmd
,
3426 "show ip pim [vrf NAME] group-type [json]",
3435 bool uj
= use_json(argc
, argv
);
3436 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
3441 ip_pim_ssm_show_group_range(vrf
->info
, vty
, uj
);
3446 static void ip_pim_ssm_show_group_type(struct pim_instance
*pim
,
3447 struct vty
*vty
, bool uj
,
3450 struct in_addr group_addr
;
3451 const char *type_str
;
3454 result
= inet_pton(AF_INET
, group
, &group_addr
);
3456 type_str
= "invalid";
3458 if (pim_is_group_224_4(group_addr
))
3460 pim_is_grp_ssm(pim
, group_addr
) ? "SSM" : "ASM";
3462 type_str
= "not-multicast";
3467 json
= json_object_new_object();
3468 json_object_string_add(json
, "groupType", type_str
);
3469 vty_json(vty
, json
);
3471 vty_out(vty
, "Group type : %s\n", type_str
);
3474 DEFUN (show_ip_pim_group_type
,
3475 show_ip_pim_group_type_cmd
,
3476 "show ip pim [vrf NAME] group-type A.B.C.D [json]",
3481 "multicast group type\n"
3486 bool uj
= use_json(argc
, argv
);
3487 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
3492 argv_find(argv
, argc
, "A.B.C.D", &idx
);
3493 ip_pim_ssm_show_group_type(vrf
->info
, vty
, uj
, argv
[idx
]->arg
);
3498 DEFPY (show_ip_pim_bsr
,
3499 show_ip_pim_bsr_cmd
,
3500 "show ip pim bsr [vrf NAME] [json$json]",
3504 "boot-strap router information\n"
3508 return pim_show_bsr_helper(vrf
, vty
, !!json
);
3513 "ip ssmpingd [A.B.C.D]",
3519 const char *src_str
= (argc
== 3) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3521 return pim_process_ssmpingd_cmd(vty
, NB_OP_CREATE
, src_str
);
3524 DEFUN (no_ip_ssmpingd
,
3526 "no ip ssmpingd [A.B.C.D]",
3533 const char *src_str
= (argc
== 4) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3535 return pim_process_ssmpingd_cmd(vty
, NB_OP_DESTROY
, src_str
);
3542 "pim multicast routing\n"
3543 "Enable PIM ECMP \n")
3545 const char *vrfname
;
3546 char ecmp_xpath
[XPATH_MAXLEN
];
3548 vrfname
= pim_cli_get_vrf_name(vty
);
3549 if (vrfname
== NULL
)
3550 return CMD_WARNING_CONFIG_FAILED
;
3552 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3553 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3554 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3556 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3557 return nb_cli_apply_changes(vty
, NULL
);
3560 DEFUN (no_ip_pim_ecmp
,
3565 "pim multicast routing\n"
3566 "Disable PIM ECMP \n")
3568 const char *vrfname
;
3569 char ecmp_xpath
[XPATH_MAXLEN
];
3571 vrfname
= pim_cli_get_vrf_name(vty
);
3572 if (vrfname
== NULL
)
3573 return CMD_WARNING_CONFIG_FAILED
;
3575 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3576 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3577 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3579 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "false");
3581 return nb_cli_apply_changes(vty
, NULL
);
3584 DEFUN (ip_pim_ecmp_rebalance
,
3585 ip_pim_ecmp_rebalance_cmd
,
3586 "ip pim ecmp rebalance",
3588 "pim multicast routing\n"
3589 "Enable PIM ECMP \n"
3590 "Enable PIM ECMP Rebalance\n")
3592 const char *vrfname
;
3593 char ecmp_xpath
[XPATH_MAXLEN
];
3594 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3596 vrfname
= pim_cli_get_vrf_name(vty
);
3597 if (vrfname
== NULL
)
3598 return CMD_WARNING_CONFIG_FAILED
;
3600 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3601 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3602 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3603 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3605 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3606 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3607 sizeof(ecmp_rebalance_xpath
));
3609 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3610 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "true");
3612 return nb_cli_apply_changes(vty
, NULL
);
3615 DEFUN (no_ip_pim_ecmp_rebalance
,
3616 no_ip_pim_ecmp_rebalance_cmd
,
3617 "no ip pim ecmp rebalance",
3620 "pim multicast routing\n"
3621 "Disable PIM ECMP \n"
3622 "Disable PIM ECMP Rebalance\n")
3624 const char *vrfname
;
3625 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3627 vrfname
= pim_cli_get_vrf_name(vty
);
3628 if (vrfname
== NULL
)
3629 return CMD_WARNING_CONFIG_FAILED
;
3631 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3633 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3634 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3635 sizeof(ecmp_rebalance_xpath
));
3637 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "false");
3639 return nb_cli_apply_changes(vty
, NULL
);
3642 DEFUN (interface_ip_igmp
,
3643 interface_ip_igmp_cmd
,
3648 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
, "true");
3650 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3651 "frr-routing:ipv4");
3654 DEFUN (interface_no_ip_igmp
,
3655 interface_no_ip_igmp_cmd
,
3661 const struct lyd_node
*pim_enable_dnode
;
3662 char pim_if_xpath
[XPATH_MAXLEN
];
3665 snprintf(pim_if_xpath
, sizeof(pim_if_xpath
),
3666 "%s/frr-pim:pim/address-family[address-family='%s']",
3667 VTY_CURR_XPATH
, "frr-routing:ipv4");
3669 if (printed
>= (int)(sizeof(pim_if_xpath
))) {
3670 vty_out(vty
, "Xpath too long (%d > %u)", printed
+ 1,
3672 return CMD_WARNING_CONFIG_FAILED
;
3675 pim_enable_dnode
= yang_dnode_getf(vty
->candidate_config
->dnode
,
3676 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3677 "frr-routing:ipv4");
3678 if (!pim_enable_dnode
) {
3679 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
, NULL
);
3680 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3682 if (!yang_dnode_get_bool(pim_enable_dnode
, ".")) {
3683 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
,
3685 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3687 nb_cli_enqueue_change(vty
, "./enable",
3688 NB_OP_MODIFY
, "false");
3691 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3692 "frr-routing:ipv4");
3695 DEFUN (interface_ip_igmp_join
,
3696 interface_ip_igmp_join_cmd
,
3697 "ip igmp join A.B.C.D [A.B.C.D]",
3700 "IGMP join multicast group\n"
3701 "Multicast group address\n"
3706 const char *source_str
;
3707 char xpath
[XPATH_MAXLEN
];
3710 source_str
= argv
[idx_source
]->arg
;
3712 if (strcmp(source_str
, "0.0.0.0") == 0) {
3713 vty_out(vty
, "Bad source address %s\n",
3714 argv
[idx_source
]->arg
);
3715 return CMD_WARNING_CONFIG_FAILED
;
3718 source_str
= "0.0.0.0";
3720 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3721 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3723 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
3725 return nb_cli_apply_changes(vty
, NULL
);
3728 DEFUN (interface_no_ip_igmp_join
,
3729 interface_no_ip_igmp_join_cmd
,
3730 "no ip igmp join A.B.C.D [A.B.C.D]",
3734 "IGMP join multicast group\n"
3735 "Multicast group address\n"
3740 const char *source_str
;
3741 char xpath
[XPATH_MAXLEN
];
3744 source_str
= argv
[idx_source
]->arg
;
3746 if (strcmp(source_str
, "0.0.0.0") == 0) {
3747 vty_out(vty
, "Bad source address %s\n",
3748 argv
[idx_source
]->arg
);
3749 return CMD_WARNING_CONFIG_FAILED
;
3752 source_str
= "0.0.0.0";
3754 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3755 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3757 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
3759 return nb_cli_apply_changes(vty
, NULL
);
3762 DEFUN (interface_ip_igmp_query_interval
,
3763 interface_ip_igmp_query_interval_cmd
,
3764 "ip igmp query-interval (1-65535)",
3767 IFACE_IGMP_QUERY_INTERVAL_STR
3768 "Query interval in seconds\n")
3770 const struct lyd_node
*pim_enable_dnode
;
3773 yang_dnode_getf(vty
->candidate_config
->dnode
,
3774 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3775 "frr-routing:ipv4");
3776 if (!pim_enable_dnode
) {
3777 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3780 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3781 nb_cli_enqueue_change(vty
, "./enable",
3782 NB_OP_MODIFY
, "true");
3785 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_MODIFY
,
3788 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3789 "frr-routing:ipv4");
3792 DEFUN (interface_no_ip_igmp_query_interval
,
3793 interface_no_ip_igmp_query_interval_cmd
,
3794 "no ip igmp query-interval [(1-65535)]",
3798 IFACE_IGMP_QUERY_INTERVAL_STR
3801 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_DESTROY
, NULL
);
3803 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3804 "frr-routing:ipv4");
3807 DEFUN (interface_ip_igmp_version
,
3808 interface_ip_igmp_version_cmd
,
3809 "ip igmp version (2-3)",
3813 "IGMP version number\n")
3815 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3817 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_MODIFY
,
3820 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3821 "frr-routing:ipv4");
3824 DEFUN (interface_no_ip_igmp_version
,
3825 interface_no_ip_igmp_version_cmd
,
3826 "no ip igmp version (2-3)",
3831 "IGMP version number\n")
3833 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_DESTROY
, NULL
);
3835 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3836 "frr-routing:ipv4");
3839 DEFPY (interface_ip_igmp_query_max_response_time
,
3840 interface_ip_igmp_query_max_response_time_cmd
,
3841 "ip igmp query-max-response-time (1-65535)$qmrt",
3844 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3845 "Query response value in deci-seconds\n")
3847 return gm_process_query_max_response_time_cmd(vty
, qmrt_str
);
3850 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3851 interface_no_ip_igmp_query_max_response_time_cmd
,
3852 "no ip igmp query-max-response-time [(1-65535)]",
3856 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3859 return gm_process_no_query_max_response_time_cmd(vty
);
3862 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
3863 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3864 "ip igmp query-max-response-time-dsec (1-65535)",
3867 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3868 "Query response value in deciseconds\n")
3870 const struct lyd_node
*pim_enable_dnode
;
3873 yang_dnode_getf(vty
->candidate_config
->dnode
,
3874 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3875 "frr-routing:ipv4");
3876 if (!pim_enable_dnode
) {
3877 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3880 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3881 nb_cli_enqueue_change(vty
, "./enable",
3882 NB_OP_MODIFY
, "true");
3885 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_MODIFY
,
3888 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3889 "frr-routing:ipv4");
3892 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
3893 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
3894 "no ip igmp query-max-response-time-dsec [(1-65535)]",
3898 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
3901 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_DESTROY
,
3904 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3905 "frr-routing:ipv4");
3908 DEFPY (interface_ip_igmp_last_member_query_count
,
3909 interface_ip_igmp_last_member_query_count_cmd
,
3910 "ip igmp last-member-query-count (1-255)$lmqc",
3913 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
3914 "Last member query count\n")
3916 return gm_process_last_member_query_count_cmd(vty
, lmqc_str
);
3919 DEFUN (interface_no_ip_igmp_last_member_query_count
,
3920 interface_no_ip_igmp_last_member_query_count_cmd
,
3921 "no ip igmp last-member-query-count [(1-255)]",
3925 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
3928 return gm_process_no_last_member_query_count_cmd(vty
);
3931 DEFPY (interface_ip_igmp_last_member_query_interval
,
3932 interface_ip_igmp_last_member_query_interval_cmd
,
3933 "ip igmp last-member-query-interval (1-65535)$lmqi",
3936 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
3937 "Last member query interval in deciseconds\n")
3939 return gm_process_last_member_query_interval_cmd(vty
, lmqi_str
);
3942 DEFUN (interface_no_ip_igmp_last_member_query_interval
,
3943 interface_no_ip_igmp_last_member_query_interval_cmd
,
3944 "no ip igmp last-member-query-interval [(1-65535)]",
3948 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
3951 return gm_process_no_last_member_query_interval_cmd(vty
);
3954 DEFUN (interface_ip_pim_drprio
,
3955 interface_ip_pim_drprio_cmd
,
3956 "ip pim drpriority (1-4294967295)",
3959 "Set the Designated Router Election Priority\n"
3960 "Value of the new DR Priority\n")
3964 return pim_process_ip_pim_drprio_cmd(vty
, argv
[idx_number
]->arg
);
3967 DEFUN (interface_no_ip_pim_drprio
,
3968 interface_no_ip_pim_drprio_cmd
,
3969 "no ip pim drpriority [(1-4294967295)]",
3973 "Revert the Designated Router Priority to default\n"
3974 "Old Value of the Priority\n")
3976 return pim_process_no_ip_pim_drprio_cmd(vty
);
3979 DEFPY_HIDDEN (interface_ip_igmp_query_generate
,
3980 interface_ip_igmp_query_generate_cmd
,
3981 "ip igmp generate-query-once [version (2-3)]",
3984 "Generate igmp general query once\n"
3986 "IGMP version number\n")
3989 VTY_DECLVAR_CONTEXT(interface
, ifp
);
3991 struct pim_interface
*pim_ifp
= ifp
->info
;
3994 vty_out(vty
, "IGMP/PIM is not enabled on the interface %s\n",
3996 return CMD_WARNING_CONFIG_FAILED
;
3999 /* It takes the igmp version configured on the interface as default */
4000 igmp_version
= pim_ifp
->igmp_version
;
4003 igmp_version
= atoi(argv
[4]->arg
);
4005 igmp_send_query_on_intf(ifp
, igmp_version
);
4010 DEFPY_HIDDEN (pim_test_sg_keepalive
,
4011 pim_test_sg_keepalive_cmd
,
4012 "test pim [vrf NAME$name] keepalive-reset A.B.C.D$source A.B.C.D$group",
4016 "Reset the Keepalive Timer\n"
4017 "The Source we are resetting\n"
4018 "The Group we are resetting\n")
4020 struct pim_upstream
*up
;
4022 struct pim_instance
*pim
;
4028 vrf
= vrf_lookup_by_name(name
? name
: VRF_DEFAULT_NAME
);
4030 vty_out(vty
, "%% Vrf specified: %s does not exist\n", name
);
4037 vty_out(vty
, "%% Unable to find pim instance\n");
4041 up
= pim_upstream_find(pim
, &sg
);
4043 vty_out(vty
, "%% Unable to find %pSG specified\n", &sg
);
4047 vty_out(vty
, "Setting %pSG to current keep alive time: %d\n", &sg
,
4048 pim
->keep_alive_time
);
4049 pim_upstream_keep_alive_timer_start(up
, pim
->keep_alive_time
);
4054 DEFPY (interface_ip_pim_activeactive
,
4055 interface_ip_pim_activeactive_cmd
,
4056 "[no$no] ip pim active-active",
4060 "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
4062 return pim_process_ip_pim_activeactive_cmd(vty
, no
);
4065 DEFUN_HIDDEN (interface_ip_pim_ssm
,
4066 interface_ip_pim_ssm_cmd
,
4074 ret
= pim_process_ip_pim_cmd(vty
);
4080 "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed\n");
4085 DEFUN_HIDDEN (interface_ip_pim_sm
,
4086 interface_ip_pim_sm_cmd
,
4092 return pim_process_ip_pim_cmd(vty
);
4095 DEFPY (interface_ip_pim
,
4096 interface_ip_pim_cmd
,
4097 "ip pim [passive$passive]",
4100 "Disable exchange of protocol packets\n")
4104 ret
= pim_process_ip_pim_cmd(vty
);
4110 return pim_process_ip_pim_passive_cmd(vty
, true);
4115 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
4116 interface_no_ip_pim_ssm_cmd
,
4123 return pim_process_no_ip_pim_cmd(vty
);
4126 DEFUN_HIDDEN (interface_no_ip_pim_sm
,
4127 interface_no_ip_pim_sm_cmd
,
4134 return pim_process_no_ip_pim_cmd(vty
);
4137 DEFPY (interface_no_ip_pim
,
4138 interface_no_ip_pim_cmd
,
4139 "no ip pim [passive$passive]",
4143 "Disable exchange of protocol packets\n")
4146 return pim_process_ip_pim_passive_cmd(vty
, false);
4148 return pim_process_no_ip_pim_cmd(vty
);
4152 DEFUN(interface_ip_pim_boundary_oil
,
4153 interface_ip_pim_boundary_oil_cmd
,
4154 "ip multicast boundary oil WORD",
4156 "Generic multicast configuration options\n"
4157 "Define multicast boundary\n"
4158 "Filter OIL by group using prefix list\n"
4159 "Prefix list to filter OIL with\n")
4161 return pim_process_ip_pim_boundary_oil_cmd(vty
, argv
[4]->arg
);
4164 DEFUN(interface_no_ip_pim_boundary_oil
,
4165 interface_no_ip_pim_boundary_oil_cmd
,
4166 "no ip multicast boundary oil [WORD]",
4169 "Generic multicast configuration options\n"
4170 "Define multicast boundary\n"
4171 "Filter OIL by group using prefix list\n"
4172 "Prefix list to filter OIL with\n")
4174 return pim_process_no_ip_pim_boundary_oil_cmd(vty
);
4177 DEFUN (interface_ip_mroute
,
4178 interface_ip_mroute_cmd
,
4179 "ip mroute INTERFACE A.B.C.D [A.B.C.D]",
4181 "Add multicast route\n"
4182 "Outgoing interface name\n"
4186 int idx_interface
= 2;
4188 const char *source_str
;
4190 if (argc
== (idx_ipv4
+ 1))
4191 source_str
= "0.0.0.0";
4193 source_str
= argv
[idx_ipv4
+ 1]->arg
;
4195 return pim_process_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
4196 argv
[idx_ipv4
]->arg
, source_str
);
4199 DEFUN (interface_no_ip_mroute
,
4200 interface_no_ip_mroute_cmd
,
4201 "no ip mroute INTERFACE A.B.C.D [A.B.C.D]",
4204 "Add multicast route\n"
4205 "Outgoing interface name\n"
4209 int idx_interface
= 3;
4211 const char *source_str
;
4213 if (argc
== (idx_ipv4
+ 1))
4214 source_str
= "0.0.0.0";
4216 source_str
= argv
[idx_ipv4
+ 1]->arg
;
4218 return pim_process_no_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
4219 argv
[idx_ipv4
]->arg
, source_str
);
4222 DEFUN (interface_ip_pim_hello
,
4223 interface_ip_pim_hello_cmd
,
4224 "ip pim hello (1-65535) [(1-65535)]",
4228 IFACE_PIM_HELLO_TIME_STR
4229 IFACE_PIM_HELLO_HOLD_STR
)
4234 if (argc
== idx_hold
+ 1)
4235 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
4236 argv
[idx_hold
]->arg
);
4239 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
4243 DEFUN (interface_no_ip_pim_hello
,
4244 interface_no_ip_pim_hello_cmd
,
4245 "no ip pim hello [(1-65535) [(1-65535)]]",
4253 return pim_process_no_ip_pim_hello_cmd(vty
);
4262 PIM_DO_DEBUG_GM_EVENTS
;
4263 PIM_DO_DEBUG_GM_PACKETS
;
4264 PIM_DO_DEBUG_GM_TRACE
;
4268 DEFUN (no_debug_igmp
,
4275 PIM_DONT_DEBUG_GM_EVENTS
;
4276 PIM_DONT_DEBUG_GM_PACKETS
;
4277 PIM_DONT_DEBUG_GM_TRACE
;
4282 DEFUN (debug_igmp_events
,
4283 debug_igmp_events_cmd
,
4284 "debug igmp events",
4287 DEBUG_IGMP_EVENTS_STR
)
4289 PIM_DO_DEBUG_GM_EVENTS
;
4293 DEFUN (no_debug_igmp_events
,
4294 no_debug_igmp_events_cmd
,
4295 "no debug igmp events",
4299 DEBUG_IGMP_EVENTS_STR
)
4301 PIM_DONT_DEBUG_GM_EVENTS
;
4306 DEFUN (debug_igmp_packets
,
4307 debug_igmp_packets_cmd
,
4308 "debug igmp packets",
4311 DEBUG_IGMP_PACKETS_STR
)
4313 PIM_DO_DEBUG_GM_PACKETS
;
4317 DEFUN (no_debug_igmp_packets
,
4318 no_debug_igmp_packets_cmd
,
4319 "no debug igmp packets",
4323 DEBUG_IGMP_PACKETS_STR
)
4325 PIM_DONT_DEBUG_GM_PACKETS
;
4330 DEFUN (debug_igmp_trace
,
4331 debug_igmp_trace_cmd
,
4335 DEBUG_IGMP_TRACE_STR
)
4337 PIM_DO_DEBUG_GM_TRACE
;
4341 DEFUN (no_debug_igmp_trace
,
4342 no_debug_igmp_trace_cmd
,
4343 "no debug igmp trace",
4347 DEBUG_IGMP_TRACE_STR
)
4349 PIM_DONT_DEBUG_GM_TRACE
;
4354 DEFUN (debug_igmp_trace_detail
,
4355 debug_igmp_trace_detail_cmd
,
4356 "debug igmp trace detail",
4359 DEBUG_IGMP_TRACE_STR
4362 PIM_DO_DEBUG_GM_TRACE_DETAIL
;
4366 DEFUN (no_debug_igmp_trace_detail
,
4367 no_debug_igmp_trace_detail_cmd
,
4368 "no debug igmp trace detail",
4372 DEBUG_IGMP_TRACE_STR
4375 PIM_DONT_DEBUG_GM_TRACE_DETAIL
;
4380 DEFUN (debug_mroute
,
4386 PIM_DO_DEBUG_MROUTE
;
4390 DEFUN (debug_mroute_detail
,
4391 debug_mroute_detail_cmd
,
4392 "debug mroute detail",
4397 PIM_DO_DEBUG_MROUTE_DETAIL
;
4401 DEFUN (no_debug_mroute
,
4402 no_debug_mroute_cmd
,
4408 PIM_DONT_DEBUG_MROUTE
;
4412 DEFUN (no_debug_mroute_detail
,
4413 no_debug_mroute_detail_cmd
,
4414 "no debug mroute detail",
4420 PIM_DONT_DEBUG_MROUTE_DETAIL
;
4424 DEFUN (debug_pim_static
,
4425 debug_pim_static_cmd
,
4431 PIM_DO_DEBUG_STATIC
;
4435 DEFUN (no_debug_pim_static
,
4436 no_debug_pim_static_cmd
,
4437 "no debug pim static",
4443 PIM_DONT_DEBUG_STATIC
;
4456 return pim_debug_pim_cmd();
4458 return pim_no_debug_pim_cmd();
4461 DEFPY (debug_pim_nht
,
4463 "[no] debug pim nht",
4467 "Nexthop Tracking\n")
4470 PIM_DO_DEBUG_PIM_NHT
;
4472 PIM_DONT_DEBUG_PIM_NHT
;
4476 DEFPY (debug_pim_nht_det
,
4477 debug_pim_nht_det_cmd
,
4478 "[no] debug pim nht detail",
4482 "Nexthop Tracking\n"
4483 "Detailed Information\n")
4486 PIM_DO_DEBUG_PIM_NHT_DETAIL
;
4488 PIM_DONT_DEBUG_PIM_NHT_DETAIL
;
4492 DEFUN (debug_pim_nht_rp
,
4493 debug_pim_nht_rp_cmd
,
4497 "Nexthop Tracking\n"
4498 "RP Nexthop Tracking\n")
4500 PIM_DO_DEBUG_PIM_NHT_RP
;
4504 DEFUN (no_debug_pim_nht_rp
,
4505 no_debug_pim_nht_rp_cmd
,
4506 "no debug pim nht rp",
4510 "Nexthop Tracking\n"
4511 "RP Nexthop Tracking\n")
4513 PIM_DONT_DEBUG_PIM_NHT_RP
;
4517 DEFPY (debug_pim_events
,
4518 debug_pim_events_cmd
,
4519 "[no] debug pim events",
4523 DEBUG_PIM_EVENTS_STR
)
4526 PIM_DO_DEBUG_PIM_EVENTS
;
4528 PIM_DONT_DEBUG_PIM_EVENTS
;
4532 DEFPY (debug_pim_packets
,
4533 debug_pim_packets_cmd
,
4534 "[no] debug pim packets [<hello$hello|joins$joins|register$registers>]",
4537 DEBUG_PIM_PACKETS_STR
4538 DEBUG_PIM_HELLO_PACKETS_STR
4539 DEBUG_PIM_J_P_PACKETS_STR
4540 DEBUG_PIM_PIM_REG_PACKETS_STR
)
4543 return pim_debug_pim_packets_cmd(hello
, joins
, registers
, vty
);
4545 return pim_no_debug_pim_packets_cmd(hello
, joins
, registers
,
4549 DEFPY (debug_pim_packetdump_send
,
4550 debug_pim_packetdump_send_cmd
,
4551 "[no] debug pim packet-dump send",
4555 DEBUG_PIM_PACKETDUMP_STR
4556 DEBUG_PIM_PACKETDUMP_SEND_STR
)
4559 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
4561 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
4565 DEFPY (debug_pim_packetdump_recv
,
4566 debug_pim_packetdump_recv_cmd
,
4567 "[no] debug pim packet-dump receive",
4571 DEBUG_PIM_PACKETDUMP_STR
4572 DEBUG_PIM_PACKETDUMP_RECV_STR
)
4575 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
4577 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
4581 DEFPY (debug_pim_trace
,
4582 debug_pim_trace_cmd
,
4583 "[no] debug pim trace",
4587 DEBUG_PIM_TRACE_STR
)
4590 PIM_DO_DEBUG_PIM_TRACE
;
4592 PIM_DONT_DEBUG_PIM_TRACE
;
4596 DEFPY (debug_pim_trace_detail
,
4597 debug_pim_trace_detail_cmd
,
4598 "[no] debug pim trace detail",
4603 "Detailed Information\n")
4606 PIM_DO_DEBUG_PIM_TRACE_DETAIL
;
4608 PIM_DONT_DEBUG_PIM_TRACE_DETAIL
;
4612 DEFUN (debug_ssmpingd
,
4618 PIM_DO_DEBUG_SSMPINGD
;
4622 DEFUN (no_debug_ssmpingd
,
4623 no_debug_ssmpingd_cmd
,
4624 "no debug ssmpingd",
4629 PIM_DONT_DEBUG_SSMPINGD
;
4633 DEFPY (debug_pim_zebra
,
4634 debug_pim_zebra_cmd
,
4635 "[no] debug pim zebra",
4639 DEBUG_PIM_ZEBRA_STR
)
4644 PIM_DONT_DEBUG_ZEBRA
;
4648 DEFUN(debug_pim_mlag
, debug_pim_mlag_cmd
, "debug pim mlag",
4649 DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4655 DEFUN(no_debug_pim_mlag
, no_debug_pim_mlag_cmd
, "no debug pim mlag",
4656 NO_STR DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4658 PIM_DONT_DEBUG_MLAG
;
4662 DEFUN (debug_pim_vxlan
,
4663 debug_pim_vxlan_cmd
,
4667 DEBUG_PIM_VXLAN_STR
)
4673 DEFUN (no_debug_pim_vxlan
,
4674 no_debug_pim_vxlan_cmd
,
4675 "no debug pim vxlan",
4679 DEBUG_PIM_VXLAN_STR
)
4681 PIM_DONT_DEBUG_VXLAN
;
4691 PIM_DO_DEBUG_MSDP_EVENTS
;
4692 PIM_DO_DEBUG_MSDP_PACKETS
;
4696 DEFUN (no_debug_msdp
,
4703 PIM_DONT_DEBUG_MSDP_EVENTS
;
4704 PIM_DONT_DEBUG_MSDP_PACKETS
;
4708 DEFUN (debug_msdp_events
,
4709 debug_msdp_events_cmd
,
4710 "debug msdp events",
4713 DEBUG_MSDP_EVENTS_STR
)
4715 PIM_DO_DEBUG_MSDP_EVENTS
;
4719 DEFUN (no_debug_msdp_events
,
4720 no_debug_msdp_events_cmd
,
4721 "no debug msdp events",
4725 DEBUG_MSDP_EVENTS_STR
)
4727 PIM_DONT_DEBUG_MSDP_EVENTS
;
4731 DEFUN (debug_msdp_packets
,
4732 debug_msdp_packets_cmd
,
4733 "debug msdp packets",
4736 DEBUG_MSDP_PACKETS_STR
)
4738 PIM_DO_DEBUG_MSDP_PACKETS
;
4742 DEFUN (no_debug_msdp_packets
,
4743 no_debug_msdp_packets_cmd
,
4744 "no debug msdp packets",
4748 DEBUG_MSDP_PACKETS_STR
)
4750 PIM_DONT_DEBUG_MSDP_PACKETS
;
4754 DEFUN (debug_mtrace
,
4760 PIM_DO_DEBUG_MTRACE
;
4764 DEFUN (no_debug_mtrace
,
4765 no_debug_mtrace_cmd
,
4771 PIM_DONT_DEBUG_MTRACE
;
4786 DEFUN (no_debug_bsm
,
4799 DEFUN_NOSH (show_debugging_pim
,
4800 show_debugging_pim_cmd
,
4801 "show debugging [pim]",
4806 vty_out(vty
, "PIM debugging status\n");
4808 pim_debug_config_write(vty
);
4810 cmd_show_lib_debugs(vty
);
4814 DEFUN (interface_pim_use_source
,
4815 interface_pim_use_source_cmd
,
4816 "ip pim use-source A.B.C.D",
4819 "Configure primary IP address\n"
4820 "source ip address\n")
4822 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, argv
[3]->arg
);
4824 return nb_cli_apply_changes(vty
,
4825 FRR_PIM_INTERFACE_XPATH
,
4826 "frr-routing:ipv4");
4829 DEFUN (interface_no_pim_use_source
,
4830 interface_no_pim_use_source_cmd
,
4831 "no ip pim use-source [A.B.C.D]",
4835 "Delete source IP address\n"
4836 "source ip address\n")
4838 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, "0.0.0.0");
4840 return nb_cli_apply_changes(vty
,
4841 FRR_PIM_INTERFACE_XPATH
,
4842 "frr-routing:ipv4");
4847 "ip pim bfd [profile BFDPROF$prof]",
4850 "Enables BFD support\n"
4852 "Use BFD profile name\n")
4854 const struct lyd_node
*igmp_enable_dnode
;
4857 yang_dnode_getf(vty
->candidate_config
->dnode
,
4858 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
4859 "frr-routing:ipv4");
4860 if (!igmp_enable_dnode
)
4861 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4864 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
4865 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4869 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
4871 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_MODIFY
, prof
);
4873 return nb_cli_apply_changes(vty
,
4874 FRR_PIM_INTERFACE_XPATH
,
4875 "frr-routing:ipv4");
4878 DEFPY(no_ip_pim_bfd_profile
, no_ip_pim_bfd_profile_cmd
,
4879 "no ip pim bfd profile [BFDPROF]",
4883 "Enables BFD support\n"
4884 "Disable BFD profile\n"
4885 "BFD Profile name\n")
4887 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_DESTROY
, NULL
);
4889 return nb_cli_apply_changes(vty
,
4890 FRR_PIM_INTERFACE_XPATH
,
4891 "frr-routing:ipv4");
4894 DEFUN (no_ip_pim_bfd
,
4900 "Disables BFD support\n")
4902 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_DESTROY
, NULL
);
4904 return nb_cli_apply_changes(vty
,
4905 FRR_PIM_INTERFACE_XPATH
,
4906 "frr-routing:ipv4");
4914 "Enable BSM support on the interface\n")
4916 return pim_process_bsm_cmd(vty
);
4918 DEFUN (no_ip_pim_bsm
,
4924 "Enable BSM support on the interface\n")
4926 return pim_process_no_bsm_cmd(vty
);
4929 DEFUN (ip_pim_ucast_bsm
,
4930 ip_pim_ucast_bsm_cmd
,
4931 "ip pim unicast-bsm",
4934 "Accept/Send unicast BSM on the interface\n")
4936 return pim_process_unicast_bsm_cmd(vty
);
4939 DEFUN (no_ip_pim_ucast_bsm
,
4940 no_ip_pim_ucast_bsm_cmd
,
4941 "no ip pim unicast-bsm",
4945 "Accept/Send unicast BSM on the interface\n")
4947 return pim_process_no_unicast_bsm_cmd(vty
);
4953 ip_pim_bfd_param_cmd
,
4954 "ip pim bfd (2-255) (1-65535) (1-65535)",
4957 "Enables BFD support\n"
4958 "Detect Multiplier\n"
4959 "Required min receive interval\n"
4960 "Desired min transmit interval\n")
4964 ip_pim_bfd_param_cmd
,
4965 "ip pim bfd (2-255) (1-65535) (1-65535)",
4968 "Enables BFD support\n"
4969 "Detect Multiplier\n"
4970 "Required min receive interval\n"
4971 "Desired min transmit interval\n")
4972 #endif /* HAVE_BFDD */
4975 int idx_number_2
= 4;
4976 int idx_number_3
= 5;
4977 const struct lyd_node
*igmp_enable_dnode
;
4980 yang_dnode_getf(vty
->candidate_config
->dnode
,
4981 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
4982 "frr-routing:ipv4");
4983 if (!igmp_enable_dnode
)
4984 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4987 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
4988 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4992 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
4993 nb_cli_enqueue_change(vty
, "./bfd/min-rx-interval", NB_OP_MODIFY
,
4994 argv
[idx_number_2
]->arg
);
4995 nb_cli_enqueue_change(vty
, "./bfd/min-tx-interval", NB_OP_MODIFY
,
4996 argv
[idx_number_3
]->arg
);
4997 nb_cli_enqueue_change(vty
, "./bfd/detect_mult", NB_OP_MODIFY
,
4998 argv
[idx_number
]->arg
);
5000 return nb_cli_apply_changes(vty
,
5001 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5005 ALIAS(no_ip_pim_bfd
, no_ip_pim_bfd_param_cmd
,
5006 "no ip pim bfd (2-255) (1-65535) (1-65535)",
5010 "Enables BFD support\n"
5011 "Detect Multiplier\n"
5012 "Required min receive interval\n"
5013 "Desired min transmit interval\n")
5014 #endif /* !HAVE_BFDD */
5016 DEFPY(ip_msdp_peer
, ip_msdp_peer_cmd
,
5017 "ip msdp peer A.B.C.D$peer source A.B.C.D$source",
5020 "Configure MSDP peer\n"
5022 "Source address for TCP connection\n"
5023 "Local IP address\n")
5025 const char *vrfname
;
5026 char temp_xpath
[XPATH_MAXLEN
];
5027 char msdp_peer_source_xpath
[XPATH_MAXLEN
];
5029 vrfname
= pim_cli_get_vrf_name(vty
);
5030 if (vrfname
== NULL
)
5031 return CMD_WARNING_CONFIG_FAILED
;
5033 snprintf(msdp_peer_source_xpath
, sizeof(msdp_peer_source_xpath
),
5034 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
5035 "frr-routing:ipv4");
5036 snprintf(temp_xpath
, sizeof(temp_xpath
),
5037 "/msdp-peer[peer-ip='%s']/source-ip", peer_str
);
5038 strlcat(msdp_peer_source_xpath
, temp_xpath
,
5039 sizeof(msdp_peer_source_xpath
));
5041 nb_cli_enqueue_change(vty
, msdp_peer_source_xpath
, NB_OP_MODIFY
,
5044 return nb_cli_apply_changes(vty
,
5045 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5048 DEFPY(ip_msdp_timers
, ip_msdp_timers_cmd
,
5049 "ip msdp timers (1-65535)$keepalive (1-65535)$holdtime [(1-65535)$connretry]",
5052 "MSDP timers configuration\n"
5053 "Keep alive period (in seconds)\n"
5054 "Hold time period (in seconds)\n"
5055 "Connection retry period (in seconds)\n")
5057 const char *vrfname
;
5059 vrfname
= pim_cli_get_vrf_name(vty
);
5060 if (vrfname
== NULL
)
5061 return CMD_WARNING_CONFIG_FAILED
;
5063 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_MODIFY
, holdtime_str
);
5064 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_MODIFY
, keepalive_str
);
5066 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_MODIFY
,
5069 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
,
5072 nb_cli_apply_changes(vty
, FRR_PIM_MSDP_XPATH
, "frr-pim:pimd", "pim",
5073 vrfname
, "frr-routing:ipv4");
5077 DEFPY(no_ip_msdp_timers
, no_ip_msdp_timers_cmd
,
5078 "no ip msdp timers [(1-65535) (1-65535) [(1-65535)]]",
5082 "MSDP timers configuration\n"
5087 const char *vrfname
;
5089 vrfname
= pim_cli_get_vrf_name(vty
);
5090 if (vrfname
== NULL
)
5091 return CMD_WARNING_CONFIG_FAILED
;
5093 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_DESTROY
, NULL
);
5094 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_DESTROY
, NULL
);
5095 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
, NULL
);
5097 nb_cli_apply_changes(vty
, FRR_PIM_MSDP_XPATH
, "frr-pim:pimd", "pim",
5098 vrfname
, "frr-routing:ipv4");
5103 DEFUN (no_ip_msdp_peer
,
5104 no_ip_msdp_peer_cmd
,
5105 "no ip msdp peer A.B.C.D",
5109 "Delete MSDP peer\n"
5110 "peer ip address\n")
5112 const char *vrfname
;
5113 char msdp_peer_xpath
[XPATH_MAXLEN
];
5114 char temp_xpath
[XPATH_MAXLEN
];
5116 vrfname
= pim_cli_get_vrf_name(vty
);
5117 if (vrfname
== NULL
)
5118 return CMD_WARNING_CONFIG_FAILED
;
5120 snprintf(msdp_peer_xpath
, sizeof(msdp_peer_xpath
),
5122 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
5123 snprintf(temp_xpath
, sizeof(temp_xpath
),
5124 "/msdp-peer[peer-ip='%s']",
5127 strlcat(msdp_peer_xpath
, temp_xpath
, sizeof(msdp_peer_xpath
));
5129 nb_cli_enqueue_change(vty
, msdp_peer_xpath
, NB_OP_DESTROY
, NULL
);
5131 return nb_cli_apply_changes(vty
, NULL
);
5134 DEFPY(ip_msdp_mesh_group_member
,
5135 ip_msdp_mesh_group_member_cmd
,
5136 "ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
5139 "Configure MSDP mesh-group\n"
5141 "Mesh group member\n"
5142 "Peer IP address\n")
5144 const char *vrfname
;
5145 char xpath_value
[XPATH_MAXLEN
];
5147 vrfname
= pim_cli_get_vrf_name(vty
);
5148 if (vrfname
== NULL
)
5149 return CMD_WARNING_CONFIG_FAILED
;
5151 /* Create mesh group. */
5152 snprintf(xpath_value
, sizeof(xpath_value
),
5153 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5154 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5155 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5157 /* Create mesh group member. */
5158 strlcat(xpath_value
, "/members[address='", sizeof(xpath_value
));
5159 strlcat(xpath_value
, maddr_str
, sizeof(xpath_value
));
5160 strlcat(xpath_value
, "']", sizeof(xpath_value
));
5161 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5163 return nb_cli_apply_changes(vty
, NULL
);
5166 DEFPY(no_ip_msdp_mesh_group_member
,
5167 no_ip_msdp_mesh_group_member_cmd
,
5168 "no ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
5172 "Delete MSDP mesh-group member\n"
5174 "Mesh group member\n"
5175 "Peer IP address\n")
5177 const char *vrfname
;
5178 char xpath_value
[XPATH_MAXLEN
];
5179 char xpath_member_value
[XPATH_MAXLEN
];
5181 vrfname
= pim_cli_get_vrf_name(vty
);
5182 if (vrfname
== NULL
)
5183 return CMD_WARNING_CONFIG_FAILED
;
5185 /* Get mesh group base XPath. */
5186 snprintf(xpath_value
, sizeof(xpath_value
),
5187 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5188 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5190 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
)) {
5191 vty_out(vty
, "%% mesh-group does not exist\n");
5192 return CMD_WARNING_CONFIG_FAILED
;
5195 /* Remove mesh group member. */
5196 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
5197 strlcat(xpath_member_value
, "/members[address='",
5198 sizeof(xpath_member_value
));
5199 strlcat(xpath_member_value
, maddr_str
, sizeof(xpath_member_value
));
5200 strlcat(xpath_member_value
, "']", sizeof(xpath_member_value
));
5201 if (!yang_dnode_exists(vty
->candidate_config
->dnode
,
5202 xpath_member_value
)) {
5203 vty_out(vty
, "%% mesh-group member does not exist\n");
5204 return CMD_WARNING_CONFIG_FAILED
;
5207 nb_cli_enqueue_change(vty
, xpath_member_value
, NB_OP_DESTROY
, NULL
);
5210 * If this is the last member, then we must remove the group altogether
5211 * to not break legacy CLI behaviour.
5213 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5215 return nb_cli_apply_changes(vty
, NULL
);
5218 DEFPY(ip_msdp_mesh_group_source
,
5219 ip_msdp_mesh_group_source_cmd
,
5220 "ip msdp mesh-group WORD$gname source A.B.C.D$saddr",
5223 "Configure MSDP mesh-group\n"
5225 "Mesh group local address\n"
5226 "Source IP address for the TCP connection\n")
5228 const char *vrfname
;
5229 char xpath_value
[XPATH_MAXLEN
];
5231 vrfname
= pim_cli_get_vrf_name(vty
);
5232 if (vrfname
== NULL
)
5233 return CMD_WARNING_CONFIG_FAILED
;
5235 /* Create mesh group. */
5236 snprintf(xpath_value
, sizeof(xpath_value
),
5237 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5238 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5239 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5241 /* Create mesh group source. */
5242 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5243 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_MODIFY
, saddr_str
);
5245 return nb_cli_apply_changes(vty
, NULL
);
5248 DEFPY(no_ip_msdp_mesh_group_source
,
5249 no_ip_msdp_mesh_group_source_cmd
,
5250 "no ip msdp mesh-group WORD$gname source [A.B.C.D]",
5254 "Delete MSDP mesh-group source\n"
5256 "Mesh group source\n"
5257 "Mesh group local address\n")
5259 const char *vrfname
;
5260 char xpath_value
[XPATH_MAXLEN
];
5262 vrfname
= pim_cli_get_vrf_name(vty
);
5263 if (vrfname
== NULL
)
5264 return CMD_WARNING_CONFIG_FAILED
;
5266 /* Get mesh group base XPath. */
5267 snprintf(xpath_value
, sizeof(xpath_value
),
5268 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5269 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5270 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5272 /* Create mesh group source. */
5273 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5274 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5277 * If this is the last member, then we must remove the group altogether
5278 * to not break legacy CLI behaviour.
5280 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5282 return nb_cli_apply_changes(vty
, NULL
);
5285 DEFPY(no_ip_msdp_mesh_group
,
5286 no_ip_msdp_mesh_group_cmd
,
5287 "no ip msdp mesh-group WORD$gname",
5291 "Delete MSDP mesh-group\n"
5292 "Mesh group name\n")
5294 const char *vrfname
;
5295 char xpath_value
[XPATH_MAXLEN
];
5297 vrfname
= pim_cli_get_vrf_name(vty
);
5298 if (vrfname
== NULL
)
5299 return CMD_WARNING_CONFIG_FAILED
;
5301 /* Get mesh group base XPath. */
5302 snprintf(xpath_value
, sizeof(xpath_value
),
5303 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5304 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5305 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
5308 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5309 return nb_cli_apply_changes(vty
, NULL
);
5312 static void ip_msdp_show_mesh_group(struct vty
*vty
, struct pim_msdp_mg
*mg
,
5313 struct json_object
*json
)
5315 struct listnode
*mbrnode
;
5316 struct pim_msdp_mg_mbr
*mbr
;
5317 char mbr_str
[INET_ADDRSTRLEN
];
5318 char src_str
[INET_ADDRSTRLEN
];
5319 char state_str
[PIM_MSDP_STATE_STRLEN
];
5320 enum pim_msdp_peer_state state
;
5321 json_object
*json_mg_row
= NULL
;
5322 json_object
*json_members
= NULL
;
5323 json_object
*json_row
= NULL
;
5325 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
5327 /* currently there is only one mesh group but we should still
5329 * it a dict with mg-name as key */
5330 json_mg_row
= json_object_new_object();
5331 json_object_string_add(json_mg_row
, "name",
5332 mg
->mesh_group_name
);
5333 json_object_string_add(json_mg_row
, "source", src_str
);
5335 vty_out(vty
, "Mesh group : %s\n", mg
->mesh_group_name
);
5336 vty_out(vty
, " Source : %s\n", src_str
);
5337 vty_out(vty
, " Member State\n");
5340 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
5341 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
5343 state
= mbr
->mp
->state
;
5345 state
= PIM_MSDP_DISABLED
;
5347 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
5349 json_row
= json_object_new_object();
5350 json_object_string_add(json_row
, "member", mbr_str
);
5351 json_object_string_add(json_row
, "state", state_str
);
5352 if (!json_members
) {
5353 json_members
= json_object_new_object();
5354 json_object_object_add(json_mg_row
, "members",
5357 json_object_object_add(json_members
, mbr_str
, json_row
);
5359 vty_out(vty
, " %-15s %11s\n", mbr_str
, state_str
);
5364 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
5367 DEFUN (show_ip_msdp_mesh_group
,
5368 show_ip_msdp_mesh_group_cmd
,
5369 "show ip msdp [vrf NAME] mesh-group [json]",
5374 "MSDP mesh-group information\n"
5377 bool uj
= use_json(argc
, argv
);
5379 struct pim_msdp_mg
*mg
;
5380 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
5381 struct pim_instance
*pim
;
5382 struct json_object
*json
= NULL
;
5388 /* Quick case: list is empty. */
5389 if (SLIST_EMPTY(&pim
->msdp
.mglist
)) {
5391 vty_out(vty
, "{}\n");
5397 json
= json_object_new_object();
5399 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5400 ip_msdp_show_mesh_group(vty
, mg
, json
);
5403 vty_json(vty
, json
);
5408 DEFUN (show_ip_msdp_mesh_group_vrf_all
,
5409 show_ip_msdp_mesh_group_vrf_all_cmd
,
5410 "show ip msdp vrf all mesh-group [json]",
5415 "MSDP mesh-group information\n"
5418 bool uj
= use_json(argc
, argv
);
5419 struct json_object
*json
= NULL
, *vrf_json
= NULL
;
5420 struct pim_instance
*pim
;
5421 struct pim_msdp_mg
*mg
;
5425 json
= json_object_new_object();
5427 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5429 vrf_json
= json_object_new_object();
5430 json_object_object_add(json
, vrf
->name
, vrf_json
);
5432 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5435 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5436 ip_msdp_show_mesh_group(vty
, mg
, vrf_json
);
5440 vty_json(vty
, json
);
5446 static void ip_msdp_show_peers(struct pim_instance
*pim
, struct vty
*vty
,
5449 struct listnode
*mpnode
;
5450 struct pim_msdp_peer
*mp
;
5451 char peer_str
[INET_ADDRSTRLEN
];
5452 char local_str
[INET_ADDRSTRLEN
];
5453 char state_str
[PIM_MSDP_STATE_STRLEN
];
5454 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5456 json_object
*json
= NULL
;
5457 json_object
*json_row
= NULL
;
5461 json
= json_object_new_object();
5464 "Peer Local State Uptime SaCnt\n");
5467 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5468 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5469 now
= pim_time_monotonic_sec();
5470 pim_time_uptime(timebuf
, sizeof(timebuf
),
5473 strlcpy(timebuf
, "-", sizeof(timebuf
));
5475 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5476 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5478 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5480 json_row
= json_object_new_object();
5481 json_object_string_add(json_row
, "peer", peer_str
);
5482 json_object_string_add(json_row
, "local", local_str
);
5483 json_object_string_add(json_row
, "state", state_str
);
5484 json_object_string_add(json_row
, "upTime", timebuf
);
5485 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5486 json_object_object_add(json
, peer_str
, json_row
);
5488 vty_out(vty
, "%-15s %15s %11s %8s %6d\n", peer_str
,
5489 local_str
, state_str
, timebuf
, mp
->sa_cnt
);
5494 vty_json(vty
, json
);
5497 static void ip_msdp_show_peers_detail(struct pim_instance
*pim
, struct vty
*vty
,
5498 const char *peer
, bool uj
)
5500 struct listnode
*mpnode
;
5501 struct pim_msdp_peer
*mp
;
5502 char peer_str
[INET_ADDRSTRLEN
];
5503 char local_str
[INET_ADDRSTRLEN
];
5504 char state_str
[PIM_MSDP_STATE_STRLEN
];
5505 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5506 char katimer
[PIM_MSDP_TIMER_STRLEN
];
5507 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
5508 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
5510 json_object
*json
= NULL
;
5511 json_object
*json_row
= NULL
;
5514 json
= json_object_new_object();
5517 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5518 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5519 if (strcmp(peer
, "detail") && strcmp(peer
, peer_str
))
5522 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5523 now
= pim_time_monotonic_sec();
5524 pim_time_uptime(timebuf
, sizeof(timebuf
),
5527 strlcpy(timebuf
, "-", sizeof(timebuf
));
5529 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5531 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5532 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
),
5534 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
),
5536 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
),
5540 json_row
= json_object_new_object();
5541 json_object_string_add(json_row
, "peer", peer_str
);
5542 json_object_string_add(json_row
, "local", local_str
);
5543 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5544 json_object_string_add(json_row
,
5546 mp
->mesh_group_name
);
5547 json_object_string_add(json_row
, "state", state_str
);
5548 json_object_string_add(json_row
, "upTime", timebuf
);
5549 json_object_string_add(json_row
, "keepAliveTimer",
5551 json_object_string_add(json_row
, "connRetryTimer",
5553 json_object_string_add(json_row
, "holdTimer",
5555 json_object_string_add(json_row
, "lastReset",
5557 json_object_int_add(json_row
, "connAttempts",
5559 json_object_int_add(json_row
, "establishedChanges",
5561 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5562 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
5563 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
5564 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
5565 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
5566 json_object_object_add(json
, peer_str
, json_row
);
5568 vty_out(vty
, "Peer : %s\n", peer_str
);
5569 vty_out(vty
, " Local : %s\n", local_str
);
5570 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5571 vty_out(vty
, " Mesh Group : %s\n",
5572 mp
->mesh_group_name
);
5573 vty_out(vty
, " State : %s\n", state_str
);
5574 vty_out(vty
, " Uptime : %s\n", timebuf
);
5576 vty_out(vty
, " Keepalive Timer : %s\n", katimer
);
5577 vty_out(vty
, " Conn Retry Timer : %s\n", crtimer
);
5578 vty_out(vty
, " Hold Timer : %s\n", holdtimer
);
5579 vty_out(vty
, " Last Reset : %s\n",
5581 vty_out(vty
, " Conn Attempts : %d\n",
5583 vty_out(vty
, " Established Changes : %d\n",
5585 vty_out(vty
, " SA Count : %d\n",
5587 vty_out(vty
, " Statistics :\n");
5590 vty_out(vty
, " Keepalives : %10d %10d\n",
5591 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
);
5592 vty_out(vty
, " SAs : %10d %10d\n",
5593 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
);
5599 vty_json(vty
, json
);
5602 DEFUN (show_ip_msdp_peer_detail
,
5603 show_ip_msdp_peer_detail_cmd
,
5604 "show ip msdp [vrf NAME] peer [detail|A.B.C.D] [json]",
5609 "MSDP peer information\n"
5614 bool uj
= use_json(argc
, argv
);
5616 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
5623 if (argv_find(argv
, argc
, "detail", &idx
))
5624 arg
= argv
[idx
]->text
;
5625 else if (argv_find(argv
, argc
, "A.B.C.D", &idx
))
5626 arg
= argv
[idx
]->arg
;
5629 ip_msdp_show_peers_detail(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
5631 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5636 DEFUN (show_ip_msdp_peer_detail_vrf_all
,
5637 show_ip_msdp_peer_detail_vrf_all_cmd
,
5638 "show ip msdp vrf all peer [detail|A.B.C.D] [json]",
5643 "MSDP peer information\n"
5649 bool uj
= use_json(argc
, argv
);
5655 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5659 vty_out(vty
, " \"%s\": ", vrf
->name
);
5662 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5663 if (argv_find(argv
, argc
, "detail", &idx
)
5664 || argv_find(argv
, argc
, "A.B.C.D", &idx
))
5665 ip_msdp_show_peers_detail(vrf
->info
, vty
,
5666 argv
[idx
]->arg
, uj
);
5668 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5671 vty_out(vty
, "}\n");
5676 static void ip_msdp_show_sa(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
5678 struct listnode
*sanode
;
5679 struct pim_msdp_sa
*sa
;
5680 char rp_str
[INET_ADDRSTRLEN
];
5681 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5685 json_object
*json
= NULL
;
5686 json_object
*json_group
= NULL
;
5687 json_object
*json_row
= NULL
;
5690 json
= json_object_new_object();
5693 "Source Group RP Local SPT Uptime\n");
5696 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5697 now
= pim_time_monotonic_sec();
5698 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5699 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5700 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5702 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5704 strlcpy(spt_str
, "no", sizeof(spt_str
));
5707 strlcpy(rp_str
, "-", sizeof(rp_str
));
5708 strlcpy(spt_str
, "-", sizeof(spt_str
));
5710 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5711 strlcpy(local_str
, "yes", sizeof(local_str
));
5713 strlcpy(local_str
, "no", sizeof(local_str
));
5716 char src_str
[PIM_ADDRSTRLEN
];
5717 char grp_str
[PIM_ADDRSTRLEN
];
5719 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
5721 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
5724 json_object_object_get_ex(json
, grp_str
, &json_group
);
5727 json_group
= json_object_new_object();
5728 json_object_object_add(json
, grp_str
,
5732 json_row
= json_object_new_object();
5733 json_object_string_add(json_row
, "source", src_str
);
5734 json_object_string_add(json_row
, "group", grp_str
);
5735 json_object_string_add(json_row
, "rp", rp_str
);
5736 json_object_string_add(json_row
, "local", local_str
);
5737 json_object_string_add(json_row
, "sptSetup", spt_str
);
5738 json_object_string_add(json_row
, "upTime", timebuf
);
5739 json_object_object_add(json_group
, src_str
, json_row
);
5741 vty_out(vty
, "%-15pPAs %15pPAs %15s %5c %3c %8s\n",
5742 &sa
->sg
.src
, &sa
->sg
.grp
, rp_str
, local_str
[0],
5743 spt_str
[0], timebuf
);
5748 vty_json(vty
, json
);
5751 static void ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
,
5752 const char *src_str
,
5753 const char *grp_str
, struct vty
*vty
,
5754 bool uj
, json_object
*json
)
5756 char rp_str
[INET_ADDRSTRLEN
];
5757 char peer_str
[INET_ADDRSTRLEN
];
5758 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5761 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
5763 json_object
*json_group
= NULL
;
5764 json_object
*json_row
= NULL
;
5766 now
= pim_time_monotonic_sec();
5767 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5768 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5769 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5770 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
5772 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5774 strlcpy(spt_str
, "no", sizeof(spt_str
));
5777 strlcpy(rp_str
, "-", sizeof(rp_str
));
5778 strlcpy(peer_str
, "-", sizeof(peer_str
));
5779 strlcpy(spt_str
, "-", sizeof(spt_str
));
5781 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5782 strlcpy(local_str
, "yes", sizeof(local_str
));
5784 strlcpy(local_str
, "no", sizeof(local_str
));
5786 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
),
5787 sa
->sa_state_timer
);
5789 json_object_object_get_ex(json
, grp_str
, &json_group
);
5792 json_group
= json_object_new_object();
5793 json_object_object_add(json
, grp_str
, json_group
);
5796 json_row
= json_object_new_object();
5797 json_object_string_add(json_row
, "source", src_str
);
5798 json_object_string_add(json_row
, "group", grp_str
);
5799 json_object_string_add(json_row
, "rp", rp_str
);
5800 json_object_string_add(json_row
, "local", local_str
);
5801 json_object_string_add(json_row
, "sptSetup", spt_str
);
5802 json_object_string_add(json_row
, "upTime", timebuf
);
5803 json_object_string_add(json_row
, "stateTimer", statetimer
);
5804 json_object_object_add(json_group
, src_str
, json_row
);
5806 vty_out(vty
, "SA : %s\n", sa
->sg_str
);
5807 vty_out(vty
, " RP : %s\n", rp_str
);
5808 vty_out(vty
, " Peer : %s\n", peer_str
);
5809 vty_out(vty
, " Local : %s\n", local_str
);
5810 vty_out(vty
, " SPT Setup : %s\n", spt_str
);
5811 vty_out(vty
, " Uptime : %s\n", timebuf
);
5812 vty_out(vty
, " State Timer : %s\n", statetimer
);
5817 static void ip_msdp_show_sa_detail(struct pim_instance
*pim
, struct vty
*vty
,
5820 struct listnode
*sanode
;
5821 struct pim_msdp_sa
*sa
;
5822 json_object
*json
= NULL
;
5825 json
= json_object_new_object();
5828 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5829 char src_str
[PIM_ADDRSTRLEN
];
5830 char grp_str
[PIM_ADDRSTRLEN
];
5832 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5833 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5835 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
,
5840 vty_json(vty
, json
);
5843 DEFUN (show_ip_msdp_sa_detail
,
5844 show_ip_msdp_sa_detail_cmd
,
5845 "show ip msdp [vrf NAME] sa detail [json]",
5850 "MSDP active-source information\n"
5854 bool uj
= use_json(argc
, argv
);
5856 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
5861 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
5866 DEFUN (show_ip_msdp_sa_detail_vrf_all
,
5867 show_ip_msdp_sa_detail_vrf_all_cmd
,
5868 "show ip msdp vrf all sa detail [json]",
5873 "MSDP active-source information\n"
5877 bool uj
= use_json(argc
, argv
);
5883 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5887 vty_out(vty
, " \"%s\": ", vrf
->name
);
5890 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5891 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
5894 vty_out(vty
, "}\n");
5899 static void ip_msdp_show_sa_addr(struct pim_instance
*pim
, struct vty
*vty
,
5900 const char *addr
, bool uj
)
5902 struct listnode
*sanode
;
5903 struct pim_msdp_sa
*sa
;
5904 json_object
*json
= NULL
;
5907 json
= json_object_new_object();
5910 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5911 char src_str
[PIM_ADDRSTRLEN
];
5912 char grp_str
[PIM_ADDRSTRLEN
];
5914 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5915 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5917 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
5918 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
5924 vty_json(vty
, json
);
5927 static void ip_msdp_show_sa_sg(struct pim_instance
*pim
, struct vty
*vty
,
5928 const char *src
, const char *grp
, bool uj
)
5930 struct listnode
*sanode
;
5931 struct pim_msdp_sa
*sa
;
5932 json_object
*json
= NULL
;
5935 json
= json_object_new_object();
5938 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5939 char src_str
[PIM_ADDRSTRLEN
];
5940 char grp_str
[PIM_ADDRSTRLEN
];
5942 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
5943 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
5945 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
5946 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
5952 vty_json(vty
, json
);
5955 DEFUN (show_ip_msdp_sa_sg
,
5956 show_ip_msdp_sa_sg_cmd
,
5957 "show ip msdp [vrf NAME] sa [A.B.C.D [A.B.C.D]] [json]",
5962 "MSDP active-source information\n"
5963 "source or group ip\n"
5967 bool uj
= use_json(argc
, argv
);
5971 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
5976 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
5978 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
5982 if (src_ip
&& grp_ip
)
5983 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
5985 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
5987 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
5992 DEFUN (show_ip_msdp_sa_sg_vrf_all
,
5993 show_ip_msdp_sa_sg_vrf_all_cmd
,
5994 "show ip msdp vrf all sa [A.B.C.D [A.B.C.D]] [json]",
5999 "MSDP active-source information\n"
6000 "source or group ip\n"
6004 bool uj
= use_json(argc
, argv
);
6009 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
6011 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
6017 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
6021 vty_out(vty
, " \"%s\": ", vrf
->name
);
6024 vty_out(vty
, "VRF: %s\n", vrf
->name
);
6026 if (src_ip
&& grp_ip
)
6027 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6029 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
6031 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
6034 vty_out(vty
, "}\n");
6039 struct pim_sg_cache_walk_data
{
6042 json_object
*json_group
;
6043 struct in_addr addr
;
6047 static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg
*vxlan_sg
,
6048 struct pim_sg_cache_walk_data
*cwd
)
6050 struct vty
*vty
= cwd
->vty
;
6051 json_object
*json
= cwd
->json
;
6052 json_object
*json_row
;
6053 bool installed
= (vxlan_sg
->up
) ? true : false;
6054 const char *iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
6055 const char *oif_name
;
6057 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
6058 oif_name
= vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
6060 oif_name
= vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
6062 if (cwd
->addr_match
&& pim_addr_cmp(vxlan_sg
->sg
.src
, cwd
->addr
) &&
6063 pim_addr_cmp(vxlan_sg
->sg
.grp
, cwd
->addr
)) {
6067 char src_str
[PIM_ADDRSTRLEN
];
6068 char grp_str
[PIM_ADDRSTRLEN
];
6070 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
6072 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
6075 json_object_object_get_ex(json
, grp_str
, &cwd
->json_group
);
6077 if (!cwd
->json_group
) {
6078 cwd
->json_group
= json_object_new_object();
6079 json_object_object_add(json
, grp_str
,
6083 json_row
= json_object_new_object();
6084 json_object_string_add(json_row
, "source", src_str
);
6085 json_object_string_add(json_row
, "group", grp_str
);
6086 json_object_string_add(json_row
, "input", iif_name
);
6087 json_object_string_add(json_row
, "output", oif_name
);
6089 json_object_boolean_true_add(json_row
, "installed");
6091 json_object_boolean_false_add(json_row
, "installed");
6092 json_object_object_add(cwd
->json_group
, src_str
, json_row
);
6094 vty_out(vty
, "%-15pPAs %-15pPAs %-15s %-15s %-5s\n",
6095 &vxlan_sg
->sg
.src
, &vxlan_sg
->sg
.grp
, iif_name
,
6096 oif_name
, installed
? "I" : "");
6100 static void pim_show_vxlan_sg_hash_entry(struct hash_bucket
*bucket
, void *arg
)
6102 pim_show_vxlan_sg_entry((struct pim_vxlan_sg
*)bucket
->data
,
6103 (struct pim_sg_cache_walk_data
*)arg
);
6106 static void pim_show_vxlan_sg(struct pim_instance
*pim
,
6107 struct vty
*vty
, bool uj
)
6109 json_object
*json
= NULL
;
6110 struct pim_sg_cache_walk_data cwd
;
6113 json
= json_object_new_object();
6115 vty_out(vty
, "Codes: I -> installed\n");
6117 "Source Group Input Output Flags\n");
6120 memset(&cwd
, 0, sizeof(cwd
));
6123 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
6126 vty_json(vty
, json
);
6129 static void pim_show_vxlan_sg_match_addr(struct pim_instance
*pim
,
6130 struct vty
*vty
, char *addr_str
,
6133 json_object
*json
= NULL
;
6134 struct pim_sg_cache_walk_data cwd
;
6137 memset(&cwd
, 0, sizeof(cwd
));
6138 result
= inet_pton(AF_INET
, addr_str
, &cwd
.addr
);
6140 vty_out(vty
, "Bad address %s: errno=%d: %s\n", addr_str
,
6141 errno
, safe_strerror(errno
));
6146 json
= json_object_new_object();
6148 vty_out(vty
, "Codes: I -> installed\n");
6150 "Source Group Input Output Flags\n");
6155 cwd
.addr_match
= true;
6156 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
6159 vty_json(vty
, json
);
6162 static void pim_show_vxlan_sg_one(struct pim_instance
*pim
,
6163 struct vty
*vty
, char *src_str
, char *grp_str
,
6166 json_object
*json
= NULL
;
6169 struct pim_vxlan_sg
*vxlan_sg
;
6170 const char *iif_name
;
6172 const char *oif_name
;
6174 result
= inet_pton(AF_INET
, src_str
, &sg
.src
);
6176 vty_out(vty
, "Bad src address %s: errno=%d: %s\n", src_str
,
6177 errno
, safe_strerror(errno
));
6180 result
= inet_pton(AF_INET
, grp_str
, &sg
.grp
);
6182 vty_out(vty
, "Bad grp address %s: errno=%d: %s\n", grp_str
,
6183 errno
, safe_strerror(errno
));
6188 json
= json_object_new_object();
6190 vxlan_sg
= pim_vxlan_sg_find(pim
, &sg
);
6192 installed
= (vxlan_sg
->up
) ? true : false;
6193 iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
6195 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
6197 vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
6200 vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
6203 json_object_string_add(json
, "source", src_str
);
6204 json_object_string_add(json
, "group", grp_str
);
6205 json_object_string_add(json
, "input", iif_name
);
6206 json_object_string_add(json
, "output", oif_name
);
6208 json_object_boolean_true_add(json
, "installed");
6210 json_object_boolean_false_add(json
,
6213 vty_out(vty
, "SG : %s\n", vxlan_sg
->sg_str
);
6214 vty_out(vty
, " Input : %s\n", iif_name
);
6215 vty_out(vty
, " Output : %s\n", oif_name
);
6216 vty_out(vty
, " installed : %s\n",
6217 installed
?"yes":"no");
6222 vty_json(vty
, json
);
6225 DEFUN (show_ip_pim_vxlan_sg
,
6226 show_ip_pim_vxlan_sg_cmd
,
6227 "show ip pim [vrf NAME] vxlan-groups [A.B.C.D [A.B.C.D]] [json]",
6232 "VxLAN BUM groups\n"
6233 "source or group ip\n"
6237 bool uj
= use_json(argc
, argv
);
6241 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
6246 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
6247 argv
[idx
++]->arg
:NULL
;
6248 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
6249 argv
[idx
]->arg
:NULL
;
6251 if (src_ip
&& grp_ip
)
6252 pim_show_vxlan_sg_one(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6254 pim_show_vxlan_sg_match_addr(vrf
->info
, vty
, src_ip
, uj
);
6256 pim_show_vxlan_sg(vrf
->info
, vty
, uj
);
6261 static void pim_show_vxlan_sg_work(struct pim_instance
*pim
,
6262 struct vty
*vty
, bool uj
)
6264 json_object
*json
= NULL
;
6265 struct pim_sg_cache_walk_data cwd
;
6266 struct listnode
*node
;
6267 struct pim_vxlan_sg
*vxlan_sg
;
6270 json
= json_object_new_object();
6272 vty_out(vty
, "Codes: I -> installed\n");
6274 "Source Group Input Flags\n");
6277 memset(&cwd
, 0, sizeof(cwd
));
6280 for (ALL_LIST_ELEMENTS_RO(pim_vxlan_p
->work_list
, node
, vxlan_sg
))
6281 pim_show_vxlan_sg_entry(vxlan_sg
, &cwd
);
6284 vty_json(vty
, json
);
6287 DEFUN_HIDDEN (show_ip_pim_vxlan_sg_work
,
6288 show_ip_pim_vxlan_sg_work_cmd
,
6289 "show ip pim [vrf NAME] vxlan-work [json]",
6297 bool uj
= use_json(argc
, argv
);
6301 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
, uj
);
6306 pim_show_vxlan_sg_work(vrf
->info
, vty
, uj
);
6311 DEFUN_HIDDEN (no_ip_pim_mlag
,
6319 char mlag_xpath
[XPATH_MAXLEN
];
6321 snprintf(mlag_xpath
, sizeof(mlag_xpath
), FRR_PIM_VRF_XPATH
,
6322 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6323 strlcat(mlag_xpath
, "/mlag", sizeof(mlag_xpath
));
6325 nb_cli_enqueue_change(vty
, mlag_xpath
, NB_OP_DESTROY
, NULL
);
6328 return nb_cli_apply_changes(vty
, NULL
);
6331 DEFUN_HIDDEN (ip_pim_mlag
,
6333 "ip pim mlag INTERFACE role [primary|secondary] state [up|down] addr A.B.C.D",
6337 "peerlink sub interface\n"
6339 "MLAG role primary\n"
6340 "MLAG role secondary\n"
6341 "peer session state\n"
6342 "peer session state up\n"
6343 "peer session state down\n"
6345 "unique ip address\n")
6348 char mlag_peerlink_rif_xpath
[XPATH_MAXLEN
];
6349 char mlag_my_role_xpath
[XPATH_MAXLEN
];
6350 char mlag_peer_state_xpath
[XPATH_MAXLEN
];
6351 char mlag_reg_address_xpath
[XPATH_MAXLEN
];
6353 snprintf(mlag_peerlink_rif_xpath
, sizeof(mlag_peerlink_rif_xpath
),
6355 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6356 strlcat(mlag_peerlink_rif_xpath
, "/mlag/peerlink-rif",
6357 sizeof(mlag_peerlink_rif_xpath
));
6360 nb_cli_enqueue_change(vty
, mlag_peerlink_rif_xpath
, NB_OP_MODIFY
,
6363 snprintf(mlag_my_role_xpath
, sizeof(mlag_my_role_xpath
),
6365 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6366 strlcat(mlag_my_role_xpath
, "/mlag/my-role",
6367 sizeof(mlag_my_role_xpath
));
6370 if (!strcmp(argv
[idx
]->arg
, "primary")) {
6371 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6372 "MLAG_ROLE_PRIMARY");
6374 } else if (!strcmp(argv
[idx
]->arg
, "secondary")) {
6375 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6376 "MLAG_ROLE_SECONDARY");
6379 vty_out(vty
, "unknown MLAG role %s\n", argv
[idx
]->arg
);
6383 snprintf(mlag_peer_state_xpath
, sizeof(mlag_peer_state_xpath
),
6385 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6386 strlcat(mlag_peer_state_xpath
, "/mlag/peer-state",
6387 sizeof(mlag_peer_state_xpath
));
6390 if (!strcmp(argv
[idx
]->arg
, "up")) {
6391 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6394 } else if (strcmp(argv
[idx
]->arg
, "down")) {
6395 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6399 vty_out(vty
, "unknown MLAG state %s\n", argv
[idx
]->arg
);
6403 snprintf(mlag_reg_address_xpath
, sizeof(mlag_reg_address_xpath
),
6405 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6406 strlcat(mlag_reg_address_xpath
, "/mlag/reg-address",
6407 sizeof(mlag_reg_address_xpath
));
6410 nb_cli_enqueue_change(vty
, mlag_reg_address_xpath
, NB_OP_MODIFY
,
6413 return nb_cli_apply_changes(vty
, NULL
);
6416 void pim_cmd_init(void)
6418 if_cmd_init(pim_interface_config_write
);
6420 install_node(&debug_node
);
6422 install_element(ENABLE_NODE
, &pim_test_sg_keepalive_cmd
);
6424 install_element(CONFIG_NODE
, &ip_pim_rp_cmd
);
6425 install_element(VRF_NODE
, &ip_pim_rp_cmd
);
6426 install_element(CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6427 install_element(VRF_NODE
, &no_ip_pim_rp_cmd
);
6428 install_element(CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6429 install_element(VRF_NODE
, &ip_pim_rp_prefix_list_cmd
);
6430 install_element(CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6431 install_element(VRF_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6432 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6433 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6434 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6435 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6436 install_element(CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6437 install_element(VRF_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6438 install_element(CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6439 install_element(CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6440 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6441 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6442 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6443 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6444 install_element(CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6445 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6446 install_element(CONFIG_NODE
,
6447 &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6448 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6449 install_element(CONFIG_NODE
, &pim_register_accept_list_cmd
);
6450 install_element(VRF_NODE
, &pim_register_accept_list_cmd
);
6451 install_element(CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6452 install_element(CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6453 install_element(CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6454 install_element(VRF_NODE
, &ip_pim_keep_alive_cmd
);
6455 install_element(CONFIG_NODE
, &ip_pim_rp_keep_alive_cmd
);
6456 install_element(VRF_NODE
, &ip_pim_rp_keep_alive_cmd
);
6457 install_element(CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6458 install_element(VRF_NODE
, &no_ip_pim_keep_alive_cmd
);
6459 install_element(CONFIG_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6460 install_element(VRF_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6461 install_element(CONFIG_NODE
, &ip_pim_packets_cmd
);
6462 install_element(CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6463 install_element(CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6464 install_element(VRF_NODE
, &ip_pim_v6_secondary_cmd
);
6465 install_element(CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6466 install_element(VRF_NODE
, &no_ip_pim_v6_secondary_cmd
);
6467 install_element(CONFIG_NODE
, &ip_ssmpingd_cmd
);
6468 install_element(VRF_NODE
, &ip_ssmpingd_cmd
);
6469 install_element(CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6470 install_element(VRF_NODE
, &no_ip_ssmpingd_cmd
);
6471 install_element(CONFIG_NODE
, &ip_msdp_peer_cmd
);
6472 install_element(VRF_NODE
, &ip_msdp_peer_cmd
);
6473 install_element(CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6474 install_element(VRF_NODE
, &no_ip_msdp_peer_cmd
);
6475 install_element(CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6476 install_element(VRF_NODE
, &ip_pim_ecmp_cmd
);
6477 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6478 install_element(VRF_NODE
, &no_ip_pim_ecmp_cmd
);
6479 install_element(CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6480 install_element(VRF_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6481 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6482 install_element(VRF_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6483 install_element(CONFIG_NODE
, &ip_pim_mlag_cmd
);
6484 install_element(CONFIG_NODE
, &no_ip_pim_mlag_cmd
);
6485 install_element(CONFIG_NODE
, &ip_igmp_group_watermark_cmd
);
6486 install_element(VRF_NODE
, &ip_igmp_group_watermark_cmd
);
6487 install_element(CONFIG_NODE
, &no_ip_igmp_group_watermark_cmd
);
6488 install_element(VRF_NODE
, &no_ip_igmp_group_watermark_cmd
);
6490 install_element(INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6491 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6492 install_element(INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6493 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6494 install_element(INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6495 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6496 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6497 install_element(INTERFACE_NODE
,
6498 &interface_no_ip_igmp_query_interval_cmd
);
6499 install_element(INTERFACE_NODE
,
6500 &interface_ip_igmp_query_max_response_time_cmd
);
6501 install_element(INTERFACE_NODE
,
6502 &interface_no_ip_igmp_query_max_response_time_cmd
);
6503 install_element(INTERFACE_NODE
,
6504 &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6505 install_element(INTERFACE_NODE
,
6506 &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6507 install_element(INTERFACE_NODE
,
6508 &interface_ip_igmp_last_member_query_count_cmd
);
6509 install_element(INTERFACE_NODE
,
6510 &interface_no_ip_igmp_last_member_query_count_cmd
);
6511 install_element(INTERFACE_NODE
,
6512 &interface_ip_igmp_last_member_query_interval_cmd
);
6513 install_element(INTERFACE_NODE
,
6514 &interface_no_ip_igmp_last_member_query_interval_cmd
);
6515 install_element(INTERFACE_NODE
, &interface_ip_pim_activeactive_cmd
);
6516 install_element(INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6517 install_element(INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6518 install_element(INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6519 install_element(INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6520 install_element(INTERFACE_NODE
, &interface_ip_pim_cmd
);
6521 install_element(INTERFACE_NODE
, &interface_no_ip_pim_cmd
);
6522 install_element(INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6523 install_element(INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6524 install_element(INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6525 install_element(INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6526 install_element(INTERFACE_NODE
, &interface_ip_pim_boundary_oil_cmd
);
6527 install_element(INTERFACE_NODE
, &interface_no_ip_pim_boundary_oil_cmd
);
6528 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_generate_cmd
);
6530 // Static mroutes NEB
6531 install_element(INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6532 install_element(INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6534 install_element(VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6535 install_element(VIEW_NODE
, &show_ip_igmp_interface_vrf_all_cmd
);
6536 install_element(VIEW_NODE
, &show_ip_igmp_join_cmd
);
6537 install_element(VIEW_NODE
, &show_ip_igmp_join_vrf_all_cmd
);
6538 install_element(VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6539 install_element(VIEW_NODE
, &show_ip_igmp_groups_vrf_all_cmd
);
6540 install_element(VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6541 install_element(VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6542 install_element(VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6543 install_element(VIEW_NODE
, &show_ip_igmp_statistics_cmd
);
6544 install_element(VIEW_NODE
, &show_ip_pim_assert_cmd
);
6545 install_element(VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6546 install_element(VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6547 install_element(VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6548 install_element(VIEW_NODE
, &show_ip_pim_interface_traffic_cmd
);
6549 install_element(VIEW_NODE
, &show_ip_pim_interface_cmd
);
6550 install_element(VIEW_NODE
, &show_ip_pim_interface_vrf_all_cmd
);
6551 install_element(VIEW_NODE
, &show_ip_pim_join_cmd
);
6552 install_element(VIEW_NODE
, &show_ip_pim_join_vrf_all_cmd
);
6553 install_element(VIEW_NODE
, &show_ip_pim_jp_agg_cmd
);
6554 install_element(VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6555 install_element(VIEW_NODE
, &show_ip_pim_mlag_summary_cmd
);
6556 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_cmd
);
6557 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_vrf_all_cmd
);
6558 install_element(VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6559 install_element(VIEW_NODE
, &show_ip_pim_neighbor_vrf_all_cmd
);
6560 install_element(VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6561 install_element(VIEW_NODE
, &show_ip_pim_rpf_vrf_all_cmd
);
6562 install_element(VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6563 install_element(VIEW_NODE
, &show_ip_pim_state_cmd
);
6564 install_element(VIEW_NODE
, &show_ip_pim_state_vrf_all_cmd
);
6565 install_element(VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6566 install_element(VIEW_NODE
, &show_ip_pim_upstream_vrf_all_cmd
);
6567 install_element(VIEW_NODE
, &show_ip_pim_channel_cmd
);
6568 install_element(VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6569 install_element(VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6570 install_element(VIEW_NODE
, &show_ip_pim_rp_cmd
);
6571 install_element(VIEW_NODE
, &show_ip_pim_rp_vrf_all_cmd
);
6572 install_element(VIEW_NODE
, &show_ip_pim_bsr_cmd
);
6573 install_element(VIEW_NODE
, &show_ip_multicast_cmd
);
6574 install_element(VIEW_NODE
, &show_ip_multicast_vrf_all_cmd
);
6575 install_element(VIEW_NODE
, &show_ip_multicast_count_cmd
);
6576 install_element(VIEW_NODE
, &show_ip_multicast_count_vrf_all_cmd
);
6577 install_element(VIEW_NODE
, &show_ip_mroute_cmd
);
6578 install_element(VIEW_NODE
, &show_ip_mroute_vrf_all_cmd
);
6579 install_element(VIEW_NODE
, &show_ip_mroute_count_cmd
);
6580 install_element(VIEW_NODE
, &show_ip_mroute_count_vrf_all_cmd
);
6581 install_element(VIEW_NODE
, &show_ip_mroute_summary_cmd
);
6582 install_element(VIEW_NODE
, &show_ip_mroute_summary_vrf_all_cmd
);
6583 install_element(VIEW_NODE
, &show_ip_rib_cmd
);
6584 install_element(VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6585 install_element(VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6586 install_element(VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6587 install_element(VIEW_NODE
, &show_ip_pim_bsrp_cmd
);
6588 install_element(VIEW_NODE
, &show_ip_pim_bsm_db_cmd
);
6589 install_element(VIEW_NODE
, &show_ip_pim_statistics_cmd
);
6591 install_element(ENABLE_NODE
, &clear_ip_mroute_count_cmd
);
6592 install_element(ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6593 install_element(ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6594 install_element(ENABLE_NODE
, &clear_ip_mroute_cmd
);
6595 install_element(ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6596 install_element(ENABLE_NODE
, &clear_ip_pim_interface_traffic_cmd
);
6597 install_element(ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6598 install_element(ENABLE_NODE
, &clear_ip_pim_statistics_cmd
);
6599 install_element(ENABLE_NODE
, &clear_ip_pim_bsr_db_cmd
);
6601 install_element(ENABLE_NODE
, &show_debugging_pim_cmd
);
6603 install_element(ENABLE_NODE
, &debug_igmp_cmd
);
6604 install_element(ENABLE_NODE
, &no_debug_igmp_cmd
);
6605 install_element(ENABLE_NODE
, &debug_igmp_events_cmd
);
6606 install_element(ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6607 install_element(ENABLE_NODE
, &debug_igmp_packets_cmd
);
6608 install_element(ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6609 install_element(ENABLE_NODE
, &debug_igmp_trace_cmd
);
6610 install_element(ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6611 install_element(ENABLE_NODE
, &debug_igmp_trace_detail_cmd
);
6612 install_element(ENABLE_NODE
, &no_debug_igmp_trace_detail_cmd
);
6613 install_element(ENABLE_NODE
, &debug_mroute_cmd
);
6614 install_element(ENABLE_NODE
, &debug_mroute_detail_cmd
);
6615 install_element(ENABLE_NODE
, &no_debug_mroute_cmd
);
6616 install_element(ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6617 install_element(ENABLE_NODE
, &debug_pim_static_cmd
);
6618 install_element(ENABLE_NODE
, &no_debug_pim_static_cmd
);
6619 install_element(ENABLE_NODE
, &debug_pim_cmd
);
6620 install_element(ENABLE_NODE
, &debug_pim_nht_cmd
);
6621 install_element(ENABLE_NODE
, &debug_pim_nht_det_cmd
);
6622 install_element(ENABLE_NODE
, &debug_pim_nht_rp_cmd
);
6623 install_element(ENABLE_NODE
, &no_debug_pim_nht_rp_cmd
);
6624 install_element(ENABLE_NODE
, &debug_pim_events_cmd
);
6625 install_element(ENABLE_NODE
, &debug_pim_packets_cmd
);
6626 install_element(ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6627 install_element(ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6628 install_element(ENABLE_NODE
, &debug_pim_trace_cmd
);
6629 install_element(ENABLE_NODE
, &debug_pim_trace_detail_cmd
);
6630 install_element(ENABLE_NODE
, &debug_ssmpingd_cmd
);
6631 install_element(ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6632 install_element(ENABLE_NODE
, &debug_pim_zebra_cmd
);
6633 install_element(ENABLE_NODE
, &debug_pim_mlag_cmd
);
6634 install_element(ENABLE_NODE
, &no_debug_pim_mlag_cmd
);
6635 install_element(ENABLE_NODE
, &debug_pim_vxlan_cmd
);
6636 install_element(ENABLE_NODE
, &no_debug_pim_vxlan_cmd
);
6637 install_element(ENABLE_NODE
, &debug_msdp_cmd
);
6638 install_element(ENABLE_NODE
, &no_debug_msdp_cmd
);
6639 install_element(ENABLE_NODE
, &debug_msdp_events_cmd
);
6640 install_element(ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6641 install_element(ENABLE_NODE
, &debug_msdp_packets_cmd
);
6642 install_element(ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6643 install_element(ENABLE_NODE
, &debug_mtrace_cmd
);
6644 install_element(ENABLE_NODE
, &no_debug_mtrace_cmd
);
6645 install_element(ENABLE_NODE
, &debug_bsm_cmd
);
6646 install_element(ENABLE_NODE
, &no_debug_bsm_cmd
);
6648 install_element(CONFIG_NODE
, &debug_igmp_cmd
);
6649 install_element(CONFIG_NODE
, &no_debug_igmp_cmd
);
6650 install_element(CONFIG_NODE
, &debug_igmp_events_cmd
);
6651 install_element(CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6652 install_element(CONFIG_NODE
, &debug_igmp_packets_cmd
);
6653 install_element(CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6654 install_element(CONFIG_NODE
, &debug_igmp_trace_cmd
);
6655 install_element(CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6656 install_element(CONFIG_NODE
, &debug_igmp_trace_detail_cmd
);
6657 install_element(CONFIG_NODE
, &no_debug_igmp_trace_detail_cmd
);
6658 install_element(CONFIG_NODE
, &debug_mroute_cmd
);
6659 install_element(CONFIG_NODE
, &debug_mroute_detail_cmd
);
6660 install_element(CONFIG_NODE
, &no_debug_mroute_cmd
);
6661 install_element(CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6662 install_element(CONFIG_NODE
, &debug_pim_static_cmd
);
6663 install_element(CONFIG_NODE
, &no_debug_pim_static_cmd
);
6664 install_element(CONFIG_NODE
, &debug_pim_cmd
);
6665 install_element(CONFIG_NODE
, &debug_pim_nht_cmd
);
6666 install_element(CONFIG_NODE
, &debug_pim_nht_det_cmd
);
6667 install_element(CONFIG_NODE
, &debug_pim_nht_rp_cmd
);
6668 install_element(CONFIG_NODE
, &no_debug_pim_nht_rp_cmd
);
6669 install_element(CONFIG_NODE
, &debug_pim_events_cmd
);
6670 install_element(CONFIG_NODE
, &debug_pim_packets_cmd
);
6671 install_element(CONFIG_NODE
, &debug_pim_packetdump_send_cmd
);
6672 install_element(CONFIG_NODE
, &debug_pim_packetdump_recv_cmd
);
6673 install_element(CONFIG_NODE
, &debug_pim_trace_cmd
);
6674 install_element(CONFIG_NODE
, &debug_pim_trace_detail_cmd
);
6675 install_element(CONFIG_NODE
, &debug_ssmpingd_cmd
);
6676 install_element(CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6677 install_element(CONFIG_NODE
, &debug_pim_zebra_cmd
);
6678 install_element(CONFIG_NODE
, &debug_pim_mlag_cmd
);
6679 install_element(CONFIG_NODE
, &no_debug_pim_mlag_cmd
);
6680 install_element(CONFIG_NODE
, &debug_pim_vxlan_cmd
);
6681 install_element(CONFIG_NODE
, &no_debug_pim_vxlan_cmd
);
6682 install_element(CONFIG_NODE
, &debug_msdp_cmd
);
6683 install_element(CONFIG_NODE
, &no_debug_msdp_cmd
);
6684 install_element(CONFIG_NODE
, &debug_msdp_events_cmd
);
6685 install_element(CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6686 install_element(CONFIG_NODE
, &debug_msdp_packets_cmd
);
6687 install_element(CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6688 install_element(CONFIG_NODE
, &debug_mtrace_cmd
);
6689 install_element(CONFIG_NODE
, &no_debug_mtrace_cmd
);
6690 install_element(CONFIG_NODE
, &debug_bsm_cmd
);
6691 install_element(CONFIG_NODE
, &no_debug_bsm_cmd
);
6693 install_element(CONFIG_NODE
, &ip_msdp_timers_cmd
);
6694 install_element(VRF_NODE
, &ip_msdp_timers_cmd
);
6695 install_element(CONFIG_NODE
, &no_ip_msdp_timers_cmd
);
6696 install_element(VRF_NODE
, &no_ip_msdp_timers_cmd
);
6697 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6698 install_element(VRF_NODE
, &ip_msdp_mesh_group_member_cmd
);
6699 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6700 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6701 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6702 install_element(VRF_NODE
, &ip_msdp_mesh_group_source_cmd
);
6703 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6704 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6705 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_cmd
);
6706 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_cmd
);
6707 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6708 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_vrf_all_cmd
);
6709 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6710 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_vrf_all_cmd
);
6711 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6712 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_vrf_all_cmd
);
6713 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6714 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_vrf_all_cmd
);
6715 install_element(VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6716 install_element(VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6717 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_cmd
);
6718 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_work_cmd
);
6719 install_element(INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6720 install_element(INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);
6721 /* Install BSM command */
6722 install_element(INTERFACE_NODE
, &ip_pim_bsm_cmd
);
6723 install_element(INTERFACE_NODE
, &no_ip_pim_bsm_cmd
);
6724 install_element(INTERFACE_NODE
, &ip_pim_ucast_bsm_cmd
);
6725 install_element(INTERFACE_NODE
, &no_ip_pim_ucast_bsm_cmd
);
6726 /* Install BFD command */
6727 install_element(INTERFACE_NODE
, &ip_pim_bfd_cmd
);
6728 install_element(INTERFACE_NODE
, &ip_pim_bfd_param_cmd
);
6729 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_profile_cmd
);
6730 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_cmd
);
6732 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_param_cmd
);
6733 #endif /* !HAVE_BFDD */