3 * Copyright (C) 2008 Everton da Silva Marques
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 #include "pim_mroute.h"
36 #include "pim_iface.h"
38 #include "pim_mroute.h"
41 #include "pim_igmpv3.h"
46 #include "pim_neighbor.h"
48 #include "pim_ifchannel.h"
49 #include "pim_hello.h"
51 #include "pim_upstream.h"
53 #include "pim_macro.h"
54 #include "pim_ssmpingd.h"
55 #include "pim_zebra.h"
56 #include "pim_static.h"
58 #include "pim_zlookup.h"
63 #include "pim_vxlan.h"
67 #include "lib/northbound_cli.h"
68 #include "pim_errors.h"
71 #include "pim_cmd_common.h"
73 #ifndef VTYSH_EXTRACT_PL
74 #include "pimd/pim_cmd_clippy.c"
77 static struct cmd_node debug_node
= {
81 .config_write
= pim_debug_config_write
,
84 static struct vrf
*pim_cmd_lookup_vrf(struct vty
*vty
, struct cmd_token
*argv
[],
85 const int argc
, int *idx
)
89 if (argv_find(argv
, argc
, "NAME", idx
))
90 vrf
= vrf_lookup_by_name(argv
[*idx
]->arg
);
92 vrf
= vrf_lookup_by_id(VRF_DEFAULT
);
95 vty_out(vty
, "Specified VRF: %s does not exist\n",
101 static void pim_show_assert_helper(struct vty
*vty
,
102 struct pim_interface
*pim_ifp
,
103 struct pim_ifchannel
*ch
, time_t now
)
105 char winner_str
[INET_ADDRSTRLEN
];
106 struct in_addr ifaddr
;
109 char buf
[PREFIX_STRLEN
];
111 ifaddr
= pim_ifp
->primary_address
;
113 pim_inet4_dump("<assrt_win?>", ch
->ifassert_winner
, winner_str
,
116 pim_time_uptime(uptime
, sizeof(uptime
), now
- ch
->ifassert_creation
);
117 pim_time_timer_to_mmss(timer
, sizeof(timer
), ch
->t_ifassert_timer
);
119 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-6s %-15s %-8s %-5s\n",
121 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
122 &ch
->sg
.grp
, pim_ifchannel_ifassert_name(ch
->ifassert_state
),
123 winner_str
, uptime
, timer
);
126 static void pim_show_assert(struct pim_instance
*pim
, struct vty
*vty
)
128 struct pim_interface
*pim_ifp
;
129 struct pim_ifchannel
*ch
;
130 struct interface
*ifp
;
133 now
= pim_time_monotonic_sec();
136 "Interface Address Source Group State Winner Uptime Timer\n");
138 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
143 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
144 if (ch
->ifassert_state
== PIM_IFASSERT_NOINFO
)
147 pim_show_assert_helper(vty
, pim_ifp
, ch
, now
);
148 } /* scan interface channels */
152 static void pim_show_assert_internal_helper(struct vty
*vty
,
153 struct pim_interface
*pim_ifp
,
154 struct pim_ifchannel
*ch
)
156 struct in_addr ifaddr
;
157 char buf
[PREFIX_STRLEN
];
159 ifaddr
= pim_ifp
->primary_address
;
161 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-3s %-3s %-4s\n",
163 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
165 PIM_IF_FLAG_TEST_COULD_ASSERT(ch
->flags
) ? "yes" : "no",
166 pim_macro_ch_could_assert_eval(ch
) ? "yes" : "no",
167 PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch
->flags
) ? "yes"
169 pim_macro_assert_tracking_desired_eval(ch
) ? "yes" : "no");
172 static void pim_show_assert_internal(struct pim_instance
*pim
, struct vty
*vty
)
174 struct pim_interface
*pim_ifp
;
175 struct pim_ifchannel
*ch
;
176 struct interface
*ifp
;
180 "ECA: Evaluate CouldAssert\n"
181 "ATD: AssertTrackingDesired\n"
182 "eATD: Evaluate AssertTrackingDesired\n\n");
185 "Interface Address Source Group CA eCA ATD eATD\n");
186 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
191 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
192 pim_show_assert_internal_helper(vty
, pim_ifp
, ch
);
193 } /* scan interface channels */
197 static void pim_show_assert_metric_helper(struct vty
*vty
,
198 struct pim_interface
*pim_ifp
,
199 struct pim_ifchannel
*ch
)
201 char addr_str
[INET_ADDRSTRLEN
];
202 struct pim_assert_metric am
;
203 struct in_addr ifaddr
;
204 char buf
[PREFIX_STRLEN
];
206 ifaddr
= pim_ifp
->primary_address
;
208 am
= pim_macro_spt_assert_metric(&ch
->upstream
->rpf
,
209 pim_ifp
->primary_address
);
211 pim_inet4_dump("<addr?>", am
.ip_address
, addr_str
, sizeof(addr_str
));
213 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %4u %6u %-15s\n",
215 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
216 &ch
->sg
.grp
, am
.rpt_bit_flag
? "yes" : "no",
217 am
.metric_preference
, am
.route_metric
, addr_str
);
220 static void pim_show_assert_metric(struct pim_instance
*pim
, struct vty
*vty
)
222 struct pim_interface
*pim_ifp
;
223 struct pim_ifchannel
*ch
;
224 struct interface
*ifp
;
227 "Interface Address Source Group RPT Pref Metric Address \n");
229 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
234 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
235 pim_show_assert_metric_helper(vty
, pim_ifp
, ch
);
236 } /* scan interface channels */
240 static void pim_show_assert_winner_metric_helper(struct vty
*vty
,
241 struct pim_interface
*pim_ifp
,
242 struct pim_ifchannel
*ch
)
244 char addr_str
[INET_ADDRSTRLEN
];
245 struct pim_assert_metric
*am
;
246 struct in_addr ifaddr
;
249 char buf
[PREFIX_STRLEN
];
251 ifaddr
= pim_ifp
->primary_address
;
253 am
= &ch
->ifassert_winner_metric
;
255 pim_inet4_dump("<addr?>", am
->ip_address
, addr_str
, sizeof(addr_str
));
257 if (am
->metric_preference
== PIM_ASSERT_METRIC_PREFERENCE_MAX
)
258 snprintf(pref_str
, sizeof(pref_str
), "INFI");
260 snprintf(pref_str
, sizeof(pref_str
), "%4u",
261 am
->metric_preference
);
263 if (am
->route_metric
== PIM_ASSERT_ROUTE_METRIC_MAX
)
264 snprintf(metr_str
, sizeof(metr_str
), "INFI");
266 snprintf(metr_str
, sizeof(metr_str
), "%6u", am
->route_metric
);
268 vty_out(vty
, "%-16s %-15s %-15pPAs %-15pPAs %-3s %-4s %-6s %-15s\n",
270 inet_ntop(AF_INET
, &ifaddr
, buf
, sizeof(buf
)), &ch
->sg
.src
,
271 &ch
->sg
.grp
, am
->rpt_bit_flag
? "yes" : "no", pref_str
,
275 static void pim_show_assert_winner_metric(struct pim_instance
*pim
,
278 struct pim_interface
*pim_ifp
;
279 struct pim_ifchannel
*ch
;
280 struct interface
*ifp
;
283 "Interface Address Source Group RPT Pref Metric Address \n");
285 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
290 RB_FOREACH (ch
, pim_ifchannel_rb
, &pim_ifp
->ifchannel_rb
) {
291 pim_show_assert_winner_metric_helper(vty
, pim_ifp
, ch
);
292 } /* scan interface channels */
296 static void igmp_show_interfaces(struct pim_instance
*pim
, struct vty
*vty
,
299 struct interface
*ifp
;
301 char buf
[PREFIX_STRLEN
];
302 json_object
*json
= NULL
;
303 json_object
*json_row
= NULL
;
305 now
= pim_time_monotonic_sec();
308 json
= json_object_new_object();
311 "Interface State Address V Querier QuerierIp Query Timer Uptime\n");
313 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
314 struct pim_interface
*pim_ifp
;
315 struct listnode
*sock_node
;
316 struct gm_sock
*igmp
;
323 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
326 char query_hhmmss
[10];
328 pim_time_uptime(uptime
, sizeof(uptime
),
329 now
- igmp
->sock_creation
);
330 pim_time_timer_to_hhmmss(query_hhmmss
,
331 sizeof(query_hhmmss
),
332 igmp
->t_igmp_query_timer
);
335 json_row
= json_object_new_object();
336 json_object_pim_ifp_add(json_row
, ifp
);
337 json_object_string_add(json_row
, "upTime",
339 json_object_int_add(json_row
, "version",
340 pim_ifp
->igmp_version
);
342 if (igmp
->t_igmp_query_timer
) {
343 json_object_boolean_true_add(json_row
,
345 json_object_string_add(json_row
,
349 json_object_string_addf(json_row
, "querierIp",
351 &igmp
->querier_addr
);
353 json_object_object_add(json
, ifp
->name
,
356 if (igmp
->mtrace_only
) {
357 json_object_boolean_true_add(
358 json_row
, "mtraceOnly");
362 "%-16s %5s %15s %d %7s %17pI4 %11s %8s\n",
365 ? (igmp
->mtrace_only
? "mtrc"
368 inet_ntop(AF_INET
, &igmp
->ifaddr
, buf
,
370 pim_ifp
->igmp_version
,
371 igmp
->t_igmp_query_timer
? "local"
373 &igmp
->querier_addr
, query_hhmmss
,
383 static void igmp_show_interfaces_single(struct pim_instance
*pim
,
384 struct vty
*vty
, const char *ifname
,
387 struct gm_sock
*igmp
;
388 struct interface
*ifp
;
389 struct listnode
*sock_node
;
390 struct pim_interface
*pim_ifp
;
392 char query_hhmmss
[10];
393 char other_hhmmss
[10];
394 int found_ifname
= 0;
396 long gmi_msec
; /* Group Membership Interval */
399 long oqpi_msec
; /* Other Querier Present Interval */
404 json_object
*json
= NULL
;
405 json_object
*json_row
= NULL
;
408 json
= json_object_new_object();
410 now
= pim_time_monotonic_sec();
412 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
418 if (strcmp(ifname
, "detail") && strcmp(ifname
, ifp
->name
))
421 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
424 pim_time_uptime(uptime
, sizeof(uptime
),
425 now
- igmp
->sock_creation
);
426 pim_time_timer_to_hhmmss(query_hhmmss
,
427 sizeof(query_hhmmss
),
428 igmp
->t_igmp_query_timer
);
429 pim_time_timer_to_hhmmss(other_hhmmss
,
430 sizeof(other_hhmmss
),
431 igmp
->t_other_querier_timer
);
433 gmi_msec
= PIM_IGMP_GMI_MSEC(
434 igmp
->querier_robustness_variable
,
435 igmp
->querier_query_interval
,
436 pim_ifp
->gm_query_max_response_time_dsec
);
438 sqi
= PIM_IGMP_SQI(pim_ifp
->gm_default_query_interval
);
440 oqpi_msec
= PIM_IGMP_OQPI_MSEC(
441 igmp
->querier_robustness_variable
,
442 igmp
->querier_query_interval
,
443 pim_ifp
->gm_query_max_response_time_dsec
);
445 lmqt_msec
= PIM_IGMP_LMQT_MSEC(
446 pim_ifp
->gm_specific_query_max_response_time_dsec
,
447 pim_ifp
->gm_last_member_query_count
);
451 igmp
->querier_robustness_variable
,
452 igmp
->querier_query_interval
,
453 pim_ifp
->gm_query_max_response_time_dsec
) *
457 pim_ifp
->gm_query_max_response_time_dsec
* 100;
458 lmqc
= pim_ifp
->gm_last_member_query_count
;
461 json_row
= json_object_new_object();
462 json_object_pim_ifp_add(json_row
, ifp
);
463 json_object_string_add(json_row
, "upTime",
465 json_object_string_add(json_row
, "querier",
466 igmp
->t_igmp_query_timer
469 json_object_string_addf(json_row
, "querierIp",
471 &igmp
->querier_addr
);
472 json_object_int_add(json_row
, "queryStartCount",
473 igmp
->startup_query_count
);
474 json_object_string_add(json_row
,
477 json_object_string_add(json_row
,
480 json_object_int_add(json_row
, "version",
481 pim_ifp
->igmp_version
);
484 "timerGroupMembershipIntervalMsec",
486 json_object_int_add(json_row
,
487 "lastMemberQueryCount",
489 json_object_int_add(json_row
,
490 "timerLastMemberQueryMsec",
494 "timerOlderHostPresentIntervalMsec",
498 "timerOtherQuerierPresentIntervalMsec",
501 json_row
, "timerQueryInterval",
502 igmp
->querier_query_interval
);
505 "timerQueryResponseIntervalMsec",
508 json_row
, "timerRobustnessVariable",
509 igmp
->querier_robustness_variable
);
510 json_object_int_add(json_row
,
511 "timerStartupQueryInterval",
514 json_object_object_add(json
, ifp
->name
,
517 if (igmp
->mtrace_only
) {
518 json_object_boolean_true_add(
519 json_row
, "mtraceOnly");
522 vty_out(vty
, "Interface : %s\n", ifp
->name
);
523 vty_out(vty
, "State : %s\n",
524 if_is_up(ifp
) ? (igmp
->mtrace_only
?
528 vty_out(vty
, "Address : %pI4\n",
529 &pim_ifp
->primary_address
);
530 vty_out(vty
, "Uptime : %s\n", uptime
);
531 vty_out(vty
, "Version : %d\n",
532 pim_ifp
->igmp_version
);
536 vty_out(vty
, "Querier\n");
537 vty_out(vty
, "-------\n");
538 vty_out(vty
, "Querier : %s\n",
539 igmp
->t_igmp_query_timer
? "local"
541 vty_out(vty
, "QuerierIp : %pI4",
542 &igmp
->querier_addr
);
543 if (pim_ifp
->primary_address
.s_addr
544 == igmp
->querier_addr
.s_addr
)
545 vty_out(vty
, " (this router)\n");
549 vty_out(vty
, "Start Count : %d\n",
550 igmp
->startup_query_count
);
551 vty_out(vty
, "Query Timer : %s\n",
553 vty_out(vty
, "Other Timer : %s\n",
558 vty_out(vty
, "Timers\n");
559 vty_out(vty
, "------\n");
561 "Group Membership Interval : %lis\n",
564 "Last Member Query Count : %d\n",
567 "Last Member Query Time : %lis\n",
570 "Older Host Present Interval : %lis\n",
573 "Other Querier Present Interval : %lis\n",
576 "Query Interval : %ds\n",
577 igmp
->querier_query_interval
);
579 "Query Response Interval : %lis\n",
582 "Robustness Variable : %d\n",
583 igmp
->querier_robustness_variable
);
585 "Startup Query Interval : %ds\n",
590 pim_print_ifp_flags(vty
, ifp
);
597 else if (!found_ifname
)
598 vty_out(vty
, "%% No such interface\n");
601 static void igmp_show_interface_join(struct pim_instance
*pim
, struct vty
*vty
,
604 struct interface
*ifp
;
606 json_object
*json
= NULL
;
607 json_object
*json_iface
= NULL
;
608 json_object
*json_grp
= NULL
;
609 json_object
*json_grp_arr
= NULL
;
611 now
= pim_time_monotonic_sec();
614 json
= json_object_new_object();
615 json_object_string_add(json
, "vrf",
616 vrf_id_to_name(pim
->vrf
->vrf_id
));
619 "Interface Address Source Group Socket Uptime \n");
622 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
623 struct pim_interface
*pim_ifp
;
624 struct listnode
*join_node
;
626 struct in_addr pri_addr
;
627 char pri_addr_str
[INET_ADDRSTRLEN
];
634 if (!pim_ifp
->gm_join_list
)
637 pri_addr
= pim_find_primary_addr(ifp
);
638 pim_inet4_dump("<pri?>", pri_addr
, pri_addr_str
,
639 sizeof(pri_addr_str
));
641 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_join_list
, join_node
,
643 char group_str
[INET_ADDRSTRLEN
];
644 char source_str
[INET_ADDRSTRLEN
];
647 pim_time_uptime(uptime
, sizeof(uptime
),
648 now
- ij
->sock_creation
);
649 pim_inet4_dump("<grp?>", ij
->group_addr
, group_str
,
651 pim_inet4_dump("<src?>", ij
->source_addr
, source_str
,
655 json_object_object_get_ex(json
, ifp
->name
,
659 json_iface
= json_object_new_object();
660 json_object_string_add(
661 json_iface
, "name", ifp
->name
);
662 json_object_object_add(json
, ifp
->name
,
664 json_grp_arr
= json_object_new_array();
665 json_object_object_add(json_iface
,
670 json_grp
= json_object_new_object();
671 json_object_string_add(json_grp
, "source",
673 json_object_string_add(json_grp
, "group",
675 json_object_string_add(json_grp
, "primaryAddr",
677 json_object_int_add(json_grp
, "sockFd",
679 json_object_string_add(json_grp
, "upTime",
681 json_object_array_add(json_grp_arr
, json_grp
);
684 "%-16s %-15s %-15s %-15s %6d %8s\n",
685 ifp
->name
, pri_addr_str
, source_str
,
686 group_str
, ij
->sock_fd
, uptime
);
688 } /* for (pim_ifp->gm_join_list) */
696 static void igmp_show_statistics(struct pim_instance
*pim
, struct vty
*vty
,
697 const char *ifname
, bool uj
)
699 struct interface
*ifp
;
700 struct igmp_stats igmp_stats
;
701 bool found_ifname
= false;
702 json_object
*json
= NULL
;
704 igmp_stats_init(&igmp_stats
);
707 json
= json_object_new_object();
709 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
710 struct pim_interface
*pim_ifp
;
711 struct listnode
*sock_node
, *source_node
, *group_node
;
712 struct gm_sock
*igmp
;
713 struct gm_group
*group
;
714 struct gm_source
*src
;
721 if (ifname
&& strcmp(ifname
, ifp
->name
))
726 igmp_stats
.joins_failed
+= pim_ifp
->igmp_ifstat_joins_failed
;
727 igmp_stats
.joins_sent
+= pim_ifp
->igmp_ifstat_joins_sent
;
728 igmp_stats
.total_groups
+=
729 pim_ifp
->gm_group_list
730 ? listcount(pim_ifp
->gm_group_list
)
732 igmp_stats
.peak_groups
+= pim_ifp
->igmp_peak_group_count
;
735 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, group_node
,
737 for (ALL_LIST_ELEMENTS_RO(group
->group_source_list
,
739 if (pim_addr_is_any(src
->source_addr
))
742 igmp_stats
.total_source_groups
++;
746 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_socket_list
, sock_node
,
748 igmp_stats_add(&igmp_stats
, &igmp
->igmp_stats
);
756 vty_out(vty
, "%% No such interface\n");
761 json_object
*json_row
= json_object_new_object();
763 json_object_string_add(json_row
, "name",
764 ifname
? ifname
: "global");
765 json_object_int_add(json_row
, "queryV1", igmp_stats
.query_v1
);
766 json_object_int_add(json_row
, "queryV2", igmp_stats
.query_v2
);
767 json_object_int_add(json_row
, "queryV3", igmp_stats
.query_v3
);
768 json_object_int_add(json_row
, "leaveV2", igmp_stats
.leave_v2
);
769 json_object_int_add(json_row
, "reportV1", igmp_stats
.report_v1
);
770 json_object_int_add(json_row
, "reportV2", igmp_stats
.report_v2
);
771 json_object_int_add(json_row
, "reportV3", igmp_stats
.report_v3
);
772 json_object_int_add(json_row
, "mtraceResponse",
773 igmp_stats
.mtrace_rsp
);
774 json_object_int_add(json_row
, "mtraceRequest",
775 igmp_stats
.mtrace_req
);
776 json_object_int_add(json_row
, "unsupported",
777 igmp_stats
.unsupported
);
778 json_object_int_add(json_row
, "totalReceivedMessages",
779 igmp_stats
.total_recv_messages
);
780 json_object_int_add(json_row
, "peakGroups",
781 igmp_stats
.peak_groups
);
782 json_object_int_add(json_row
, "totalGroups",
783 igmp_stats
.total_groups
);
784 json_object_int_add(json_row
, "totalSourceGroups",
785 igmp_stats
.total_source_groups
);
786 json_object_int_add(json_row
, "joinsFailed",
787 igmp_stats
.joins_failed
);
788 json_object_int_add(json_row
, "joinsSent",
789 igmp_stats
.joins_sent
);
790 json_object_int_add(json_row
, "generalQueriesSent",
791 igmp_stats
.general_queries_sent
);
792 json_object_int_add(json_row
, "groupQueriesSent",
793 igmp_stats
.group_queries_sent
);
794 json_object_object_add(json
, ifname
? ifname
: "global",
798 vty_out(vty
, "IGMP statistics\n");
799 vty_out(vty
, "Interface : %s\n",
800 ifname
? ifname
: "global");
801 vty_out(vty
, "V1 query : %u\n",
802 igmp_stats
.query_v1
);
803 vty_out(vty
, "V2 query : %u\n",
804 igmp_stats
.query_v2
);
805 vty_out(vty
, "V3 query : %u\n",
806 igmp_stats
.query_v3
);
807 vty_out(vty
, "V2 leave : %u\n",
808 igmp_stats
.leave_v2
);
809 vty_out(vty
, "V1 report : %u\n",
810 igmp_stats
.report_v1
);
811 vty_out(vty
, "V2 report : %u\n",
812 igmp_stats
.report_v2
);
813 vty_out(vty
, "V3 report : %u\n",
814 igmp_stats
.report_v3
);
815 vty_out(vty
, "mtrace response : %u\n",
816 igmp_stats
.mtrace_rsp
);
817 vty_out(vty
, "mtrace request : %u\n",
818 igmp_stats
.mtrace_req
);
819 vty_out(vty
, "unsupported : %u\n",
820 igmp_stats
.unsupported
);
821 vty_out(vty
, "total received messages : %u\n",
822 igmp_stats
.total_recv_messages
);
823 vty_out(vty
, "joins failed : %u\n",
824 igmp_stats
.joins_failed
);
825 vty_out(vty
, "joins sent : %u\n",
826 igmp_stats
.joins_sent
);
827 vty_out(vty
, "general queries sent : %u\n",
828 igmp_stats
.general_queries_sent
);
829 vty_out(vty
, "group queries sent : %u\n",
830 igmp_stats
.group_queries_sent
);
831 vty_out(vty
, "peak groups : %u\n",
832 igmp_stats
.peak_groups
);
833 vty_out(vty
, "total groups : %u\n",
834 igmp_stats
.total_groups
);
835 vty_out(vty
, "total source groups : %u\n",
836 igmp_stats
.total_source_groups
);
840 /* Display the bsm database details */
841 static void pim_show_bsm_db(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
845 struct bsm_frag
*bsfrag
;
846 json_object
*json
= NULL
;
847 json_object
*json_group
= NULL
;
848 json_object
*json_row
= NULL
;
850 count
= bsm_frags_count(pim
->global_scope
.bsm_frags
);
853 json
= json_object_new_object();
854 json_object_int_add(json
, "Number of the fragments", count
);
856 vty_out(vty
, "Scope Zone: Global\n");
857 vty_out(vty
, "Number of the fragments: %d\n", count
);
861 frr_each (bsm_frags
, pim
->global_scope
.bsm_frags
, bsfrag
) {
862 char grp_str
[PREFIX_STRLEN
];
863 char rp_str
[INET_ADDRSTRLEN
];
864 char bsr_str
[INET_ADDRSTRLEN
];
865 struct bsmmsg_grpinfo
*group
;
866 struct bsmmsg_rpinfo
*rpaddr
;
872 uint32_t frag_rp_cnt
= 0;
877 /* skip pim header */
878 buf
+= PIM_MSG_HEADER_LEN
;
879 len
-= PIM_MSG_HEADER_LEN
;
881 hdr
= (struct bsm_hdr
*)buf
;
883 /* BSM starts with bsr header */
884 buf
+= sizeof(struct bsm_hdr
);
885 len
-= sizeof(struct bsm_hdr
);
887 pim_inet4_dump("<BSR Address?>", hdr
->bsr_addr
.addr
, bsr_str
,
892 json_object_string_add(json
, "BSR address", bsr_str
);
893 json_object_int_add(json
, "BSR priority",
895 json_object_int_add(json
, "Hashmask Length",
897 json_object_int_add(json
, "Fragment Tag",
898 ntohs(hdr
->frag_tag
));
900 vty_out(vty
, "BSM Fragment : %d\n", fragment
);
901 vty_out(vty
, "------------------\n");
902 vty_out(vty
, "%-15s %-15s %-15s %-15s\n", "BSR-Address",
903 "BSR-Priority", "Hashmask-len", "Fragment-Tag");
904 vty_out(vty
, "%-15s %-15d %-15d %-15d\n", bsr_str
,
905 hdr
->bsr_prio
, hdr
->hm_len
,
906 ntohs(hdr
->frag_tag
));
911 while (offset
< len
) {
912 group
= (struct bsmmsg_grpinfo
*)buf
;
914 if (group
->group
.family
== PIM_MSG_ADDRESS_FAMILY_IPV4
)
915 grp
.family
= AF_INET
;
917 grp
.prefixlen
= group
->group
.mask
;
918 grp
.u
.prefix4
.s_addr
= group
->group
.addr
.s_addr
;
920 prefix2str(&grp
, grp_str
, sizeof(grp_str
));
922 buf
+= sizeof(struct bsmmsg_grpinfo
);
923 offset
+= sizeof(struct bsmmsg_grpinfo
);
926 json_object_object_get_ex(json
, grp_str
,
929 json_group
= json_object_new_object();
930 json_object_int_add(json_group
,
934 json_group
, "Fragment Rp count",
935 group
->frag_rp_count
);
936 json_object_object_add(json
, grp_str
,
940 vty_out(vty
, "Group : %s\n", grp_str
);
941 vty_out(vty
, "-------------------\n");
942 vty_out(vty
, "Rp Count:%d\n", group
->rp_count
);
943 vty_out(vty
, "Fragment Rp Count : %d\n",
944 group
->frag_rp_count
);
947 frag_rp_cnt
= group
->frag_rp_count
;
954 "RpAddress HoldTime Priority\n");
956 while (frag_rp_cnt
--) {
957 rpaddr
= (struct bsmmsg_rpinfo
*)buf
;
959 buf
+= sizeof(struct bsmmsg_rpinfo
);
960 offset
+= sizeof(struct bsmmsg_rpinfo
);
962 pim_inet4_dump("<Rp addr?>",
963 rpaddr
->rpaddr
.addr
, rp_str
,
967 json_row
= json_object_new_object();
968 json_object_string_add(
969 json_row
, "Rp Address", rp_str
);
971 json_row
, "Rp HoldTime",
972 ntohs(rpaddr
->rp_holdtime
));
973 json_object_int_add(json_row
,
976 json_object_object_add(
977 json_group
, rp_str
, json_row
);
979 vty_out(vty
, "%-15s %-12d %d\n", rp_str
,
980 ntohs(rpaddr
->rp_holdtime
),
994 /*Display the group-rp mappings */
995 static void pim_show_group_rp_mappings_info(struct pim_instance
*pim
,
996 struct vty
*vty
, bool uj
)
998 struct bsgrp_node
*bsgrp
;
999 struct bsm_rpinfo
*bsm_rp
;
1000 struct route_node
*rn
;
1001 char bsr_str
[INET_ADDRSTRLEN
];
1002 json_object
*json
= NULL
;
1003 json_object
*json_group
= NULL
;
1004 json_object
*json_row
= NULL
;
1006 if (pim
->global_scope
.current_bsr
.s_addr
== INADDR_ANY
)
1007 strlcpy(bsr_str
, "0.0.0.0", sizeof(bsr_str
));
1010 pim_inet4_dump("<bsr?>", pim
->global_scope
.current_bsr
, bsr_str
,
1014 json
= json_object_new_object();
1015 json_object_string_add(json
, "BSR Address", bsr_str
);
1017 vty_out(vty
, "BSR Address %s\n", bsr_str
);
1020 for (rn
= route_top(pim
->global_scope
.bsrp_table
); rn
;
1021 rn
= route_next(rn
)) {
1022 bsgrp
= (struct bsgrp_node
*)rn
->info
;
1027 char grp_str
[PREFIX_STRLEN
];
1029 prefix2str(&bsgrp
->group
, grp_str
, sizeof(grp_str
));
1032 json_object_object_get_ex(json
, grp_str
, &json_group
);
1034 json_group
= json_object_new_object();
1035 json_object_object_add(json
, grp_str
,
1039 vty_out(vty
, "Group Address %pFX\n", &bsgrp
->group
);
1040 vty_out(vty
, "--------------------------\n");
1041 vty_out(vty
, "%-15s %-15s %-15s %-15s\n", "Rp Address",
1042 "priority", "Holdtime", "Hash");
1044 vty_out(vty
, "(ACTIVE)\n");
1047 frr_each (bsm_rpinfos
, bsgrp
->bsrp_list
, bsm_rp
) {
1048 char rp_str
[INET_ADDRSTRLEN
];
1050 pim_inet4_dump("<Rp Address?>", bsm_rp
->rp_address
,
1051 rp_str
, sizeof(rp_str
));
1054 json_row
= json_object_new_object();
1055 json_object_string_add(json_row
, "Rp Address",
1057 json_object_int_add(json_row
, "Rp HoldTime",
1058 bsm_rp
->rp_holdtime
);
1059 json_object_int_add(json_row
, "Rp Priority",
1061 json_object_int_add(json_row
, "Hash Val",
1063 json_object_object_add(json_group
, rp_str
,
1067 vty_out(vty
, "%-15s %-15u %-15u %-15u\n",
1068 rp_str
, bsm_rp
->rp_prio
,
1069 bsm_rp
->rp_holdtime
, bsm_rp
->hash
);
1072 if (!bsm_rpinfos_count(bsgrp
->bsrp_list
) && !uj
)
1073 vty_out(vty
, "Active List is empty.\n");
1076 json_object_int_add(json_group
, "Pending RP count",
1077 bsgrp
->pend_rp_cnt
);
1079 vty_out(vty
, "(PENDING)\n");
1080 vty_out(vty
, "Pending RP count :%d\n",
1081 bsgrp
->pend_rp_cnt
);
1082 if (bsgrp
->pend_rp_cnt
)
1083 vty_out(vty
, "%-15s %-15s %-15s %-15s\n",
1084 "Rp Address", "priority", "Holdtime",
1088 frr_each (bsm_rpinfos
, bsgrp
->partial_bsrp_list
, bsm_rp
) {
1089 char rp_str
[INET_ADDRSTRLEN
];
1091 pim_inet4_dump("<Rp Addr?>", bsm_rp
->rp_address
, rp_str
,
1095 json_row
= json_object_new_object();
1096 json_object_string_add(json_row
, "Rp Address",
1098 json_object_int_add(json_row
, "Rp HoldTime",
1099 bsm_rp
->rp_holdtime
);
1100 json_object_int_add(json_row
, "Rp Priority",
1102 json_object_int_add(json_row
, "Hash Val",
1104 json_object_object_add(json_group
, rp_str
,
1107 vty_out(vty
, "%-15s %-15u %-15u %-15u\n",
1108 rp_str
, bsm_rp
->rp_prio
,
1109 bsm_rp
->rp_holdtime
, bsm_rp
->hash
);
1112 if (!bsm_rpinfos_count(bsgrp
->partial_bsrp_list
) && !uj
)
1113 vty_out(vty
, "Partial List is empty\n");
1120 vty_json(vty
, json
);
1123 static void igmp_show_groups(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
1125 struct interface
*ifp
;
1127 json_object
*json
= NULL
;
1128 json_object
*json_iface
= NULL
;
1129 json_object
*json_group
= NULL
;
1130 json_object
*json_groups
= NULL
;
1132 now
= pim_time_monotonic_sec();
1135 json
= json_object_new_object();
1136 json_object_int_add(json
, "totalGroups", pim
->igmp_group_count
);
1137 json_object_int_add(json
, "watermarkLimit",
1138 pim
->igmp_watermark_limit
);
1140 vty_out(vty
, "Total IGMP groups: %u\n", pim
->igmp_group_count
);
1141 vty_out(vty
, "Watermark warn limit(%s): %u\n",
1142 pim
->igmp_watermark_limit
? "Set" : "Not Set",
1143 pim
->igmp_watermark_limit
);
1145 "Interface Group Mode Timer Srcs V Uptime \n");
1148 /* scan interfaces */
1149 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1150 struct pim_interface
*pim_ifp
= ifp
->info
;
1151 struct listnode
*grpnode
;
1152 struct gm_group
*grp
;
1157 /* scan igmp groups */
1158 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1160 char group_str
[INET_ADDRSTRLEN
];
1164 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1166 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
),
1167 grp
->t_group_timer
);
1168 pim_time_uptime(uptime
, sizeof(uptime
),
1169 now
- grp
->group_creation
);
1172 json_object_object_get_ex(json
, ifp
->name
,
1176 json_iface
= json_object_new_object();
1177 json_object_pim_ifp_add(json_iface
,
1179 json_object_object_add(json
, ifp
->name
,
1181 json_groups
= json_object_new_array();
1182 json_object_object_add(json_iface
,
1187 json_group
= json_object_new_object();
1188 json_object_string_add(json_group
, "group",
1191 if (grp
->igmp_version
== 3)
1192 json_object_string_add(
1194 grp
->group_filtermode_isexcl
1198 json_object_string_add(json_group
, "timer",
1200 json_object_int_add(
1201 json_group
, "sourcesCount",
1202 grp
->group_source_list
? listcount(
1203 grp
->group_source_list
)
1205 json_object_int_add(json_group
, "version",
1207 json_object_string_add(json_group
, "uptime",
1209 json_object_array_add(json_groups
, json_group
);
1211 vty_out(vty
, "%-16s %-15s %4s %8s %4d %d %8s\n",
1212 ifp
->name
, group_str
,
1213 grp
->igmp_version
== 3
1214 ? (grp
->group_filtermode_isexcl
1219 grp
->group_source_list
? listcount(
1220 grp
->group_source_list
)
1222 grp
->igmp_version
, uptime
);
1224 } /* scan igmp groups */
1225 } /* scan interfaces */
1228 vty_json(vty
, json
);
1231 static void igmp_show_group_retransmission(struct pim_instance
*pim
,
1234 struct interface
*ifp
;
1237 "Interface Group RetTimer Counter RetSrcs\n");
1239 /* scan interfaces */
1240 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1241 struct pim_interface
*pim_ifp
= ifp
->info
;
1242 struct listnode
*grpnode
;
1243 struct gm_group
*grp
;
1248 /* scan igmp groups */
1249 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1251 char group_str
[INET_ADDRSTRLEN
];
1252 char grp_retr_mmss
[10];
1253 struct listnode
*src_node
;
1254 struct gm_source
*src
;
1255 int grp_retr_sources
= 0;
1257 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1259 pim_time_timer_to_mmss(
1260 grp_retr_mmss
, sizeof(grp_retr_mmss
),
1261 grp
->t_group_query_retransmit_timer
);
1264 /* count group sources with retransmission state
1266 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1268 if (src
->source_query_retransmit_count
> 0) {
1273 vty_out(vty
, "%-16s %-15s %-8s %7d %7d\n", ifp
->name
,
1274 group_str
, grp_retr_mmss
,
1275 grp
->group_specific_query_retransmit_count
,
1278 } /* scan igmp groups */
1279 } /* scan interfaces */
1282 static void igmp_show_sources(struct pim_instance
*pim
, struct vty
*vty
,
1285 struct interface
*ifp
;
1287 json_object
*json
= NULL
;
1288 json_object
*json_iface
= NULL
;
1289 json_object
*json_group
= NULL
;
1290 json_object
*json_source
= NULL
;
1291 json_object
*json_sources
= NULL
;
1293 now
= pim_time_monotonic_sec();
1296 json
= json_object_new_object();
1299 "Interface Group Source Timer Fwd Uptime \n");
1301 /* scan interfaces */
1302 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1303 struct pim_interface
*pim_ifp
= ifp
->info
;
1304 struct listnode
*grpnode
;
1305 struct gm_group
*grp
;
1310 /* scan igmp groups */
1311 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1313 char group_str
[INET_ADDRSTRLEN
];
1314 struct listnode
*srcnode
;
1315 struct gm_source
*src
;
1317 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1320 /* scan group sources */
1321 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1323 char source_str
[INET_ADDRSTRLEN
];
1327 pim_inet4_dump("<source?>", src
->source_addr
,
1328 source_str
, sizeof(source_str
));
1330 pim_time_timer_to_mmss(mmss
, sizeof(mmss
),
1331 src
->t_source_timer
);
1333 pim_time_uptime(uptime
, sizeof(uptime
),
1334 now
- src
->source_creation
);
1337 json_object_object_get_ex(
1338 json
, ifp
->name
, &json_iface
);
1341 json_object_new_object();
1342 json_object_string_add(
1345 json_object_object_add(
1349 json_object_object_get_ex(json_iface
,
1355 json_object_new_object();
1356 json_object_string_add(
1357 json_group
, "group",
1359 json_object_object_add(
1360 json_iface
, group_str
,
1363 json_object_new_array();
1364 json_object_object_add(
1365 json_group
, "sources",
1368 json_source
= json_object_new_object();
1369 json_object_string_add(json_source
,
1372 json_object_string_add(json_source
,
1374 json_object_boolean_add(
1375 json_source
, "forwarded",
1376 IGMP_SOURCE_TEST_FORWARDING(
1377 src
->source_flags
));
1378 json_object_string_add(
1379 json_source
, "uptime", uptime
);
1380 json_object_array_add(json_sources
,
1385 "%-16s %-15s %-15s %5s %3s %8s\n",
1386 ifp
->name
, group_str
,
1388 IGMP_SOURCE_TEST_FORWARDING(
1395 } /* scan group sources */
1396 } /* scan igmp groups */
1397 } /* scan interfaces */
1399 vty_json(vty
, json
);
1402 static void igmp_show_source_retransmission(struct pim_instance
*pim
,
1405 struct interface
*ifp
;
1408 "Interface Group Source Counter\n");
1410 /* scan interfaces */
1411 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1412 struct pim_interface
*pim_ifp
= ifp
->info
;
1413 struct listnode
*grpnode
;
1414 struct gm_group
*grp
;
1419 /* scan igmp groups */
1420 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1422 char group_str
[INET_ADDRSTRLEN
];
1423 struct listnode
*srcnode
;
1424 struct gm_source
*src
;
1426 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1429 /* scan group sources */
1430 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1432 char source_str
[INET_ADDRSTRLEN
];
1434 pim_inet4_dump("<source?>", src
->source_addr
,
1435 source_str
, sizeof(source_str
));
1437 vty_out(vty
, "%-16s %-15s %-15s %7d\n",
1438 ifp
->name
, group_str
, source_str
,
1439 src
->source_query_retransmit_count
);
1441 } /* scan group sources */
1442 } /* scan igmp groups */
1443 } /* scan interfaces */
1446 static void pim_show_bsr(struct pim_instance
*pim
,
1451 char last_bsm_seen
[10];
1454 char bsr_str
[PREFIX_STRLEN
];
1455 json_object
*json
= NULL
;
1457 if (pim
->global_scope
.current_bsr
.s_addr
== INADDR_ANY
) {
1458 strlcpy(bsr_str
, "0.0.0.0", sizeof(bsr_str
));
1459 pim_time_uptime(uptime
, sizeof(uptime
),
1460 pim
->global_scope
.current_bsr_first_ts
);
1461 pim_time_uptime(last_bsm_seen
, sizeof(last_bsm_seen
),
1462 pim
->global_scope
.current_bsr_last_ts
);
1466 pim_inet4_dump("<bsr?>", pim
->global_scope
.current_bsr
,
1467 bsr_str
, sizeof(bsr_str
));
1468 now
= pim_time_monotonic_sec();
1469 pim_time_uptime(uptime
, sizeof(uptime
),
1470 (now
- pim
->global_scope
.current_bsr_first_ts
));
1471 pim_time_uptime(last_bsm_seen
, sizeof(last_bsm_seen
),
1472 now
- pim
->global_scope
.current_bsr_last_ts
);
1475 switch (pim
->global_scope
.state
) {
1477 strlcpy(bsr_state
, "NO_INFO", sizeof(bsr_state
));
1480 strlcpy(bsr_state
, "ACCEPT_ANY", sizeof(bsr_state
));
1482 case ACCEPT_PREFERRED
:
1483 strlcpy(bsr_state
, "ACCEPT_PREFERRED", sizeof(bsr_state
));
1486 strlcpy(bsr_state
, "", sizeof(bsr_state
));
1490 json
= json_object_new_object();
1491 json_object_string_add(json
, "bsr", bsr_str
);
1492 json_object_int_add(json
, "priority",
1493 pim
->global_scope
.current_bsr_prio
);
1494 json_object_int_add(json
, "fragmentTag",
1495 pim
->global_scope
.bsm_frag_tag
);
1496 json_object_string_add(json
, "state", bsr_state
);
1497 json_object_string_add(json
, "upTime", uptime
);
1498 json_object_string_add(json
, "lastBsmSeen", last_bsm_seen
);
1502 vty_out(vty
, "PIMv2 Bootstrap information\n");
1503 vty_out(vty
, "Current preferred BSR address: %s\n", bsr_str
);
1505 "Priority Fragment-Tag State UpTime\n");
1506 vty_out(vty
, " %-12d %-12d %-13s %7s\n",
1507 pim
->global_scope
.current_bsr_prio
,
1508 pim
->global_scope
.bsm_frag_tag
,
1511 vty_out(vty
, "Last BSM seen: %s\n", last_bsm_seen
);
1515 vty_json(vty
, json
);
1518 static void clear_igmp_interfaces(struct pim_instance
*pim
)
1520 struct interface
*ifp
;
1522 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1523 pim_if_addr_del_all_igmp(ifp
);
1525 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1526 pim_if_addr_add_all(ifp
);
1529 static void clear_pim_interfaces(struct pim_instance
*pim
)
1531 struct interface
*ifp
;
1533 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1535 pim_neighbor_delete_all(ifp
, "interface cleared");
1540 static void clear_interfaces(struct pim_instance
*pim
)
1542 clear_igmp_interfaces(pim
);
1543 clear_pim_interfaces(pim
);
1546 #define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \
1547 pim_ifp = ifp->info; \
1550 "%% Enable PIM and/or IGMP on this interface first\n"); \
1551 return CMD_WARNING_CONFIG_FAILED; \
1555 * Compatibility function to keep the legacy mesh group CLI behavior:
1556 * Delete group when there are no more configurations in it.
1559 * Don't forget to call `nb_cli_apply_changes` after this.
1561 static void pim_cli_legacy_mesh_group_behavior(struct vty
*vty
,
1564 const char *vrfname
;
1565 char xpath_value
[XPATH_MAXLEN
];
1566 char xpath_member_value
[XPATH_MAXLEN
];
1567 const struct lyd_node
*member_dnode
;
1569 vrfname
= pim_cli_get_vrf_name(vty
);
1570 if (vrfname
== NULL
)
1573 /* Get mesh group base XPath. */
1574 snprintf(xpath_value
, sizeof(xpath_value
),
1575 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
1576 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
1577 /* Group must exists, otherwise just quit. */
1578 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
1581 /* Group members check: */
1582 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1583 strlcat(xpath_member_value
, "/members", sizeof(xpath_member_value
));
1584 if (yang_dnode_exists(vty
->candidate_config
->dnode
,
1585 xpath_member_value
)) {
1586 member_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
1587 xpath_member_value
);
1588 if (!member_dnode
|| !yang_is_last_list_dnode(member_dnode
))
1592 /* Source address check: */
1593 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1594 strlcat(xpath_member_value
, "/source", sizeof(xpath_member_value
));
1595 if (yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_member_value
))
1598 /* No configurations found: delete it. */
1599 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
1602 DEFUN (clear_ip_interfaces
,
1603 clear_ip_interfaces_cmd
,
1604 "clear ip interfaces [vrf NAME]",
1607 "Reset interfaces\n"
1611 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1616 clear_interfaces(vrf
->info
);
1621 DEFUN (clear_ip_igmp_interfaces
,
1622 clear_ip_igmp_interfaces_cmd
,
1623 "clear ip igmp [vrf NAME] interfaces",
1628 "Reset IGMP interfaces\n")
1631 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1636 clear_igmp_interfaces(vrf
->info
);
1641 DEFPY (clear_ip_pim_statistics
,
1642 clear_ip_pim_statistics_cmd
,
1643 "clear ip pim statistics [vrf NAME]$name",
1648 "Reset PIM statistics\n")
1650 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1655 clear_pim_statistics(v
->info
);
1660 DEFPY (clear_ip_mroute
,
1661 clear_ip_mroute_cmd
,
1662 "clear ip mroute [vrf NAME]$name",
1665 "Reset multicast routes\n"
1668 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1673 clear_mroute(v
->info
);
1678 DEFUN (clear_ip_pim_interfaces
,
1679 clear_ip_pim_interfaces_cmd
,
1680 "clear ip pim [vrf NAME] interfaces",
1685 "Reset PIM interfaces\n")
1688 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1693 clear_pim_interfaces(vrf
->info
);
1698 DEFUN (clear_ip_pim_interface_traffic
,
1699 clear_ip_pim_interface_traffic_cmd
,
1700 "clear ip pim [vrf NAME] interface traffic",
1703 "PIM clear commands\n"
1705 "Reset PIM interfaces\n"
1706 "Reset Protocol Packet counters\n")
1709 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1710 struct interface
*ifp
= NULL
;
1711 struct pim_interface
*pim_ifp
= NULL
;
1716 FOR_ALL_INTERFACES (vrf
, ifp
) {
1717 pim_ifp
= ifp
->info
;
1722 pim_ifp
->pim_ifstat_hello_recv
= 0;
1723 pim_ifp
->pim_ifstat_hello_sent
= 0;
1724 pim_ifp
->pim_ifstat_join_recv
= 0;
1725 pim_ifp
->pim_ifstat_join_send
= 0;
1726 pim_ifp
->pim_ifstat_prune_recv
= 0;
1727 pim_ifp
->pim_ifstat_prune_send
= 0;
1728 pim_ifp
->pim_ifstat_reg_recv
= 0;
1729 pim_ifp
->pim_ifstat_reg_send
= 0;
1730 pim_ifp
->pim_ifstat_reg_stop_recv
= 0;
1731 pim_ifp
->pim_ifstat_reg_stop_send
= 0;
1732 pim_ifp
->pim_ifstat_assert_recv
= 0;
1733 pim_ifp
->pim_ifstat_assert_send
= 0;
1734 pim_ifp
->pim_ifstat_bsm_rx
= 0;
1735 pim_ifp
->pim_ifstat_bsm_tx
= 0;
1736 pim_ifp
->igmp_ifstat_joins_sent
= 0;
1737 pim_ifp
->igmp_ifstat_joins_failed
= 0;
1738 pim_ifp
->igmp_peak_group_count
= 0;
1744 DEFPY (clear_ip_pim_oil
,
1745 clear_ip_pim_oil_cmd
,
1746 "clear ip pim [vrf NAME]$name oil",
1751 "Rescan PIM OIL (output interface list)\n")
1753 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1758 pim_scan_oil(v
->info
);
1763 DEFUN (clear_ip_pim_bsr_db
,
1764 clear_ip_pim_bsr_db_cmd
,
1765 "clear ip pim [vrf NAME] bsr-data",
1770 "Reset pim bsr data\n")
1773 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1778 pim_bsm_clear(vrf
->info
);
1783 DEFUN (show_ip_igmp_interface
,
1784 show_ip_igmp_interface_cmd
,
1785 "show ip igmp [vrf NAME] interface [detail|WORD] [json]",
1790 "IGMP interface information\n"
1796 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1797 bool uj
= use_json(argc
, argv
);
1802 if (argv_find(argv
, argc
, "detail", &idx
)
1803 || argv_find(argv
, argc
, "WORD", &idx
))
1804 igmp_show_interfaces_single(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1806 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1811 DEFUN (show_ip_igmp_interface_vrf_all
,
1812 show_ip_igmp_interface_vrf_all_cmd
,
1813 "show ip igmp vrf all interface [detail|WORD] [json]",
1818 "IGMP interface information\n"
1824 bool uj
= use_json(argc
, argv
);
1830 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1834 vty_out(vty
, " \"%s\": ", vrf
->name
);
1837 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1838 if (argv_find(argv
, argc
, "detail", &idx
)
1839 || argv_find(argv
, argc
, "WORD", &idx
))
1840 igmp_show_interfaces_single(vrf
->info
, vty
,
1841 argv
[idx
]->arg
, uj
);
1843 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1846 vty_out(vty
, "}\n");
1851 DEFUN (show_ip_igmp_join
,
1852 show_ip_igmp_join_cmd
,
1853 "show ip igmp [vrf NAME] join [json]",
1858 "IGMP static join information\n"
1862 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1863 bool uj
= use_json(argc
, argv
);
1868 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1873 DEFUN (show_ip_igmp_join_vrf_all
,
1874 show_ip_igmp_join_vrf_all_cmd
,
1875 "show ip igmp vrf all join [json]",
1880 "IGMP static join information\n"
1883 bool uj
= use_json(argc
, argv
);
1889 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1893 vty_out(vty
, " \"%s\": ", vrf
->name
);
1896 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1897 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1900 vty_out(vty
, "}\n");
1905 DEFUN (show_ip_igmp_groups
,
1906 show_ip_igmp_groups_cmd
,
1907 "show ip igmp [vrf NAME] groups [json]",
1916 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1917 bool uj
= use_json(argc
, argv
);
1922 igmp_show_groups(vrf
->info
, vty
, uj
);
1927 DEFUN (show_ip_igmp_groups_vrf_all
,
1928 show_ip_igmp_groups_vrf_all_cmd
,
1929 "show ip igmp vrf all groups [json]",
1937 bool uj
= use_json(argc
, argv
);
1943 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1947 vty_out(vty
, " \"%s\": ", vrf
->name
);
1950 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1951 igmp_show_groups(vrf
->info
, vty
, uj
);
1954 vty_out(vty
, "}\n");
1959 DEFUN (show_ip_igmp_groups_retransmissions
,
1960 show_ip_igmp_groups_retransmissions_cmd
,
1961 "show ip igmp [vrf NAME] groups retransmissions",
1967 "IGMP group retransmissions\n")
1970 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1975 igmp_show_group_retransmission(vrf
->info
, vty
);
1980 DEFUN (show_ip_igmp_sources
,
1981 show_ip_igmp_sources_cmd
,
1982 "show ip igmp [vrf NAME] sources [json]",
1991 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1996 igmp_show_sources(vrf
->info
, vty
, use_json(argc
, argv
));
2001 DEFUN (show_ip_igmp_sources_retransmissions
,
2002 show_ip_igmp_sources_retransmissions_cmd
,
2003 "show ip igmp [vrf NAME] sources retransmissions",
2009 "IGMP source retransmissions\n")
2012 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2017 igmp_show_source_retransmission(vrf
->info
, vty
);
2022 DEFUN (show_ip_igmp_statistics
,
2023 show_ip_igmp_statistics_cmd
,
2024 "show ip igmp [vrf NAME] statistics [interface WORD] [json]",
2035 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2036 bool uj
= use_json(argc
, argv
);
2041 if (argv_find(argv
, argc
, "WORD", &idx
))
2042 igmp_show_statistics(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
2044 igmp_show_statistics(vrf
->info
, vty
, NULL
, uj
);
2049 DEFUN (show_ip_pim_mlag_summary
,
2050 show_ip_pim_mlag_summary_cmd
,
2051 "show ip pim mlag summary [json]",
2056 "status and stats\n"
2059 bool uj
= use_json(argc
, argv
);
2060 char role_buf
[MLAG_ROLE_STRSIZE
];
2061 char addr_buf
[INET_ADDRSTRLEN
];
2064 json_object
*json
= NULL
;
2065 json_object
*json_stat
= NULL
;
2067 json
= json_object_new_object();
2068 if (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
2069 json_object_boolean_true_add(json
, "mlagConnUp");
2070 if (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
2071 json_object_boolean_true_add(json
, "mlagPeerConnUp");
2072 if (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
2073 json_object_boolean_true_add(json
, "mlagPeerZebraUp");
2074 json_object_string_add(json
, "mlagRole",
2075 mlag_role2str(router
->mlag_role
,
2076 role_buf
, sizeof(role_buf
)));
2077 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
2078 addr_buf
, INET_ADDRSTRLEN
);
2079 json_object_string_add(json
, "localVtepIp", addr_buf
);
2080 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
2081 addr_buf
, INET_ADDRSTRLEN
);
2082 json_object_string_add(json
, "anycastVtepIp", addr_buf
);
2083 json_object_string_add(json
, "peerlinkRif",
2084 router
->peerlink_rif
);
2086 json_stat
= json_object_new_object();
2087 json_object_int_add(json_stat
, "mlagConnFlaps",
2088 router
->mlag_stats
.mlagd_session_downs
);
2089 json_object_int_add(json_stat
, "mlagPeerConnFlaps",
2090 router
->mlag_stats
.peer_session_downs
);
2091 json_object_int_add(json_stat
, "mlagPeerZebraFlaps",
2092 router
->mlag_stats
.peer_zebra_downs
);
2093 json_object_int_add(json_stat
, "mrouteAddRx",
2094 router
->mlag_stats
.msg
.mroute_add_rx
);
2095 json_object_int_add(json_stat
, "mrouteAddTx",
2096 router
->mlag_stats
.msg
.mroute_add_tx
);
2097 json_object_int_add(json_stat
, "mrouteDelRx",
2098 router
->mlag_stats
.msg
.mroute_del_rx
);
2099 json_object_int_add(json_stat
, "mrouteDelTx",
2100 router
->mlag_stats
.msg
.mroute_del_tx
);
2101 json_object_int_add(json_stat
, "mlagStatusUpdates",
2102 router
->mlag_stats
.msg
.mlag_status_updates
);
2103 json_object_int_add(json_stat
, "peerZebraStatusUpdates",
2104 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
2105 json_object_int_add(json_stat
, "pimStatusUpdates",
2106 router
->mlag_stats
.msg
.pim_status_updates
);
2107 json_object_int_add(json_stat
, "vxlanUpdates",
2108 router
->mlag_stats
.msg
.vxlan_updates
);
2109 json_object_object_add(json
, "connStats", json_stat
);
2111 vty_json(vty
, json
);
2115 vty_out(vty
, "MLAG daemon connection: %s\n",
2116 (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
2118 vty_out(vty
, "MLAG peer state: %s\n",
2119 (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
2121 vty_out(vty
, "Zebra peer state: %s\n",
2122 (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
2124 vty_out(vty
, "MLAG role: %s\n",
2125 mlag_role2str(router
->mlag_role
, role_buf
, sizeof(role_buf
)));
2126 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
2127 addr_buf
, INET_ADDRSTRLEN
);
2128 vty_out(vty
, "Local VTEP IP: %s\n", addr_buf
);
2129 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
2130 addr_buf
, INET_ADDRSTRLEN
);
2131 vty_out(vty
, "Anycast VTEP IP: %s\n", addr_buf
);
2132 vty_out(vty
, "Peerlink: %s\n", router
->peerlink_rif
);
2133 vty_out(vty
, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n",
2134 router
->mlag_stats
.mlagd_session_downs
,
2135 router
->mlag_stats
.peer_session_downs
,
2136 router
->mlag_stats
.peer_zebra_downs
);
2137 vty_out(vty
, "Message Statistics:\n");
2138 vty_out(vty
, " mroute adds: rx: %d, tx: %d\n",
2139 router
->mlag_stats
.msg
.mroute_add_rx
,
2140 router
->mlag_stats
.msg
.mroute_add_tx
);
2141 vty_out(vty
, " mroute dels: rx: %d, tx: %d\n",
2142 router
->mlag_stats
.msg
.mroute_del_rx
,
2143 router
->mlag_stats
.msg
.mroute_del_tx
);
2144 vty_out(vty
, " peer zebra status updates: %d\n",
2145 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
2146 vty_out(vty
, " PIM status updates: %d\n",
2147 router
->mlag_stats
.msg
.pim_status_updates
);
2148 vty_out(vty
, " VxLAN updates: %d\n",
2149 router
->mlag_stats
.msg
.vxlan_updates
);
2154 DEFUN (show_ip_pim_assert
,
2155 show_ip_pim_assert_cmd
,
2156 "show ip pim [vrf NAME] assert",
2161 "PIM interface assert\n")
2164 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2169 pim_show_assert(vrf
->info
, vty
);
2174 DEFUN (show_ip_pim_assert_internal
,
2175 show_ip_pim_assert_internal_cmd
,
2176 "show ip pim [vrf NAME] assert-internal",
2181 "PIM interface internal assert state\n")
2184 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2189 pim_show_assert_internal(vrf
->info
, vty
);
2194 DEFUN (show_ip_pim_assert_metric
,
2195 show_ip_pim_assert_metric_cmd
,
2196 "show ip pim [vrf NAME] assert-metric",
2201 "PIM interface assert metric\n")
2204 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2209 pim_show_assert_metric(vrf
->info
, vty
);
2214 DEFUN (show_ip_pim_assert_winner_metric
,
2215 show_ip_pim_assert_winner_metric_cmd
,
2216 "show ip pim [vrf NAME] assert-winner-metric",
2221 "PIM interface assert winner metric\n")
2224 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2229 pim_show_assert_winner_metric(vrf
->info
, vty
);
2234 DEFPY (show_ip_pim_interface
,
2235 show_ip_pim_interface_cmd
,
2236 "show ip pim [mlag$mlag] [vrf NAME] interface [detail|WORD]$interface [json$json]",
2242 "PIM interface information\n"
2247 return pim_show_interface_cmd_helper(vrf
, vty
, !!json
, !!mlag
,
2251 DEFPY (show_ip_pim_interface_vrf_all
,
2252 show_ip_pim_interface_vrf_all_cmd
,
2253 "show ip pim [mlag$mlag] vrf all interface [detail|WORD]$interface [json$json]",
2259 "PIM interface information\n"
2264 return pim_show_interface_vrf_all_cmd_helper(vty
, !!json
, !!mlag
,
2268 DEFPY (show_ip_pim_join
,
2269 show_ip_pim_join_cmd
,
2270 "show ip pim [vrf NAME] join [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2275 "PIM interface join information\n"
2276 "The Source or Group\n"
2280 return pim_show_join_cmd_helper(vrf
, vty
, s_or_g
, g
, json
);
2283 DEFPY (show_ip_pim_join_vrf_all
,
2284 show_ip_pim_join_vrf_all_cmd
,
2285 "show ip pim vrf all join [json$json]",
2290 "PIM interface join information\n"
2293 return pim_show_join_vrf_all_cmd_helper(vty
, json
);
2296 DEFPY (show_ip_pim_jp_agg
,
2297 show_ip_pim_jp_agg_cmd
,
2298 "show ip pim [vrf NAME] jp-agg",
2303 "join prune aggregation list\n")
2305 return pim_show_jp_agg_list_cmd_helper(vrf
, vty
);
2308 DEFPY (show_ip_pim_local_membership
,
2309 show_ip_pim_local_membership_cmd
,
2310 "show ip pim [vrf NAME] local-membership [json$json]",
2315 "PIM interface local-membership\n"
2318 return pim_show_membership_cmd_helper(vrf
, vty
, !!json
);
2321 static void pim_show_mlag_up_entry_detail(struct vrf
*vrf
,
2323 struct pim_upstream
*up
,
2324 char *src_str
, char *grp_str
,
2328 json_object
*json_row
= NULL
;
2329 json_object
*own_list
= NULL
;
2330 json_object
*json_group
= NULL
;
2333 json_object_object_get_ex(json
, grp_str
, &json_group
);
2335 json_group
= json_object_new_object();
2336 json_object_object_add(json
, grp_str
,
2340 json_row
= json_object_new_object();
2341 json_object_string_add(json_row
, "source", src_str
);
2342 json_object_string_add(json_row
, "group", grp_str
);
2344 own_list
= json_object_new_array();
2345 if (pim_up_mlag_is_local(up
))
2346 json_object_array_add(own_list
,
2347 json_object_new_string("local"));
2348 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2349 json_object_array_add(own_list
,
2350 json_object_new_string("peer"));
2351 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2352 json_object_array_add(
2353 own_list
, json_object_new_string("Interface"));
2354 json_object_object_add(json_row
, "owners", own_list
);
2356 json_object_int_add(json_row
, "localCost",
2357 pim_up_mlag_local_cost(up
));
2358 json_object_int_add(json_row
, "peerCost",
2359 pim_up_mlag_peer_cost(up
));
2360 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2361 json_object_boolean_false_add(json_row
, "df");
2363 json_object_boolean_true_add(json_row
, "df");
2364 json_object_object_add(json_group
, src_str
, json_row
);
2369 if (pim_up_mlag_is_local(up
))
2370 strlcat(own_str
, "L", sizeof(own_str
));
2371 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2372 strlcat(own_str
, "P", sizeof(own_str
));
2373 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2374 strlcat(own_str
, "I", sizeof(own_str
));
2375 /* XXX - fixup, print paragraph output */
2377 "%-15s %-15s %-6s %-11u %-10d %2s\n",
2378 src_str
, grp_str
, own_str
,
2379 pim_up_mlag_local_cost(up
),
2380 pim_up_mlag_peer_cost(up
),
2381 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2386 static void pim_show_mlag_up_detail(struct vrf
*vrf
,
2387 struct vty
*vty
, const char *src_or_group
,
2388 const char *group
, bool uj
)
2390 char src_str
[PIM_ADDRSTRLEN
];
2391 char grp_str
[PIM_ADDRSTRLEN
];
2392 struct pim_upstream
*up
;
2393 struct pim_instance
*pim
= vrf
->info
;
2394 json_object
*json
= NULL
;
2397 json
= json_object_new_object();
2400 "Source Group Owner Local-cost Peer-cost DF\n");
2402 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2403 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2404 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2405 && !pim_up_mlag_is_local(up
))
2408 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &up
->sg
.grp
);
2409 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &up
->sg
.src
);
2411 /* XXX: strcmps are clearly inefficient. we should do uint comps
2415 if (strcmp(src_str
, src_or_group
) ||
2416 strcmp(grp_str
, group
))
2419 if (strcmp(src_str
, src_or_group
) &&
2420 strcmp(grp_str
, src_or_group
))
2423 pim_show_mlag_up_entry_detail(vrf
, vty
, up
,
2424 src_str
, grp_str
, json
);
2428 vty_json(vty
, json
);
2431 static void pim_show_mlag_up_vrf(struct vrf
*vrf
, struct vty
*vty
, bool uj
)
2433 json_object
*json
= NULL
;
2434 json_object
*json_row
;
2435 struct pim_upstream
*up
;
2436 struct pim_instance
*pim
= vrf
->info
;
2437 json_object
*json_group
= NULL
;
2440 json
= json_object_new_object();
2443 "Source Group Owner Local-cost Peer-cost DF\n");
2446 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2447 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2448 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2449 && !pim_up_mlag_is_local(up
))
2452 char src_str
[PIM_ADDRSTRLEN
];
2453 char grp_str
[PIM_ADDRSTRLEN
];
2454 json_object
*own_list
= NULL
;
2456 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
2458 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
2461 json_object_object_get_ex(json
, grp_str
, &json_group
);
2463 json_group
= json_object_new_object();
2464 json_object_object_add(json
, grp_str
,
2468 json_row
= json_object_new_object();
2469 json_object_string_add(json_row
, "vrf", vrf
->name
);
2470 json_object_string_add(json_row
, "source", src_str
);
2471 json_object_string_add(json_row
, "group", grp_str
);
2473 own_list
= json_object_new_array();
2474 if (pim_up_mlag_is_local(up
)) {
2476 json_object_array_add(own_list
,
2477 json_object_new_string(
2480 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)) {
2481 json_object_array_add(own_list
,
2482 json_object_new_string(
2485 json_object_object_add(json_row
, "owners", own_list
);
2487 json_object_int_add(json_row
, "localCost",
2488 pim_up_mlag_local_cost(up
));
2489 json_object_int_add(json_row
, "peerCost",
2490 pim_up_mlag_peer_cost(up
));
2491 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2492 json_object_boolean_false_add(json_row
, "df");
2494 json_object_boolean_true_add(json_row
, "df");
2495 json_object_object_add(json_group
, src_str
, json_row
);
2500 if (pim_up_mlag_is_local(up
))
2501 strlcat(own_str
, "L", sizeof(own_str
));
2502 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2503 strlcat(own_str
, "P", sizeof(own_str
));
2504 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2505 strlcat(own_str
, "I", sizeof(own_str
));
2507 "%-15pPAs %-15pPAs %-6s %-11u %-10u %2s\n",
2508 &up
->sg
.src
, &up
->sg
.grp
, own_str
,
2509 pim_up_mlag_local_cost(up
),
2510 pim_up_mlag_peer_cost(up
),
2511 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2516 vty_json(vty
, json
);
2519 static void pim_show_mlag_help_string(struct vty
*vty
, bool uj
)
2522 vty_out(vty
, "Owner codes:\n");
2524 "L: EVPN-MLAG Entry, I:PIM-MLAG Entry, P: Peer Entry\n");
2529 DEFUN(show_ip_pim_mlag_up
, show_ip_pim_mlag_up_cmd
,
2530 "show ip pim [vrf NAME] mlag upstream [A.B.C.D [A.B.C.D]] [json]",
2537 "Unicast or Multicast address\n"
2538 "Multicast address\n" JSON_STR
)
2540 const char *src_or_group
= NULL
;
2541 const char *group
= NULL
;
2543 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2544 bool uj
= use_json(argc
, argv
);
2546 if (!vrf
|| !vrf
->info
) {
2547 vty_out(vty
, "%s: VRF or Info missing\n", __func__
);
2554 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
2555 src_or_group
= argv
[idx
]->arg
;
2557 group
= argv
[idx
+ 1]->arg
;
2560 pim_show_mlag_help_string(vty
, uj
);
2563 pim_show_mlag_up_detail(vrf
, vty
, src_or_group
, group
, uj
);
2565 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2571 DEFUN(show_ip_pim_mlag_up_vrf_all
, show_ip_pim_mlag_up_vrf_all_cmd
,
2572 "show ip pim vrf all mlag upstream [json]",
2573 SHOW_STR IP_STR PIM_STR VRF_CMD_HELP_STR
2575 "upstream\n" JSON_STR
)
2578 bool uj
= use_json(argc
, argv
);
2580 pim_show_mlag_help_string(vty
, uj
);
2581 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
2582 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2588 DEFPY (show_ip_pim_neighbor
,
2589 show_ip_pim_neighbor_cmd
,
2590 "show ip pim [vrf NAME] neighbor [detail|WORD]$interface [json$json]",
2595 "PIM neighbor information\n"
2597 "Name of interface or neighbor\n"
2600 return pim_show_neighbors_cmd_helper(vrf
, vty
, json
, interface
);
2603 DEFPY (show_ip_pim_neighbor_vrf_all
,
2604 show_ip_pim_neighbor_vrf_all_cmd
,
2605 "show ip pim vrf all neighbor [detail|WORD]$interface [json$json]",
2610 "PIM neighbor information\n"
2612 "Name of interface or neighbor\n"
2615 return pim_show_neighbors_vrf_all_cmd_helper(vty
, json
, interface
);
2618 DEFPY (show_ip_pim_secondary
,
2619 show_ip_pim_secondary_cmd
,
2620 "show ip pim [vrf NAME] secondary",
2625 "PIM neighbor addresses\n")
2627 return pim_show_secondary_helper(vrf
, vty
);
2630 DEFPY (show_ip_pim_state
,
2631 show_ip_pim_state_cmd
,
2632 "show ip pim [vrf NAME] state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2637 "PIM state information\n"
2638 "Unicast or Multicast address\n"
2639 "Multicast address\n"
2642 return pim_show_state_helper(vrf
, vty
, s_or_g_str
, g_str
, !!json
);
2645 DEFPY (show_ip_pim_state_vrf_all
,
2646 show_ip_pim_state_vrf_all_cmd
,
2647 "show ip pim vrf all state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2652 "PIM state information\n"
2653 "Unicast or Multicast address\n"
2654 "Multicast address\n"
2657 return pim_show_state_vrf_all_helper(vty
, s_or_g_str
, g_str
, !!json
);
2660 DEFPY (show_ip_pim_upstream
,
2661 show_ip_pim_upstream_cmd
,
2662 "show ip pim [vrf NAME] upstream [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2667 "PIM upstream information\n"
2668 "The Source or Group\n"
2672 return pim_show_upstream_helper(vrf
, vty
, s_or_g
, g
, !!json
);
2675 DEFPY (show_ip_pim_upstream_vrf_all
,
2676 show_ip_pim_upstream_vrf_all_cmd
,
2677 "show ip pim vrf all upstream [json$json]",
2682 "PIM upstream information\n"
2685 return pim_show_upstream_vrf_all_helper(vty
, !!json
);
2688 DEFPY (show_ip_pim_channel
,
2689 show_ip_pim_channel_cmd
,
2690 "show ip pim [vrf NAME] channel [json$json]",
2695 "PIM downstream channel info\n"
2698 return pim_show_channel_cmd_helper(vrf
, vty
, !!json
);
2701 DEFPY (show_ip_pim_upstream_join_desired
,
2702 show_ip_pim_upstream_join_desired_cmd
,
2703 "show ip pim [vrf NAME] upstream-join-desired [json$json]",
2708 "PIM upstream join-desired\n"
2711 return pim_show_upstream_join_desired_helper(vrf
, vty
, !!json
);
2714 DEFPY (show_ip_pim_upstream_rpf
,
2715 show_ip_pim_upstream_rpf_cmd
,
2716 "show ip pim [vrf NAME] upstream-rpf [json$json]",
2721 "PIM upstream source rpf\n"
2724 return pim_show_upstream_rpf_helper(vrf
, vty
, !!json
);
2727 DEFPY (show_ip_pim_rp
,
2729 "show ip pim [vrf NAME] rp-info [A.B.C.D/M$group] [json$json]",
2734 "PIM RP information\n"
2735 "Multicast Group range\n"
2738 return pim_show_rp_helper(vrf
, vty
, group_str
, (struct prefix
*)group
,
2742 DEFPY (show_ip_pim_rp_vrf_all
,
2743 show_ip_pim_rp_vrf_all_cmd
,
2744 "show ip pim vrf all rp-info [A.B.C.D/M$group] [json$json]",
2749 "PIM RP information\n"
2750 "Multicast Group range\n"
2753 return pim_show_rp_vrf_all_helper(vty
, group_str
,
2754 (struct prefix
*)group
, !!json
);
2757 DEFPY (show_ip_pim_rpf
,
2758 show_ip_pim_rpf_cmd
,
2759 "show ip pim [vrf NAME] rpf [json$json]",
2764 "PIM cached source rpf information\n"
2767 return pim_show_rpf_helper(vrf
, vty
, !!json
);
2770 DEFPY (show_ip_pim_rpf_vrf_all
,
2771 show_ip_pim_rpf_vrf_all_cmd
,
2772 "show ip pim vrf all rpf [json$json]",
2777 "PIM cached source rpf information\n"
2780 return pim_show_rpf_vrf_all_helper(vty
, !!json
);
2783 DEFPY (show_ip_pim_nexthop
,
2784 show_ip_pim_nexthop_cmd
,
2785 "show ip pim [vrf NAME] nexthop",
2790 "PIM cached nexthop rpf information\n")
2792 return pim_show_nexthop_cmd_helper(vrf
, vty
);
2795 DEFPY (show_ip_pim_nexthop_lookup
,
2796 show_ip_pim_nexthop_lookup_cmd
,
2797 "show ip pim [vrf NAME] nexthop-lookup A.B.C.D$source A.B.C.D$group",
2802 "PIM cached nexthop rpf lookup\n"
2803 "Source/RP address\n"
2804 "Multicast Group address\n")
2806 return pim_show_nexthop_lookup_cmd_helper(vrf
, vty
, source
, group
);
2809 DEFPY (show_ip_pim_interface_traffic
,
2810 show_ip_pim_interface_traffic_cmd
,
2811 "show ip pim [vrf NAME] interface traffic [WORD$if_name] [json$json]",
2816 "PIM interface information\n"
2817 "Protocol Packet counters\n"
2821 return pim_show_interface_traffic_helper(vrf
, if_name
, vty
, !!json
);
2824 DEFUN (show_ip_pim_bsm_db
,
2825 show_ip_pim_bsm_db_cmd
,
2826 "show ip pim bsm-database [vrf NAME] [json]",
2830 "PIM cached bsm packets information\n"
2835 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2836 bool uj
= use_json(argc
, argv
);
2841 pim_show_bsm_db(vrf
->info
, vty
, uj
);
2845 DEFUN (show_ip_pim_bsrp
,
2846 show_ip_pim_bsrp_cmd
,
2847 "show ip pim bsrp-info [vrf NAME] [json]",
2851 "PIM cached group-rp mappings information\n"
2856 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2857 bool uj
= use_json(argc
, argv
);
2862 pim_show_group_rp_mappings_info(vrf
->info
, vty
, uj
);
2867 DEFPY (show_ip_pim_statistics
,
2868 show_ip_pim_statistics_cmd
,
2869 "show ip pim [vrf NAME] statistics [interface WORD$word] [json$json]",
2879 return pim_show_statistics_helper(vrf
, vty
, word
, !!json
);
2882 DEFPY (show_ip_multicast
,
2883 show_ip_multicast_cmd
,
2884 "show ip multicast [vrf NAME]",
2887 "Multicast global information\n"
2890 return pim_show_multicast_helper(vrf
, vty
);
2893 DEFPY (show_ip_multicast_vrf_all
,
2894 show_ip_multicast_vrf_all_cmd
,
2895 "show ip multicast vrf all",
2898 "Multicast global information\n"
2901 return pim_show_multicast_vrf_all_helper(vty
);
2904 DEFPY (show_ip_multicast_count
,
2905 show_ip_multicast_count_cmd
,
2906 "show ip multicast count [vrf NAME] [json$json]",
2909 "Multicast global information\n"
2910 "Data packet count\n"
2914 return pim_show_multicast_count_helper(vrf
, vty
, !!json
);
2917 DEFPY (show_ip_multicast_count_vrf_all
,
2918 show_ip_multicast_count_vrf_all_cmd
,
2919 "show ip multicast count vrf all [json$json]",
2922 "Multicast global information\n"
2923 "Data packet count\n"
2927 return pim_show_multicast_count_vrf_all_helper(vty
, !!json
);
2930 DEFPY (show_ip_mroute
,
2932 "show ip mroute [vrf NAME] [A.B.C.D$s_or_g [A.B.C.D$g]] [fill$fill] [json$json]",
2937 "The Source or Group\n"
2939 "Fill in Assumed data\n"
2942 return pim_show_mroute_helper(vrf
, vty
, s_or_g
, g
, !!fill
, !!json
);
2945 DEFPY (show_ip_mroute_vrf_all
,
2946 show_ip_mroute_vrf_all_cmd
,
2947 "show ip mroute vrf all [fill$fill] [json$json]",
2952 "Fill in Assumed data\n"
2955 return pim_show_mroute_vrf_all_helper(vty
, !!fill
, !!json
);
2958 DEFPY (clear_ip_mroute_count
,
2959 clear_ip_mroute_count_cmd
,
2960 "clear ip mroute [vrf NAME]$name count",
2965 "Route and packet count data\n")
2967 return clear_ip_mroute_count_command(vty
, name
);
2970 DEFPY (show_ip_mroute_count
,
2971 show_ip_mroute_count_cmd
,
2972 "show ip mroute [vrf NAME] count [json$json]",
2977 "Route and packet count data\n"
2980 return pim_show_mroute_count_helper(vrf
, vty
, !!json
);
2983 DEFPY (show_ip_mroute_count_vrf_all
,
2984 show_ip_mroute_count_vrf_all_cmd
,
2985 "show ip mroute vrf all count [json$json]",
2990 "Route and packet count data\n"
2993 return pim_show_mroute_count_vrf_all_helper(vty
, !!json
);
2996 DEFPY (show_ip_mroute_summary
,
2997 show_ip_mroute_summary_cmd
,
2998 "show ip mroute [vrf NAME] summary [json$json]",
3003 "Summary of all mroutes\n"
3006 return pim_show_mroute_summary_helper(vrf
, vty
, !!json
);
3009 DEFPY (show_ip_mroute_summary_vrf_all
,
3010 show_ip_mroute_summary_vrf_all_cmd
,
3011 "show ip mroute vrf all summary [json$json]",
3016 "Summary of all mroutes\n"
3019 return pim_show_mroute_summary_vrf_all_helper(vty
, !!json
);
3024 "show ip rib [vrf NAME] A.B.C.D",
3029 "Unicast address\n")
3032 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3033 struct in_addr addr
;
3034 const char *addr_str
;
3035 struct pim_nexthop nexthop
;
3041 memset(&nexthop
, 0, sizeof(nexthop
));
3042 argv_find(argv
, argc
, "A.B.C.D", &idx
);
3043 addr_str
= argv
[idx
]->arg
;
3044 result
= inet_pton(AF_INET
, addr_str
, &addr
);
3046 vty_out(vty
, "Bad unicast address %s: errno=%d: %s\n", addr_str
,
3047 errno
, safe_strerror(errno
));
3051 if (!pim_nexthop_lookup(vrf
->info
, &nexthop
, addr
, 0)) {
3053 "Failure querying RIB nexthop for unicast address %s\n",
3059 "Address NextHop Interface Metric Preference\n");
3061 vty_out(vty
, "%-15s %-15pPAs %-9s %6d %10d\n", addr_str
,
3062 &nexthop
.mrib_nexthop_addr
,
3063 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
3064 nexthop
.mrib_route_metric
, nexthop
.mrib_metric_preference
);
3069 static void show_ssmpingd(struct pim_instance
*pim
, struct vty
*vty
)
3071 struct listnode
*node
;
3072 struct ssmpingd_sock
*ss
;
3076 "Source Socket Address Port Uptime Requests\n");
3078 if (!pim
->ssmpingd_list
)
3081 now
= pim_time_monotonic_sec();
3083 for (ALL_LIST_ELEMENTS_RO(pim
->ssmpingd_list
, node
, ss
)) {
3084 char source_str
[INET_ADDRSTRLEN
];
3086 struct sockaddr_in bind_addr
;
3087 socklen_t len
= sizeof(bind_addr
);
3088 char bind_addr_str
[INET_ADDRSTRLEN
];
3090 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
,
3091 sizeof(source_str
));
3093 if (pim_socket_getsockname(
3094 ss
->sock_fd
, (struct sockaddr
*)&bind_addr
, &len
)) {
3096 "%% Failure reading socket name for ssmpingd source %s on fd=%d\n",
3097 source_str
, ss
->sock_fd
);
3100 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
,
3101 sizeof(bind_addr_str
));
3102 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
),
3103 now
- ss
->creation
);
3105 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld\n", source_str
,
3106 ss
->sock_fd
, bind_addr_str
, ntohs(bind_addr
.sin_port
),
3107 ss_uptime
, (long long)ss
->requests
);
3111 DEFUN (show_ip_ssmpingd
,
3112 show_ip_ssmpingd_cmd
,
3113 "show ip ssmpingd [vrf NAME]",
3120 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3125 show_ssmpingd(vrf
->info
, vty
);
3129 DEFUN (ip_pim_spt_switchover_infinity
,
3130 ip_pim_spt_switchover_infinity_cmd
,
3131 "ip pim spt-switchover infinity-and-beyond",
3135 "Never switch to SPT Tree\n")
3137 return pim_process_spt_switchover_infinity_cmd(vty
);
3140 DEFPY (ip_pim_spt_switchover_infinity_plist
,
3141 ip_pim_spt_switchover_infinity_plist_cmd
,
3142 "ip pim spt-switchover infinity-and-beyond prefix-list WORD$plist",
3146 "Never switch to SPT Tree\n"
3147 "Prefix-List to control which groups to switch\n"
3148 "Prefix-List name\n")
3150 return pim_process_spt_switchover_prefixlist_cmd(vty
, plist
);
3153 DEFUN (no_ip_pim_spt_switchover_infinity
,
3154 no_ip_pim_spt_switchover_infinity_cmd
,
3155 "no ip pim spt-switchover infinity-and-beyond",
3160 "Never switch to SPT Tree\n")
3162 return pim_process_no_spt_switchover_cmd(vty
);
3165 DEFUN (no_ip_pim_spt_switchover_infinity_plist
,
3166 no_ip_pim_spt_switchover_infinity_plist_cmd
,
3167 "no ip pim spt-switchover infinity-and-beyond prefix-list WORD",
3172 "Never switch to SPT Tree\n"
3173 "Prefix-List to control which groups to switch\n"
3174 "Prefix-List name\n")
3176 return pim_process_no_spt_switchover_cmd(vty
);
3179 DEFPY (pim_register_accept_list
,
3180 pim_register_accept_list_cmd
,
3181 "[no] ip pim register-accept-list WORD$word",
3185 "Only accept registers from a specific source prefix list\n"
3186 "Prefix-List name\n")
3188 const char *vrfname
;
3189 char reg_alist_xpath
[XPATH_MAXLEN
];
3191 vrfname
= pim_cli_get_vrf_name(vty
);
3192 if (vrfname
== NULL
)
3193 return CMD_WARNING_CONFIG_FAILED
;
3195 snprintf(reg_alist_xpath
, sizeof(reg_alist_xpath
),
3196 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
3197 "frr-routing:ipv4");
3198 strlcat(reg_alist_xpath
, "/register-accept-list",
3199 sizeof(reg_alist_xpath
));
3202 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
3203 NB_OP_DESTROY
, NULL
);
3205 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
3206 NB_OP_MODIFY
, word
);
3208 return nb_cli_apply_changes(vty
, NULL
);
3211 DEFPY (ip_pim_joinprune_time
,
3212 ip_pim_joinprune_time_cmd
,
3213 "ip pim join-prune-interval (1-65535)$jpi",
3215 "pim multicast routing\n"
3216 "Join Prune Send Interval\n"
3219 return pim_process_join_prune_cmd(vty
, jpi_str
);
3222 DEFUN (no_ip_pim_joinprune_time
,
3223 no_ip_pim_joinprune_time_cmd
,
3224 "no ip pim join-prune-interval [(1-65535)]",
3227 "pim multicast routing\n"
3228 "Join Prune Send Interval\n"
3231 return pim_process_no_join_prune_cmd(vty
);
3234 DEFPY (ip_pim_register_suppress
,
3235 ip_pim_register_suppress_cmd
,
3236 "ip pim register-suppress-time (1-65535)$rst",
3238 "pim multicast routing\n"
3239 "Register Suppress Timer\n"
3242 return pim_process_register_suppress_cmd(vty
, rst_str
);
3245 DEFUN (no_ip_pim_register_suppress
,
3246 no_ip_pim_register_suppress_cmd
,
3247 "no ip pim register-suppress-time [(1-65535)]",
3250 "pim multicast routing\n"
3251 "Register Suppress Timer\n"
3254 return pim_process_no_register_suppress_cmd(vty
);
3257 DEFPY (ip_pim_rp_keep_alive
,
3258 ip_pim_rp_keep_alive_cmd
,
3259 "ip pim rp keep-alive-timer (1-65535)$kat",
3261 "pim multicast routing\n"
3262 "Rendezvous Point\n"
3263 "Keep alive Timer\n"
3266 return pim_process_rp_kat_cmd(vty
, kat_str
);
3269 DEFUN (no_ip_pim_rp_keep_alive
,
3270 no_ip_pim_rp_keep_alive_cmd
,
3271 "no ip pim rp keep-alive-timer [(1-65535)]",
3274 "pim multicast routing\n"
3275 "Rendezvous Point\n"
3276 "Keep alive Timer\n"
3279 return pim_process_no_rp_kat_cmd(vty
);
3282 DEFPY (ip_pim_keep_alive
,
3283 ip_pim_keep_alive_cmd
,
3284 "ip pim keep-alive-timer (1-65535)$kat",
3286 "pim multicast routing\n"
3287 "Keep alive Timer\n"
3290 return pim_process_keepalivetimer_cmd(vty
, kat_str
);
3293 DEFUN (no_ip_pim_keep_alive
,
3294 no_ip_pim_keep_alive_cmd
,
3295 "no ip pim keep-alive-timer [(1-65535)]",
3298 "pim multicast routing\n"
3299 "Keep alive Timer\n"
3302 return pim_process_no_keepalivetimer_cmd(vty
);
3305 DEFPY (ip_pim_packets
,
3307 "ip pim packets (1-255)",
3309 "pim multicast routing\n"
3310 "packets to process at one time per fd\n"
3311 "Number of packets\n")
3313 return pim_process_pim_packet_cmd(vty
, packets_str
);
3316 DEFUN (no_ip_pim_packets
,
3317 no_ip_pim_packets_cmd
,
3318 "no ip pim packets [(1-255)]",
3321 "pim multicast routing\n"
3322 "packets to process at one time per fd\n"
3325 return pim_process_no_pim_packet_cmd(vty
);
3328 DEFPY (ip_igmp_group_watermark
,
3329 ip_igmp_group_watermark_cmd
,
3330 "ip igmp watermark-warn (1-65535)$limit",
3333 "Configure group limit for watermark warning\n"
3334 "Group count to generate watermark warning\n")
3336 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
3337 pim
->igmp_watermark_limit
= limit
;
3342 DEFPY (no_ip_igmp_group_watermark
,
3343 no_ip_igmp_group_watermark_cmd
,
3344 "no ip igmp watermark-warn [(1-65535)$limit]",
3348 "Unconfigure group limit for watermark warning\n"
3351 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
3352 pim
->igmp_watermark_limit
= 0;
3357 DEFUN (ip_pim_v6_secondary
,
3358 ip_pim_v6_secondary_cmd
,
3359 "ip pim send-v6-secondary",
3361 "pim multicast routing\n"
3362 "Send v6 secondary addresses\n")
3364 const char *vrfname
;
3365 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
3367 vrfname
= pim_cli_get_vrf_name(vty
);
3368 if (vrfname
== NULL
)
3369 return CMD_WARNING_CONFIG_FAILED
;
3371 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
3373 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3374 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
3375 sizeof(send_v6_secondary_xpath
));
3377 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
3380 return nb_cli_apply_changes(vty
, NULL
);
3383 DEFUN (no_ip_pim_v6_secondary
,
3384 no_ip_pim_v6_secondary_cmd
,
3385 "no ip pim send-v6-secondary",
3388 "pim multicast routing\n"
3389 "Send v6 secondary addresses\n")
3391 const char *vrfname
;
3392 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
3394 vrfname
= pim_cli_get_vrf_name(vty
);
3395 if (vrfname
== NULL
)
3396 return CMD_WARNING_CONFIG_FAILED
;
3398 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
3400 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3401 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
3402 sizeof(send_v6_secondary_xpath
));
3404 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
3407 return nb_cli_apply_changes(vty
, NULL
);
3412 "ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3414 "pim multicast routing\n"
3415 "Rendezvous Point\n"
3416 "ip address of RP\n"
3417 "Group Address range to cover\n")
3419 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3421 return pim_process_rp_cmd(vty
, rp_str
, group_str
);
3424 DEFPY (ip_pim_rp_prefix_list
,
3425 ip_pim_rp_prefix_list_cmd
,
3426 "ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3428 "pim multicast routing\n"
3429 "Rendezvous Point\n"
3430 "ip address of RP\n"
3431 "group prefix-list filter\n"
3432 "Name of a prefix-list\n")
3434 return pim_process_rp_plist_cmd(vty
, rp_str
, plist
);
3437 DEFPY (no_ip_pim_rp
,
3439 "no ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3442 "pim multicast routing\n"
3443 "Rendezvous Point\n"
3444 "ip address of RP\n"
3445 "Group Address range to cover\n")
3447 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3449 return pim_process_no_rp_cmd(vty
, rp_str
, group_str
);
3452 DEFPY (no_ip_pim_rp_prefix_list
,
3453 no_ip_pim_rp_prefix_list_cmd
,
3454 "no ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3457 "pim multicast routing\n"
3458 "Rendezvous Point\n"
3459 "ip address of RP\n"
3460 "group prefix-list filter\n"
3461 "Name of a prefix-list\n")
3463 return pim_process_no_rp_plist_cmd(vty
, rp_str
, plist
);
3466 DEFUN (ip_pim_ssm_prefix_list
,
3467 ip_pim_ssm_prefix_list_cmd
,
3468 "ip pim ssm prefix-list WORD",
3470 "pim multicast routing\n"
3471 "Source Specific Multicast\n"
3472 "group range prefix-list filter\n"
3473 "Name of a prefix-list\n")
3475 const char *vrfname
;
3476 char ssm_plist_xpath
[XPATH_MAXLEN
];
3478 vrfname
= pim_cli_get_vrf_name(vty
);
3479 if (vrfname
== NULL
)
3480 return CMD_WARNING_CONFIG_FAILED
;
3482 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
), FRR_PIM_VRF_XPATH
,
3483 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3484 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3486 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_MODIFY
, argv
[4]->arg
);
3488 return nb_cli_apply_changes(vty
, NULL
);
3491 DEFUN (no_ip_pim_ssm_prefix_list
,
3492 no_ip_pim_ssm_prefix_list_cmd
,
3493 "no ip pim ssm prefix-list",
3496 "pim multicast routing\n"
3497 "Source Specific Multicast\n"
3498 "group range prefix-list filter\n")
3500 const char *vrfname
;
3501 char ssm_plist_xpath
[XPATH_MAXLEN
];
3503 vrfname
= pim_cli_get_vrf_name(vty
);
3504 if (vrfname
== NULL
)
3505 return CMD_WARNING_CONFIG_FAILED
;
3507 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3509 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3510 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3512 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
, NULL
);
3514 return nb_cli_apply_changes(vty
, NULL
);
3517 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3518 no_ip_pim_ssm_prefix_list_name_cmd
,
3519 "no ip pim ssm prefix-list WORD",
3522 "pim multicast routing\n"
3523 "Source Specific Multicast\n"
3524 "group range prefix-list filter\n"
3525 "Name of a prefix-list\n")
3527 const char *vrfname
;
3528 const struct lyd_node
*ssm_plist_dnode
;
3529 char ssm_plist_xpath
[XPATH_MAXLEN
];
3530 const char *ssm_plist_name
;
3532 vrfname
= pim_cli_get_vrf_name(vty
);
3533 if (vrfname
== NULL
)
3534 return CMD_WARNING_CONFIG_FAILED
;
3536 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3538 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3539 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3540 ssm_plist_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
3543 if (!ssm_plist_dnode
) {
3545 "%% pim ssm prefix-list %s doesn't exist\n",
3547 return CMD_WARNING_CONFIG_FAILED
;
3550 ssm_plist_name
= yang_dnode_get_string(ssm_plist_dnode
, ".");
3552 if (ssm_plist_name
&& !strcmp(ssm_plist_name
, argv
[5]->arg
)) {
3553 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
,
3556 return nb_cli_apply_changes(vty
, NULL
);
3559 vty_out(vty
, "%% pim ssm prefix-list %s doesn't exist\n", argv
[5]->arg
);
3561 return CMD_WARNING_CONFIG_FAILED
;
3564 DEFUN (show_ip_pim_ssm_range
,
3565 show_ip_pim_ssm_range_cmd
,
3566 "show ip pim [vrf NAME] group-type [json]",
3575 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3576 bool uj
= use_json(argc
, argv
);
3581 ip_pim_ssm_show_group_range(vrf
->info
, vty
, uj
);
3586 static void ip_pim_ssm_show_group_type(struct pim_instance
*pim
,
3587 struct vty
*vty
, bool uj
,
3590 struct in_addr group_addr
;
3591 const char *type_str
;
3594 result
= inet_pton(AF_INET
, group
, &group_addr
);
3596 type_str
= "invalid";
3598 if (pim_is_group_224_4(group_addr
))
3600 pim_is_grp_ssm(pim
, group_addr
) ? "SSM" : "ASM";
3602 type_str
= "not-multicast";
3607 json
= json_object_new_object();
3608 json_object_string_add(json
, "groupType", type_str
);
3609 vty_json(vty
, json
);
3611 vty_out(vty
, "Group type : %s\n", type_str
);
3614 DEFUN (show_ip_pim_group_type
,
3615 show_ip_pim_group_type_cmd
,
3616 "show ip pim [vrf NAME] group-type A.B.C.D [json]",
3621 "multicast group type\n"
3626 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3627 bool uj
= use_json(argc
, argv
);
3632 argv_find(argv
, argc
, "A.B.C.D", &idx
);
3633 ip_pim_ssm_show_group_type(vrf
->info
, vty
, uj
, argv
[idx
]->arg
);
3638 DEFUN (show_ip_pim_bsr
,
3639 show_ip_pim_bsr_cmd
,
3640 "show ip pim bsr [json]",
3644 "boot-strap router information\n"
3648 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3649 bool uj
= use_json(argc
, argv
);
3654 pim_show_bsr(vrf
->info
, vty
, uj
);
3661 "ip ssmpingd [A.B.C.D]",
3667 const char *src_str
= (argc
== 3) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3669 return pim_process_ssmpingd_cmd(vty
, NB_OP_CREATE
, src_str
);
3672 DEFUN (no_ip_ssmpingd
,
3674 "no ip ssmpingd [A.B.C.D]",
3681 const char *src_str
= (argc
== 4) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3683 return pim_process_ssmpingd_cmd(vty
, NB_OP_DESTROY
, src_str
);
3690 "pim multicast routing\n"
3691 "Enable PIM ECMP \n")
3693 const char *vrfname
;
3694 char ecmp_xpath
[XPATH_MAXLEN
];
3696 vrfname
= pim_cli_get_vrf_name(vty
);
3697 if (vrfname
== NULL
)
3698 return CMD_WARNING_CONFIG_FAILED
;
3700 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3701 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3702 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3704 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3705 return nb_cli_apply_changes(vty
, NULL
);
3708 DEFUN (no_ip_pim_ecmp
,
3713 "pim multicast routing\n"
3714 "Disable PIM ECMP \n")
3716 const char *vrfname
;
3717 char ecmp_xpath
[XPATH_MAXLEN
];
3719 vrfname
= pim_cli_get_vrf_name(vty
);
3720 if (vrfname
== NULL
)
3721 return CMD_WARNING_CONFIG_FAILED
;
3723 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3724 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3725 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3727 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "false");
3729 return nb_cli_apply_changes(vty
, NULL
);
3732 DEFUN (ip_pim_ecmp_rebalance
,
3733 ip_pim_ecmp_rebalance_cmd
,
3734 "ip pim ecmp rebalance",
3736 "pim multicast routing\n"
3737 "Enable PIM ECMP \n"
3738 "Enable PIM ECMP Rebalance\n")
3740 const char *vrfname
;
3741 char ecmp_xpath
[XPATH_MAXLEN
];
3742 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3744 vrfname
= pim_cli_get_vrf_name(vty
);
3745 if (vrfname
== NULL
)
3746 return CMD_WARNING_CONFIG_FAILED
;
3748 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3749 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3750 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3751 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3753 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3754 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3755 sizeof(ecmp_rebalance_xpath
));
3757 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3758 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "true");
3760 return nb_cli_apply_changes(vty
, NULL
);
3763 DEFUN (no_ip_pim_ecmp_rebalance
,
3764 no_ip_pim_ecmp_rebalance_cmd
,
3765 "no ip pim ecmp rebalance",
3768 "pim multicast routing\n"
3769 "Disable PIM ECMP \n"
3770 "Disable PIM ECMP Rebalance\n")
3772 const char *vrfname
;
3773 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3775 vrfname
= pim_cli_get_vrf_name(vty
);
3776 if (vrfname
== NULL
)
3777 return CMD_WARNING_CONFIG_FAILED
;
3779 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3781 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3782 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3783 sizeof(ecmp_rebalance_xpath
));
3785 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "false");
3787 return nb_cli_apply_changes(vty
, NULL
);
3790 DEFUN (interface_ip_igmp
,
3791 interface_ip_igmp_cmd
,
3796 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
, "true");
3798 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3799 "frr-routing:ipv4");
3802 DEFUN (interface_no_ip_igmp
,
3803 interface_no_ip_igmp_cmd
,
3809 const struct lyd_node
*pim_enable_dnode
;
3810 char pim_if_xpath
[XPATH_MAXLEN
];
3813 snprintf(pim_if_xpath
, sizeof(pim_if_xpath
),
3814 "%s/frr-pim:pim/address-family[address-family='%s']",
3815 VTY_CURR_XPATH
, "frr-routing:ipv4");
3817 if (printed
>= (int)(sizeof(pim_if_xpath
))) {
3818 vty_out(vty
, "Xpath too long (%d > %u)", printed
+ 1,
3820 return CMD_WARNING_CONFIG_FAILED
;
3823 pim_enable_dnode
= yang_dnode_getf(vty
->candidate_config
->dnode
,
3824 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3825 "frr-routing:ipv4");
3826 if (!pim_enable_dnode
) {
3827 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
, NULL
);
3828 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3830 if (!yang_dnode_get_bool(pim_enable_dnode
, ".")) {
3831 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
,
3833 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3835 nb_cli_enqueue_change(vty
, "./enable",
3836 NB_OP_MODIFY
, "false");
3839 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3840 "frr-routing:ipv4");
3843 DEFUN (interface_ip_igmp_join
,
3844 interface_ip_igmp_join_cmd
,
3845 "ip igmp join A.B.C.D [A.B.C.D]",
3848 "IGMP join multicast group\n"
3849 "Multicast group address\n"
3854 const char *source_str
;
3855 char xpath
[XPATH_MAXLEN
];
3858 source_str
= argv
[idx_source
]->arg
;
3860 if (strcmp(source_str
, "0.0.0.0") == 0) {
3861 vty_out(vty
, "Bad source address %s\n",
3862 argv
[idx_source
]->arg
);
3863 return CMD_WARNING_CONFIG_FAILED
;
3866 source_str
= "0.0.0.0";
3868 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3869 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3871 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
3873 return nb_cli_apply_changes(vty
, NULL
);
3876 DEFUN (interface_no_ip_igmp_join
,
3877 interface_no_ip_igmp_join_cmd
,
3878 "no ip igmp join A.B.C.D [A.B.C.D]",
3882 "IGMP join multicast group\n"
3883 "Multicast group address\n"
3888 const char *source_str
;
3889 char xpath
[XPATH_MAXLEN
];
3892 source_str
= argv
[idx_source
]->arg
;
3894 if (strcmp(source_str
, "0.0.0.0") == 0) {
3895 vty_out(vty
, "Bad source address %s\n",
3896 argv
[idx_source
]->arg
);
3897 return CMD_WARNING_CONFIG_FAILED
;
3900 source_str
= "0.0.0.0";
3902 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3903 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3905 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
3907 return nb_cli_apply_changes(vty
, NULL
);
3910 DEFUN (interface_ip_igmp_query_interval
,
3911 interface_ip_igmp_query_interval_cmd
,
3912 "ip igmp query-interval (1-65535)",
3915 IFACE_IGMP_QUERY_INTERVAL_STR
3916 "Query interval in seconds\n")
3918 const struct lyd_node
*pim_enable_dnode
;
3921 yang_dnode_getf(vty
->candidate_config
->dnode
,
3922 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3923 "frr-routing:ipv4");
3924 if (!pim_enable_dnode
) {
3925 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3928 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3929 nb_cli_enqueue_change(vty
, "./enable",
3930 NB_OP_MODIFY
, "true");
3933 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_MODIFY
,
3936 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3937 "frr-routing:ipv4");
3940 DEFUN (interface_no_ip_igmp_query_interval
,
3941 interface_no_ip_igmp_query_interval_cmd
,
3942 "no ip igmp query-interval [(1-65535)]",
3946 IFACE_IGMP_QUERY_INTERVAL_STR
3949 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_DESTROY
, NULL
);
3951 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3952 "frr-routing:ipv4");
3955 DEFUN (interface_ip_igmp_version
,
3956 interface_ip_igmp_version_cmd
,
3957 "ip igmp version (2-3)",
3961 "IGMP version number\n")
3963 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3965 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_MODIFY
,
3968 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3969 "frr-routing:ipv4");
3972 DEFUN (interface_no_ip_igmp_version
,
3973 interface_no_ip_igmp_version_cmd
,
3974 "no ip igmp version (2-3)",
3979 "IGMP version number\n")
3981 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_DESTROY
, NULL
);
3983 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3984 "frr-routing:ipv4");
3987 DEFPY (interface_ip_igmp_query_max_response_time
,
3988 interface_ip_igmp_query_max_response_time_cmd
,
3989 "ip igmp query-max-response-time (1-65535)$qmrt",
3992 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3993 "Query response value in deci-seconds\n")
3995 return gm_process_query_max_response_time_cmd(vty
, qmrt_str
);
3998 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3999 interface_no_ip_igmp_query_max_response_time_cmd
,
4000 "no ip igmp query-max-response-time [(1-65535)]",
4004 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
4007 return gm_process_no_query_max_response_time_cmd(vty
);
4010 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
4011 interface_ip_igmp_query_max_response_time_dsec_cmd
,
4012 "ip igmp query-max-response-time-dsec (1-65535)",
4015 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4016 "Query response value in deciseconds\n")
4018 const struct lyd_node
*pim_enable_dnode
;
4021 yang_dnode_getf(vty
->candidate_config
->dnode
,
4022 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
4023 "frr-routing:ipv4");
4024 if (!pim_enable_dnode
) {
4025 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
4028 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
4029 nb_cli_enqueue_change(vty
, "./enable",
4030 NB_OP_MODIFY
, "true");
4033 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_MODIFY
,
4036 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
4037 "frr-routing:ipv4");
4040 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
4041 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
4042 "no ip igmp query-max-response-time-dsec [(1-65535)]",
4046 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4049 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_DESTROY
,
4052 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
4053 "frr-routing:ipv4");
4056 DEFPY (interface_ip_igmp_last_member_query_count
,
4057 interface_ip_igmp_last_member_query_count_cmd
,
4058 "ip igmp last-member-query-count (1-255)$lmqc",
4061 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
4062 "Last member query count\n")
4064 return gm_process_last_member_query_count_cmd(vty
, lmqc_str
);
4067 DEFUN (interface_no_ip_igmp_last_member_query_count
,
4068 interface_no_ip_igmp_last_member_query_count_cmd
,
4069 "no ip igmp last-member-query-count [(1-255)]",
4073 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
4076 return gm_process_no_last_member_query_count_cmd(vty
);
4079 DEFPY (interface_ip_igmp_last_member_query_interval
,
4080 interface_ip_igmp_last_member_query_interval_cmd
,
4081 "ip igmp last-member-query-interval (1-65535)$lmqi",
4084 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
4085 "Last member query interval in deciseconds\n")
4087 return gm_process_last_member_query_interval_cmd(vty
, lmqi_str
);
4090 DEFUN (interface_no_ip_igmp_last_member_query_interval
,
4091 interface_no_ip_igmp_last_member_query_interval_cmd
,
4092 "no ip igmp last-member-query-interval [(1-65535)]",
4096 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
4099 return gm_process_no_last_member_query_interval_cmd(vty
);
4102 DEFUN (interface_ip_pim_drprio
,
4103 interface_ip_pim_drprio_cmd
,
4104 "ip pim drpriority (1-4294967295)",
4107 "Set the Designated Router Election Priority\n"
4108 "Value of the new DR Priority\n")
4112 return pim_process_ip_pim_drprio_cmd(vty
, argv
[idx_number
]->arg
);
4115 DEFUN (interface_no_ip_pim_drprio
,
4116 interface_no_ip_pim_drprio_cmd
,
4117 "no ip pim drpriority [(1-4294967295)]",
4121 "Revert the Designated Router Priority to default\n"
4122 "Old Value of the Priority\n")
4124 return pim_process_no_ip_pim_drprio_cmd(vty
);
4127 DEFPY_HIDDEN (interface_ip_igmp_query_generate
,
4128 interface_ip_igmp_query_generate_cmd
,
4129 "ip igmp generate-query-once [version (2-3)]",
4132 "Generate igmp general query once\n"
4134 "IGMP version number\n")
4137 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4139 struct pim_interface
*pim_ifp
= ifp
->info
;
4142 vty_out(vty
, "IGMP/PIM is not enabled on the interface %s\n",
4144 return CMD_WARNING_CONFIG_FAILED
;
4147 /* It takes the igmp version configured on the interface as default */
4148 igmp_version
= pim_ifp
->igmp_version
;
4151 igmp_version
= atoi(argv
[4]->arg
);
4153 igmp_send_query_on_intf(ifp
, igmp_version
);
4158 DEFPY_HIDDEN (pim_test_sg_keepalive
,
4159 pim_test_sg_keepalive_cmd
,
4160 "test pim [vrf NAME$name] keepalive-reset A.B.C.D$source A.B.C.D$group",
4164 "Reset the Keepalive Timer\n"
4165 "The Source we are resetting\n"
4166 "The Group we are resetting\n")
4168 struct pim_upstream
*up
;
4169 struct pim_instance
*pim
;
4176 pim
= pim_get_pim_instance(VRF_DEFAULT
);
4178 struct vrf
*vrf
= vrf_lookup_by_name(name
);
4181 vty_out(vty
, "%% Vrf specified: %s does not exist\n",
4186 pim
= pim_get_pim_instance(vrf
->vrf_id
);
4190 vty_out(vty
, "%% Unable to find pim instance\n");
4194 up
= pim_upstream_find(pim
, &sg
);
4196 vty_out(vty
, "%% Unable to find %pSG specified\n", &sg
);
4200 vty_out(vty
, "Setting %pSG to current keep alive time: %d\n", &sg
,
4201 pim
->keep_alive_time
);
4202 pim_upstream_keep_alive_timer_start(up
, pim
->keep_alive_time
);
4207 DEFPY (interface_ip_pim_activeactive
,
4208 interface_ip_pim_activeactive_cmd
,
4209 "[no$no] ip pim active-active",
4213 "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
4215 return pim_process_ip_pim_activeactive_cmd(vty
, no
);
4218 DEFUN_HIDDEN (interface_ip_pim_ssm
,
4219 interface_ip_pim_ssm_cmd
,
4227 ret
= pim_process_ip_pim_cmd(vty
);
4233 "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed\n");
4238 DEFUN_HIDDEN (interface_ip_pim_sm
,
4239 interface_ip_pim_sm_cmd
,
4245 return pim_process_ip_pim_cmd(vty
);
4248 DEFPY (interface_ip_pim
,
4249 interface_ip_pim_cmd
,
4250 "ip pim [passive$passive]",
4253 "Disable exchange of protocol packets\n")
4257 ret
= pim_process_ip_pim_cmd(vty
);
4263 return pim_process_ip_pim_passive_cmd(vty
, true);
4268 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
4269 interface_no_ip_pim_ssm_cmd
,
4276 return pim_process_no_ip_pim_cmd(vty
);
4279 DEFUN_HIDDEN (interface_no_ip_pim_sm
,
4280 interface_no_ip_pim_sm_cmd
,
4287 return pim_process_no_ip_pim_cmd(vty
);
4290 DEFPY (interface_no_ip_pim
,
4291 interface_no_ip_pim_cmd
,
4292 "no ip pim [passive$passive]",
4296 "Disable exchange of protocol packets\n")
4299 return pim_process_ip_pim_passive_cmd(vty
, false);
4301 return pim_process_no_ip_pim_cmd(vty
);
4305 DEFUN(interface_ip_pim_boundary_oil
,
4306 interface_ip_pim_boundary_oil_cmd
,
4307 "ip multicast boundary oil WORD",
4309 "Generic multicast configuration options\n"
4310 "Define multicast boundary\n"
4311 "Filter OIL by group using prefix list\n"
4312 "Prefix list to filter OIL with\n")
4314 return pim_process_ip_pim_boundary_oil_cmd(vty
, argv
[4]->arg
);
4317 DEFUN(interface_no_ip_pim_boundary_oil
,
4318 interface_no_ip_pim_boundary_oil_cmd
,
4319 "no ip multicast boundary oil [WORD]",
4322 "Generic multicast configuration options\n"
4323 "Define multicast boundary\n"
4324 "Filter OIL by group using prefix list\n"
4325 "Prefix list to filter OIL with\n")
4327 return pim_process_no_ip_pim_boundary_oil_cmd(vty
);
4330 DEFUN (interface_ip_mroute
,
4331 interface_ip_mroute_cmd
,
4332 "ip mroute INTERFACE A.B.C.D [A.B.C.D]",
4334 "Add multicast route\n"
4335 "Outgoing interface name\n"
4339 int idx_interface
= 2;
4341 const char *source_str
;
4343 if (argc
== (idx_ipv4
+ 1))
4344 source_str
= "0.0.0.0";
4346 source_str
= argv
[idx_ipv4
+ 1]->arg
;
4348 return pim_process_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
4349 argv
[idx_ipv4
]->arg
, source_str
);
4352 DEFUN (interface_no_ip_mroute
,
4353 interface_no_ip_mroute_cmd
,
4354 "no ip mroute INTERFACE A.B.C.D [A.B.C.D]",
4357 "Add multicast route\n"
4358 "Outgoing interface name\n"
4362 int idx_interface
= 3;
4364 const char *source_str
;
4366 if (argc
== (idx_ipv4
+ 1))
4367 source_str
= "0.0.0.0";
4369 source_str
= argv
[idx_ipv4
+ 1]->arg
;
4371 return pim_process_no_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
4372 argv
[idx_ipv4
]->arg
, source_str
);
4375 DEFUN (interface_ip_pim_hello
,
4376 interface_ip_pim_hello_cmd
,
4377 "ip pim hello (1-65535) [(1-65535)]",
4381 IFACE_PIM_HELLO_TIME_STR
4382 IFACE_PIM_HELLO_HOLD_STR
)
4387 if (argc
== idx_hold
+ 1)
4388 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
4389 argv
[idx_hold
]->arg
);
4392 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
4396 DEFUN (interface_no_ip_pim_hello
,
4397 interface_no_ip_pim_hello_cmd
,
4398 "no ip pim hello [(1-65535) [(1-65535)]]",
4406 return pim_process_no_ip_pim_hello_cmd(vty
);
4415 PIM_DO_DEBUG_IGMP_EVENTS
;
4416 PIM_DO_DEBUG_IGMP_PACKETS
;
4417 PIM_DO_DEBUG_IGMP_TRACE
;
4421 DEFUN (no_debug_igmp
,
4428 PIM_DONT_DEBUG_IGMP_EVENTS
;
4429 PIM_DONT_DEBUG_IGMP_PACKETS
;
4430 PIM_DONT_DEBUG_IGMP_TRACE
;
4435 DEFUN (debug_igmp_events
,
4436 debug_igmp_events_cmd
,
4437 "debug igmp events",
4440 DEBUG_IGMP_EVENTS_STR
)
4442 PIM_DO_DEBUG_IGMP_EVENTS
;
4446 DEFUN (no_debug_igmp_events
,
4447 no_debug_igmp_events_cmd
,
4448 "no debug igmp events",
4452 DEBUG_IGMP_EVENTS_STR
)
4454 PIM_DONT_DEBUG_IGMP_EVENTS
;
4459 DEFUN (debug_igmp_packets
,
4460 debug_igmp_packets_cmd
,
4461 "debug igmp packets",
4464 DEBUG_IGMP_PACKETS_STR
)
4466 PIM_DO_DEBUG_IGMP_PACKETS
;
4470 DEFUN (no_debug_igmp_packets
,
4471 no_debug_igmp_packets_cmd
,
4472 "no debug igmp packets",
4476 DEBUG_IGMP_PACKETS_STR
)
4478 PIM_DONT_DEBUG_IGMP_PACKETS
;
4483 DEFUN (debug_igmp_trace
,
4484 debug_igmp_trace_cmd
,
4488 DEBUG_IGMP_TRACE_STR
)
4490 PIM_DO_DEBUG_IGMP_TRACE
;
4494 DEFUN (no_debug_igmp_trace
,
4495 no_debug_igmp_trace_cmd
,
4496 "no debug igmp trace",
4500 DEBUG_IGMP_TRACE_STR
)
4502 PIM_DONT_DEBUG_IGMP_TRACE
;
4507 DEFUN (debug_igmp_trace_detail
,
4508 debug_igmp_trace_detail_cmd
,
4509 "debug igmp trace detail",
4512 DEBUG_IGMP_TRACE_STR
4515 PIM_DO_DEBUG_IGMP_TRACE_DETAIL
;
4519 DEFUN (no_debug_igmp_trace_detail
,
4520 no_debug_igmp_trace_detail_cmd
,
4521 "no debug igmp trace detail",
4525 DEBUG_IGMP_TRACE_STR
4528 PIM_DONT_DEBUG_IGMP_TRACE_DETAIL
;
4533 DEFUN (debug_mroute
,
4539 PIM_DO_DEBUG_MROUTE
;
4543 DEFUN (debug_mroute_detail
,
4544 debug_mroute_detail_cmd
,
4545 "debug mroute detail",
4550 PIM_DO_DEBUG_MROUTE_DETAIL
;
4554 DEFUN (no_debug_mroute
,
4555 no_debug_mroute_cmd
,
4561 PIM_DONT_DEBUG_MROUTE
;
4565 DEFUN (no_debug_mroute_detail
,
4566 no_debug_mroute_detail_cmd
,
4567 "no debug mroute detail",
4573 PIM_DONT_DEBUG_MROUTE_DETAIL
;
4577 DEFUN (debug_pim_static
,
4578 debug_pim_static_cmd
,
4584 PIM_DO_DEBUG_STATIC
;
4588 DEFUN (no_debug_pim_static
,
4589 no_debug_pim_static_cmd
,
4590 "no debug pim static",
4596 PIM_DONT_DEBUG_STATIC
;
4609 return pim_debug_pim_cmd();
4611 return pim_no_debug_pim_cmd();
4614 DEFPY (debug_pim_nht
,
4616 "[no] debug pim nht",
4620 "Nexthop Tracking\n")
4623 PIM_DO_DEBUG_PIM_NHT
;
4625 PIM_DONT_DEBUG_PIM_NHT
;
4629 DEFPY (debug_pim_nht_det
,
4630 debug_pim_nht_det_cmd
,
4631 "[no] debug pim nht detail",
4635 "Nexthop Tracking\n"
4636 "Detailed Information\n")
4639 PIM_DO_DEBUG_PIM_NHT_DETAIL
;
4641 PIM_DONT_DEBUG_PIM_NHT_DETAIL
;
4645 DEFUN (debug_pim_nht_rp
,
4646 debug_pim_nht_rp_cmd
,
4650 "Nexthop Tracking\n"
4651 "RP Nexthop Tracking\n")
4653 PIM_DO_DEBUG_PIM_NHT_RP
;
4657 DEFUN (no_debug_pim_nht_rp
,
4658 no_debug_pim_nht_rp_cmd
,
4659 "no debug pim nht rp",
4663 "Nexthop Tracking\n"
4664 "RP Nexthop Tracking\n")
4666 PIM_DONT_DEBUG_PIM_NHT_RP
;
4670 DEFPY (debug_pim_events
,
4671 debug_pim_events_cmd
,
4672 "[no] debug pim events",
4676 DEBUG_PIM_EVENTS_STR
)
4679 PIM_DO_DEBUG_PIM_EVENTS
;
4681 PIM_DONT_DEBUG_PIM_EVENTS
;
4685 DEFPY (debug_pim_packets
,
4686 debug_pim_packets_cmd
,
4687 "[no] debug pim packets [<hello$hello|joins$joins|register$registers>]",
4690 DEBUG_PIM_PACKETS_STR
4691 DEBUG_PIM_HELLO_PACKETS_STR
4692 DEBUG_PIM_J_P_PACKETS_STR
4693 DEBUG_PIM_PIM_REG_PACKETS_STR
)
4696 return pim_debug_pim_packets_cmd(hello
, joins
, registers
, vty
);
4698 return pim_no_debug_pim_packets_cmd(hello
, joins
, registers
,
4702 DEFPY (debug_pim_packetdump_send
,
4703 debug_pim_packetdump_send_cmd
,
4704 "[no] debug pim packet-dump send",
4708 DEBUG_PIM_PACKETDUMP_STR
4709 DEBUG_PIM_PACKETDUMP_SEND_STR
)
4712 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
4714 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
4718 DEFPY (debug_pim_packetdump_recv
,
4719 debug_pim_packetdump_recv_cmd
,
4720 "[no] debug pim packet-dump receive",
4724 DEBUG_PIM_PACKETDUMP_STR
4725 DEBUG_PIM_PACKETDUMP_RECV_STR
)
4728 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
4730 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
4734 DEFPY (debug_pim_trace
,
4735 debug_pim_trace_cmd
,
4736 "[no] debug pim trace",
4740 DEBUG_PIM_TRACE_STR
)
4743 PIM_DO_DEBUG_PIM_TRACE
;
4745 PIM_DONT_DEBUG_PIM_TRACE
;
4749 DEFPY (debug_pim_trace_detail
,
4750 debug_pim_trace_detail_cmd
,
4751 "[no] debug pim trace detail",
4756 "Detailed Information\n")
4759 PIM_DO_DEBUG_PIM_TRACE_DETAIL
;
4761 PIM_DONT_DEBUG_PIM_TRACE_DETAIL
;
4765 DEFUN (debug_ssmpingd
,
4771 PIM_DO_DEBUG_SSMPINGD
;
4775 DEFUN (no_debug_ssmpingd
,
4776 no_debug_ssmpingd_cmd
,
4777 "no debug ssmpingd",
4782 PIM_DONT_DEBUG_SSMPINGD
;
4786 DEFPY (debug_pim_zebra
,
4787 debug_pim_zebra_cmd
,
4788 "[no] debug pim zebra",
4792 DEBUG_PIM_ZEBRA_STR
)
4797 PIM_DONT_DEBUG_ZEBRA
;
4801 DEFUN(debug_pim_mlag
, debug_pim_mlag_cmd
, "debug pim mlag",
4802 DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4808 DEFUN(no_debug_pim_mlag
, no_debug_pim_mlag_cmd
, "no debug pim mlag",
4809 NO_STR DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4811 PIM_DONT_DEBUG_MLAG
;
4815 DEFUN (debug_pim_vxlan
,
4816 debug_pim_vxlan_cmd
,
4820 DEBUG_PIM_VXLAN_STR
)
4826 DEFUN (no_debug_pim_vxlan
,
4827 no_debug_pim_vxlan_cmd
,
4828 "no debug pim vxlan",
4832 DEBUG_PIM_VXLAN_STR
)
4834 PIM_DONT_DEBUG_VXLAN
;
4844 PIM_DO_DEBUG_MSDP_EVENTS
;
4845 PIM_DO_DEBUG_MSDP_PACKETS
;
4849 DEFUN (no_debug_msdp
,
4856 PIM_DONT_DEBUG_MSDP_EVENTS
;
4857 PIM_DONT_DEBUG_MSDP_PACKETS
;
4861 DEFUN (debug_msdp_events
,
4862 debug_msdp_events_cmd
,
4863 "debug msdp events",
4866 DEBUG_MSDP_EVENTS_STR
)
4868 PIM_DO_DEBUG_MSDP_EVENTS
;
4872 DEFUN (no_debug_msdp_events
,
4873 no_debug_msdp_events_cmd
,
4874 "no debug msdp events",
4878 DEBUG_MSDP_EVENTS_STR
)
4880 PIM_DONT_DEBUG_MSDP_EVENTS
;
4884 DEFUN (debug_msdp_packets
,
4885 debug_msdp_packets_cmd
,
4886 "debug msdp packets",
4889 DEBUG_MSDP_PACKETS_STR
)
4891 PIM_DO_DEBUG_MSDP_PACKETS
;
4895 DEFUN (no_debug_msdp_packets
,
4896 no_debug_msdp_packets_cmd
,
4897 "no debug msdp packets",
4901 DEBUG_MSDP_PACKETS_STR
)
4903 PIM_DONT_DEBUG_MSDP_PACKETS
;
4907 DEFUN (debug_mtrace
,
4913 PIM_DO_DEBUG_MTRACE
;
4917 DEFUN (no_debug_mtrace
,
4918 no_debug_mtrace_cmd
,
4924 PIM_DONT_DEBUG_MTRACE
;
4939 DEFUN (no_debug_bsm
,
4952 DEFUN_NOSH (show_debugging_pim
,
4953 show_debugging_pim_cmd
,
4954 "show debugging [pim]",
4959 vty_out(vty
, "PIM debugging status\n");
4961 pim_debug_config_write(vty
);
4966 DEFUN (interface_pim_use_source
,
4967 interface_pim_use_source_cmd
,
4968 "ip pim use-source A.B.C.D",
4971 "Configure primary IP address\n"
4972 "source ip address\n")
4974 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, argv
[3]->arg
);
4976 return nb_cli_apply_changes(vty
,
4977 FRR_PIM_INTERFACE_XPATH
,
4978 "frr-routing:ipv4");
4981 DEFUN (interface_no_pim_use_source
,
4982 interface_no_pim_use_source_cmd
,
4983 "no ip pim use-source [A.B.C.D]",
4987 "Delete source IP address\n"
4988 "source ip address\n")
4990 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, "0.0.0.0");
4992 return nb_cli_apply_changes(vty
,
4993 FRR_PIM_INTERFACE_XPATH
,
4994 "frr-routing:ipv4");
4999 "ip pim bfd [profile BFDPROF$prof]",
5002 "Enables BFD support\n"
5004 "Use BFD profile name\n")
5006 const struct lyd_node
*igmp_enable_dnode
;
5009 yang_dnode_getf(vty
->candidate_config
->dnode
,
5010 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
5011 "frr-routing:ipv4");
5012 if (!igmp_enable_dnode
)
5013 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5016 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
5017 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5021 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
5023 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_MODIFY
, prof
);
5025 return nb_cli_apply_changes(vty
,
5026 FRR_PIM_INTERFACE_XPATH
,
5027 "frr-routing:ipv4");
5030 DEFPY(no_ip_pim_bfd_profile
, no_ip_pim_bfd_profile_cmd
,
5031 "no ip pim bfd profile [BFDPROF]",
5035 "Enables BFD support\n"
5036 "Disable BFD profile\n"
5037 "BFD Profile name\n")
5039 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_DESTROY
, NULL
);
5041 return nb_cli_apply_changes(vty
,
5042 FRR_PIM_INTERFACE_XPATH
,
5043 "frr-routing:ipv4");
5046 DEFUN (no_ip_pim_bfd
,
5052 "Disables BFD support\n")
5054 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_DESTROY
, NULL
);
5056 return nb_cli_apply_changes(vty
,
5057 FRR_PIM_INTERFACE_XPATH
,
5058 "frr-routing:ipv4");
5066 "Enables BSM support on the interface\n")
5068 const struct lyd_node
*igmp_enable_dnode
;
5071 yang_dnode_getf(vty
->candidate_config
->dnode
,
5072 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
5073 "frr-routing:ipv4");
5074 if (!igmp_enable_dnode
)
5075 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5078 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
5079 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5083 nb_cli_enqueue_change(vty
, "./bsm", NB_OP_MODIFY
, "true");
5085 return nb_cli_apply_changes(vty
,
5086 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5089 DEFUN (no_ip_pim_bsm
,
5095 "Disables BSM support\n")
5097 nb_cli_enqueue_change(vty
, "./bsm", NB_OP_MODIFY
, "false");
5099 return nb_cli_apply_changes(vty
,
5100 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5103 DEFUN (ip_pim_ucast_bsm
,
5104 ip_pim_ucast_bsm_cmd
,
5105 "ip pim unicast-bsm",
5108 "Accept/Send unicast BSM on the interface\n")
5110 const struct lyd_node
*igmp_enable_dnode
;
5113 yang_dnode_getf(vty
->candidate_config
->dnode
,
5114 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
5115 "frr-routing:ipv4");
5116 if (!igmp_enable_dnode
)
5117 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5120 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
5121 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5125 nb_cli_enqueue_change(vty
, "./unicast-bsm", NB_OP_MODIFY
, "true");
5127 return nb_cli_apply_changes(vty
,
5128 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5132 DEFUN (no_ip_pim_ucast_bsm
,
5133 no_ip_pim_ucast_bsm_cmd
,
5134 "no ip pim unicast-bsm",
5138 "Block send/receive unicast BSM on this interface\n")
5140 nb_cli_enqueue_change(vty
, "./unicast-bsm", NB_OP_MODIFY
, "false");
5142 return nb_cli_apply_changes(vty
,
5143 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5149 ip_pim_bfd_param_cmd
,
5150 "ip pim bfd (2-255) (1-65535) (1-65535)",
5153 "Enables BFD support\n"
5154 "Detect Multiplier\n"
5155 "Required min receive interval\n"
5156 "Desired min transmit interval\n")
5160 ip_pim_bfd_param_cmd
,
5161 "ip pim bfd (2-255) (1-65535) (1-65535)",
5164 "Enables BFD support\n"
5165 "Detect Multiplier\n"
5166 "Required min receive interval\n"
5167 "Desired min transmit interval\n")
5168 #endif /* HAVE_BFDD */
5171 int idx_number_2
= 4;
5172 int idx_number_3
= 5;
5173 const struct lyd_node
*igmp_enable_dnode
;
5176 yang_dnode_getf(vty
->candidate_config
->dnode
,
5177 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
5178 "frr-routing:ipv4");
5179 if (!igmp_enable_dnode
)
5180 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5183 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
5184 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5188 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
5189 nb_cli_enqueue_change(vty
, "./bfd/min-rx-interval", NB_OP_MODIFY
,
5190 argv
[idx_number_2
]->arg
);
5191 nb_cli_enqueue_change(vty
, "./bfd/min-tx-interval", NB_OP_MODIFY
,
5192 argv
[idx_number_3
]->arg
);
5193 nb_cli_enqueue_change(vty
, "./bfd/detect_mult", NB_OP_MODIFY
,
5194 argv
[idx_number
]->arg
);
5196 return nb_cli_apply_changes(vty
,
5197 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5201 ALIAS(no_ip_pim_bfd
, no_ip_pim_bfd_param_cmd
,
5202 "no ip pim bfd (2-255) (1-65535) (1-65535)",
5206 "Enables BFD support\n"
5207 "Detect Multiplier\n"
5208 "Required min receive interval\n"
5209 "Desired min transmit interval\n")
5210 #endif /* !HAVE_BFDD */
5212 DEFPY(ip_msdp_peer
, ip_msdp_peer_cmd
,
5213 "ip msdp peer A.B.C.D$peer source A.B.C.D$source",
5216 "Configure MSDP peer\n"
5218 "Source address for TCP connection\n"
5219 "Local IP address\n")
5221 const char *vrfname
;
5222 char temp_xpath
[XPATH_MAXLEN
];
5223 char msdp_peer_source_xpath
[XPATH_MAXLEN
];
5225 vrfname
= pim_cli_get_vrf_name(vty
);
5226 if (vrfname
== NULL
)
5227 return CMD_WARNING_CONFIG_FAILED
;
5229 snprintf(msdp_peer_source_xpath
, sizeof(msdp_peer_source_xpath
),
5230 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
5231 "frr-routing:ipv4");
5232 snprintf(temp_xpath
, sizeof(temp_xpath
),
5233 "/msdp-peer[peer-ip='%s']/source-ip", peer_str
);
5234 strlcat(msdp_peer_source_xpath
, temp_xpath
,
5235 sizeof(msdp_peer_source_xpath
));
5237 nb_cli_enqueue_change(vty
, msdp_peer_source_xpath
, NB_OP_MODIFY
,
5240 return nb_cli_apply_changes(vty
,
5241 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5244 DEFPY(ip_msdp_timers
, ip_msdp_timers_cmd
,
5245 "ip msdp timers (1-65535)$keepalive (1-65535)$holdtime [(1-65535)$connretry]",
5248 "MSDP timers configuration\n"
5249 "Keep alive period (in seconds)\n"
5250 "Hold time period (in seconds)\n"
5251 "Connection retry period (in seconds)\n")
5253 const char *vrfname
;
5254 char xpath
[XPATH_MAXLEN
];
5256 vrfname
= pim_cli_get_vrf_name(vty
);
5257 if (vrfname
== NULL
)
5258 return CMD_WARNING_CONFIG_FAILED
;
5260 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
5261 "pim", vrfname
, "frr-routing:ipv4");
5262 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_MODIFY
, holdtime_str
);
5263 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_MODIFY
, keepalive_str
);
5265 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_MODIFY
,
5268 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
,
5271 nb_cli_apply_changes(vty
, xpath
);
5276 DEFPY(no_ip_msdp_timers
, no_ip_msdp_timers_cmd
,
5277 "no ip msdp timers [(1-65535) (1-65535) [(1-65535)]]",
5281 "MSDP timers configuration\n"
5286 const char *vrfname
;
5287 char xpath
[XPATH_MAXLEN
];
5289 vrfname
= pim_cli_get_vrf_name(vty
);
5290 if (vrfname
== NULL
)
5291 return CMD_WARNING_CONFIG_FAILED
;
5293 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
5294 "pim", vrfname
, "frr-routing:ipv4");
5296 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_DESTROY
, NULL
);
5297 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_DESTROY
, NULL
);
5298 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
, NULL
);
5300 nb_cli_apply_changes(vty
, xpath
);
5305 DEFUN (no_ip_msdp_peer
,
5306 no_ip_msdp_peer_cmd
,
5307 "no ip msdp peer A.B.C.D",
5311 "Delete MSDP peer\n"
5312 "peer ip address\n")
5314 const char *vrfname
;
5315 char msdp_peer_xpath
[XPATH_MAXLEN
];
5316 char temp_xpath
[XPATH_MAXLEN
];
5318 vrfname
= pim_cli_get_vrf_name(vty
);
5319 if (vrfname
== NULL
)
5320 return CMD_WARNING_CONFIG_FAILED
;
5322 snprintf(msdp_peer_xpath
, sizeof(msdp_peer_xpath
),
5324 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
5325 snprintf(temp_xpath
, sizeof(temp_xpath
),
5326 "/msdp-peer[peer-ip='%s']",
5329 strlcat(msdp_peer_xpath
, temp_xpath
, sizeof(msdp_peer_xpath
));
5331 nb_cli_enqueue_change(vty
, msdp_peer_xpath
, NB_OP_DESTROY
, NULL
);
5333 return nb_cli_apply_changes(vty
, NULL
);
5336 DEFPY(ip_msdp_mesh_group_member
,
5337 ip_msdp_mesh_group_member_cmd
,
5338 "ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
5341 "Configure MSDP mesh-group\n"
5343 "Mesh group member\n"
5344 "Peer IP address\n")
5346 const char *vrfname
;
5347 char xpath_value
[XPATH_MAXLEN
];
5349 vrfname
= pim_cli_get_vrf_name(vty
);
5350 if (vrfname
== NULL
)
5351 return CMD_WARNING_CONFIG_FAILED
;
5353 /* Create mesh group. */
5354 snprintf(xpath_value
, sizeof(xpath_value
),
5355 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5356 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5357 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5359 /* Create mesh group member. */
5360 strlcat(xpath_value
, "/members[address='", sizeof(xpath_value
));
5361 strlcat(xpath_value
, maddr_str
, sizeof(xpath_value
));
5362 strlcat(xpath_value
, "']", sizeof(xpath_value
));
5363 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5365 return nb_cli_apply_changes(vty
, NULL
);
5368 DEFPY(no_ip_msdp_mesh_group_member
,
5369 no_ip_msdp_mesh_group_member_cmd
,
5370 "no ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
5374 "Delete MSDP mesh-group member\n"
5376 "Mesh group member\n"
5377 "Peer IP address\n")
5379 const char *vrfname
;
5380 char xpath_value
[XPATH_MAXLEN
];
5381 char xpath_member_value
[XPATH_MAXLEN
];
5383 vrfname
= pim_cli_get_vrf_name(vty
);
5384 if (vrfname
== NULL
)
5385 return CMD_WARNING_CONFIG_FAILED
;
5387 /* Get mesh group base XPath. */
5388 snprintf(xpath_value
, sizeof(xpath_value
),
5389 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5390 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5392 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
)) {
5393 vty_out(vty
, "%% mesh-group does not exist\n");
5394 return CMD_WARNING_CONFIG_FAILED
;
5397 /* Remove mesh group member. */
5398 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
5399 strlcat(xpath_member_value
, "/members[address='",
5400 sizeof(xpath_member_value
));
5401 strlcat(xpath_member_value
, maddr_str
, sizeof(xpath_member_value
));
5402 strlcat(xpath_member_value
, "']", sizeof(xpath_member_value
));
5403 if (!yang_dnode_exists(vty
->candidate_config
->dnode
,
5404 xpath_member_value
)) {
5405 vty_out(vty
, "%% mesh-group member does not exist\n");
5406 return CMD_WARNING_CONFIG_FAILED
;
5409 nb_cli_enqueue_change(vty
, xpath_member_value
, NB_OP_DESTROY
, NULL
);
5412 * If this is the last member, then we must remove the group altogether
5413 * to not break legacy CLI behaviour.
5415 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5417 return nb_cli_apply_changes(vty
, NULL
);
5420 DEFPY(ip_msdp_mesh_group_source
,
5421 ip_msdp_mesh_group_source_cmd
,
5422 "ip msdp mesh-group WORD$gname source A.B.C.D$saddr",
5425 "Configure MSDP mesh-group\n"
5427 "Mesh group local address\n"
5428 "Source IP address for the TCP connection\n")
5430 const char *vrfname
;
5431 char xpath_value
[XPATH_MAXLEN
];
5433 vrfname
= pim_cli_get_vrf_name(vty
);
5434 if (vrfname
== NULL
)
5435 return CMD_WARNING_CONFIG_FAILED
;
5437 /* Create mesh group. */
5438 snprintf(xpath_value
, sizeof(xpath_value
),
5439 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5440 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5441 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5443 /* Create mesh group source. */
5444 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5445 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_MODIFY
, saddr_str
);
5447 return nb_cli_apply_changes(vty
, NULL
);
5450 DEFPY(no_ip_msdp_mesh_group_source
,
5451 no_ip_msdp_mesh_group_source_cmd
,
5452 "no ip msdp mesh-group WORD$gname source [A.B.C.D]",
5456 "Delete MSDP mesh-group source\n"
5458 "Mesh group source\n"
5459 "Mesh group local address\n")
5461 const char *vrfname
;
5462 char xpath_value
[XPATH_MAXLEN
];
5464 vrfname
= pim_cli_get_vrf_name(vty
);
5465 if (vrfname
== NULL
)
5466 return CMD_WARNING_CONFIG_FAILED
;
5468 /* Get mesh group base XPath. */
5469 snprintf(xpath_value
, sizeof(xpath_value
),
5470 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5471 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5472 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5474 /* Create mesh group source. */
5475 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5476 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5479 * If this is the last member, then we must remove the group altogether
5480 * to not break legacy CLI behaviour.
5482 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5484 return nb_cli_apply_changes(vty
, NULL
);
5487 DEFPY(no_ip_msdp_mesh_group
,
5488 no_ip_msdp_mesh_group_cmd
,
5489 "no ip msdp mesh-group WORD$gname",
5493 "Delete MSDP mesh-group\n"
5496 const char *vrfname
;
5497 char xpath_value
[XPATH_MAXLEN
];
5499 vrfname
= pim_cli_get_vrf_name(vty
);
5500 if (vrfname
== NULL
)
5501 return CMD_WARNING_CONFIG_FAILED
;
5503 /* Get mesh group base XPath. */
5504 snprintf(xpath_value
, sizeof(xpath_value
),
5505 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5506 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5507 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
5510 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5511 return nb_cli_apply_changes(vty
, NULL
);
5514 static void ip_msdp_show_mesh_group(struct vty
*vty
, struct pim_msdp_mg
*mg
,
5515 struct json_object
*json
)
5517 struct listnode
*mbrnode
;
5518 struct pim_msdp_mg_mbr
*mbr
;
5519 char mbr_str
[INET_ADDRSTRLEN
];
5520 char src_str
[INET_ADDRSTRLEN
];
5521 char state_str
[PIM_MSDP_STATE_STRLEN
];
5522 enum pim_msdp_peer_state state
;
5523 json_object
*json_mg_row
= NULL
;
5524 json_object
*json_members
= NULL
;
5525 json_object
*json_row
= NULL
;
5527 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
5529 /* currently there is only one mesh group but we should still
5531 * it a dict with mg-name as key */
5532 json_mg_row
= json_object_new_object();
5533 json_object_string_add(json_mg_row
, "name",
5534 mg
->mesh_group_name
);
5535 json_object_string_add(json_mg_row
, "source", src_str
);
5537 vty_out(vty
, "Mesh group : %s\n", mg
->mesh_group_name
);
5538 vty_out(vty
, " Source : %s\n", src_str
);
5539 vty_out(vty
, " Member State\n");
5542 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
5543 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
5545 state
= mbr
->mp
->state
;
5547 state
= PIM_MSDP_DISABLED
;
5549 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
5551 json_row
= json_object_new_object();
5552 json_object_string_add(json_row
, "member", mbr_str
);
5553 json_object_string_add(json_row
, "state", state_str
);
5554 if (!json_members
) {
5555 json_members
= json_object_new_object();
5556 json_object_object_add(json_mg_row
, "members",
5559 json_object_object_add(json_members
, mbr_str
, json_row
);
5561 vty_out(vty
, " %-15s %11s\n", mbr_str
, state_str
);
5566 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
5569 DEFUN (show_ip_msdp_mesh_group
,
5570 show_ip_msdp_mesh_group_cmd
,
5571 "show ip msdp [vrf NAME] mesh-group [json]",
5576 "MSDP mesh-group information\n"
5579 bool uj
= use_json(argc
, argv
);
5581 struct pim_msdp_mg
*mg
;
5582 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5583 struct pim_instance
*pim
= vrf
->info
;
5584 struct json_object
*json
= NULL
;
5589 /* Quick case: list is empty. */
5590 if (SLIST_EMPTY(&pim
->msdp
.mglist
)) {
5592 vty_out(vty
, "{}\n");
5598 json
= json_object_new_object();
5600 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5601 ip_msdp_show_mesh_group(vty
, mg
, json
);
5604 vty_json(vty
, json
);
5609 DEFUN (show_ip_msdp_mesh_group_vrf_all
,
5610 show_ip_msdp_mesh_group_vrf_all_cmd
,
5611 "show ip msdp vrf all mesh-group [json]",
5616 "MSDP mesh-group information\n"
5619 bool uj
= use_json(argc
, argv
);
5620 struct json_object
*json
= NULL
, *vrf_json
= NULL
;
5621 struct pim_instance
*pim
;
5622 struct pim_msdp_mg
*mg
;
5626 json
= json_object_new_object();
5628 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5630 vrf_json
= json_object_new_object();
5631 json_object_object_add(json
, vrf
->name
, vrf_json
);
5633 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5636 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5637 ip_msdp_show_mesh_group(vty
, mg
, vrf_json
);
5641 vty_json(vty
, json
);
5647 static void ip_msdp_show_peers(struct pim_instance
*pim
, struct vty
*vty
,
5650 struct listnode
*mpnode
;
5651 struct pim_msdp_peer
*mp
;
5652 char peer_str
[INET_ADDRSTRLEN
];
5653 char local_str
[INET_ADDRSTRLEN
];
5654 char state_str
[PIM_MSDP_STATE_STRLEN
];
5655 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5657 json_object
*json
= NULL
;
5658 json_object
*json_row
= NULL
;
5662 json
= json_object_new_object();
5665 "Peer Local State Uptime SaCnt\n");
5668 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5669 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5670 now
= pim_time_monotonic_sec();
5671 pim_time_uptime(timebuf
, sizeof(timebuf
),
5674 strlcpy(timebuf
, "-", sizeof(timebuf
));
5676 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5677 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5679 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5681 json_row
= json_object_new_object();
5682 json_object_string_add(json_row
, "peer", peer_str
);
5683 json_object_string_add(json_row
, "local", local_str
);
5684 json_object_string_add(json_row
, "state", state_str
);
5685 json_object_string_add(json_row
, "upTime", timebuf
);
5686 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5687 json_object_object_add(json
, peer_str
, json_row
);
5689 vty_out(vty
, "%-15s %15s %11s %8s %6d\n", peer_str
,
5690 local_str
, state_str
, timebuf
, mp
->sa_cnt
);
5695 vty_json(vty
, json
);
5698 static void ip_msdp_show_peers_detail(struct pim_instance
*pim
, struct vty
*vty
,
5699 const char *peer
, bool uj
)
5701 struct listnode
*mpnode
;
5702 struct pim_msdp_peer
*mp
;
5703 char peer_str
[INET_ADDRSTRLEN
];
5704 char local_str
[INET_ADDRSTRLEN
];
5705 char state_str
[PIM_MSDP_STATE_STRLEN
];
5706 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5707 char katimer
[PIM_MSDP_TIMER_STRLEN
];
5708 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
5709 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
5711 json_object
*json
= NULL
;
5712 json_object
*json_row
= NULL
;
5715 json
= json_object_new_object();
5718 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5719 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5720 if (strcmp(peer
, "detail") && strcmp(peer
, peer_str
))
5723 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5724 now
= pim_time_monotonic_sec();
5725 pim_time_uptime(timebuf
, sizeof(timebuf
),
5728 strlcpy(timebuf
, "-", sizeof(timebuf
));
5730 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5732 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5733 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
),
5735 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
),
5737 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
),
5741 json_row
= json_object_new_object();
5742 json_object_string_add(json_row
, "peer", peer_str
);
5743 json_object_string_add(json_row
, "local", local_str
);
5744 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5745 json_object_string_add(json_row
,
5747 mp
->mesh_group_name
);
5748 json_object_string_add(json_row
, "state", state_str
);
5749 json_object_string_add(json_row
, "upTime", timebuf
);
5750 json_object_string_add(json_row
, "keepAliveTimer",
5752 json_object_string_add(json_row
, "connRetryTimer",
5754 json_object_string_add(json_row
, "holdTimer",
5756 json_object_string_add(json_row
, "lastReset",
5758 json_object_int_add(json_row
, "connAttempts",
5760 json_object_int_add(json_row
, "establishedChanges",
5762 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5763 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
5764 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
5765 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
5766 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
5767 json_object_object_add(json
, peer_str
, json_row
);
5769 vty_out(vty
, "Peer : %s\n", peer_str
);
5770 vty_out(vty
, " Local : %s\n", local_str
);
5771 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5772 vty_out(vty
, " Mesh Group : %s\n",
5773 mp
->mesh_group_name
);
5774 vty_out(vty
, " State : %s\n", state_str
);
5775 vty_out(vty
, " Uptime : %s\n", timebuf
);
5777 vty_out(vty
, " Keepalive Timer : %s\n", katimer
);
5778 vty_out(vty
, " Conn Retry Timer : %s\n", crtimer
);
5779 vty_out(vty
, " Hold Timer : %s\n", holdtimer
);
5780 vty_out(vty
, " Last Reset : %s\n",
5782 vty_out(vty
, " Conn Attempts : %d\n",
5784 vty_out(vty
, " Established Changes : %d\n",
5786 vty_out(vty
, " SA Count : %d\n",
5788 vty_out(vty
, " Statistics :\n");
5791 vty_out(vty
, " Keepalives : %10d %10d\n",
5792 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
);
5793 vty_out(vty
, " SAs : %10d %10d\n",
5794 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
);
5800 vty_json(vty
, json
);
5803 DEFUN (show_ip_msdp_peer_detail
,
5804 show_ip_msdp_peer_detail_cmd
,
5805 "show ip msdp [vrf NAME] peer [detail|A.B.C.D] [json]",
5810 "MSDP peer information\n"
5815 bool uj
= use_json(argc
, argv
);
5817 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5824 if (argv_find(argv
, argc
, "detail", &idx
))
5825 arg
= argv
[idx
]->text
;
5826 else if (argv_find(argv
, argc
, "A.B.C.D", &idx
))
5827 arg
= argv
[idx
]->arg
;
5830 ip_msdp_show_peers_detail(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
5832 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5837 DEFUN (show_ip_msdp_peer_detail_vrf_all
,
5838 show_ip_msdp_peer_detail_vrf_all_cmd
,
5839 "show ip msdp vrf all peer [detail|A.B.C.D] [json]",
5844 "MSDP peer information\n"
5850 bool uj
= use_json(argc
, argv
);
5856 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5860 vty_out(vty
, " \"%s\": ", vrf
->name
);
5863 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5864 if (argv_find(argv
, argc
, "detail", &idx
)
5865 || argv_find(argv
, argc
, "A.B.C.D", &idx
))
5866 ip_msdp_show_peers_detail(vrf
->info
, vty
,
5867 argv
[idx
]->arg
, uj
);
5869 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5872 vty_out(vty
, "}\n");
5877 static void ip_msdp_show_sa(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
5879 struct listnode
*sanode
;
5880 struct pim_msdp_sa
*sa
;
5881 char rp_str
[INET_ADDRSTRLEN
];
5882 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5886 json_object
*json
= NULL
;
5887 json_object
*json_group
= NULL
;
5888 json_object
*json_row
= NULL
;
5891 json
= json_object_new_object();
5894 "Source Group RP Local SPT Uptime\n");
5897 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5898 now
= pim_time_monotonic_sec();
5899 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5900 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5901 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5903 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5905 strlcpy(spt_str
, "no", sizeof(spt_str
));
5908 strlcpy(rp_str
, "-", sizeof(rp_str
));
5909 strlcpy(spt_str
, "-", sizeof(spt_str
));
5911 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5912 strlcpy(local_str
, "yes", sizeof(local_str
));
5914 strlcpy(local_str
, "no", sizeof(local_str
));
5917 char src_str
[PIM_ADDRSTRLEN
];
5918 char grp_str
[PIM_ADDRSTRLEN
];
5920 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
5922 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
5925 json_object_object_get_ex(json
, grp_str
, &json_group
);
5928 json_group
= json_object_new_object();
5929 json_object_object_add(json
, grp_str
,
5933 json_row
= json_object_new_object();
5934 json_object_string_add(json_row
, "source", src_str
);
5935 json_object_string_add(json_row
, "group", grp_str
);
5936 json_object_string_add(json_row
, "rp", rp_str
);
5937 json_object_string_add(json_row
, "local", local_str
);
5938 json_object_string_add(json_row
, "sptSetup", spt_str
);
5939 json_object_string_add(json_row
, "upTime", timebuf
);
5940 json_object_object_add(json_group
, src_str
, json_row
);
5942 vty_out(vty
, "%-15pPAs %15pPAs %15s %5c %3c %8s\n",
5943 &sa
->sg
.src
, &sa
->sg
.grp
, rp_str
, local_str
[0],
5944 spt_str
[0], timebuf
);
5949 vty_json(vty
, json
);
5952 static void ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
,
5953 const char *src_str
,
5954 const char *grp_str
, struct vty
*vty
,
5955 bool uj
, json_object
*json
)
5957 char rp_str
[INET_ADDRSTRLEN
];
5958 char peer_str
[INET_ADDRSTRLEN
];
5959 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5962 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
5964 json_object
*json_group
= NULL
;
5965 json_object
*json_row
= NULL
;
5967 now
= pim_time_monotonic_sec();
5968 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5969 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5970 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5971 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
5973 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5975 strlcpy(spt_str
, "no", sizeof(spt_str
));
5978 strlcpy(rp_str
, "-", sizeof(rp_str
));
5979 strlcpy(peer_str
, "-", sizeof(peer_str
));
5980 strlcpy(spt_str
, "-", sizeof(spt_str
));
5982 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5983 strlcpy(local_str
, "yes", sizeof(local_str
));
5985 strlcpy(local_str
, "no", sizeof(local_str
));
5987 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
),
5988 sa
->sa_state_timer
);
5990 json_object_object_get_ex(json
, grp_str
, &json_group
);
5993 json_group
= json_object_new_object();
5994 json_object_object_add(json
, grp_str
, json_group
);
5997 json_row
= json_object_new_object();
5998 json_object_string_add(json_row
, "source", src_str
);
5999 json_object_string_add(json_row
, "group", grp_str
);
6000 json_object_string_add(json_row
, "rp", rp_str
);
6001 json_object_string_add(json_row
, "local", local_str
);
6002 json_object_string_add(json_row
, "sptSetup", spt_str
);
6003 json_object_string_add(json_row
, "upTime", timebuf
);
6004 json_object_string_add(json_row
, "stateTimer", statetimer
);
6005 json_object_object_add(json_group
, src_str
, json_row
);
6007 vty_out(vty
, "SA : %s\n", sa
->sg_str
);
6008 vty_out(vty
, " RP : %s\n", rp_str
);
6009 vty_out(vty
, " Peer : %s\n", peer_str
);
6010 vty_out(vty
, " Local : %s\n", local_str
);
6011 vty_out(vty
, " SPT Setup : %s\n", spt_str
);
6012 vty_out(vty
, " Uptime : %s\n", timebuf
);
6013 vty_out(vty
, " State Timer : %s\n", statetimer
);
6018 static void ip_msdp_show_sa_detail(struct pim_instance
*pim
, struct vty
*vty
,
6021 struct listnode
*sanode
;
6022 struct pim_msdp_sa
*sa
;
6023 json_object
*json
= NULL
;
6026 json
= json_object_new_object();
6029 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
6030 char src_str
[PIM_ADDRSTRLEN
];
6031 char grp_str
[PIM_ADDRSTRLEN
];
6033 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
6034 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
6036 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
,
6041 vty_json(vty
, json
);
6044 DEFUN (show_ip_msdp_sa_detail
,
6045 show_ip_msdp_sa_detail_cmd
,
6046 "show ip msdp [vrf NAME] sa detail [json]",
6051 "MSDP active-source information\n"
6055 bool uj
= use_json(argc
, argv
);
6057 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6062 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
6067 DEFUN (show_ip_msdp_sa_detail_vrf_all
,
6068 show_ip_msdp_sa_detail_vrf_all_cmd
,
6069 "show ip msdp vrf all sa detail [json]",
6074 "MSDP active-source information\n"
6078 bool uj
= use_json(argc
, argv
);
6084 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
6088 vty_out(vty
, " \"%s\": ", vrf
->name
);
6091 vty_out(vty
, "VRF: %s\n", vrf
->name
);
6092 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
6095 vty_out(vty
, "}\n");
6100 static void ip_msdp_show_sa_addr(struct pim_instance
*pim
, struct vty
*vty
,
6101 const char *addr
, bool uj
)
6103 struct listnode
*sanode
;
6104 struct pim_msdp_sa
*sa
;
6105 json_object
*json
= NULL
;
6108 json
= json_object_new_object();
6111 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
6112 char src_str
[PIM_ADDRSTRLEN
];
6113 char grp_str
[PIM_ADDRSTRLEN
];
6115 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
6116 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
6118 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
6119 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
6125 vty_json(vty
, json
);
6128 static void ip_msdp_show_sa_sg(struct pim_instance
*pim
, struct vty
*vty
,
6129 const char *src
, const char *grp
, bool uj
)
6131 struct listnode
*sanode
;
6132 struct pim_msdp_sa
*sa
;
6133 json_object
*json
= NULL
;
6136 json
= json_object_new_object();
6139 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
6140 char src_str
[PIM_ADDRSTRLEN
];
6141 char grp_str
[PIM_ADDRSTRLEN
];
6143 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
6144 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
6146 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
6147 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
6153 vty_json(vty
, json
);
6156 DEFUN (show_ip_msdp_sa_sg
,
6157 show_ip_msdp_sa_sg_cmd
,
6158 "show ip msdp [vrf NAME] sa [A.B.C.D [A.B.C.D]] [json]",
6163 "MSDP active-source information\n"
6164 "source or group ip\n"
6168 bool uj
= use_json(argc
, argv
);
6172 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6177 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
6179 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
6183 if (src_ip
&& grp_ip
)
6184 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6186 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
6188 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
6193 DEFUN (show_ip_msdp_sa_sg_vrf_all
,
6194 show_ip_msdp_sa_sg_vrf_all_cmd
,
6195 "show ip msdp vrf all sa [A.B.C.D [A.B.C.D]] [json]",
6200 "MSDP active-source information\n"
6201 "source or group ip\n"
6205 bool uj
= use_json(argc
, argv
);
6210 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
6212 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
6218 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
6222 vty_out(vty
, " \"%s\": ", vrf
->name
);
6225 vty_out(vty
, "VRF: %s\n", vrf
->name
);
6227 if (src_ip
&& grp_ip
)
6228 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6230 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
6232 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
6235 vty_out(vty
, "}\n");
6240 struct pim_sg_cache_walk_data
{
6243 json_object
*json_group
;
6244 struct in_addr addr
;
6248 static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg
*vxlan_sg
,
6249 struct pim_sg_cache_walk_data
*cwd
)
6251 struct vty
*vty
= cwd
->vty
;
6252 json_object
*json
= cwd
->json
;
6253 json_object
*json_row
;
6254 bool installed
= (vxlan_sg
->up
) ? true : false;
6255 const char *iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
6256 const char *oif_name
;
6258 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
6259 oif_name
= vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
6261 oif_name
= vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
6263 if (cwd
->addr_match
&& pim_addr_cmp(vxlan_sg
->sg
.src
, cwd
->addr
) &&
6264 pim_addr_cmp(vxlan_sg
->sg
.grp
, cwd
->addr
)) {
6268 char src_str
[PIM_ADDRSTRLEN
];
6269 char grp_str
[PIM_ADDRSTRLEN
];
6271 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
6273 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
6276 json_object_object_get_ex(json
, grp_str
, &cwd
->json_group
);
6278 if (!cwd
->json_group
) {
6279 cwd
->json_group
= json_object_new_object();
6280 json_object_object_add(json
, grp_str
,
6284 json_row
= json_object_new_object();
6285 json_object_string_add(json_row
, "source", src_str
);
6286 json_object_string_add(json_row
, "group", grp_str
);
6287 json_object_string_add(json_row
, "input", iif_name
);
6288 json_object_string_add(json_row
, "output", oif_name
);
6290 json_object_boolean_true_add(json_row
, "installed");
6292 json_object_boolean_false_add(json_row
, "installed");
6293 json_object_object_add(cwd
->json_group
, src_str
, json_row
);
6295 vty_out(vty
, "%-15pPAs %-15pPAs %-15s %-15s %-5s\n",
6296 &vxlan_sg
->sg
.src
, &vxlan_sg
->sg
.grp
, iif_name
,
6297 oif_name
, installed
? "I" : "");
6301 static void pim_show_vxlan_sg_hash_entry(struct hash_bucket
*bucket
, void *arg
)
6303 pim_show_vxlan_sg_entry((struct pim_vxlan_sg
*)bucket
->data
,
6304 (struct pim_sg_cache_walk_data
*)arg
);
6307 static void pim_show_vxlan_sg(struct pim_instance
*pim
,
6308 struct vty
*vty
, bool uj
)
6310 json_object
*json
= NULL
;
6311 struct pim_sg_cache_walk_data cwd
;
6314 json
= json_object_new_object();
6316 vty_out(vty
, "Codes: I -> installed\n");
6318 "Source Group Input Output Flags\n");
6321 memset(&cwd
, 0, sizeof(cwd
));
6324 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
6327 vty_json(vty
, json
);
6330 static void pim_show_vxlan_sg_match_addr(struct pim_instance
*pim
,
6331 struct vty
*vty
, char *addr_str
,
6334 json_object
*json
= NULL
;
6335 struct pim_sg_cache_walk_data cwd
;
6338 memset(&cwd
, 0, sizeof(cwd
));
6339 result
= inet_pton(AF_INET
, addr_str
, &cwd
.addr
);
6341 vty_out(vty
, "Bad address %s: errno=%d: %s\n", addr_str
,
6342 errno
, safe_strerror(errno
));
6347 json
= json_object_new_object();
6349 vty_out(vty
, "Codes: I -> installed\n");
6351 "Source Group Input Output Flags\n");
6356 cwd
.addr_match
= true;
6357 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
6360 vty_json(vty
, json
);
6363 static void pim_show_vxlan_sg_one(struct pim_instance
*pim
,
6364 struct vty
*vty
, char *src_str
, char *grp_str
,
6367 json_object
*json
= NULL
;
6370 struct pim_vxlan_sg
*vxlan_sg
;
6371 const char *iif_name
;
6373 const char *oif_name
;
6375 result
= inet_pton(AF_INET
, src_str
, &sg
.src
);
6377 vty_out(vty
, "Bad src address %s: errno=%d: %s\n", src_str
,
6378 errno
, safe_strerror(errno
));
6381 result
= inet_pton(AF_INET
, grp_str
, &sg
.grp
);
6383 vty_out(vty
, "Bad grp address %s: errno=%d: %s\n", grp_str
,
6384 errno
, safe_strerror(errno
));
6389 json
= json_object_new_object();
6391 vxlan_sg
= pim_vxlan_sg_find(pim
, &sg
);
6393 installed
= (vxlan_sg
->up
) ? true : false;
6394 iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
6396 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
6398 vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
6401 vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
6404 json_object_string_add(json
, "source", src_str
);
6405 json_object_string_add(json
, "group", grp_str
);
6406 json_object_string_add(json
, "input", iif_name
);
6407 json_object_string_add(json
, "output", oif_name
);
6409 json_object_boolean_true_add(json
, "installed");
6411 json_object_boolean_false_add(json
,
6414 vty_out(vty
, "SG : %s\n", vxlan_sg
->sg_str
);
6415 vty_out(vty
, " Input : %s\n", iif_name
);
6416 vty_out(vty
, " Output : %s\n", oif_name
);
6417 vty_out(vty
, " installed : %s\n",
6418 installed
?"yes":"no");
6423 vty_json(vty
, json
);
6426 DEFUN (show_ip_pim_vxlan_sg
,
6427 show_ip_pim_vxlan_sg_cmd
,
6428 "show ip pim [vrf NAME] vxlan-groups [A.B.C.D [A.B.C.D]] [json]",
6433 "VxLAN BUM groups\n"
6434 "source or group ip\n"
6438 bool uj
= use_json(argc
, argv
);
6442 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6447 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
6448 argv
[idx
++]->arg
:NULL
;
6449 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
6450 argv
[idx
]->arg
:NULL
;
6452 if (src_ip
&& grp_ip
)
6453 pim_show_vxlan_sg_one(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6455 pim_show_vxlan_sg_match_addr(vrf
->info
, vty
, src_ip
, uj
);
6457 pim_show_vxlan_sg(vrf
->info
, vty
, uj
);
6462 static void pim_show_vxlan_sg_work(struct pim_instance
*pim
,
6463 struct vty
*vty
, bool uj
)
6465 json_object
*json
= NULL
;
6466 struct pim_sg_cache_walk_data cwd
;
6467 struct listnode
*node
;
6468 struct pim_vxlan_sg
*vxlan_sg
;
6471 json
= json_object_new_object();
6473 vty_out(vty
, "Codes: I -> installed\n");
6475 "Source Group Input Flags\n");
6478 memset(&cwd
, 0, sizeof(cwd
));
6481 for (ALL_LIST_ELEMENTS_RO(pim_vxlan_p
->work_list
, node
, vxlan_sg
))
6482 pim_show_vxlan_sg_entry(vxlan_sg
, &cwd
);
6485 vty_json(vty
, json
);
6488 DEFUN_HIDDEN (show_ip_pim_vxlan_sg_work
,
6489 show_ip_pim_vxlan_sg_work_cmd
,
6490 "show ip pim [vrf NAME] vxlan-work [json]",
6498 bool uj
= use_json(argc
, argv
);
6502 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6507 pim_show_vxlan_sg_work(vrf
->info
, vty
, uj
);
6512 DEFUN_HIDDEN (no_ip_pim_mlag
,
6520 char mlag_xpath
[XPATH_MAXLEN
];
6522 snprintf(mlag_xpath
, sizeof(mlag_xpath
), FRR_PIM_VRF_XPATH
,
6523 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6524 strlcat(mlag_xpath
, "/mlag", sizeof(mlag_xpath
));
6526 nb_cli_enqueue_change(vty
, mlag_xpath
, NB_OP_DESTROY
, NULL
);
6529 return nb_cli_apply_changes(vty
, NULL
);
6532 DEFUN_HIDDEN (ip_pim_mlag
,
6534 "ip pim mlag INTERFACE role [primary|secondary] state [up|down] addr A.B.C.D",
6538 "peerlink sub interface\n"
6540 "MLAG role primary\n"
6541 "MLAG role secondary\n"
6542 "peer session state\n"
6543 "peer session state up\n"
6544 "peer session state down\n"
6546 "unique ip address\n")
6549 char mlag_peerlink_rif_xpath
[XPATH_MAXLEN
];
6550 char mlag_my_role_xpath
[XPATH_MAXLEN
];
6551 char mlag_peer_state_xpath
[XPATH_MAXLEN
];
6552 char mlag_reg_address_xpath
[XPATH_MAXLEN
];
6554 snprintf(mlag_peerlink_rif_xpath
, sizeof(mlag_peerlink_rif_xpath
),
6556 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6557 strlcat(mlag_peerlink_rif_xpath
, "/mlag/peerlink-rif",
6558 sizeof(mlag_peerlink_rif_xpath
));
6561 nb_cli_enqueue_change(vty
, mlag_peerlink_rif_xpath
, NB_OP_MODIFY
,
6564 snprintf(mlag_my_role_xpath
, sizeof(mlag_my_role_xpath
),
6566 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6567 strlcat(mlag_my_role_xpath
, "/mlag/my-role",
6568 sizeof(mlag_my_role_xpath
));
6571 if (!strcmp(argv
[idx
]->arg
, "primary")) {
6572 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6573 "MLAG_ROLE_PRIMARY");
6575 } else if (!strcmp(argv
[idx
]->arg
, "secondary")) {
6576 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6577 "MLAG_ROLE_SECONDARY");
6580 vty_out(vty
, "unknown MLAG role %s\n", argv
[idx
]->arg
);
6584 snprintf(mlag_peer_state_xpath
, sizeof(mlag_peer_state_xpath
),
6586 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6587 strlcat(mlag_peer_state_xpath
, "/mlag/peer-state",
6588 sizeof(mlag_peer_state_xpath
));
6591 if (!strcmp(argv
[idx
]->arg
, "up")) {
6592 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6595 } else if (strcmp(argv
[idx
]->arg
, "down")) {
6596 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6600 vty_out(vty
, "unknown MLAG state %s\n", argv
[idx
]->arg
);
6604 snprintf(mlag_reg_address_xpath
, sizeof(mlag_reg_address_xpath
),
6606 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6607 strlcat(mlag_reg_address_xpath
, "/mlag/reg-address",
6608 sizeof(mlag_reg_address_xpath
));
6611 nb_cli_enqueue_change(vty
, mlag_reg_address_xpath
, NB_OP_MODIFY
,
6614 return nb_cli_apply_changes(vty
, NULL
);
6617 void pim_cmd_init(void)
6619 if_cmd_init(pim_interface_config_write
);
6621 install_node(&debug_node
);
6623 install_element(ENABLE_NODE
, &pim_test_sg_keepalive_cmd
);
6625 install_element(CONFIG_NODE
, &ip_pim_rp_cmd
);
6626 install_element(VRF_NODE
, &ip_pim_rp_cmd
);
6627 install_element(CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6628 install_element(VRF_NODE
, &no_ip_pim_rp_cmd
);
6629 install_element(CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6630 install_element(VRF_NODE
, &ip_pim_rp_prefix_list_cmd
);
6631 install_element(CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6632 install_element(VRF_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6633 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6634 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6635 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6636 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6637 install_element(CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6638 install_element(VRF_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6639 install_element(CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6640 install_element(CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6641 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6642 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6643 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6644 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6645 install_element(CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6646 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6647 install_element(CONFIG_NODE
,
6648 &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6649 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6650 install_element(CONFIG_NODE
, &pim_register_accept_list_cmd
);
6651 install_element(VRF_NODE
, &pim_register_accept_list_cmd
);
6652 install_element(CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6653 install_element(CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6654 install_element(CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6655 install_element(VRF_NODE
, &ip_pim_keep_alive_cmd
);
6656 install_element(CONFIG_NODE
, &ip_pim_rp_keep_alive_cmd
);
6657 install_element(VRF_NODE
, &ip_pim_rp_keep_alive_cmd
);
6658 install_element(CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6659 install_element(VRF_NODE
, &no_ip_pim_keep_alive_cmd
);
6660 install_element(CONFIG_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6661 install_element(VRF_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6662 install_element(CONFIG_NODE
, &ip_pim_packets_cmd
);
6663 install_element(CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6664 install_element(CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6665 install_element(VRF_NODE
, &ip_pim_v6_secondary_cmd
);
6666 install_element(CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6667 install_element(VRF_NODE
, &no_ip_pim_v6_secondary_cmd
);
6668 install_element(CONFIG_NODE
, &ip_ssmpingd_cmd
);
6669 install_element(VRF_NODE
, &ip_ssmpingd_cmd
);
6670 install_element(CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6671 install_element(VRF_NODE
, &no_ip_ssmpingd_cmd
);
6672 install_element(CONFIG_NODE
, &ip_msdp_peer_cmd
);
6673 install_element(VRF_NODE
, &ip_msdp_peer_cmd
);
6674 install_element(CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6675 install_element(VRF_NODE
, &no_ip_msdp_peer_cmd
);
6676 install_element(CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6677 install_element(VRF_NODE
, &ip_pim_ecmp_cmd
);
6678 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6679 install_element(VRF_NODE
, &no_ip_pim_ecmp_cmd
);
6680 install_element(CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6681 install_element(VRF_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6682 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6683 install_element(VRF_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6684 install_element(CONFIG_NODE
, &ip_pim_mlag_cmd
);
6685 install_element(CONFIG_NODE
, &no_ip_pim_mlag_cmd
);
6686 install_element(CONFIG_NODE
, &ip_igmp_group_watermark_cmd
);
6687 install_element(VRF_NODE
, &ip_igmp_group_watermark_cmd
);
6688 install_element(CONFIG_NODE
, &no_ip_igmp_group_watermark_cmd
);
6689 install_element(VRF_NODE
, &no_ip_igmp_group_watermark_cmd
);
6691 install_element(INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6692 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6693 install_element(INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6694 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6695 install_element(INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6696 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6697 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6698 install_element(INTERFACE_NODE
,
6699 &interface_no_ip_igmp_query_interval_cmd
);
6700 install_element(INTERFACE_NODE
,
6701 &interface_ip_igmp_query_max_response_time_cmd
);
6702 install_element(INTERFACE_NODE
,
6703 &interface_no_ip_igmp_query_max_response_time_cmd
);
6704 install_element(INTERFACE_NODE
,
6705 &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6706 install_element(INTERFACE_NODE
,
6707 &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6708 install_element(INTERFACE_NODE
,
6709 &interface_ip_igmp_last_member_query_count_cmd
);
6710 install_element(INTERFACE_NODE
,
6711 &interface_no_ip_igmp_last_member_query_count_cmd
);
6712 install_element(INTERFACE_NODE
,
6713 &interface_ip_igmp_last_member_query_interval_cmd
);
6714 install_element(INTERFACE_NODE
,
6715 &interface_no_ip_igmp_last_member_query_interval_cmd
);
6716 install_element(INTERFACE_NODE
, &interface_ip_pim_activeactive_cmd
);
6717 install_element(INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6718 install_element(INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6719 install_element(INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6720 install_element(INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6721 install_element(INTERFACE_NODE
, &interface_ip_pim_cmd
);
6722 install_element(INTERFACE_NODE
, &interface_no_ip_pim_cmd
);
6723 install_element(INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6724 install_element(INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6725 install_element(INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6726 install_element(INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6727 install_element(INTERFACE_NODE
, &interface_ip_pim_boundary_oil_cmd
);
6728 install_element(INTERFACE_NODE
, &interface_no_ip_pim_boundary_oil_cmd
);
6729 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_generate_cmd
);
6731 // Static mroutes NEB
6732 install_element(INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6733 install_element(INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6735 install_element(VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6736 install_element(VIEW_NODE
, &show_ip_igmp_interface_vrf_all_cmd
);
6737 install_element(VIEW_NODE
, &show_ip_igmp_join_cmd
);
6738 install_element(VIEW_NODE
, &show_ip_igmp_join_vrf_all_cmd
);
6739 install_element(VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6740 install_element(VIEW_NODE
, &show_ip_igmp_groups_vrf_all_cmd
);
6741 install_element(VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6742 install_element(VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6743 install_element(VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6744 install_element(VIEW_NODE
, &show_ip_igmp_statistics_cmd
);
6745 install_element(VIEW_NODE
, &show_ip_pim_assert_cmd
);
6746 install_element(VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6747 install_element(VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6748 install_element(VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6749 install_element(VIEW_NODE
, &show_ip_pim_interface_traffic_cmd
);
6750 install_element(VIEW_NODE
, &show_ip_pim_interface_cmd
);
6751 install_element(VIEW_NODE
, &show_ip_pim_interface_vrf_all_cmd
);
6752 install_element(VIEW_NODE
, &show_ip_pim_join_cmd
);
6753 install_element(VIEW_NODE
, &show_ip_pim_join_vrf_all_cmd
);
6754 install_element(VIEW_NODE
, &show_ip_pim_jp_agg_cmd
);
6755 install_element(VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6756 install_element(VIEW_NODE
, &show_ip_pim_mlag_summary_cmd
);
6757 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_cmd
);
6758 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_vrf_all_cmd
);
6759 install_element(VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6760 install_element(VIEW_NODE
, &show_ip_pim_neighbor_vrf_all_cmd
);
6761 install_element(VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6762 install_element(VIEW_NODE
, &show_ip_pim_rpf_vrf_all_cmd
);
6763 install_element(VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6764 install_element(VIEW_NODE
, &show_ip_pim_state_cmd
);
6765 install_element(VIEW_NODE
, &show_ip_pim_state_vrf_all_cmd
);
6766 install_element(VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6767 install_element(VIEW_NODE
, &show_ip_pim_upstream_vrf_all_cmd
);
6768 install_element(VIEW_NODE
, &show_ip_pim_channel_cmd
);
6769 install_element(VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6770 install_element(VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6771 install_element(VIEW_NODE
, &show_ip_pim_rp_cmd
);
6772 install_element(VIEW_NODE
, &show_ip_pim_rp_vrf_all_cmd
);
6773 install_element(VIEW_NODE
, &show_ip_pim_bsr_cmd
);
6774 install_element(VIEW_NODE
, &show_ip_multicast_cmd
);
6775 install_element(VIEW_NODE
, &show_ip_multicast_vrf_all_cmd
);
6776 install_element(VIEW_NODE
, &show_ip_multicast_count_cmd
);
6777 install_element(VIEW_NODE
, &show_ip_multicast_count_vrf_all_cmd
);
6778 install_element(VIEW_NODE
, &show_ip_mroute_cmd
);
6779 install_element(VIEW_NODE
, &show_ip_mroute_vrf_all_cmd
);
6780 install_element(VIEW_NODE
, &show_ip_mroute_count_cmd
);
6781 install_element(VIEW_NODE
, &show_ip_mroute_count_vrf_all_cmd
);
6782 install_element(VIEW_NODE
, &show_ip_mroute_summary_cmd
);
6783 install_element(VIEW_NODE
, &show_ip_mroute_summary_vrf_all_cmd
);
6784 install_element(VIEW_NODE
, &show_ip_rib_cmd
);
6785 install_element(VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6786 install_element(VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6787 install_element(VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6788 install_element(VIEW_NODE
, &show_ip_pim_bsrp_cmd
);
6789 install_element(VIEW_NODE
, &show_ip_pim_bsm_db_cmd
);
6790 install_element(VIEW_NODE
, &show_ip_pim_statistics_cmd
);
6792 install_element(ENABLE_NODE
, &clear_ip_mroute_count_cmd
);
6793 install_element(ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6794 install_element(ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6795 install_element(ENABLE_NODE
, &clear_ip_mroute_cmd
);
6796 install_element(ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6797 install_element(ENABLE_NODE
, &clear_ip_pim_interface_traffic_cmd
);
6798 install_element(ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6799 install_element(ENABLE_NODE
, &clear_ip_pim_statistics_cmd
);
6800 install_element(ENABLE_NODE
, &clear_ip_pim_bsr_db_cmd
);
6802 install_element(ENABLE_NODE
, &show_debugging_pim_cmd
);
6804 install_element(ENABLE_NODE
, &debug_igmp_cmd
);
6805 install_element(ENABLE_NODE
, &no_debug_igmp_cmd
);
6806 install_element(ENABLE_NODE
, &debug_igmp_events_cmd
);
6807 install_element(ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6808 install_element(ENABLE_NODE
, &debug_igmp_packets_cmd
);
6809 install_element(ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6810 install_element(ENABLE_NODE
, &debug_igmp_trace_cmd
);
6811 install_element(ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6812 install_element(ENABLE_NODE
, &debug_igmp_trace_detail_cmd
);
6813 install_element(ENABLE_NODE
, &no_debug_igmp_trace_detail_cmd
);
6814 install_element(ENABLE_NODE
, &debug_mroute_cmd
);
6815 install_element(ENABLE_NODE
, &debug_mroute_detail_cmd
);
6816 install_element(ENABLE_NODE
, &no_debug_mroute_cmd
);
6817 install_element(ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6818 install_element(ENABLE_NODE
, &debug_pim_static_cmd
);
6819 install_element(ENABLE_NODE
, &no_debug_pim_static_cmd
);
6820 install_element(ENABLE_NODE
, &debug_pim_cmd
);
6821 install_element(ENABLE_NODE
, &debug_pim_nht_cmd
);
6822 install_element(ENABLE_NODE
, &debug_pim_nht_det_cmd
);
6823 install_element(ENABLE_NODE
, &debug_pim_nht_rp_cmd
);
6824 install_element(ENABLE_NODE
, &no_debug_pim_nht_rp_cmd
);
6825 install_element(ENABLE_NODE
, &debug_pim_events_cmd
);
6826 install_element(ENABLE_NODE
, &debug_pim_packets_cmd
);
6827 install_element(ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6828 install_element(ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6829 install_element(ENABLE_NODE
, &debug_pim_trace_cmd
);
6830 install_element(ENABLE_NODE
, &debug_pim_trace_detail_cmd
);
6831 install_element(ENABLE_NODE
, &debug_ssmpingd_cmd
);
6832 install_element(ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6833 install_element(ENABLE_NODE
, &debug_pim_zebra_cmd
);
6834 install_element(ENABLE_NODE
, &debug_pim_mlag_cmd
);
6835 install_element(ENABLE_NODE
, &no_debug_pim_mlag_cmd
);
6836 install_element(ENABLE_NODE
, &debug_pim_vxlan_cmd
);
6837 install_element(ENABLE_NODE
, &no_debug_pim_vxlan_cmd
);
6838 install_element(ENABLE_NODE
, &debug_msdp_cmd
);
6839 install_element(ENABLE_NODE
, &no_debug_msdp_cmd
);
6840 install_element(ENABLE_NODE
, &debug_msdp_events_cmd
);
6841 install_element(ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6842 install_element(ENABLE_NODE
, &debug_msdp_packets_cmd
);
6843 install_element(ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6844 install_element(ENABLE_NODE
, &debug_mtrace_cmd
);
6845 install_element(ENABLE_NODE
, &no_debug_mtrace_cmd
);
6846 install_element(ENABLE_NODE
, &debug_bsm_cmd
);
6847 install_element(ENABLE_NODE
, &no_debug_bsm_cmd
);
6849 install_element(CONFIG_NODE
, &debug_igmp_cmd
);
6850 install_element(CONFIG_NODE
, &no_debug_igmp_cmd
);
6851 install_element(CONFIG_NODE
, &debug_igmp_events_cmd
);
6852 install_element(CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6853 install_element(CONFIG_NODE
, &debug_igmp_packets_cmd
);
6854 install_element(CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6855 install_element(CONFIG_NODE
, &debug_igmp_trace_cmd
);
6856 install_element(CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6857 install_element(CONFIG_NODE
, &debug_igmp_trace_detail_cmd
);
6858 install_element(CONFIG_NODE
, &no_debug_igmp_trace_detail_cmd
);
6859 install_element(CONFIG_NODE
, &debug_mroute_cmd
);
6860 install_element(CONFIG_NODE
, &debug_mroute_detail_cmd
);
6861 install_element(CONFIG_NODE
, &no_debug_mroute_cmd
);
6862 install_element(CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6863 install_element(CONFIG_NODE
, &debug_pim_static_cmd
);
6864 install_element(CONFIG_NODE
, &no_debug_pim_static_cmd
);
6865 install_element(CONFIG_NODE
, &debug_pim_cmd
);
6866 install_element(CONFIG_NODE
, &debug_pim_nht_cmd
);
6867 install_element(CONFIG_NODE
, &debug_pim_nht_det_cmd
);
6868 install_element(CONFIG_NODE
, &debug_pim_nht_rp_cmd
);
6869 install_element(CONFIG_NODE
, &no_debug_pim_nht_rp_cmd
);
6870 install_element(CONFIG_NODE
, &debug_pim_events_cmd
);
6871 install_element(CONFIG_NODE
, &debug_pim_packets_cmd
);
6872 install_element(CONFIG_NODE
, &debug_pim_packetdump_send_cmd
);
6873 install_element(CONFIG_NODE
, &debug_pim_packetdump_recv_cmd
);
6874 install_element(CONFIG_NODE
, &debug_pim_trace_cmd
);
6875 install_element(CONFIG_NODE
, &debug_pim_trace_detail_cmd
);
6876 install_element(CONFIG_NODE
, &debug_ssmpingd_cmd
);
6877 install_element(CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6878 install_element(CONFIG_NODE
, &debug_pim_zebra_cmd
);
6879 install_element(CONFIG_NODE
, &debug_pim_mlag_cmd
);
6880 install_element(CONFIG_NODE
, &no_debug_pim_mlag_cmd
);
6881 install_element(CONFIG_NODE
, &debug_pim_vxlan_cmd
);
6882 install_element(CONFIG_NODE
, &no_debug_pim_vxlan_cmd
);
6883 install_element(CONFIG_NODE
, &debug_msdp_cmd
);
6884 install_element(CONFIG_NODE
, &no_debug_msdp_cmd
);
6885 install_element(CONFIG_NODE
, &debug_msdp_events_cmd
);
6886 install_element(CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6887 install_element(CONFIG_NODE
, &debug_msdp_packets_cmd
);
6888 install_element(CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6889 install_element(CONFIG_NODE
, &debug_mtrace_cmd
);
6890 install_element(CONFIG_NODE
, &no_debug_mtrace_cmd
);
6891 install_element(CONFIG_NODE
, &debug_bsm_cmd
);
6892 install_element(CONFIG_NODE
, &no_debug_bsm_cmd
);
6894 install_element(CONFIG_NODE
, &ip_msdp_timers_cmd
);
6895 install_element(VRF_NODE
, &ip_msdp_timers_cmd
);
6896 install_element(CONFIG_NODE
, &no_ip_msdp_timers_cmd
);
6897 install_element(VRF_NODE
, &no_ip_msdp_timers_cmd
);
6898 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6899 install_element(VRF_NODE
, &ip_msdp_mesh_group_member_cmd
);
6900 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6901 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6902 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6903 install_element(VRF_NODE
, &ip_msdp_mesh_group_source_cmd
);
6904 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6905 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6906 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_cmd
);
6907 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_cmd
);
6908 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6909 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_vrf_all_cmd
);
6910 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6911 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_vrf_all_cmd
);
6912 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6913 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_vrf_all_cmd
);
6914 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6915 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_vrf_all_cmd
);
6916 install_element(VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6917 install_element(VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6918 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_cmd
);
6919 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_work_cmd
);
6920 install_element(INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6921 install_element(INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);
6922 /* Install BSM command */
6923 install_element(INTERFACE_NODE
, &ip_pim_bsm_cmd
);
6924 install_element(INTERFACE_NODE
, &no_ip_pim_bsm_cmd
);
6925 install_element(INTERFACE_NODE
, &ip_pim_ucast_bsm_cmd
);
6926 install_element(INTERFACE_NODE
, &no_ip_pim_ucast_bsm_cmd
);
6927 /* Install BFD command */
6928 install_element(INTERFACE_NODE
, &ip_pim_bfd_cmd
);
6929 install_element(INTERFACE_NODE
, &ip_pim_bfd_param_cmd
);
6930 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_profile_cmd
);
6931 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_cmd
);
6933 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_param_cmd
);
6934 #endif /* !HAVE_BFDD */