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 struct bsmmsg_grpinfo
*group
;
864 struct bsmmsg_rpinfo
*bsm_rpinfo
;
871 uint32_t frag_rp_cnt
= 0;
876 /* skip pim header */
877 buf
+= PIM_MSG_HEADER_LEN
;
878 len
-= PIM_MSG_HEADER_LEN
;
880 hdr
= (struct bsm_hdr
*)buf
;
881 /* NB: bshdr->bsr_addr.addr is packed/unaligned => memcpy */
882 memcpy(&bsr_addr
, &hdr
->bsr_addr
.addr
, sizeof(bsr_addr
));
884 /* BSM starts with bsr header */
885 buf
+= sizeof(struct bsm_hdr
);
886 len
-= sizeof(struct bsm_hdr
);
889 json_object_string_addf(json
, "BSR address", "%pPA",
891 json_object_int_add(json
, "BSR priority",
893 json_object_int_add(json
, "Hashmask Length",
895 json_object_int_add(json
, "Fragment Tag",
896 ntohs(hdr
->frag_tag
));
898 vty_out(vty
, "BSM Fragment : %d\n", fragment
);
899 vty_out(vty
, "------------------\n");
900 vty_out(vty
, "%-15s %-15s %-15s %-15s\n", "BSR-Address",
901 "BSR-Priority", "Hashmask-len", "Fragment-Tag");
902 vty_out(vty
, "%-15pPA %-15d %-15d %-15d\n", &bsr_addr
,
903 hdr
->bsr_prio
, hdr
->hm_len
,
904 ntohs(hdr
->frag_tag
));
909 while (offset
< len
) {
910 group
= (struct bsmmsg_grpinfo
*)buf
;
912 if (group
->group
.family
== PIM_MSG_ADDRESS_FAMILY_IPV4
)
913 grp
.family
= AF_INET
;
914 else if (group
->group
.family
==
915 PIM_MSG_ADDRESS_FAMILY_IPV6
)
916 grp
.family
= AF_INET6
;
918 grp
.prefixlen
= group
->group
.mask
;
920 grp
.u
.prefix4
= group
->group
.addr
;
922 grp
.u
.prefix6
= group
->group
.addr
;
925 prefix2str(&grp
, grp_str
, sizeof(grp_str
));
927 buf
+= sizeof(struct bsmmsg_grpinfo
);
928 offset
+= sizeof(struct bsmmsg_grpinfo
);
931 json_object_object_get_ex(json
, grp_str
,
934 json_group
= json_object_new_object();
935 json_object_int_add(json_group
,
939 json_group
, "Fragment Rp count",
940 group
->frag_rp_count
);
941 json_object_object_add(json
, grp_str
,
945 vty_out(vty
, "Group : %s\n", grp_str
);
946 vty_out(vty
, "-------------------\n");
947 vty_out(vty
, "Rp Count:%d\n", group
->rp_count
);
948 vty_out(vty
, "Fragment Rp Count : %d\n",
949 group
->frag_rp_count
);
952 frag_rp_cnt
= group
->frag_rp_count
;
959 "RpAddress HoldTime Priority\n");
961 while (frag_rp_cnt
--) {
964 bsm_rpinfo
= (struct bsmmsg_rpinfo
*)buf
;
965 /* unaligned, again */
966 memcpy(&rp_addr
, &bsm_rpinfo
->rpaddr
,
969 buf
+= sizeof(struct bsmmsg_rpinfo
);
970 offset
+= sizeof(struct bsmmsg_rpinfo
);
973 json_row
= json_object_new_object();
974 json_object_string_addf(
975 json_row
, "Rp Address", "%pPA",
978 json_row
, "Rp HoldTime",
979 ntohs(bsm_rpinfo
->rp_holdtime
));
980 json_object_int_add(json_row
,
983 json_object_object_addf(
984 json_group
, json_row
, "%pPA",
987 vty_out(vty
, "%-15pPA %-12d %d\n",
989 ntohs(bsm_rpinfo
->rp_holdtime
),
1000 vty_json(vty
, json
);
1003 /*Display the group-rp mappings */
1004 static void pim_show_group_rp_mappings_info(struct pim_instance
*pim
,
1005 struct vty
*vty
, bool uj
)
1007 struct bsgrp_node
*bsgrp
;
1008 struct bsm_rpinfo
*bsm_rp
;
1009 struct route_node
*rn
;
1010 json_object
*json
= NULL
;
1011 json_object
*json_group
= NULL
;
1012 json_object
*json_row
= NULL
;
1015 json
= json_object_new_object();
1016 json_object_string_addf(json
, "BSR Address", "%pPA",
1017 &pim
->global_scope
.current_bsr
);
1019 vty_out(vty
, "BSR Address %pPA\n",
1020 &pim
->global_scope
.current_bsr
);
1022 for (rn
= route_top(pim
->global_scope
.bsrp_table
); rn
;
1023 rn
= route_next(rn
)) {
1024 bsgrp
= (struct bsgrp_node
*)rn
->info
;
1029 char grp_str
[PREFIX_STRLEN
];
1031 prefix2str(&bsgrp
->group
, grp_str
, sizeof(grp_str
));
1034 json_object_object_get_ex(json
, grp_str
, &json_group
);
1036 json_group
= json_object_new_object();
1037 json_object_object_add(json
, grp_str
,
1041 vty_out(vty
, "Group Address %pFX\n", &bsgrp
->group
);
1042 vty_out(vty
, "--------------------------\n");
1043 vty_out(vty
, "%-15s %-15s %-15s %-15s\n", "Rp Address",
1044 "priority", "Holdtime", "Hash");
1046 vty_out(vty
, "(ACTIVE)\n");
1049 frr_each (bsm_rpinfos
, bsgrp
->bsrp_list
, bsm_rp
) {
1051 json_row
= json_object_new_object();
1052 json_object_string_addf(json_row
, "Rp Address",
1054 &bsm_rp
->rp_address
);
1055 json_object_int_add(json_row
, "Rp HoldTime",
1056 bsm_rp
->rp_holdtime
);
1057 json_object_int_add(json_row
, "Rp Priority",
1059 json_object_int_add(json_row
, "Hash Val",
1061 json_object_object_addf(json_group
, json_row
,
1063 &bsm_rp
->rp_address
);
1066 vty_out(vty
, "%-15pPA %-15u %-15u %-15u\n",
1067 &bsm_rp
->rp_address
, bsm_rp
->rp_prio
,
1068 bsm_rp
->rp_holdtime
, bsm_rp
->hash
);
1071 if (!bsm_rpinfos_count(bsgrp
->bsrp_list
) && !uj
)
1072 vty_out(vty
, "Active List is empty.\n");
1075 json_object_int_add(json_group
, "Pending RP count",
1076 bsgrp
->pend_rp_cnt
);
1078 vty_out(vty
, "(PENDING)\n");
1079 vty_out(vty
, "Pending RP count :%d\n",
1080 bsgrp
->pend_rp_cnt
);
1081 if (bsgrp
->pend_rp_cnt
)
1082 vty_out(vty
, "%-15s %-15s %-15s %-15s\n",
1083 "Rp Address", "priority", "Holdtime",
1087 frr_each (bsm_rpinfos
, bsgrp
->partial_bsrp_list
, bsm_rp
) {
1089 json_row
= json_object_new_object();
1090 json_object_string_addf(json_row
, "Rp Address",
1092 &bsm_rp
->rp_address
);
1093 json_object_int_add(json_row
, "Rp HoldTime",
1094 bsm_rp
->rp_holdtime
);
1095 json_object_int_add(json_row
, "Rp Priority",
1097 json_object_int_add(json_row
, "Hash Val",
1099 json_object_object_addf(json_group
, json_row
,
1101 &bsm_rp
->rp_address
);
1103 vty_out(vty
, "%-15pPA %-15u %-15u %-15u\n",
1104 &bsm_rp
->rp_address
, bsm_rp
->rp_prio
,
1105 bsm_rp
->rp_holdtime
, bsm_rp
->hash
);
1108 if (!bsm_rpinfos_count(bsgrp
->partial_bsrp_list
) && !uj
)
1109 vty_out(vty
, "Partial List is empty\n");
1116 vty_json(vty
, json
);
1119 static void igmp_show_groups(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
1121 struct interface
*ifp
;
1123 json_object
*json
= NULL
;
1124 json_object
*json_iface
= NULL
;
1125 json_object
*json_group
= NULL
;
1126 json_object
*json_groups
= NULL
;
1128 now
= pim_time_monotonic_sec();
1131 json
= json_object_new_object();
1132 json_object_int_add(json
, "totalGroups", pim
->igmp_group_count
);
1133 json_object_int_add(json
, "watermarkLimit",
1134 pim
->gm_watermark_limit
);
1136 vty_out(vty
, "Total IGMP groups: %u\n", pim
->igmp_group_count
);
1137 vty_out(vty
, "Watermark warn limit(%s): %u\n",
1138 pim
->gm_watermark_limit
? "Set" : "Not Set",
1139 pim
->gm_watermark_limit
);
1141 "Interface Group Mode Timer Srcs V Uptime \n");
1144 /* scan interfaces */
1145 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1146 struct pim_interface
*pim_ifp
= ifp
->info
;
1147 struct listnode
*grpnode
;
1148 struct gm_group
*grp
;
1153 /* scan igmp groups */
1154 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1156 char group_str
[INET_ADDRSTRLEN
];
1160 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1162 pim_time_timer_to_hhmmss(hhmmss
, sizeof(hhmmss
),
1163 grp
->t_group_timer
);
1164 pim_time_uptime(uptime
, sizeof(uptime
),
1165 now
- grp
->group_creation
);
1168 json_object_object_get_ex(json
, ifp
->name
,
1172 json_iface
= json_object_new_object();
1173 json_object_pim_ifp_add(json_iface
,
1175 json_object_object_add(json
, ifp
->name
,
1177 json_groups
= json_object_new_array();
1178 json_object_object_add(json_iface
,
1183 json_group
= json_object_new_object();
1184 json_object_string_add(json_group
, "group",
1187 if (grp
->igmp_version
== 3)
1188 json_object_string_add(
1190 grp
->group_filtermode_isexcl
1194 json_object_string_add(json_group
, "timer",
1196 json_object_int_add(
1197 json_group
, "sourcesCount",
1198 grp
->group_source_list
? listcount(
1199 grp
->group_source_list
)
1201 json_object_int_add(json_group
, "version",
1203 json_object_string_add(json_group
, "uptime",
1205 json_object_array_add(json_groups
, json_group
);
1207 vty_out(vty
, "%-16s %-15s %4s %8s %4d %d %8s\n",
1208 ifp
->name
, group_str
,
1209 grp
->igmp_version
== 3
1210 ? (grp
->group_filtermode_isexcl
1215 grp
->group_source_list
? listcount(
1216 grp
->group_source_list
)
1218 grp
->igmp_version
, uptime
);
1220 } /* scan igmp groups */
1221 } /* scan interfaces */
1224 vty_json(vty
, json
);
1227 static void igmp_show_group_retransmission(struct pim_instance
*pim
,
1230 struct interface
*ifp
;
1233 "Interface Group RetTimer Counter RetSrcs\n");
1235 /* scan interfaces */
1236 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1237 struct pim_interface
*pim_ifp
= ifp
->info
;
1238 struct listnode
*grpnode
;
1239 struct gm_group
*grp
;
1244 /* scan igmp groups */
1245 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1247 char group_str
[INET_ADDRSTRLEN
];
1248 char grp_retr_mmss
[10];
1249 struct listnode
*src_node
;
1250 struct gm_source
*src
;
1251 int grp_retr_sources
= 0;
1253 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1255 pim_time_timer_to_mmss(
1256 grp_retr_mmss
, sizeof(grp_retr_mmss
),
1257 grp
->t_group_query_retransmit_timer
);
1260 /* count group sources with retransmission state
1262 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1264 if (src
->source_query_retransmit_count
> 0) {
1269 vty_out(vty
, "%-16s %-15s %-8s %7d %7d\n", ifp
->name
,
1270 group_str
, grp_retr_mmss
,
1271 grp
->group_specific_query_retransmit_count
,
1274 } /* scan igmp groups */
1275 } /* scan interfaces */
1278 static void igmp_show_sources(struct pim_instance
*pim
, struct vty
*vty
,
1281 struct interface
*ifp
;
1283 json_object
*json
= NULL
;
1284 json_object
*json_iface
= NULL
;
1285 json_object
*json_group
= NULL
;
1286 json_object
*json_source
= NULL
;
1287 json_object
*json_sources
= NULL
;
1289 now
= pim_time_monotonic_sec();
1292 json
= json_object_new_object();
1295 "Interface Group Source Timer Fwd Uptime \n");
1297 /* scan interfaces */
1298 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1299 struct pim_interface
*pim_ifp
= ifp
->info
;
1300 struct listnode
*grpnode
;
1301 struct gm_group
*grp
;
1306 /* scan igmp groups */
1307 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1309 char group_str
[INET_ADDRSTRLEN
];
1310 struct listnode
*srcnode
;
1311 struct gm_source
*src
;
1313 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1316 /* scan group sources */
1317 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1319 char source_str
[INET_ADDRSTRLEN
];
1323 pim_inet4_dump("<source?>", src
->source_addr
,
1324 source_str
, sizeof(source_str
));
1326 pim_time_timer_to_mmss(mmss
, sizeof(mmss
),
1327 src
->t_source_timer
);
1329 pim_time_uptime(uptime
, sizeof(uptime
),
1330 now
- src
->source_creation
);
1333 json_object_object_get_ex(
1334 json
, ifp
->name
, &json_iface
);
1337 json_object_new_object();
1338 json_object_string_add(
1341 json_object_object_add(
1345 json_object_object_get_ex(json_iface
,
1351 json_object_new_object();
1352 json_object_string_add(
1353 json_group
, "group",
1355 json_object_object_add(
1356 json_iface
, group_str
,
1359 json_object_new_array();
1360 json_object_object_add(
1361 json_group
, "sources",
1364 json_source
= json_object_new_object();
1365 json_object_string_add(json_source
,
1368 json_object_string_add(json_source
,
1370 json_object_boolean_add(
1371 json_source
, "forwarded",
1372 IGMP_SOURCE_TEST_FORWARDING(
1373 src
->source_flags
));
1374 json_object_string_add(
1375 json_source
, "uptime", uptime
);
1376 json_object_array_add(json_sources
,
1381 "%-16s %-15s %-15s %5s %3s %8s\n",
1382 ifp
->name
, group_str
,
1384 IGMP_SOURCE_TEST_FORWARDING(
1391 } /* scan group sources */
1392 } /* scan igmp groups */
1393 } /* scan interfaces */
1395 vty_json(vty
, json
);
1398 static void igmp_show_source_retransmission(struct pim_instance
*pim
,
1401 struct interface
*ifp
;
1404 "Interface Group Source Counter\n");
1406 /* scan interfaces */
1407 FOR_ALL_INTERFACES (pim
->vrf
, ifp
) {
1408 struct pim_interface
*pim_ifp
= ifp
->info
;
1409 struct listnode
*grpnode
;
1410 struct gm_group
*grp
;
1415 /* scan igmp groups */
1416 for (ALL_LIST_ELEMENTS_RO(pim_ifp
->gm_group_list
, grpnode
,
1418 char group_str
[INET_ADDRSTRLEN
];
1419 struct listnode
*srcnode
;
1420 struct gm_source
*src
;
1422 pim_inet4_dump("<group?>", grp
->group_addr
, group_str
,
1425 /* scan group sources */
1426 for (ALL_LIST_ELEMENTS_RO(grp
->group_source_list
,
1428 char source_str
[INET_ADDRSTRLEN
];
1430 pim_inet4_dump("<source?>", src
->source_addr
,
1431 source_str
, sizeof(source_str
));
1433 vty_out(vty
, "%-16s %-15s %-15s %7d\n",
1434 ifp
->name
, group_str
, source_str
,
1435 src
->source_query_retransmit_count
);
1437 } /* scan group sources */
1438 } /* scan igmp groups */
1439 } /* scan interfaces */
1442 static void pim_show_bsr(struct pim_instance
*pim
,
1447 char last_bsm_seen
[10];
1450 json_object
*json
= NULL
;
1452 if (pim_addr_is_any(pim
->global_scope
.current_bsr
)) {
1453 pim_time_uptime(uptime
, sizeof(uptime
),
1454 pim
->global_scope
.current_bsr_first_ts
);
1455 pim_time_uptime(last_bsm_seen
, sizeof(last_bsm_seen
),
1456 pim
->global_scope
.current_bsr_last_ts
);
1460 now
= pim_time_monotonic_sec();
1461 pim_time_uptime(uptime
, sizeof(uptime
),
1462 (now
- pim
->global_scope
.current_bsr_first_ts
));
1463 pim_time_uptime(last_bsm_seen
, sizeof(last_bsm_seen
),
1464 now
- pim
->global_scope
.current_bsr_last_ts
);
1467 switch (pim
->global_scope
.state
) {
1469 strlcpy(bsr_state
, "NO_INFO", sizeof(bsr_state
));
1472 strlcpy(bsr_state
, "ACCEPT_ANY", sizeof(bsr_state
));
1474 case ACCEPT_PREFERRED
:
1475 strlcpy(bsr_state
, "ACCEPT_PREFERRED", sizeof(bsr_state
));
1478 strlcpy(bsr_state
, "", sizeof(bsr_state
));
1483 json
= json_object_new_object();
1484 json_object_string_addf(json
, "bsr", "%pPA",
1485 &pim
->global_scope
.current_bsr
);
1486 json_object_int_add(json
, "priority",
1487 pim
->global_scope
.current_bsr_prio
);
1488 json_object_int_add(json
, "fragmentTag",
1489 pim
->global_scope
.bsm_frag_tag
);
1490 json_object_string_add(json
, "state", bsr_state
);
1491 json_object_string_add(json
, "upTime", uptime
);
1492 json_object_string_add(json
, "lastBsmSeen", last_bsm_seen
);
1496 vty_out(vty
, "PIMv2 Bootstrap information\n");
1497 vty_out(vty
, "Current preferred BSR address: %pPA\n",
1498 &pim
->global_scope
.current_bsr
);
1500 "Priority Fragment-Tag State UpTime\n");
1501 vty_out(vty
, " %-12d %-12d %-13s %7s\n",
1502 pim
->global_scope
.current_bsr_prio
,
1503 pim
->global_scope
.bsm_frag_tag
,
1506 vty_out(vty
, "Last BSM seen: %s\n", last_bsm_seen
);
1510 vty_json(vty
, json
);
1513 static void clear_igmp_interfaces(struct pim_instance
*pim
)
1515 struct interface
*ifp
;
1517 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1518 pim_if_addr_del_all_igmp(ifp
);
1520 FOR_ALL_INTERFACES (pim
->vrf
, ifp
)
1521 pim_if_addr_add_all(ifp
);
1524 static void clear_interfaces(struct pim_instance
*pim
)
1526 clear_igmp_interfaces(pim
);
1527 clear_pim_interfaces(pim
);
1530 #define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \
1531 pim_ifp = ifp->info; \
1534 "%% Enable PIM and/or IGMP on this interface first\n"); \
1535 return CMD_WARNING_CONFIG_FAILED; \
1539 * Compatibility function to keep the legacy mesh group CLI behavior:
1540 * Delete group when there are no more configurations in it.
1543 * Don't forget to call `nb_cli_apply_changes` after this.
1545 static void pim_cli_legacy_mesh_group_behavior(struct vty
*vty
,
1548 const char *vrfname
;
1549 char xpath_value
[XPATH_MAXLEN
];
1550 char xpath_member_value
[XPATH_MAXLEN
];
1551 const struct lyd_node
*member_dnode
;
1553 vrfname
= pim_cli_get_vrf_name(vty
);
1554 if (vrfname
== NULL
)
1557 /* Get mesh group base XPath. */
1558 snprintf(xpath_value
, sizeof(xpath_value
),
1559 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
1560 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
1561 /* Group must exists, otherwise just quit. */
1562 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
1565 /* Group members check: */
1566 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1567 strlcat(xpath_member_value
, "/members", sizeof(xpath_member_value
));
1568 if (yang_dnode_exists(vty
->candidate_config
->dnode
,
1569 xpath_member_value
)) {
1570 member_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
1571 xpath_member_value
);
1572 if (!member_dnode
|| !yang_is_last_list_dnode(member_dnode
))
1576 /* Source address check: */
1577 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
1578 strlcat(xpath_member_value
, "/source", sizeof(xpath_member_value
));
1579 if (yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_member_value
))
1582 /* No configurations found: delete it. */
1583 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
1586 DEFUN (clear_ip_interfaces
,
1587 clear_ip_interfaces_cmd
,
1588 "clear ip interfaces [vrf NAME]",
1591 "Reset interfaces\n"
1595 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1600 clear_interfaces(vrf
->info
);
1605 DEFUN (clear_ip_igmp_interfaces
,
1606 clear_ip_igmp_interfaces_cmd
,
1607 "clear ip igmp [vrf NAME] interfaces",
1612 "Reset IGMP interfaces\n")
1615 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1620 clear_igmp_interfaces(vrf
->info
);
1625 DEFPY (clear_ip_pim_statistics
,
1626 clear_ip_pim_statistics_cmd
,
1627 "clear ip pim statistics [vrf NAME]$name",
1632 "Reset PIM statistics\n")
1634 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1639 clear_pim_statistics(v
->info
);
1644 DEFPY (clear_ip_mroute
,
1645 clear_ip_mroute_cmd
,
1646 "clear ip mroute [vrf NAME]$name",
1652 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1657 clear_mroute(v
->info
);
1662 DEFPY (clear_ip_pim_interfaces
,
1663 clear_ip_pim_interfaces_cmd
,
1664 "clear ip pim [vrf NAME] interfaces",
1669 "Reset PIM interfaces\n")
1671 struct vrf
*v
= pim_cmd_lookup(vty
, vrf
);
1676 clear_pim_interfaces(v
->info
);
1681 DEFUN (clear_ip_pim_interface_traffic
,
1682 clear_ip_pim_interface_traffic_cmd
,
1683 "clear ip pim [vrf NAME] interface traffic",
1686 "PIM clear commands\n"
1688 "Reset PIM interfaces\n"
1689 "Reset Protocol Packet counters\n")
1692 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1693 struct interface
*ifp
= NULL
;
1694 struct pim_interface
*pim_ifp
= NULL
;
1699 FOR_ALL_INTERFACES (vrf
, ifp
) {
1700 pim_ifp
= ifp
->info
;
1705 pim_ifp
->pim_ifstat_hello_recv
= 0;
1706 pim_ifp
->pim_ifstat_hello_sent
= 0;
1707 pim_ifp
->pim_ifstat_join_recv
= 0;
1708 pim_ifp
->pim_ifstat_join_send
= 0;
1709 pim_ifp
->pim_ifstat_prune_recv
= 0;
1710 pim_ifp
->pim_ifstat_prune_send
= 0;
1711 pim_ifp
->pim_ifstat_reg_recv
= 0;
1712 pim_ifp
->pim_ifstat_reg_send
= 0;
1713 pim_ifp
->pim_ifstat_reg_stop_recv
= 0;
1714 pim_ifp
->pim_ifstat_reg_stop_send
= 0;
1715 pim_ifp
->pim_ifstat_assert_recv
= 0;
1716 pim_ifp
->pim_ifstat_assert_send
= 0;
1717 pim_ifp
->pim_ifstat_bsm_rx
= 0;
1718 pim_ifp
->pim_ifstat_bsm_tx
= 0;
1719 pim_ifp
->igmp_ifstat_joins_sent
= 0;
1720 pim_ifp
->igmp_ifstat_joins_failed
= 0;
1721 pim_ifp
->igmp_peak_group_count
= 0;
1727 DEFPY (clear_ip_pim_oil
,
1728 clear_ip_pim_oil_cmd
,
1729 "clear ip pim [vrf NAME]$name oil",
1734 "Rescan PIM OIL (output interface list)\n")
1736 struct vrf
*v
= pim_cmd_lookup(vty
, name
);
1741 pim_scan_oil(v
->info
);
1746 DEFUN (clear_ip_pim_bsr_db
,
1747 clear_ip_pim_bsr_db_cmd
,
1748 "clear ip pim [vrf NAME] bsr-data",
1753 "Reset pim bsr data\n")
1756 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1761 pim_bsm_clear(vrf
->info
);
1766 DEFUN (show_ip_igmp_interface
,
1767 show_ip_igmp_interface_cmd
,
1768 "show ip igmp [vrf NAME] interface [detail|WORD] [json]",
1773 "IGMP interface information\n"
1779 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1780 bool uj
= use_json(argc
, argv
);
1785 if (argv_find(argv
, argc
, "detail", &idx
)
1786 || argv_find(argv
, argc
, "WORD", &idx
))
1787 igmp_show_interfaces_single(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
1789 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1794 DEFUN (show_ip_igmp_interface_vrf_all
,
1795 show_ip_igmp_interface_vrf_all_cmd
,
1796 "show ip igmp vrf all interface [detail|WORD] [json]",
1801 "IGMP interface information\n"
1807 bool uj
= use_json(argc
, argv
);
1813 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1817 vty_out(vty
, " \"%s\": ", vrf
->name
);
1820 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1821 if (argv_find(argv
, argc
, "detail", &idx
)
1822 || argv_find(argv
, argc
, "WORD", &idx
))
1823 igmp_show_interfaces_single(vrf
->info
, vty
,
1824 argv
[idx
]->arg
, uj
);
1826 igmp_show_interfaces(vrf
->info
, vty
, uj
);
1829 vty_out(vty
, "}\n");
1834 DEFUN (show_ip_igmp_join
,
1835 show_ip_igmp_join_cmd
,
1836 "show ip igmp [vrf NAME] join [json]",
1841 "IGMP static join information\n"
1845 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1846 bool uj
= use_json(argc
, argv
);
1851 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1856 DEFUN (show_ip_igmp_join_vrf_all
,
1857 show_ip_igmp_join_vrf_all_cmd
,
1858 "show ip igmp vrf all join [json]",
1863 "IGMP static join information\n"
1866 bool uj
= use_json(argc
, argv
);
1872 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1876 vty_out(vty
, " \"%s\": ", vrf
->name
);
1879 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1880 igmp_show_interface_join(vrf
->info
, vty
, uj
);
1883 vty_out(vty
, "}\n");
1888 DEFUN (show_ip_igmp_groups
,
1889 show_ip_igmp_groups_cmd
,
1890 "show ip igmp [vrf NAME] groups [json]",
1899 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1900 bool uj
= use_json(argc
, argv
);
1905 igmp_show_groups(vrf
->info
, vty
, uj
);
1910 DEFUN (show_ip_igmp_groups_vrf_all
,
1911 show_ip_igmp_groups_vrf_all_cmd
,
1912 "show ip igmp vrf all groups [json]",
1920 bool uj
= use_json(argc
, argv
);
1926 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1930 vty_out(vty
, " \"%s\": ", vrf
->name
);
1933 vty_out(vty
, "VRF: %s\n", vrf
->name
);
1934 igmp_show_groups(vrf
->info
, vty
, uj
);
1937 vty_out(vty
, "}\n");
1942 DEFUN (show_ip_igmp_groups_retransmissions
,
1943 show_ip_igmp_groups_retransmissions_cmd
,
1944 "show ip igmp [vrf NAME] groups retransmissions",
1950 "IGMP group retransmissions\n")
1953 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1958 igmp_show_group_retransmission(vrf
->info
, vty
);
1963 DEFUN (show_ip_igmp_sources
,
1964 show_ip_igmp_sources_cmd
,
1965 "show ip igmp [vrf NAME] sources [json]",
1974 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
1979 igmp_show_sources(vrf
->info
, vty
, use_json(argc
, argv
));
1984 DEFUN (show_ip_igmp_sources_retransmissions
,
1985 show_ip_igmp_sources_retransmissions_cmd
,
1986 "show ip igmp [vrf NAME] sources retransmissions",
1992 "IGMP source retransmissions\n")
1995 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2000 igmp_show_source_retransmission(vrf
->info
, vty
);
2005 DEFUN (show_ip_igmp_statistics
,
2006 show_ip_igmp_statistics_cmd
,
2007 "show ip igmp [vrf NAME] statistics [interface WORD] [json]",
2018 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2019 bool uj
= use_json(argc
, argv
);
2024 if (argv_find(argv
, argc
, "WORD", &idx
))
2025 igmp_show_statistics(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
2027 igmp_show_statistics(vrf
->info
, vty
, NULL
, uj
);
2032 DEFUN (show_ip_pim_mlag_summary
,
2033 show_ip_pim_mlag_summary_cmd
,
2034 "show ip pim mlag summary [json]",
2039 "status and stats\n"
2042 bool uj
= use_json(argc
, argv
);
2043 char role_buf
[MLAG_ROLE_STRSIZE
];
2044 char addr_buf
[INET_ADDRSTRLEN
];
2047 json_object
*json
= NULL
;
2048 json_object
*json_stat
= NULL
;
2050 json
= json_object_new_object();
2051 if (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
2052 json_object_boolean_true_add(json
, "mlagConnUp");
2053 if (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
2054 json_object_boolean_true_add(json
, "mlagPeerConnUp");
2055 if (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
2056 json_object_boolean_true_add(json
, "mlagPeerZebraUp");
2057 json_object_string_add(json
, "mlagRole",
2058 mlag_role2str(router
->mlag_role
,
2059 role_buf
, sizeof(role_buf
)));
2060 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
2061 addr_buf
, INET_ADDRSTRLEN
);
2062 json_object_string_add(json
, "localVtepIp", addr_buf
);
2063 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
2064 addr_buf
, INET_ADDRSTRLEN
);
2065 json_object_string_add(json
, "anycastVtepIp", addr_buf
);
2066 json_object_string_add(json
, "peerlinkRif",
2067 router
->peerlink_rif
);
2069 json_stat
= json_object_new_object();
2070 json_object_int_add(json_stat
, "mlagConnFlaps",
2071 router
->mlag_stats
.mlagd_session_downs
);
2072 json_object_int_add(json_stat
, "mlagPeerConnFlaps",
2073 router
->mlag_stats
.peer_session_downs
);
2074 json_object_int_add(json_stat
, "mlagPeerZebraFlaps",
2075 router
->mlag_stats
.peer_zebra_downs
);
2076 json_object_int_add(json_stat
, "mrouteAddRx",
2077 router
->mlag_stats
.msg
.mroute_add_rx
);
2078 json_object_int_add(json_stat
, "mrouteAddTx",
2079 router
->mlag_stats
.msg
.mroute_add_tx
);
2080 json_object_int_add(json_stat
, "mrouteDelRx",
2081 router
->mlag_stats
.msg
.mroute_del_rx
);
2082 json_object_int_add(json_stat
, "mrouteDelTx",
2083 router
->mlag_stats
.msg
.mroute_del_tx
);
2084 json_object_int_add(json_stat
, "mlagStatusUpdates",
2085 router
->mlag_stats
.msg
.mlag_status_updates
);
2086 json_object_int_add(json_stat
, "peerZebraStatusUpdates",
2087 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
2088 json_object_int_add(json_stat
, "pimStatusUpdates",
2089 router
->mlag_stats
.msg
.pim_status_updates
);
2090 json_object_int_add(json_stat
, "vxlanUpdates",
2091 router
->mlag_stats
.msg
.vxlan_updates
);
2092 json_object_object_add(json
, "connStats", json_stat
);
2094 vty_json(vty
, json
);
2098 vty_out(vty
, "MLAG daemon connection: %s\n",
2099 (router
->mlag_flags
& PIM_MLAGF_LOCAL_CONN_UP
)
2101 vty_out(vty
, "MLAG peer state: %s\n",
2102 (router
->mlag_flags
& PIM_MLAGF_PEER_CONN_UP
)
2104 vty_out(vty
, "Zebra peer state: %s\n",
2105 (router
->mlag_flags
& PIM_MLAGF_PEER_ZEBRA_UP
)
2107 vty_out(vty
, "MLAG role: %s\n",
2108 mlag_role2str(router
->mlag_role
, role_buf
, sizeof(role_buf
)));
2109 inet_ntop(AF_INET
, &router
->local_vtep_ip
,
2110 addr_buf
, INET_ADDRSTRLEN
);
2111 vty_out(vty
, "Local VTEP IP: %s\n", addr_buf
);
2112 inet_ntop(AF_INET
, &router
->anycast_vtep_ip
,
2113 addr_buf
, INET_ADDRSTRLEN
);
2114 vty_out(vty
, "Anycast VTEP IP: %s\n", addr_buf
);
2115 vty_out(vty
, "Peerlink: %s\n", router
->peerlink_rif
);
2116 vty_out(vty
, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n",
2117 router
->mlag_stats
.mlagd_session_downs
,
2118 router
->mlag_stats
.peer_session_downs
,
2119 router
->mlag_stats
.peer_zebra_downs
);
2120 vty_out(vty
, "Message Statistics:\n");
2121 vty_out(vty
, " mroute adds: rx: %d, tx: %d\n",
2122 router
->mlag_stats
.msg
.mroute_add_rx
,
2123 router
->mlag_stats
.msg
.mroute_add_tx
);
2124 vty_out(vty
, " mroute dels: rx: %d, tx: %d\n",
2125 router
->mlag_stats
.msg
.mroute_del_rx
,
2126 router
->mlag_stats
.msg
.mroute_del_tx
);
2127 vty_out(vty
, " peer zebra status updates: %d\n",
2128 router
->mlag_stats
.msg
.peer_zebra_status_updates
);
2129 vty_out(vty
, " PIM status updates: %d\n",
2130 router
->mlag_stats
.msg
.pim_status_updates
);
2131 vty_out(vty
, " VxLAN updates: %d\n",
2132 router
->mlag_stats
.msg
.vxlan_updates
);
2137 DEFUN (show_ip_pim_assert
,
2138 show_ip_pim_assert_cmd
,
2139 "show ip pim [vrf NAME] assert",
2144 "PIM interface assert\n")
2147 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2152 pim_show_assert(vrf
->info
, vty
);
2157 DEFUN (show_ip_pim_assert_internal
,
2158 show_ip_pim_assert_internal_cmd
,
2159 "show ip pim [vrf NAME] assert-internal",
2164 "PIM interface internal assert state\n")
2167 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2172 pim_show_assert_internal(vrf
->info
, vty
);
2177 DEFUN (show_ip_pim_assert_metric
,
2178 show_ip_pim_assert_metric_cmd
,
2179 "show ip pim [vrf NAME] assert-metric",
2184 "PIM interface assert metric\n")
2187 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2192 pim_show_assert_metric(vrf
->info
, vty
);
2197 DEFUN (show_ip_pim_assert_winner_metric
,
2198 show_ip_pim_assert_winner_metric_cmd
,
2199 "show ip pim [vrf NAME] assert-winner-metric",
2204 "PIM interface assert winner metric\n")
2207 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2212 pim_show_assert_winner_metric(vrf
->info
, vty
);
2217 DEFPY (show_ip_pim_interface
,
2218 show_ip_pim_interface_cmd
,
2219 "show ip pim [mlag$mlag] [vrf NAME] interface [detail|WORD]$interface [json$json]",
2225 "PIM interface information\n"
2230 return pim_show_interface_cmd_helper(vrf
, vty
, !!json
, !!mlag
,
2234 DEFPY (show_ip_pim_interface_vrf_all
,
2235 show_ip_pim_interface_vrf_all_cmd
,
2236 "show ip pim [mlag$mlag] vrf all interface [detail|WORD]$interface [json$json]",
2242 "PIM interface information\n"
2247 return pim_show_interface_vrf_all_cmd_helper(vty
, !!json
, !!mlag
,
2251 DEFPY (show_ip_pim_join
,
2252 show_ip_pim_join_cmd
,
2253 "show ip pim [vrf NAME] join [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2258 "PIM interface join information\n"
2259 "The Source or Group\n"
2263 return pim_show_join_cmd_helper(vrf
, vty
, s_or_g
, g
, json
);
2266 DEFPY (show_ip_pim_join_vrf_all
,
2267 show_ip_pim_join_vrf_all_cmd
,
2268 "show ip pim vrf all join [json$json]",
2273 "PIM interface join information\n"
2276 return pim_show_join_vrf_all_cmd_helper(vty
, json
);
2279 DEFPY (show_ip_pim_jp_agg
,
2280 show_ip_pim_jp_agg_cmd
,
2281 "show ip pim [vrf NAME] jp-agg",
2286 "join prune aggregation list\n")
2288 return pim_show_jp_agg_list_cmd_helper(vrf
, vty
);
2291 DEFPY (show_ip_pim_local_membership
,
2292 show_ip_pim_local_membership_cmd
,
2293 "show ip pim [vrf NAME] local-membership [json$json]",
2298 "PIM interface local-membership\n"
2301 return pim_show_membership_cmd_helper(vrf
, vty
, !!json
);
2304 static void pim_show_mlag_up_entry_detail(struct vrf
*vrf
,
2306 struct pim_upstream
*up
,
2307 char *src_str
, char *grp_str
,
2311 json_object
*json_row
= NULL
;
2312 json_object
*own_list
= NULL
;
2313 json_object
*json_group
= NULL
;
2316 json_object_object_get_ex(json
, grp_str
, &json_group
);
2318 json_group
= json_object_new_object();
2319 json_object_object_add(json
, grp_str
,
2323 json_row
= json_object_new_object();
2324 json_object_string_add(json_row
, "source", src_str
);
2325 json_object_string_add(json_row
, "group", grp_str
);
2327 own_list
= json_object_new_array();
2328 if (pim_up_mlag_is_local(up
))
2329 json_object_array_add(own_list
,
2330 json_object_new_string("local"));
2331 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2332 json_object_array_add(own_list
,
2333 json_object_new_string("peer"));
2334 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2335 json_object_array_add(
2336 own_list
, json_object_new_string("Interface"));
2337 json_object_object_add(json_row
, "owners", own_list
);
2339 json_object_int_add(json_row
, "localCost",
2340 pim_up_mlag_local_cost(up
));
2341 json_object_int_add(json_row
, "peerCost",
2342 pim_up_mlag_peer_cost(up
));
2343 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2344 json_object_boolean_false_add(json_row
, "df");
2346 json_object_boolean_true_add(json_row
, "df");
2347 json_object_object_add(json_group
, src_str
, json_row
);
2352 if (pim_up_mlag_is_local(up
))
2353 strlcat(own_str
, "L", sizeof(own_str
));
2354 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2355 strlcat(own_str
, "P", sizeof(own_str
));
2356 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2357 strlcat(own_str
, "I", sizeof(own_str
));
2358 /* XXX - fixup, print paragraph output */
2360 "%-15s %-15s %-6s %-11u %-10d %2s\n",
2361 src_str
, grp_str
, own_str
,
2362 pim_up_mlag_local_cost(up
),
2363 pim_up_mlag_peer_cost(up
),
2364 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2369 static void pim_show_mlag_up_detail(struct vrf
*vrf
,
2370 struct vty
*vty
, const char *src_or_group
,
2371 const char *group
, bool uj
)
2373 char src_str
[PIM_ADDRSTRLEN
];
2374 char grp_str
[PIM_ADDRSTRLEN
];
2375 struct pim_upstream
*up
;
2376 struct pim_instance
*pim
= vrf
->info
;
2377 json_object
*json
= NULL
;
2380 json
= json_object_new_object();
2383 "Source Group Owner Local-cost Peer-cost DF\n");
2385 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2386 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2387 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2388 && !pim_up_mlag_is_local(up
))
2391 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &up
->sg
.grp
);
2392 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &up
->sg
.src
);
2394 /* XXX: strcmps are clearly inefficient. we should do uint comps
2398 if (strcmp(src_str
, src_or_group
) ||
2399 strcmp(grp_str
, group
))
2402 if (strcmp(src_str
, src_or_group
) &&
2403 strcmp(grp_str
, src_or_group
))
2406 pim_show_mlag_up_entry_detail(vrf
, vty
, up
,
2407 src_str
, grp_str
, json
);
2411 vty_json(vty
, json
);
2414 static void pim_show_mlag_up_vrf(struct vrf
*vrf
, struct vty
*vty
, bool uj
)
2416 json_object
*json
= NULL
;
2417 json_object
*json_row
;
2418 struct pim_upstream
*up
;
2419 struct pim_instance
*pim
= vrf
->info
;
2420 json_object
*json_group
= NULL
;
2423 json
= json_object_new_object();
2426 "Source Group Owner Local-cost Peer-cost DF\n");
2429 frr_each (rb_pim_upstream
, &pim
->upstream_head
, up
) {
2430 if (!(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)
2431 && !(up
->flags
& PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
)
2432 && !pim_up_mlag_is_local(up
))
2435 char src_str
[PIM_ADDRSTRLEN
];
2436 char grp_str
[PIM_ADDRSTRLEN
];
2437 json_object
*own_list
= NULL
;
2439 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
2441 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
2444 json_object_object_get_ex(json
, grp_str
, &json_group
);
2446 json_group
= json_object_new_object();
2447 json_object_object_add(json
, grp_str
,
2451 json_row
= json_object_new_object();
2452 json_object_string_add(json_row
, "vrf", vrf
->name
);
2453 json_object_string_add(json_row
, "source", src_str
);
2454 json_object_string_add(json_row
, "group", grp_str
);
2456 own_list
= json_object_new_array();
2457 if (pim_up_mlag_is_local(up
)) {
2459 json_object_array_add(own_list
,
2460 json_object_new_string(
2463 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
)) {
2464 json_object_array_add(own_list
,
2465 json_object_new_string(
2468 json_object_object_add(json_row
, "owners", own_list
);
2470 json_object_int_add(json_row
, "localCost",
2471 pim_up_mlag_local_cost(up
));
2472 json_object_int_add(json_row
, "peerCost",
2473 pim_up_mlag_peer_cost(up
));
2474 if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
))
2475 json_object_boolean_false_add(json_row
, "df");
2477 json_object_boolean_true_add(json_row
, "df");
2478 json_object_object_add(json_group
, src_str
, json_row
);
2483 if (pim_up_mlag_is_local(up
))
2484 strlcat(own_str
, "L", sizeof(own_str
));
2485 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER
))
2486 strlcat(own_str
, "P", sizeof(own_str
));
2487 if (up
->flags
& (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE
))
2488 strlcat(own_str
, "I", sizeof(own_str
));
2490 "%-15pPAs %-15pPAs %-6s %-11u %-10u %2s\n",
2491 &up
->sg
.src
, &up
->sg
.grp
, own_str
,
2492 pim_up_mlag_local_cost(up
),
2493 pim_up_mlag_peer_cost(up
),
2494 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up
->flags
)
2499 vty_json(vty
, json
);
2502 static void pim_show_mlag_help_string(struct vty
*vty
, bool uj
)
2505 vty_out(vty
, "Owner codes:\n");
2507 "L: EVPN-MLAG Entry, I:PIM-MLAG Entry, P: Peer Entry\n");
2512 DEFUN(show_ip_pim_mlag_up
, show_ip_pim_mlag_up_cmd
,
2513 "show ip pim [vrf NAME] mlag upstream [A.B.C.D [A.B.C.D]] [json]",
2520 "Unicast or Multicast address\n"
2521 "Multicast address\n" JSON_STR
)
2523 const char *src_or_group
= NULL
;
2524 const char *group
= NULL
;
2526 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2527 bool uj
= use_json(argc
, argv
);
2529 if (!vrf
|| !vrf
->info
) {
2530 vty_out(vty
, "%s: VRF or Info missing\n", __func__
);
2537 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
2538 src_or_group
= argv
[idx
]->arg
;
2540 group
= argv
[idx
+ 1]->arg
;
2543 pim_show_mlag_help_string(vty
, uj
);
2546 pim_show_mlag_up_detail(vrf
, vty
, src_or_group
, group
, uj
);
2548 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2554 DEFUN(show_ip_pim_mlag_up_vrf_all
, show_ip_pim_mlag_up_vrf_all_cmd
,
2555 "show ip pim vrf all mlag upstream [json]",
2556 SHOW_STR IP_STR PIM_STR VRF_CMD_HELP_STR
2558 "upstream\n" JSON_STR
)
2561 bool uj
= use_json(argc
, argv
);
2563 pim_show_mlag_help_string(vty
, uj
);
2564 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
2565 pim_show_mlag_up_vrf(vrf
, vty
, uj
);
2571 DEFPY (show_ip_pim_neighbor
,
2572 show_ip_pim_neighbor_cmd
,
2573 "show ip pim [vrf NAME] neighbor [detail|WORD]$interface [json$json]",
2578 "PIM neighbor information\n"
2580 "Name of interface or neighbor\n"
2583 return pim_show_neighbors_cmd_helper(vrf
, vty
, json
, interface
);
2586 DEFPY (show_ip_pim_neighbor_vrf_all
,
2587 show_ip_pim_neighbor_vrf_all_cmd
,
2588 "show ip pim vrf all neighbor [detail|WORD]$interface [json$json]",
2593 "PIM neighbor information\n"
2595 "Name of interface or neighbor\n"
2598 return pim_show_neighbors_vrf_all_cmd_helper(vty
, json
, interface
);
2601 DEFPY (show_ip_pim_secondary
,
2602 show_ip_pim_secondary_cmd
,
2603 "show ip pim [vrf NAME] secondary",
2608 "PIM neighbor addresses\n")
2610 return pim_show_secondary_helper(vrf
, vty
);
2613 DEFPY (show_ip_pim_state
,
2614 show_ip_pim_state_cmd
,
2615 "show ip pim [vrf NAME] state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2620 "PIM state information\n"
2621 "Unicast or Multicast address\n"
2622 "Multicast address\n"
2625 return pim_show_state_helper(vrf
, vty
, s_or_g_str
, g_str
, !!json
);
2628 DEFPY (show_ip_pim_state_vrf_all
,
2629 show_ip_pim_state_vrf_all_cmd
,
2630 "show ip pim vrf all state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2635 "PIM state information\n"
2636 "Unicast or Multicast address\n"
2637 "Multicast address\n"
2640 return pim_show_state_vrf_all_helper(vty
, s_or_g_str
, g_str
, !!json
);
2643 DEFPY (show_ip_pim_upstream
,
2644 show_ip_pim_upstream_cmd
,
2645 "show ip pim [vrf NAME] upstream [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
2650 "PIM upstream information\n"
2651 "The Source or Group\n"
2655 return pim_show_upstream_helper(vrf
, vty
, s_or_g
, g
, !!json
);
2658 DEFPY (show_ip_pim_upstream_vrf_all
,
2659 show_ip_pim_upstream_vrf_all_cmd
,
2660 "show ip pim vrf all upstream [json$json]",
2665 "PIM upstream information\n"
2668 return pim_show_upstream_vrf_all_helper(vty
, !!json
);
2671 DEFPY (show_ip_pim_channel
,
2672 show_ip_pim_channel_cmd
,
2673 "show ip pim [vrf NAME] channel [json$json]",
2678 "PIM downstream channel info\n"
2681 return pim_show_channel_cmd_helper(vrf
, vty
, !!json
);
2684 DEFPY (show_ip_pim_upstream_join_desired
,
2685 show_ip_pim_upstream_join_desired_cmd
,
2686 "show ip pim [vrf NAME] upstream-join-desired [json$json]",
2691 "PIM upstream join-desired\n"
2694 return pim_show_upstream_join_desired_helper(vrf
, vty
, !!json
);
2697 DEFPY (show_ip_pim_upstream_rpf
,
2698 show_ip_pim_upstream_rpf_cmd
,
2699 "show ip pim [vrf NAME] upstream-rpf [json$json]",
2704 "PIM upstream source rpf\n"
2707 return pim_show_upstream_rpf_helper(vrf
, vty
, !!json
);
2710 DEFPY (show_ip_pim_rp
,
2712 "show ip pim [vrf NAME] rp-info [A.B.C.D/M$group] [json$json]",
2717 "PIM RP information\n"
2718 "Multicast Group range\n"
2721 return pim_show_rp_helper(vrf
, vty
, group_str
, (struct prefix
*)group
,
2725 DEFPY (show_ip_pim_rp_vrf_all
,
2726 show_ip_pim_rp_vrf_all_cmd
,
2727 "show ip pim vrf all rp-info [A.B.C.D/M$group] [json$json]",
2732 "PIM RP information\n"
2733 "Multicast Group range\n"
2736 return pim_show_rp_vrf_all_helper(vty
, group_str
,
2737 (struct prefix
*)group
, !!json
);
2740 DEFPY (show_ip_pim_rpf
,
2741 show_ip_pim_rpf_cmd
,
2742 "show ip pim [vrf NAME] rpf [json$json]",
2747 "PIM cached source rpf information\n"
2750 return pim_show_rpf_helper(vrf
, vty
, !!json
);
2753 DEFPY (show_ip_pim_rpf_vrf_all
,
2754 show_ip_pim_rpf_vrf_all_cmd
,
2755 "show ip pim vrf all rpf [json$json]",
2760 "PIM cached source rpf information\n"
2763 return pim_show_rpf_vrf_all_helper(vty
, !!json
);
2766 DEFPY (show_ip_pim_nexthop
,
2767 show_ip_pim_nexthop_cmd
,
2768 "show ip pim [vrf NAME] nexthop [json$json]",
2773 "PIM cached nexthop rpf information\n"
2776 return pim_show_nexthop_cmd_helper(vrf
, vty
, !!json
);
2779 DEFPY (show_ip_pim_nexthop_lookup
,
2780 show_ip_pim_nexthop_lookup_cmd
,
2781 "show ip pim [vrf NAME] nexthop-lookup A.B.C.D$source A.B.C.D$group",
2786 "PIM cached nexthop rpf lookup\n"
2787 "Source/RP address\n"
2788 "Multicast Group address\n")
2790 return pim_show_nexthop_lookup_cmd_helper(vrf
, vty
, source
, group
);
2793 DEFPY (show_ip_pim_interface_traffic
,
2794 show_ip_pim_interface_traffic_cmd
,
2795 "show ip pim [vrf NAME] interface traffic [WORD$if_name] [json$json]",
2800 "PIM interface information\n"
2801 "Protocol Packet counters\n"
2805 return pim_show_interface_traffic_helper(vrf
, if_name
, vty
, !!json
);
2808 DEFUN (show_ip_pim_bsm_db
,
2809 show_ip_pim_bsm_db_cmd
,
2810 "show ip pim bsm-database [vrf NAME] [json]",
2814 "PIM cached bsm packets information\n"
2819 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2820 bool uj
= use_json(argc
, argv
);
2825 pim_show_bsm_db(vrf
->info
, vty
, uj
);
2829 DEFUN (show_ip_pim_bsrp
,
2830 show_ip_pim_bsrp_cmd
,
2831 "show ip pim bsrp-info [vrf NAME] [json]",
2835 "PIM cached group-rp mappings information\n"
2840 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
2841 bool uj
= use_json(argc
, argv
);
2846 pim_show_group_rp_mappings_info(vrf
->info
, vty
, uj
);
2851 DEFPY (show_ip_pim_statistics
,
2852 show_ip_pim_statistics_cmd
,
2853 "show ip pim [vrf NAME] statistics [interface WORD$word] [json$json]",
2863 return pim_show_statistics_helper(vrf
, vty
, word
, !!json
);
2866 DEFPY (show_ip_multicast
,
2867 show_ip_multicast_cmd
,
2868 "show ip multicast [vrf NAME]",
2871 "Multicast global information\n"
2874 return pim_show_multicast_helper(vrf
, vty
);
2877 DEFPY (show_ip_multicast_vrf_all
,
2878 show_ip_multicast_vrf_all_cmd
,
2879 "show ip multicast vrf all",
2882 "Multicast global information\n"
2885 return pim_show_multicast_vrf_all_helper(vty
);
2888 DEFPY (show_ip_multicast_count
,
2889 show_ip_multicast_count_cmd
,
2890 "show ip multicast count [vrf NAME] [json$json]",
2893 "Multicast global information\n"
2894 "Data packet count\n"
2898 return pim_show_multicast_count_helper(vrf
, vty
, !!json
);
2901 DEFPY (show_ip_multicast_count_vrf_all
,
2902 show_ip_multicast_count_vrf_all_cmd
,
2903 "show ip multicast count vrf all [json$json]",
2906 "Multicast global information\n"
2907 "Data packet count\n"
2911 return pim_show_multicast_count_vrf_all_helper(vty
, !!json
);
2914 DEFPY (show_ip_mroute
,
2916 "show ip mroute [vrf NAME] [A.B.C.D$s_or_g [A.B.C.D$g]] [fill$fill] [json$json]",
2921 "The Source or Group\n"
2923 "Fill in Assumed data\n"
2926 return pim_show_mroute_helper(vrf
, vty
, s_or_g
, g
, !!fill
, !!json
);
2929 DEFPY (show_ip_mroute_vrf_all
,
2930 show_ip_mroute_vrf_all_cmd
,
2931 "show ip mroute vrf all [fill$fill] [json$json]",
2936 "Fill in Assumed data\n"
2939 return pim_show_mroute_vrf_all_helper(vty
, !!fill
, !!json
);
2942 DEFPY (clear_ip_mroute_count
,
2943 clear_ip_mroute_count_cmd
,
2944 "clear ip mroute [vrf NAME]$name count",
2949 "Route and packet count data\n")
2951 return clear_ip_mroute_count_command(vty
, name
);
2954 DEFPY (show_ip_mroute_count
,
2955 show_ip_mroute_count_cmd
,
2956 "show ip mroute [vrf NAME] count [json$json]",
2961 "Route and packet count data\n"
2964 return pim_show_mroute_count_helper(vrf
, vty
, !!json
);
2967 DEFPY (show_ip_mroute_count_vrf_all
,
2968 show_ip_mroute_count_vrf_all_cmd
,
2969 "show ip mroute vrf all count [json$json]",
2974 "Route and packet count data\n"
2977 return pim_show_mroute_count_vrf_all_helper(vty
, !!json
);
2980 DEFPY (show_ip_mroute_summary
,
2981 show_ip_mroute_summary_cmd
,
2982 "show ip mroute [vrf NAME] summary [json$json]",
2987 "Summary of all mroutes\n"
2990 return pim_show_mroute_summary_helper(vrf
, vty
, !!json
);
2993 DEFPY (show_ip_mroute_summary_vrf_all
,
2994 show_ip_mroute_summary_vrf_all_cmd
,
2995 "show ip mroute vrf all summary [json$json]",
3000 "Summary of all mroutes\n"
3003 return pim_show_mroute_summary_vrf_all_helper(vty
, !!json
);
3008 "show ip rib [vrf NAME] A.B.C.D",
3013 "Unicast address\n")
3016 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3017 struct in_addr addr
;
3018 const char *addr_str
;
3019 struct pim_nexthop nexthop
;
3025 memset(&nexthop
, 0, sizeof(nexthop
));
3026 argv_find(argv
, argc
, "A.B.C.D", &idx
);
3027 addr_str
= argv
[idx
]->arg
;
3028 result
= inet_pton(AF_INET
, addr_str
, &addr
);
3030 vty_out(vty
, "Bad unicast address %s: errno=%d: %s\n", addr_str
,
3031 errno
, safe_strerror(errno
));
3035 if (!pim_nexthop_lookup(vrf
->info
, &nexthop
, addr
, 0)) {
3037 "Failure querying RIB nexthop for unicast address %s\n",
3043 "Address NextHop Interface Metric Preference\n");
3045 vty_out(vty
, "%-15s %-15pPAs %-9s %6d %10d\n", addr_str
,
3046 &nexthop
.mrib_nexthop_addr
,
3047 nexthop
.interface
? nexthop
.interface
->name
: "<ifname?>",
3048 nexthop
.mrib_route_metric
, nexthop
.mrib_metric_preference
);
3053 static void show_ssmpingd(struct pim_instance
*pim
, struct vty
*vty
)
3055 struct listnode
*node
;
3056 struct ssmpingd_sock
*ss
;
3060 "Source Socket Address Port Uptime Requests\n");
3062 if (!pim
->ssmpingd_list
)
3065 now
= pim_time_monotonic_sec();
3067 for (ALL_LIST_ELEMENTS_RO(pim
->ssmpingd_list
, node
, ss
)) {
3068 char source_str
[INET_ADDRSTRLEN
];
3070 struct sockaddr_in bind_addr
;
3071 socklen_t len
= sizeof(bind_addr
);
3072 char bind_addr_str
[INET_ADDRSTRLEN
];
3074 pim_inet4_dump("<src?>", ss
->source_addr
, source_str
,
3075 sizeof(source_str
));
3077 if (pim_socket_getsockname(
3078 ss
->sock_fd
, (struct sockaddr
*)&bind_addr
, &len
)) {
3080 "%% Failure reading socket name for ssmpingd source %s on fd=%d\n",
3081 source_str
, ss
->sock_fd
);
3084 pim_inet4_dump("<addr?>", bind_addr
.sin_addr
, bind_addr_str
,
3085 sizeof(bind_addr_str
));
3086 pim_time_uptime(ss_uptime
, sizeof(ss_uptime
),
3087 now
- ss
->creation
);
3089 vty_out(vty
, "%-15s %6d %-15s %5d %8s %8lld\n", source_str
,
3090 ss
->sock_fd
, bind_addr_str
, ntohs(bind_addr
.sin_port
),
3091 ss_uptime
, (long long)ss
->requests
);
3095 DEFUN (show_ip_ssmpingd
,
3096 show_ip_ssmpingd_cmd
,
3097 "show ip ssmpingd [vrf NAME]",
3104 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3109 show_ssmpingd(vrf
->info
, vty
);
3113 DEFUN (ip_pim_spt_switchover_infinity
,
3114 ip_pim_spt_switchover_infinity_cmd
,
3115 "ip pim spt-switchover infinity-and-beyond",
3119 "Never switch to SPT Tree\n")
3121 return pim_process_spt_switchover_infinity_cmd(vty
);
3124 DEFPY (ip_pim_spt_switchover_infinity_plist
,
3125 ip_pim_spt_switchover_infinity_plist_cmd
,
3126 "ip pim spt-switchover infinity-and-beyond prefix-list WORD$plist",
3130 "Never switch to SPT Tree\n"
3131 "Prefix-List to control which groups to switch\n"
3132 "Prefix-List name\n")
3134 return pim_process_spt_switchover_prefixlist_cmd(vty
, plist
);
3137 DEFUN (no_ip_pim_spt_switchover_infinity
,
3138 no_ip_pim_spt_switchover_infinity_cmd
,
3139 "no ip pim spt-switchover infinity-and-beyond",
3144 "Never switch to SPT Tree\n")
3146 return pim_process_no_spt_switchover_cmd(vty
);
3149 DEFUN (no_ip_pim_spt_switchover_infinity_plist
,
3150 no_ip_pim_spt_switchover_infinity_plist_cmd
,
3151 "no ip pim spt-switchover infinity-and-beyond prefix-list WORD",
3156 "Never switch to SPT Tree\n"
3157 "Prefix-List to control which groups to switch\n"
3158 "Prefix-List name\n")
3160 return pim_process_no_spt_switchover_cmd(vty
);
3163 DEFPY (pim_register_accept_list
,
3164 pim_register_accept_list_cmd
,
3165 "[no] ip pim register-accept-list WORD$word",
3169 "Only accept registers from a specific source prefix list\n"
3170 "Prefix-List name\n")
3172 const char *vrfname
;
3173 char reg_alist_xpath
[XPATH_MAXLEN
];
3175 vrfname
= pim_cli_get_vrf_name(vty
);
3176 if (vrfname
== NULL
)
3177 return CMD_WARNING_CONFIG_FAILED
;
3179 snprintf(reg_alist_xpath
, sizeof(reg_alist_xpath
),
3180 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
3181 "frr-routing:ipv4");
3182 strlcat(reg_alist_xpath
, "/register-accept-list",
3183 sizeof(reg_alist_xpath
));
3186 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
3187 NB_OP_DESTROY
, NULL
);
3189 nb_cli_enqueue_change(vty
, reg_alist_xpath
,
3190 NB_OP_MODIFY
, word
);
3192 return nb_cli_apply_changes(vty
, NULL
);
3195 DEFPY (ip_pim_joinprune_time
,
3196 ip_pim_joinprune_time_cmd
,
3197 "ip pim join-prune-interval (1-65535)$jpi",
3199 "pim multicast routing\n"
3200 "Join Prune Send Interval\n"
3203 return pim_process_join_prune_cmd(vty
, jpi_str
);
3206 DEFUN (no_ip_pim_joinprune_time
,
3207 no_ip_pim_joinprune_time_cmd
,
3208 "no ip pim join-prune-interval [(1-65535)]",
3211 "pim multicast routing\n"
3212 "Join Prune Send Interval\n"
3215 return pim_process_no_join_prune_cmd(vty
);
3218 DEFPY (ip_pim_register_suppress
,
3219 ip_pim_register_suppress_cmd
,
3220 "ip pim register-suppress-time (1-65535)$rst",
3222 "pim multicast routing\n"
3223 "Register Suppress Timer\n"
3226 return pim_process_register_suppress_cmd(vty
, rst_str
);
3229 DEFUN (no_ip_pim_register_suppress
,
3230 no_ip_pim_register_suppress_cmd
,
3231 "no ip pim register-suppress-time [(1-65535)]",
3234 "pim multicast routing\n"
3235 "Register Suppress Timer\n"
3238 return pim_process_no_register_suppress_cmd(vty
);
3241 DEFPY (ip_pim_rp_keep_alive
,
3242 ip_pim_rp_keep_alive_cmd
,
3243 "ip pim rp keep-alive-timer (1-65535)$kat",
3245 "pim multicast routing\n"
3246 "Rendezvous Point\n"
3247 "Keep alive Timer\n"
3250 return pim_process_rp_kat_cmd(vty
, kat_str
);
3253 DEFUN (no_ip_pim_rp_keep_alive
,
3254 no_ip_pim_rp_keep_alive_cmd
,
3255 "no ip pim rp keep-alive-timer [(1-65535)]",
3258 "pim multicast routing\n"
3259 "Rendezvous Point\n"
3260 "Keep alive Timer\n"
3263 return pim_process_no_rp_kat_cmd(vty
);
3266 DEFPY (ip_pim_keep_alive
,
3267 ip_pim_keep_alive_cmd
,
3268 "ip pim keep-alive-timer (1-65535)$kat",
3270 "pim multicast routing\n"
3271 "Keep alive Timer\n"
3274 return pim_process_keepalivetimer_cmd(vty
, kat_str
);
3277 DEFUN (no_ip_pim_keep_alive
,
3278 no_ip_pim_keep_alive_cmd
,
3279 "no ip pim keep-alive-timer [(1-65535)]",
3282 "pim multicast routing\n"
3283 "Keep alive Timer\n"
3286 return pim_process_no_keepalivetimer_cmd(vty
);
3289 DEFPY (ip_pim_packets
,
3291 "ip pim packets (1-255)",
3293 "pim multicast routing\n"
3294 "packets to process at one time per fd\n"
3295 "Number of packets\n")
3297 return pim_process_pim_packet_cmd(vty
, packets_str
);
3300 DEFUN (no_ip_pim_packets
,
3301 no_ip_pim_packets_cmd
,
3302 "no ip pim packets [(1-255)]",
3305 "pim multicast routing\n"
3306 "packets to process at one time per fd\n"
3309 return pim_process_no_pim_packet_cmd(vty
);
3312 DEFPY (ip_igmp_group_watermark
,
3313 ip_igmp_group_watermark_cmd
,
3314 "ip igmp watermark-warn (1-65535)$limit",
3317 "Configure group limit for watermark warning\n"
3318 "Group count to generate watermark warning\n")
3320 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
3321 pim
->gm_watermark_limit
= limit
;
3326 DEFPY (no_ip_igmp_group_watermark
,
3327 no_ip_igmp_group_watermark_cmd
,
3328 "no ip igmp watermark-warn [(1-65535)$limit]",
3332 "Unconfigure group limit for watermark warning\n"
3335 PIM_DECLVAR_CONTEXT_VRF(vrf
, pim
);
3336 pim
->gm_watermark_limit
= 0;
3341 DEFUN (ip_pim_v6_secondary
,
3342 ip_pim_v6_secondary_cmd
,
3343 "ip pim send-v6-secondary",
3345 "pim multicast routing\n"
3346 "Send v6 secondary addresses\n")
3348 const char *vrfname
;
3349 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
3351 vrfname
= pim_cli_get_vrf_name(vty
);
3352 if (vrfname
== NULL
)
3353 return CMD_WARNING_CONFIG_FAILED
;
3355 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
3357 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3358 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
3359 sizeof(send_v6_secondary_xpath
));
3361 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
3364 return nb_cli_apply_changes(vty
, NULL
);
3367 DEFUN (no_ip_pim_v6_secondary
,
3368 no_ip_pim_v6_secondary_cmd
,
3369 "no ip pim send-v6-secondary",
3372 "pim multicast routing\n"
3373 "Send v6 secondary addresses\n")
3375 const char *vrfname
;
3376 char send_v6_secondary_xpath
[XPATH_MAXLEN
];
3378 vrfname
= pim_cli_get_vrf_name(vty
);
3379 if (vrfname
== NULL
)
3380 return CMD_WARNING_CONFIG_FAILED
;
3382 snprintf(send_v6_secondary_xpath
, sizeof(send_v6_secondary_xpath
),
3384 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3385 strlcat(send_v6_secondary_xpath
, "/send-v6-secondary",
3386 sizeof(send_v6_secondary_xpath
));
3388 nb_cli_enqueue_change(vty
, send_v6_secondary_xpath
, NB_OP_MODIFY
,
3391 return nb_cli_apply_changes(vty
, NULL
);
3396 "ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3398 "pim multicast routing\n"
3399 "Rendezvous Point\n"
3400 "ip address of RP\n"
3401 "Group Address range to cover\n")
3403 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3405 return pim_process_rp_cmd(vty
, rp_str
, group_str
);
3408 DEFPY (ip_pim_rp_prefix_list
,
3409 ip_pim_rp_prefix_list_cmd
,
3410 "ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3412 "pim multicast routing\n"
3413 "Rendezvous Point\n"
3414 "ip address of RP\n"
3415 "group prefix-list filter\n"
3416 "Name of a prefix-list\n")
3418 return pim_process_rp_plist_cmd(vty
, rp_str
, plist
);
3421 DEFPY (no_ip_pim_rp
,
3423 "no ip pim rp A.B.C.D$rp [A.B.C.D/M]$gp",
3426 "pim multicast routing\n"
3427 "Rendezvous Point\n"
3428 "ip address of RP\n"
3429 "Group Address range to cover\n")
3431 const char *group_str
= (gp_str
) ? gp_str
: "224.0.0.0/4";
3433 return pim_process_no_rp_cmd(vty
, rp_str
, group_str
);
3436 DEFPY (no_ip_pim_rp_prefix_list
,
3437 no_ip_pim_rp_prefix_list_cmd
,
3438 "no ip pim rp A.B.C.D$rp prefix-list WORD$plist",
3441 "pim multicast routing\n"
3442 "Rendezvous Point\n"
3443 "ip address of RP\n"
3444 "group prefix-list filter\n"
3445 "Name of a prefix-list\n")
3447 return pim_process_no_rp_plist_cmd(vty
, rp_str
, plist
);
3450 DEFUN (ip_pim_ssm_prefix_list
,
3451 ip_pim_ssm_prefix_list_cmd
,
3452 "ip pim ssm prefix-list WORD",
3454 "pim multicast routing\n"
3455 "Source Specific Multicast\n"
3456 "group range prefix-list filter\n"
3457 "Name of a prefix-list\n")
3459 const char *vrfname
;
3460 char ssm_plist_xpath
[XPATH_MAXLEN
];
3462 vrfname
= pim_cli_get_vrf_name(vty
);
3463 if (vrfname
== NULL
)
3464 return CMD_WARNING_CONFIG_FAILED
;
3466 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
), FRR_PIM_VRF_XPATH
,
3467 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3468 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3470 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_MODIFY
, argv
[4]->arg
);
3472 return nb_cli_apply_changes(vty
, NULL
);
3475 DEFUN (no_ip_pim_ssm_prefix_list
,
3476 no_ip_pim_ssm_prefix_list_cmd
,
3477 "no ip pim ssm prefix-list",
3480 "pim multicast routing\n"
3481 "Source Specific Multicast\n"
3482 "group range prefix-list filter\n")
3484 const char *vrfname
;
3485 char ssm_plist_xpath
[XPATH_MAXLEN
];
3487 vrfname
= pim_cli_get_vrf_name(vty
);
3488 if (vrfname
== NULL
)
3489 return CMD_WARNING_CONFIG_FAILED
;
3491 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3493 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3494 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3496 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
, NULL
);
3498 return nb_cli_apply_changes(vty
, NULL
);
3501 DEFUN (no_ip_pim_ssm_prefix_list_name
,
3502 no_ip_pim_ssm_prefix_list_name_cmd
,
3503 "no ip pim ssm prefix-list WORD",
3506 "pim multicast routing\n"
3507 "Source Specific Multicast\n"
3508 "group range prefix-list filter\n"
3509 "Name of a prefix-list\n")
3511 const char *vrfname
;
3512 const struct lyd_node
*ssm_plist_dnode
;
3513 char ssm_plist_xpath
[XPATH_MAXLEN
];
3514 const char *ssm_plist_name
;
3516 vrfname
= pim_cli_get_vrf_name(vty
);
3517 if (vrfname
== NULL
)
3518 return CMD_WARNING_CONFIG_FAILED
;
3520 snprintf(ssm_plist_xpath
, sizeof(ssm_plist_xpath
),
3522 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3523 strlcat(ssm_plist_xpath
, "/ssm-prefix-list", sizeof(ssm_plist_xpath
));
3524 ssm_plist_dnode
= yang_dnode_get(vty
->candidate_config
->dnode
,
3527 if (!ssm_plist_dnode
) {
3529 "%% pim ssm prefix-list %s doesn't exist\n",
3531 return CMD_WARNING_CONFIG_FAILED
;
3534 ssm_plist_name
= yang_dnode_get_string(ssm_plist_dnode
, ".");
3536 if (ssm_plist_name
&& !strcmp(ssm_plist_name
, argv
[5]->arg
)) {
3537 nb_cli_enqueue_change(vty
, ssm_plist_xpath
, NB_OP_DESTROY
,
3540 return nb_cli_apply_changes(vty
, NULL
);
3543 vty_out(vty
, "%% pim ssm prefix-list %s doesn't exist\n", argv
[5]->arg
);
3545 return CMD_WARNING_CONFIG_FAILED
;
3548 DEFUN (show_ip_pim_ssm_range
,
3549 show_ip_pim_ssm_range_cmd
,
3550 "show ip pim [vrf NAME] group-type [json]",
3559 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3560 bool uj
= use_json(argc
, argv
);
3565 ip_pim_ssm_show_group_range(vrf
->info
, vty
, uj
);
3570 static void ip_pim_ssm_show_group_type(struct pim_instance
*pim
,
3571 struct vty
*vty
, bool uj
,
3574 struct in_addr group_addr
;
3575 const char *type_str
;
3578 result
= inet_pton(AF_INET
, group
, &group_addr
);
3580 type_str
= "invalid";
3582 if (pim_is_group_224_4(group_addr
))
3584 pim_is_grp_ssm(pim
, group_addr
) ? "SSM" : "ASM";
3586 type_str
= "not-multicast";
3591 json
= json_object_new_object();
3592 json_object_string_add(json
, "groupType", type_str
);
3593 vty_json(vty
, json
);
3595 vty_out(vty
, "Group type : %s\n", type_str
);
3598 DEFUN (show_ip_pim_group_type
,
3599 show_ip_pim_group_type_cmd
,
3600 "show ip pim [vrf NAME] group-type A.B.C.D [json]",
3605 "multicast group type\n"
3610 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3611 bool uj
= use_json(argc
, argv
);
3616 argv_find(argv
, argc
, "A.B.C.D", &idx
);
3617 ip_pim_ssm_show_group_type(vrf
->info
, vty
, uj
, argv
[idx
]->arg
);
3622 DEFUN (show_ip_pim_bsr
,
3623 show_ip_pim_bsr_cmd
,
3624 "show ip pim bsr [json]",
3628 "boot-strap router information\n"
3632 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
3633 bool uj
= use_json(argc
, argv
);
3638 pim_show_bsr(vrf
->info
, vty
, uj
);
3645 "ip ssmpingd [A.B.C.D]",
3651 const char *src_str
= (argc
== 3) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3653 return pim_process_ssmpingd_cmd(vty
, NB_OP_CREATE
, src_str
);
3656 DEFUN (no_ip_ssmpingd
,
3658 "no ip ssmpingd [A.B.C.D]",
3665 const char *src_str
= (argc
== 4) ? argv
[idx_ipv4
]->arg
: "0.0.0.0";
3667 return pim_process_ssmpingd_cmd(vty
, NB_OP_DESTROY
, src_str
);
3674 "pim multicast routing\n"
3675 "Enable PIM ECMP \n")
3677 const char *vrfname
;
3678 char ecmp_xpath
[XPATH_MAXLEN
];
3680 vrfname
= pim_cli_get_vrf_name(vty
);
3681 if (vrfname
== NULL
)
3682 return CMD_WARNING_CONFIG_FAILED
;
3684 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3685 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3686 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3688 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3689 return nb_cli_apply_changes(vty
, NULL
);
3692 DEFUN (no_ip_pim_ecmp
,
3697 "pim multicast routing\n"
3698 "Disable PIM ECMP \n")
3700 const char *vrfname
;
3701 char ecmp_xpath
[XPATH_MAXLEN
];
3703 vrfname
= pim_cli_get_vrf_name(vty
);
3704 if (vrfname
== NULL
)
3705 return CMD_WARNING_CONFIG_FAILED
;
3707 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3708 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3709 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3711 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "false");
3713 return nb_cli_apply_changes(vty
, NULL
);
3716 DEFUN (ip_pim_ecmp_rebalance
,
3717 ip_pim_ecmp_rebalance_cmd
,
3718 "ip pim ecmp rebalance",
3720 "pim multicast routing\n"
3721 "Enable PIM ECMP \n"
3722 "Enable PIM ECMP Rebalance\n")
3724 const char *vrfname
;
3725 char ecmp_xpath
[XPATH_MAXLEN
];
3726 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3728 vrfname
= pim_cli_get_vrf_name(vty
);
3729 if (vrfname
== NULL
)
3730 return CMD_WARNING_CONFIG_FAILED
;
3732 snprintf(ecmp_xpath
, sizeof(ecmp_xpath
), FRR_PIM_VRF_XPATH
,
3733 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3734 strlcat(ecmp_xpath
, "/ecmp", sizeof(ecmp_xpath
));
3735 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3737 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3738 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3739 sizeof(ecmp_rebalance_xpath
));
3741 nb_cli_enqueue_change(vty
, ecmp_xpath
, NB_OP_MODIFY
, "true");
3742 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "true");
3744 return nb_cli_apply_changes(vty
, NULL
);
3747 DEFUN (no_ip_pim_ecmp_rebalance
,
3748 no_ip_pim_ecmp_rebalance_cmd
,
3749 "no ip pim ecmp rebalance",
3752 "pim multicast routing\n"
3753 "Disable PIM ECMP \n"
3754 "Disable PIM ECMP Rebalance\n")
3756 const char *vrfname
;
3757 char ecmp_rebalance_xpath
[XPATH_MAXLEN
];
3759 vrfname
= pim_cli_get_vrf_name(vty
);
3760 if (vrfname
== NULL
)
3761 return CMD_WARNING_CONFIG_FAILED
;
3763 snprintf(ecmp_rebalance_xpath
, sizeof(ecmp_rebalance_xpath
),
3765 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
3766 strlcat(ecmp_rebalance_xpath
, "/ecmp-rebalance",
3767 sizeof(ecmp_rebalance_xpath
));
3769 nb_cli_enqueue_change(vty
, ecmp_rebalance_xpath
, NB_OP_MODIFY
, "false");
3771 return nb_cli_apply_changes(vty
, NULL
);
3774 DEFUN (interface_ip_igmp
,
3775 interface_ip_igmp_cmd
,
3780 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
, "true");
3782 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3783 "frr-routing:ipv4");
3786 DEFUN (interface_no_ip_igmp
,
3787 interface_no_ip_igmp_cmd
,
3793 const struct lyd_node
*pim_enable_dnode
;
3794 char pim_if_xpath
[XPATH_MAXLEN
];
3797 snprintf(pim_if_xpath
, sizeof(pim_if_xpath
),
3798 "%s/frr-pim:pim/address-family[address-family='%s']",
3799 VTY_CURR_XPATH
, "frr-routing:ipv4");
3801 if (printed
>= (int)(sizeof(pim_if_xpath
))) {
3802 vty_out(vty
, "Xpath too long (%d > %u)", printed
+ 1,
3804 return CMD_WARNING_CONFIG_FAILED
;
3807 pim_enable_dnode
= yang_dnode_getf(vty
->candidate_config
->dnode
,
3808 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3809 "frr-routing:ipv4");
3810 if (!pim_enable_dnode
) {
3811 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
, NULL
);
3812 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3814 if (!yang_dnode_get_bool(pim_enable_dnode
, ".")) {
3815 nb_cli_enqueue_change(vty
, pim_if_xpath
, NB_OP_DESTROY
,
3817 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
3819 nb_cli_enqueue_change(vty
, "./enable",
3820 NB_OP_MODIFY
, "false");
3823 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3824 "frr-routing:ipv4");
3827 DEFUN (interface_ip_igmp_join
,
3828 interface_ip_igmp_join_cmd
,
3829 "ip igmp join A.B.C.D [A.B.C.D]",
3832 "IGMP join multicast group\n"
3833 "Multicast group address\n"
3838 const char *source_str
;
3839 char xpath
[XPATH_MAXLEN
];
3842 source_str
= argv
[idx_source
]->arg
;
3844 if (strcmp(source_str
, "0.0.0.0") == 0) {
3845 vty_out(vty
, "Bad source address %s\n",
3846 argv
[idx_source
]->arg
);
3847 return CMD_WARNING_CONFIG_FAILED
;
3850 source_str
= "0.0.0.0";
3852 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3853 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3855 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
3857 return nb_cli_apply_changes(vty
, NULL
);
3860 DEFUN (interface_no_ip_igmp_join
,
3861 interface_no_ip_igmp_join_cmd
,
3862 "no ip igmp join A.B.C.D [A.B.C.D]",
3866 "IGMP join multicast group\n"
3867 "Multicast group address\n"
3872 const char *source_str
;
3873 char xpath
[XPATH_MAXLEN
];
3876 source_str
= argv
[idx_source
]->arg
;
3878 if (strcmp(source_str
, "0.0.0.0") == 0) {
3879 vty_out(vty
, "Bad source address %s\n",
3880 argv
[idx_source
]->arg
);
3881 return CMD_WARNING_CONFIG_FAILED
;
3884 source_str
= "0.0.0.0";
3886 snprintf(xpath
, sizeof(xpath
), FRR_GMP_JOIN_XPATH
,
3887 "frr-routing:ipv4", argv
[idx_group
]->arg
, source_str
);
3889 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
3891 return nb_cli_apply_changes(vty
, NULL
);
3894 DEFUN (interface_ip_igmp_query_interval
,
3895 interface_ip_igmp_query_interval_cmd
,
3896 "ip igmp query-interval (1-65535)",
3899 IFACE_IGMP_QUERY_INTERVAL_STR
3900 "Query interval in seconds\n")
3902 const struct lyd_node
*pim_enable_dnode
;
3905 yang_dnode_getf(vty
->candidate_config
->dnode
,
3906 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
3907 "frr-routing:ipv4");
3908 if (!pim_enable_dnode
) {
3909 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3912 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
3913 nb_cli_enqueue_change(vty
, "./enable",
3914 NB_OP_MODIFY
, "true");
3917 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_MODIFY
,
3920 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3921 "frr-routing:ipv4");
3924 DEFUN (interface_no_ip_igmp_query_interval
,
3925 interface_no_ip_igmp_query_interval_cmd
,
3926 "no ip igmp query-interval [(1-65535)]",
3930 IFACE_IGMP_QUERY_INTERVAL_STR
3933 nb_cli_enqueue_change(vty
, "./query-interval", NB_OP_DESTROY
, NULL
);
3935 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3936 "frr-routing:ipv4");
3939 DEFUN (interface_ip_igmp_version
,
3940 interface_ip_igmp_version_cmd
,
3941 "ip igmp version (2-3)",
3945 "IGMP version number\n")
3947 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
3949 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_MODIFY
,
3952 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3953 "frr-routing:ipv4");
3956 DEFUN (interface_no_ip_igmp_version
,
3957 interface_no_ip_igmp_version_cmd
,
3958 "no ip igmp version (2-3)",
3963 "IGMP version number\n")
3965 nb_cli_enqueue_change(vty
, "./igmp-version", NB_OP_DESTROY
, NULL
);
3967 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
3968 "frr-routing:ipv4");
3971 DEFPY (interface_ip_igmp_query_max_response_time
,
3972 interface_ip_igmp_query_max_response_time_cmd
,
3973 "ip igmp query-max-response-time (1-65535)$qmrt",
3976 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3977 "Query response value in deci-seconds\n")
3979 return gm_process_query_max_response_time_cmd(vty
, qmrt_str
);
3982 DEFUN (interface_no_ip_igmp_query_max_response_time
,
3983 interface_no_ip_igmp_query_max_response_time_cmd
,
3984 "no ip igmp query-max-response-time [(1-65535)]",
3988 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
3991 return gm_process_no_query_max_response_time_cmd(vty
);
3994 DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec
,
3995 interface_ip_igmp_query_max_response_time_dsec_cmd
,
3996 "ip igmp query-max-response-time-dsec (1-65535)",
3999 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4000 "Query response value in deciseconds\n")
4002 const struct lyd_node
*pim_enable_dnode
;
4005 yang_dnode_getf(vty
->candidate_config
->dnode
,
4006 FRR_PIM_ENABLE_XPATH
, VTY_CURR_XPATH
,
4007 "frr-routing:ipv4");
4008 if (!pim_enable_dnode
) {
4009 nb_cli_enqueue_change(vty
, "./enable", NB_OP_MODIFY
,
4012 if (!yang_dnode_get_bool(pim_enable_dnode
, "."))
4013 nb_cli_enqueue_change(vty
, "./enable",
4014 NB_OP_MODIFY
, "true");
4017 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_MODIFY
,
4020 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
4021 "frr-routing:ipv4");
4024 DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec
,
4025 interface_no_ip_igmp_query_max_response_time_dsec_cmd
,
4026 "no ip igmp query-max-response-time-dsec [(1-65535)]",
4030 IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
4033 nb_cli_enqueue_change(vty
, "./query-max-response-time", NB_OP_DESTROY
,
4036 return nb_cli_apply_changes(vty
, FRR_GMP_INTERFACE_XPATH
,
4037 "frr-routing:ipv4");
4040 DEFPY (interface_ip_igmp_last_member_query_count
,
4041 interface_ip_igmp_last_member_query_count_cmd
,
4042 "ip igmp last-member-query-count (1-255)$lmqc",
4045 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
4046 "Last member query count\n")
4048 return gm_process_last_member_query_count_cmd(vty
, lmqc_str
);
4051 DEFUN (interface_no_ip_igmp_last_member_query_count
,
4052 interface_no_ip_igmp_last_member_query_count_cmd
,
4053 "no ip igmp last-member-query-count [(1-255)]",
4057 IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
4060 return gm_process_no_last_member_query_count_cmd(vty
);
4063 DEFPY (interface_ip_igmp_last_member_query_interval
,
4064 interface_ip_igmp_last_member_query_interval_cmd
,
4065 "ip igmp last-member-query-interval (1-65535)$lmqi",
4068 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
4069 "Last member query interval in deciseconds\n")
4071 return gm_process_last_member_query_interval_cmd(vty
, lmqi_str
);
4074 DEFUN (interface_no_ip_igmp_last_member_query_interval
,
4075 interface_no_ip_igmp_last_member_query_interval_cmd
,
4076 "no ip igmp last-member-query-interval [(1-65535)]",
4080 IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
4083 return gm_process_no_last_member_query_interval_cmd(vty
);
4086 DEFUN (interface_ip_pim_drprio
,
4087 interface_ip_pim_drprio_cmd
,
4088 "ip pim drpriority (1-4294967295)",
4091 "Set the Designated Router Election Priority\n"
4092 "Value of the new DR Priority\n")
4096 return pim_process_ip_pim_drprio_cmd(vty
, argv
[idx_number
]->arg
);
4099 DEFUN (interface_no_ip_pim_drprio
,
4100 interface_no_ip_pim_drprio_cmd
,
4101 "no ip pim drpriority [(1-4294967295)]",
4105 "Revert the Designated Router Priority to default\n"
4106 "Old Value of the Priority\n")
4108 return pim_process_no_ip_pim_drprio_cmd(vty
);
4111 DEFPY_HIDDEN (interface_ip_igmp_query_generate
,
4112 interface_ip_igmp_query_generate_cmd
,
4113 "ip igmp generate-query-once [version (2-3)]",
4116 "Generate igmp general query once\n"
4118 "IGMP version number\n")
4121 VTY_DECLVAR_CONTEXT(interface
, ifp
);
4123 struct pim_interface
*pim_ifp
= ifp
->info
;
4126 vty_out(vty
, "IGMP/PIM is not enabled on the interface %s\n",
4128 return CMD_WARNING_CONFIG_FAILED
;
4131 /* It takes the igmp version configured on the interface as default */
4132 igmp_version
= pim_ifp
->igmp_version
;
4135 igmp_version
= atoi(argv
[4]->arg
);
4137 igmp_send_query_on_intf(ifp
, igmp_version
);
4142 DEFPY_HIDDEN (pim_test_sg_keepalive
,
4143 pim_test_sg_keepalive_cmd
,
4144 "test pim [vrf NAME$name] keepalive-reset A.B.C.D$source A.B.C.D$group",
4148 "Reset the Keepalive Timer\n"
4149 "The Source we are resetting\n"
4150 "The Group we are resetting\n")
4152 struct pim_upstream
*up
;
4154 struct pim_instance
*pim
;
4160 vrf
= vrf_lookup_by_name(name
? name
: VRF_DEFAULT_NAME
);
4162 vty_out(vty
, "%% Vrf specified: %s does not exist\n", name
);
4169 vty_out(vty
, "%% Unable to find pim instance\n");
4173 up
= pim_upstream_find(pim
, &sg
);
4175 vty_out(vty
, "%% Unable to find %pSG specified\n", &sg
);
4179 vty_out(vty
, "Setting %pSG to current keep alive time: %d\n", &sg
,
4180 pim
->keep_alive_time
);
4181 pim_upstream_keep_alive_timer_start(up
, pim
->keep_alive_time
);
4186 DEFPY (interface_ip_pim_activeactive
,
4187 interface_ip_pim_activeactive_cmd
,
4188 "[no$no] ip pim active-active",
4192 "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
4194 return pim_process_ip_pim_activeactive_cmd(vty
, no
);
4197 DEFUN_HIDDEN (interface_ip_pim_ssm
,
4198 interface_ip_pim_ssm_cmd
,
4206 ret
= pim_process_ip_pim_cmd(vty
);
4212 "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed\n");
4217 DEFUN_HIDDEN (interface_ip_pim_sm
,
4218 interface_ip_pim_sm_cmd
,
4224 return pim_process_ip_pim_cmd(vty
);
4227 DEFPY (interface_ip_pim
,
4228 interface_ip_pim_cmd
,
4229 "ip pim [passive$passive]",
4232 "Disable exchange of protocol packets\n")
4236 ret
= pim_process_ip_pim_cmd(vty
);
4242 return pim_process_ip_pim_passive_cmd(vty
, true);
4247 DEFUN_HIDDEN (interface_no_ip_pim_ssm
,
4248 interface_no_ip_pim_ssm_cmd
,
4255 return pim_process_no_ip_pim_cmd(vty
);
4258 DEFUN_HIDDEN (interface_no_ip_pim_sm
,
4259 interface_no_ip_pim_sm_cmd
,
4266 return pim_process_no_ip_pim_cmd(vty
);
4269 DEFPY (interface_no_ip_pim
,
4270 interface_no_ip_pim_cmd
,
4271 "no ip pim [passive$passive]",
4275 "Disable exchange of protocol packets\n")
4278 return pim_process_ip_pim_passive_cmd(vty
, false);
4280 return pim_process_no_ip_pim_cmd(vty
);
4284 DEFUN(interface_ip_pim_boundary_oil
,
4285 interface_ip_pim_boundary_oil_cmd
,
4286 "ip multicast boundary oil WORD",
4288 "Generic multicast configuration options\n"
4289 "Define multicast boundary\n"
4290 "Filter OIL by group using prefix list\n"
4291 "Prefix list to filter OIL with\n")
4293 return pim_process_ip_pim_boundary_oil_cmd(vty
, argv
[4]->arg
);
4296 DEFUN(interface_no_ip_pim_boundary_oil
,
4297 interface_no_ip_pim_boundary_oil_cmd
,
4298 "no ip multicast boundary oil [WORD]",
4301 "Generic multicast configuration options\n"
4302 "Define multicast boundary\n"
4303 "Filter OIL by group using prefix list\n"
4304 "Prefix list to filter OIL with\n")
4306 return pim_process_no_ip_pim_boundary_oil_cmd(vty
);
4309 DEFUN (interface_ip_mroute
,
4310 interface_ip_mroute_cmd
,
4311 "ip mroute INTERFACE A.B.C.D [A.B.C.D]",
4313 "Add multicast route\n"
4314 "Outgoing interface name\n"
4318 int idx_interface
= 2;
4320 const char *source_str
;
4322 if (argc
== (idx_ipv4
+ 1))
4323 source_str
= "0.0.0.0";
4325 source_str
= argv
[idx_ipv4
+ 1]->arg
;
4327 return pim_process_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
4328 argv
[idx_ipv4
]->arg
, source_str
);
4331 DEFUN (interface_no_ip_mroute
,
4332 interface_no_ip_mroute_cmd
,
4333 "no ip mroute INTERFACE A.B.C.D [A.B.C.D]",
4336 "Add multicast route\n"
4337 "Outgoing interface name\n"
4341 int idx_interface
= 3;
4343 const char *source_str
;
4345 if (argc
== (idx_ipv4
+ 1))
4346 source_str
= "0.0.0.0";
4348 source_str
= argv
[idx_ipv4
+ 1]->arg
;
4350 return pim_process_no_ip_mroute_cmd(vty
, argv
[idx_interface
]->arg
,
4351 argv
[idx_ipv4
]->arg
, source_str
);
4354 DEFUN (interface_ip_pim_hello
,
4355 interface_ip_pim_hello_cmd
,
4356 "ip pim hello (1-65535) [(1-65535)]",
4360 IFACE_PIM_HELLO_TIME_STR
4361 IFACE_PIM_HELLO_HOLD_STR
)
4366 if (argc
== idx_hold
+ 1)
4367 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
4368 argv
[idx_hold
]->arg
);
4371 return pim_process_ip_pim_hello_cmd(vty
, argv
[idx_time
]->arg
,
4375 DEFUN (interface_no_ip_pim_hello
,
4376 interface_no_ip_pim_hello_cmd
,
4377 "no ip pim hello [(1-65535) [(1-65535)]]",
4385 return pim_process_no_ip_pim_hello_cmd(vty
);
4394 PIM_DO_DEBUG_IGMP_EVENTS
;
4395 PIM_DO_DEBUG_IGMP_PACKETS
;
4396 PIM_DO_DEBUG_IGMP_TRACE
;
4400 DEFUN (no_debug_igmp
,
4407 PIM_DONT_DEBUG_IGMP_EVENTS
;
4408 PIM_DONT_DEBUG_IGMP_PACKETS
;
4409 PIM_DONT_DEBUG_IGMP_TRACE
;
4414 DEFUN (debug_igmp_events
,
4415 debug_igmp_events_cmd
,
4416 "debug igmp events",
4419 DEBUG_IGMP_EVENTS_STR
)
4421 PIM_DO_DEBUG_IGMP_EVENTS
;
4425 DEFUN (no_debug_igmp_events
,
4426 no_debug_igmp_events_cmd
,
4427 "no debug igmp events",
4431 DEBUG_IGMP_EVENTS_STR
)
4433 PIM_DONT_DEBUG_IGMP_EVENTS
;
4438 DEFUN (debug_igmp_packets
,
4439 debug_igmp_packets_cmd
,
4440 "debug igmp packets",
4443 DEBUG_IGMP_PACKETS_STR
)
4445 PIM_DO_DEBUG_IGMP_PACKETS
;
4449 DEFUN (no_debug_igmp_packets
,
4450 no_debug_igmp_packets_cmd
,
4451 "no debug igmp packets",
4455 DEBUG_IGMP_PACKETS_STR
)
4457 PIM_DONT_DEBUG_IGMP_PACKETS
;
4462 DEFUN (debug_igmp_trace
,
4463 debug_igmp_trace_cmd
,
4467 DEBUG_IGMP_TRACE_STR
)
4469 PIM_DO_DEBUG_IGMP_TRACE
;
4473 DEFUN (no_debug_igmp_trace
,
4474 no_debug_igmp_trace_cmd
,
4475 "no debug igmp trace",
4479 DEBUG_IGMP_TRACE_STR
)
4481 PIM_DONT_DEBUG_IGMP_TRACE
;
4486 DEFUN (debug_igmp_trace_detail
,
4487 debug_igmp_trace_detail_cmd
,
4488 "debug igmp trace detail",
4491 DEBUG_IGMP_TRACE_STR
4494 PIM_DO_DEBUG_IGMP_TRACE_DETAIL
;
4498 DEFUN (no_debug_igmp_trace_detail
,
4499 no_debug_igmp_trace_detail_cmd
,
4500 "no debug igmp trace detail",
4504 DEBUG_IGMP_TRACE_STR
4507 PIM_DONT_DEBUG_IGMP_TRACE_DETAIL
;
4512 DEFUN (debug_mroute
,
4518 PIM_DO_DEBUG_MROUTE
;
4522 DEFUN (debug_mroute_detail
,
4523 debug_mroute_detail_cmd
,
4524 "debug mroute detail",
4529 PIM_DO_DEBUG_MROUTE_DETAIL
;
4533 DEFUN (no_debug_mroute
,
4534 no_debug_mroute_cmd
,
4540 PIM_DONT_DEBUG_MROUTE
;
4544 DEFUN (no_debug_mroute_detail
,
4545 no_debug_mroute_detail_cmd
,
4546 "no debug mroute detail",
4552 PIM_DONT_DEBUG_MROUTE_DETAIL
;
4556 DEFUN (debug_pim_static
,
4557 debug_pim_static_cmd
,
4563 PIM_DO_DEBUG_STATIC
;
4567 DEFUN (no_debug_pim_static
,
4568 no_debug_pim_static_cmd
,
4569 "no debug pim static",
4575 PIM_DONT_DEBUG_STATIC
;
4588 return pim_debug_pim_cmd();
4590 return pim_no_debug_pim_cmd();
4593 DEFPY (debug_pim_nht
,
4595 "[no] debug pim nht",
4599 "Nexthop Tracking\n")
4602 PIM_DO_DEBUG_PIM_NHT
;
4604 PIM_DONT_DEBUG_PIM_NHT
;
4608 DEFPY (debug_pim_nht_det
,
4609 debug_pim_nht_det_cmd
,
4610 "[no] debug pim nht detail",
4614 "Nexthop Tracking\n"
4615 "Detailed Information\n")
4618 PIM_DO_DEBUG_PIM_NHT_DETAIL
;
4620 PIM_DONT_DEBUG_PIM_NHT_DETAIL
;
4624 DEFUN (debug_pim_nht_rp
,
4625 debug_pim_nht_rp_cmd
,
4629 "Nexthop Tracking\n"
4630 "RP Nexthop Tracking\n")
4632 PIM_DO_DEBUG_PIM_NHT_RP
;
4636 DEFUN (no_debug_pim_nht_rp
,
4637 no_debug_pim_nht_rp_cmd
,
4638 "no debug pim nht rp",
4642 "Nexthop Tracking\n"
4643 "RP Nexthop Tracking\n")
4645 PIM_DONT_DEBUG_PIM_NHT_RP
;
4649 DEFPY (debug_pim_events
,
4650 debug_pim_events_cmd
,
4651 "[no] debug pim events",
4655 DEBUG_PIM_EVENTS_STR
)
4658 PIM_DO_DEBUG_PIM_EVENTS
;
4660 PIM_DONT_DEBUG_PIM_EVENTS
;
4664 DEFPY (debug_pim_packets
,
4665 debug_pim_packets_cmd
,
4666 "[no] debug pim packets [<hello$hello|joins$joins|register$registers>]",
4669 DEBUG_PIM_PACKETS_STR
4670 DEBUG_PIM_HELLO_PACKETS_STR
4671 DEBUG_PIM_J_P_PACKETS_STR
4672 DEBUG_PIM_PIM_REG_PACKETS_STR
)
4675 return pim_debug_pim_packets_cmd(hello
, joins
, registers
, vty
);
4677 return pim_no_debug_pim_packets_cmd(hello
, joins
, registers
,
4681 DEFPY (debug_pim_packetdump_send
,
4682 debug_pim_packetdump_send_cmd
,
4683 "[no] debug pim packet-dump send",
4687 DEBUG_PIM_PACKETDUMP_STR
4688 DEBUG_PIM_PACKETDUMP_SEND_STR
)
4691 PIM_DO_DEBUG_PIM_PACKETDUMP_SEND
;
4693 PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND
;
4697 DEFPY (debug_pim_packetdump_recv
,
4698 debug_pim_packetdump_recv_cmd
,
4699 "[no] debug pim packet-dump receive",
4703 DEBUG_PIM_PACKETDUMP_STR
4704 DEBUG_PIM_PACKETDUMP_RECV_STR
)
4707 PIM_DO_DEBUG_PIM_PACKETDUMP_RECV
;
4709 PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV
;
4713 DEFPY (debug_pim_trace
,
4714 debug_pim_trace_cmd
,
4715 "[no] debug pim trace",
4719 DEBUG_PIM_TRACE_STR
)
4722 PIM_DO_DEBUG_PIM_TRACE
;
4724 PIM_DONT_DEBUG_PIM_TRACE
;
4728 DEFPY (debug_pim_trace_detail
,
4729 debug_pim_trace_detail_cmd
,
4730 "[no] debug pim trace detail",
4735 "Detailed Information\n")
4738 PIM_DO_DEBUG_PIM_TRACE_DETAIL
;
4740 PIM_DONT_DEBUG_PIM_TRACE_DETAIL
;
4744 DEFUN (debug_ssmpingd
,
4750 PIM_DO_DEBUG_SSMPINGD
;
4754 DEFUN (no_debug_ssmpingd
,
4755 no_debug_ssmpingd_cmd
,
4756 "no debug ssmpingd",
4761 PIM_DONT_DEBUG_SSMPINGD
;
4765 DEFPY (debug_pim_zebra
,
4766 debug_pim_zebra_cmd
,
4767 "[no] debug pim zebra",
4771 DEBUG_PIM_ZEBRA_STR
)
4776 PIM_DONT_DEBUG_ZEBRA
;
4780 DEFUN(debug_pim_mlag
, debug_pim_mlag_cmd
, "debug pim mlag",
4781 DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4787 DEFUN(no_debug_pim_mlag
, no_debug_pim_mlag_cmd
, "no debug pim mlag",
4788 NO_STR DEBUG_STR DEBUG_PIM_STR DEBUG_PIM_MLAG_STR
)
4790 PIM_DONT_DEBUG_MLAG
;
4794 DEFUN (debug_pim_vxlan
,
4795 debug_pim_vxlan_cmd
,
4799 DEBUG_PIM_VXLAN_STR
)
4805 DEFUN (no_debug_pim_vxlan
,
4806 no_debug_pim_vxlan_cmd
,
4807 "no debug pim vxlan",
4811 DEBUG_PIM_VXLAN_STR
)
4813 PIM_DONT_DEBUG_VXLAN
;
4823 PIM_DO_DEBUG_MSDP_EVENTS
;
4824 PIM_DO_DEBUG_MSDP_PACKETS
;
4828 DEFUN (no_debug_msdp
,
4835 PIM_DONT_DEBUG_MSDP_EVENTS
;
4836 PIM_DONT_DEBUG_MSDP_PACKETS
;
4840 DEFUN (debug_msdp_events
,
4841 debug_msdp_events_cmd
,
4842 "debug msdp events",
4845 DEBUG_MSDP_EVENTS_STR
)
4847 PIM_DO_DEBUG_MSDP_EVENTS
;
4851 DEFUN (no_debug_msdp_events
,
4852 no_debug_msdp_events_cmd
,
4853 "no debug msdp events",
4857 DEBUG_MSDP_EVENTS_STR
)
4859 PIM_DONT_DEBUG_MSDP_EVENTS
;
4863 DEFUN (debug_msdp_packets
,
4864 debug_msdp_packets_cmd
,
4865 "debug msdp packets",
4868 DEBUG_MSDP_PACKETS_STR
)
4870 PIM_DO_DEBUG_MSDP_PACKETS
;
4874 DEFUN (no_debug_msdp_packets
,
4875 no_debug_msdp_packets_cmd
,
4876 "no debug msdp packets",
4880 DEBUG_MSDP_PACKETS_STR
)
4882 PIM_DONT_DEBUG_MSDP_PACKETS
;
4886 DEFUN (debug_mtrace
,
4892 PIM_DO_DEBUG_MTRACE
;
4896 DEFUN (no_debug_mtrace
,
4897 no_debug_mtrace_cmd
,
4903 PIM_DONT_DEBUG_MTRACE
;
4918 DEFUN (no_debug_bsm
,
4931 DEFUN_NOSH (show_debugging_pim
,
4932 show_debugging_pim_cmd
,
4933 "show debugging [pim]",
4938 vty_out(vty
, "PIM debugging status\n");
4940 pim_debug_config_write(vty
);
4945 DEFUN (interface_pim_use_source
,
4946 interface_pim_use_source_cmd
,
4947 "ip pim use-source A.B.C.D",
4950 "Configure primary IP address\n"
4951 "source ip address\n")
4953 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, argv
[3]->arg
);
4955 return nb_cli_apply_changes(vty
,
4956 FRR_PIM_INTERFACE_XPATH
,
4957 "frr-routing:ipv4");
4960 DEFUN (interface_no_pim_use_source
,
4961 interface_no_pim_use_source_cmd
,
4962 "no ip pim use-source [A.B.C.D]",
4966 "Delete source IP address\n"
4967 "source ip address\n")
4969 nb_cli_enqueue_change(vty
, "./use-source", NB_OP_MODIFY
, "0.0.0.0");
4971 return nb_cli_apply_changes(vty
,
4972 FRR_PIM_INTERFACE_XPATH
,
4973 "frr-routing:ipv4");
4978 "ip pim bfd [profile BFDPROF$prof]",
4981 "Enables BFD support\n"
4983 "Use BFD profile name\n")
4985 const struct lyd_node
*igmp_enable_dnode
;
4988 yang_dnode_getf(vty
->candidate_config
->dnode
,
4989 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
4990 "frr-routing:ipv4");
4991 if (!igmp_enable_dnode
)
4992 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
4995 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
4996 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5000 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
5002 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_MODIFY
, prof
);
5004 return nb_cli_apply_changes(vty
,
5005 FRR_PIM_INTERFACE_XPATH
,
5006 "frr-routing:ipv4");
5009 DEFPY(no_ip_pim_bfd_profile
, no_ip_pim_bfd_profile_cmd
,
5010 "no ip pim bfd profile [BFDPROF]",
5014 "Enables BFD support\n"
5015 "Disable BFD profile\n"
5016 "BFD Profile name\n")
5018 nb_cli_enqueue_change(vty
, "./bfd/profile", NB_OP_DESTROY
, NULL
);
5020 return nb_cli_apply_changes(vty
,
5021 FRR_PIM_INTERFACE_XPATH
,
5022 "frr-routing:ipv4");
5025 DEFUN (no_ip_pim_bfd
,
5031 "Disables BFD support\n")
5033 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_DESTROY
, NULL
);
5035 return nb_cli_apply_changes(vty
,
5036 FRR_PIM_INTERFACE_XPATH
,
5037 "frr-routing:ipv4");
5045 "Enables BSM support on the interface\n")
5047 const struct lyd_node
*igmp_enable_dnode
;
5050 yang_dnode_getf(vty
->candidate_config
->dnode
,
5051 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
5052 "frr-routing:ipv4");
5053 if (!igmp_enable_dnode
)
5054 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5057 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
5058 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5062 nb_cli_enqueue_change(vty
, "./bsm", NB_OP_MODIFY
, "true");
5064 return nb_cli_apply_changes(vty
,
5065 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5068 DEFUN (no_ip_pim_bsm
,
5074 "Disables BSM support\n")
5076 nb_cli_enqueue_change(vty
, "./bsm", NB_OP_MODIFY
, "false");
5078 return nb_cli_apply_changes(vty
,
5079 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5082 DEFUN (ip_pim_ucast_bsm
,
5083 ip_pim_ucast_bsm_cmd
,
5084 "ip pim unicast-bsm",
5087 "Accept/Send unicast BSM on the interface\n")
5089 const struct lyd_node
*igmp_enable_dnode
;
5092 yang_dnode_getf(vty
->candidate_config
->dnode
,
5093 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
5094 "frr-routing:ipv4");
5095 if (!igmp_enable_dnode
)
5096 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5099 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
5100 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5104 nb_cli_enqueue_change(vty
, "./unicast-bsm", NB_OP_MODIFY
, "true");
5106 return nb_cli_apply_changes(vty
,
5107 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5111 DEFUN (no_ip_pim_ucast_bsm
,
5112 no_ip_pim_ucast_bsm_cmd
,
5113 "no ip pim unicast-bsm",
5117 "Block send/receive unicast BSM on this interface\n")
5119 nb_cli_enqueue_change(vty
, "./unicast-bsm", NB_OP_MODIFY
, "false");
5121 return nb_cli_apply_changes(vty
,
5122 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5128 ip_pim_bfd_param_cmd
,
5129 "ip pim bfd (2-255) (1-65535) (1-65535)",
5132 "Enables BFD support\n"
5133 "Detect Multiplier\n"
5134 "Required min receive interval\n"
5135 "Desired min transmit interval\n")
5139 ip_pim_bfd_param_cmd
,
5140 "ip pim bfd (2-255) (1-65535) (1-65535)",
5143 "Enables BFD support\n"
5144 "Detect Multiplier\n"
5145 "Required min receive interval\n"
5146 "Desired min transmit interval\n")
5147 #endif /* HAVE_BFDD */
5150 int idx_number_2
= 4;
5151 int idx_number_3
= 5;
5152 const struct lyd_node
*igmp_enable_dnode
;
5155 yang_dnode_getf(vty
->candidate_config
->dnode
,
5156 FRR_GMP_ENABLE_XPATH
, VTY_CURR_XPATH
,
5157 "frr-routing:ipv4");
5158 if (!igmp_enable_dnode
)
5159 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5162 if (!yang_dnode_get_bool(igmp_enable_dnode
, "."))
5163 nb_cli_enqueue_change(vty
, "./pim-enable", NB_OP_MODIFY
,
5167 nb_cli_enqueue_change(vty
, "./bfd", NB_OP_CREATE
, NULL
);
5168 nb_cli_enqueue_change(vty
, "./bfd/min-rx-interval", NB_OP_MODIFY
,
5169 argv
[idx_number_2
]->arg
);
5170 nb_cli_enqueue_change(vty
, "./bfd/min-tx-interval", NB_OP_MODIFY
,
5171 argv
[idx_number_3
]->arg
);
5172 nb_cli_enqueue_change(vty
, "./bfd/detect_mult", NB_OP_MODIFY
,
5173 argv
[idx_number
]->arg
);
5175 return nb_cli_apply_changes(vty
,
5176 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5180 ALIAS(no_ip_pim_bfd
, no_ip_pim_bfd_param_cmd
,
5181 "no ip pim bfd (2-255) (1-65535) (1-65535)",
5185 "Enables BFD support\n"
5186 "Detect Multiplier\n"
5187 "Required min receive interval\n"
5188 "Desired min transmit interval\n")
5189 #endif /* !HAVE_BFDD */
5191 DEFPY(ip_msdp_peer
, ip_msdp_peer_cmd
,
5192 "ip msdp peer A.B.C.D$peer source A.B.C.D$source",
5195 "Configure MSDP peer\n"
5197 "Source address for TCP connection\n"
5198 "Local IP address\n")
5200 const char *vrfname
;
5201 char temp_xpath
[XPATH_MAXLEN
];
5202 char msdp_peer_source_xpath
[XPATH_MAXLEN
];
5204 vrfname
= pim_cli_get_vrf_name(vty
);
5205 if (vrfname
== NULL
)
5206 return CMD_WARNING_CONFIG_FAILED
;
5208 snprintf(msdp_peer_source_xpath
, sizeof(msdp_peer_source_xpath
),
5209 FRR_PIM_VRF_XPATH
, "frr-pim:pimd", "pim", vrfname
,
5210 "frr-routing:ipv4");
5211 snprintf(temp_xpath
, sizeof(temp_xpath
),
5212 "/msdp-peer[peer-ip='%s']/source-ip", peer_str
);
5213 strlcat(msdp_peer_source_xpath
, temp_xpath
,
5214 sizeof(msdp_peer_source_xpath
));
5216 nb_cli_enqueue_change(vty
, msdp_peer_source_xpath
, NB_OP_MODIFY
,
5219 return nb_cli_apply_changes(vty
,
5220 FRR_PIM_INTERFACE_XPATH
, "frr-routing:ipv4");
5223 DEFPY(ip_msdp_timers
, ip_msdp_timers_cmd
,
5224 "ip msdp timers (1-65535)$keepalive (1-65535)$holdtime [(1-65535)$connretry]",
5227 "MSDP timers configuration\n"
5228 "Keep alive period (in seconds)\n"
5229 "Hold time period (in seconds)\n"
5230 "Connection retry period (in seconds)\n")
5232 const char *vrfname
;
5233 char xpath
[XPATH_MAXLEN
];
5235 vrfname
= pim_cli_get_vrf_name(vty
);
5236 if (vrfname
== NULL
)
5237 return CMD_WARNING_CONFIG_FAILED
;
5239 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
5240 "pim", vrfname
, "frr-routing:ipv4");
5241 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_MODIFY
, holdtime_str
);
5242 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_MODIFY
, keepalive_str
);
5244 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_MODIFY
,
5247 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
,
5250 nb_cli_apply_changes(vty
, xpath
);
5255 DEFPY(no_ip_msdp_timers
, no_ip_msdp_timers_cmd
,
5256 "no ip msdp timers [(1-65535) (1-65535) [(1-65535)]]",
5260 "MSDP timers configuration\n"
5265 const char *vrfname
;
5266 char xpath
[XPATH_MAXLEN
];
5268 vrfname
= pim_cli_get_vrf_name(vty
);
5269 if (vrfname
== NULL
)
5270 return CMD_WARNING_CONFIG_FAILED
;
5272 snprintf(xpath
, sizeof(xpath
), FRR_PIM_MSDP_XPATH
, "frr-pim:pimd",
5273 "pim", vrfname
, "frr-routing:ipv4");
5275 nb_cli_enqueue_change(vty
, "./hold-time", NB_OP_DESTROY
, NULL
);
5276 nb_cli_enqueue_change(vty
, "./keep-alive", NB_OP_DESTROY
, NULL
);
5277 nb_cli_enqueue_change(vty
, "./connection-retry", NB_OP_DESTROY
, NULL
);
5279 nb_cli_apply_changes(vty
, xpath
);
5284 DEFUN (no_ip_msdp_peer
,
5285 no_ip_msdp_peer_cmd
,
5286 "no ip msdp peer A.B.C.D",
5290 "Delete MSDP peer\n"
5291 "peer ip address\n")
5293 const char *vrfname
;
5294 char msdp_peer_xpath
[XPATH_MAXLEN
];
5295 char temp_xpath
[XPATH_MAXLEN
];
5297 vrfname
= pim_cli_get_vrf_name(vty
);
5298 if (vrfname
== NULL
)
5299 return CMD_WARNING_CONFIG_FAILED
;
5301 snprintf(msdp_peer_xpath
, sizeof(msdp_peer_xpath
),
5303 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4");
5304 snprintf(temp_xpath
, sizeof(temp_xpath
),
5305 "/msdp-peer[peer-ip='%s']",
5308 strlcat(msdp_peer_xpath
, temp_xpath
, sizeof(msdp_peer_xpath
));
5310 nb_cli_enqueue_change(vty
, msdp_peer_xpath
, NB_OP_DESTROY
, NULL
);
5312 return nb_cli_apply_changes(vty
, NULL
);
5315 DEFPY(ip_msdp_mesh_group_member
,
5316 ip_msdp_mesh_group_member_cmd
,
5317 "ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
5320 "Configure MSDP mesh-group\n"
5322 "Mesh group member\n"
5323 "Peer IP address\n")
5325 const char *vrfname
;
5326 char xpath_value
[XPATH_MAXLEN
];
5328 vrfname
= pim_cli_get_vrf_name(vty
);
5329 if (vrfname
== NULL
)
5330 return CMD_WARNING_CONFIG_FAILED
;
5332 /* Create mesh group. */
5333 snprintf(xpath_value
, sizeof(xpath_value
),
5334 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5335 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5336 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5338 /* Create mesh group member. */
5339 strlcat(xpath_value
, "/members[address='", sizeof(xpath_value
));
5340 strlcat(xpath_value
, maddr_str
, sizeof(xpath_value
));
5341 strlcat(xpath_value
, "']", sizeof(xpath_value
));
5342 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5344 return nb_cli_apply_changes(vty
, NULL
);
5347 DEFPY(no_ip_msdp_mesh_group_member
,
5348 no_ip_msdp_mesh_group_member_cmd
,
5349 "no ip msdp mesh-group WORD$gname member A.B.C.D$maddr",
5353 "Delete MSDP mesh-group member\n"
5355 "Mesh group member\n"
5356 "Peer IP address\n")
5358 const char *vrfname
;
5359 char xpath_value
[XPATH_MAXLEN
];
5360 char xpath_member_value
[XPATH_MAXLEN
];
5362 vrfname
= pim_cli_get_vrf_name(vty
);
5363 if (vrfname
== NULL
)
5364 return CMD_WARNING_CONFIG_FAILED
;
5366 /* Get mesh group base XPath. */
5367 snprintf(xpath_value
, sizeof(xpath_value
),
5368 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5369 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5371 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
)) {
5372 vty_out(vty
, "%% mesh-group does not exist\n");
5373 return CMD_WARNING_CONFIG_FAILED
;
5376 /* Remove mesh group member. */
5377 strlcpy(xpath_member_value
, xpath_value
, sizeof(xpath_member_value
));
5378 strlcat(xpath_member_value
, "/members[address='",
5379 sizeof(xpath_member_value
));
5380 strlcat(xpath_member_value
, maddr_str
, sizeof(xpath_member_value
));
5381 strlcat(xpath_member_value
, "']", sizeof(xpath_member_value
));
5382 if (!yang_dnode_exists(vty
->candidate_config
->dnode
,
5383 xpath_member_value
)) {
5384 vty_out(vty
, "%% mesh-group member does not exist\n");
5385 return CMD_WARNING_CONFIG_FAILED
;
5388 nb_cli_enqueue_change(vty
, xpath_member_value
, NB_OP_DESTROY
, NULL
);
5391 * If this is the last member, then we must remove the group altogether
5392 * to not break legacy CLI behaviour.
5394 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5396 return nb_cli_apply_changes(vty
, NULL
);
5399 DEFPY(ip_msdp_mesh_group_source
,
5400 ip_msdp_mesh_group_source_cmd
,
5401 "ip msdp mesh-group WORD$gname source A.B.C.D$saddr",
5404 "Configure MSDP mesh-group\n"
5406 "Mesh group local address\n"
5407 "Source IP address for the TCP connection\n")
5409 const char *vrfname
;
5410 char xpath_value
[XPATH_MAXLEN
];
5412 vrfname
= pim_cli_get_vrf_name(vty
);
5413 if (vrfname
== NULL
)
5414 return CMD_WARNING_CONFIG_FAILED
;
5416 /* Create mesh group. */
5417 snprintf(xpath_value
, sizeof(xpath_value
),
5418 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5419 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5420 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5422 /* Create mesh group source. */
5423 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5424 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_MODIFY
, saddr_str
);
5426 return nb_cli_apply_changes(vty
, NULL
);
5429 DEFPY(no_ip_msdp_mesh_group_source
,
5430 no_ip_msdp_mesh_group_source_cmd
,
5431 "no ip msdp mesh-group WORD$gname source [A.B.C.D]",
5435 "Delete MSDP mesh-group source\n"
5437 "Mesh group source\n"
5438 "Mesh group local address\n")
5440 const char *vrfname
;
5441 char xpath_value
[XPATH_MAXLEN
];
5443 vrfname
= pim_cli_get_vrf_name(vty
);
5444 if (vrfname
== NULL
)
5445 return CMD_WARNING_CONFIG_FAILED
;
5447 /* Get mesh group base XPath. */
5448 snprintf(xpath_value
, sizeof(xpath_value
),
5449 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5450 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5451 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_CREATE
, NULL
);
5453 /* Create mesh group source. */
5454 strlcat(xpath_value
, "/source", sizeof(xpath_value
));
5455 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5458 * If this is the last member, then we must remove the group altogether
5459 * to not break legacy CLI behaviour.
5461 pim_cli_legacy_mesh_group_behavior(vty
, gname
);
5463 return nb_cli_apply_changes(vty
, NULL
);
5466 DEFPY(no_ip_msdp_mesh_group
,
5467 no_ip_msdp_mesh_group_cmd
,
5468 "no ip msdp mesh-group WORD$gname",
5472 "Delete MSDP mesh-group\n"
5475 const char *vrfname
;
5476 char xpath_value
[XPATH_MAXLEN
];
5478 vrfname
= pim_cli_get_vrf_name(vty
);
5479 if (vrfname
== NULL
)
5480 return CMD_WARNING_CONFIG_FAILED
;
5482 /* Get mesh group base XPath. */
5483 snprintf(xpath_value
, sizeof(xpath_value
),
5484 FRR_PIM_VRF_XPATH
"/msdp-mesh-groups[name='%s']",
5485 "frr-pim:pimd", "pim", vrfname
, "frr-routing:ipv4", gname
);
5486 if (!yang_dnode_exists(vty
->candidate_config
->dnode
, xpath_value
))
5489 nb_cli_enqueue_change(vty
, xpath_value
, NB_OP_DESTROY
, NULL
);
5490 return nb_cli_apply_changes(vty
, NULL
);
5493 static void ip_msdp_show_mesh_group(struct vty
*vty
, struct pim_msdp_mg
*mg
,
5494 struct json_object
*json
)
5496 struct listnode
*mbrnode
;
5497 struct pim_msdp_mg_mbr
*mbr
;
5498 char mbr_str
[INET_ADDRSTRLEN
];
5499 char src_str
[INET_ADDRSTRLEN
];
5500 char state_str
[PIM_MSDP_STATE_STRLEN
];
5501 enum pim_msdp_peer_state state
;
5502 json_object
*json_mg_row
= NULL
;
5503 json_object
*json_members
= NULL
;
5504 json_object
*json_row
= NULL
;
5506 pim_inet4_dump("<source?>", mg
->src_ip
, src_str
, sizeof(src_str
));
5508 /* currently there is only one mesh group but we should still
5510 * it a dict with mg-name as key */
5511 json_mg_row
= json_object_new_object();
5512 json_object_string_add(json_mg_row
, "name",
5513 mg
->mesh_group_name
);
5514 json_object_string_add(json_mg_row
, "source", src_str
);
5516 vty_out(vty
, "Mesh group : %s\n", mg
->mesh_group_name
);
5517 vty_out(vty
, " Source : %s\n", src_str
);
5518 vty_out(vty
, " Member State\n");
5521 for (ALL_LIST_ELEMENTS_RO(mg
->mbr_list
, mbrnode
, mbr
)) {
5522 pim_inet4_dump("<mbr?>", mbr
->mbr_ip
, mbr_str
, sizeof(mbr_str
));
5524 state
= mbr
->mp
->state
;
5526 state
= PIM_MSDP_DISABLED
;
5528 pim_msdp_state_dump(state
, state_str
, sizeof(state_str
));
5530 json_row
= json_object_new_object();
5531 json_object_string_add(json_row
, "member", mbr_str
);
5532 json_object_string_add(json_row
, "state", state_str
);
5533 if (!json_members
) {
5534 json_members
= json_object_new_object();
5535 json_object_object_add(json_mg_row
, "members",
5538 json_object_object_add(json_members
, mbr_str
, json_row
);
5540 vty_out(vty
, " %-15s %11s\n", mbr_str
, state_str
);
5545 json_object_object_add(json
, mg
->mesh_group_name
, json_mg_row
);
5548 DEFUN (show_ip_msdp_mesh_group
,
5549 show_ip_msdp_mesh_group_cmd
,
5550 "show ip msdp [vrf NAME] mesh-group [json]",
5555 "MSDP mesh-group information\n"
5558 bool uj
= use_json(argc
, argv
);
5560 struct pim_msdp_mg
*mg
;
5561 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5562 struct pim_instance
*pim
= vrf
->info
;
5563 struct json_object
*json
= NULL
;
5568 /* Quick case: list is empty. */
5569 if (SLIST_EMPTY(&pim
->msdp
.mglist
)) {
5571 vty_out(vty
, "{}\n");
5577 json
= json_object_new_object();
5579 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5580 ip_msdp_show_mesh_group(vty
, mg
, json
);
5583 vty_json(vty
, json
);
5588 DEFUN (show_ip_msdp_mesh_group_vrf_all
,
5589 show_ip_msdp_mesh_group_vrf_all_cmd
,
5590 "show ip msdp vrf all mesh-group [json]",
5595 "MSDP mesh-group information\n"
5598 bool uj
= use_json(argc
, argv
);
5599 struct json_object
*json
= NULL
, *vrf_json
= NULL
;
5600 struct pim_instance
*pim
;
5601 struct pim_msdp_mg
*mg
;
5605 json
= json_object_new_object();
5607 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5609 vrf_json
= json_object_new_object();
5610 json_object_object_add(json
, vrf
->name
, vrf_json
);
5612 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5615 SLIST_FOREACH (mg
, &pim
->msdp
.mglist
, mg_entry
)
5616 ip_msdp_show_mesh_group(vty
, mg
, vrf_json
);
5620 vty_json(vty
, json
);
5626 static void ip_msdp_show_peers(struct pim_instance
*pim
, struct vty
*vty
,
5629 struct listnode
*mpnode
;
5630 struct pim_msdp_peer
*mp
;
5631 char peer_str
[INET_ADDRSTRLEN
];
5632 char local_str
[INET_ADDRSTRLEN
];
5633 char state_str
[PIM_MSDP_STATE_STRLEN
];
5634 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5636 json_object
*json
= NULL
;
5637 json_object
*json_row
= NULL
;
5641 json
= json_object_new_object();
5644 "Peer Local State Uptime SaCnt\n");
5647 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5648 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5649 now
= pim_time_monotonic_sec();
5650 pim_time_uptime(timebuf
, sizeof(timebuf
),
5653 strlcpy(timebuf
, "-", sizeof(timebuf
));
5655 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5656 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5658 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5660 json_row
= json_object_new_object();
5661 json_object_string_add(json_row
, "peer", peer_str
);
5662 json_object_string_add(json_row
, "local", local_str
);
5663 json_object_string_add(json_row
, "state", state_str
);
5664 json_object_string_add(json_row
, "upTime", timebuf
);
5665 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5666 json_object_object_add(json
, peer_str
, json_row
);
5668 vty_out(vty
, "%-15s %15s %11s %8s %6d\n", peer_str
,
5669 local_str
, state_str
, timebuf
, mp
->sa_cnt
);
5674 vty_json(vty
, json
);
5677 static void ip_msdp_show_peers_detail(struct pim_instance
*pim
, struct vty
*vty
,
5678 const char *peer
, bool uj
)
5680 struct listnode
*mpnode
;
5681 struct pim_msdp_peer
*mp
;
5682 char peer_str
[INET_ADDRSTRLEN
];
5683 char local_str
[INET_ADDRSTRLEN
];
5684 char state_str
[PIM_MSDP_STATE_STRLEN
];
5685 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5686 char katimer
[PIM_MSDP_TIMER_STRLEN
];
5687 char crtimer
[PIM_MSDP_TIMER_STRLEN
];
5688 char holdtimer
[PIM_MSDP_TIMER_STRLEN
];
5690 json_object
*json
= NULL
;
5691 json_object
*json_row
= NULL
;
5694 json
= json_object_new_object();
5697 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.peer_list
, mpnode
, mp
)) {
5698 pim_inet4_dump("<peer?>", mp
->peer
, peer_str
, sizeof(peer_str
));
5699 if (strcmp(peer
, "detail") && strcmp(peer
, peer_str
))
5702 if (mp
->state
== PIM_MSDP_ESTABLISHED
) {
5703 now
= pim_time_monotonic_sec();
5704 pim_time_uptime(timebuf
, sizeof(timebuf
),
5707 strlcpy(timebuf
, "-", sizeof(timebuf
));
5709 pim_inet4_dump("<local?>", mp
->local
, local_str
,
5711 pim_msdp_state_dump(mp
->state
, state_str
, sizeof(state_str
));
5712 pim_time_timer_to_hhmmss(katimer
, sizeof(katimer
),
5714 pim_time_timer_to_hhmmss(crtimer
, sizeof(crtimer
),
5716 pim_time_timer_to_hhmmss(holdtimer
, sizeof(holdtimer
),
5720 json_row
= json_object_new_object();
5721 json_object_string_add(json_row
, "peer", peer_str
);
5722 json_object_string_add(json_row
, "local", local_str
);
5723 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5724 json_object_string_add(json_row
,
5726 mp
->mesh_group_name
);
5727 json_object_string_add(json_row
, "state", state_str
);
5728 json_object_string_add(json_row
, "upTime", timebuf
);
5729 json_object_string_add(json_row
, "keepAliveTimer",
5731 json_object_string_add(json_row
, "connRetryTimer",
5733 json_object_string_add(json_row
, "holdTimer",
5735 json_object_string_add(json_row
, "lastReset",
5737 json_object_int_add(json_row
, "connAttempts",
5739 json_object_int_add(json_row
, "establishedChanges",
5741 json_object_int_add(json_row
, "saCount", mp
->sa_cnt
);
5742 json_object_int_add(json_row
, "kaSent", mp
->ka_tx_cnt
);
5743 json_object_int_add(json_row
, "kaRcvd", mp
->ka_rx_cnt
);
5744 json_object_int_add(json_row
, "saSent", mp
->sa_tx_cnt
);
5745 json_object_int_add(json_row
, "saRcvd", mp
->sa_rx_cnt
);
5746 json_object_object_add(json
, peer_str
, json_row
);
5748 vty_out(vty
, "Peer : %s\n", peer_str
);
5749 vty_out(vty
, " Local : %s\n", local_str
);
5750 if (mp
->flags
& PIM_MSDP_PEERF_IN_GROUP
)
5751 vty_out(vty
, " Mesh Group : %s\n",
5752 mp
->mesh_group_name
);
5753 vty_out(vty
, " State : %s\n", state_str
);
5754 vty_out(vty
, " Uptime : %s\n", timebuf
);
5756 vty_out(vty
, " Keepalive Timer : %s\n", katimer
);
5757 vty_out(vty
, " Conn Retry Timer : %s\n", crtimer
);
5758 vty_out(vty
, " Hold Timer : %s\n", holdtimer
);
5759 vty_out(vty
, " Last Reset : %s\n",
5761 vty_out(vty
, " Conn Attempts : %d\n",
5763 vty_out(vty
, " Established Changes : %d\n",
5765 vty_out(vty
, " SA Count : %d\n",
5767 vty_out(vty
, " Statistics :\n");
5770 vty_out(vty
, " Keepalives : %10d %10d\n",
5771 mp
->ka_tx_cnt
, mp
->ka_rx_cnt
);
5772 vty_out(vty
, " SAs : %10d %10d\n",
5773 mp
->sa_tx_cnt
, mp
->sa_rx_cnt
);
5779 vty_json(vty
, json
);
5782 DEFUN (show_ip_msdp_peer_detail
,
5783 show_ip_msdp_peer_detail_cmd
,
5784 "show ip msdp [vrf NAME] peer [detail|A.B.C.D] [json]",
5789 "MSDP peer information\n"
5794 bool uj
= use_json(argc
, argv
);
5796 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
5803 if (argv_find(argv
, argc
, "detail", &idx
))
5804 arg
= argv
[idx
]->text
;
5805 else if (argv_find(argv
, argc
, "A.B.C.D", &idx
))
5806 arg
= argv
[idx
]->arg
;
5809 ip_msdp_show_peers_detail(vrf
->info
, vty
, argv
[idx
]->arg
, uj
);
5811 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5816 DEFUN (show_ip_msdp_peer_detail_vrf_all
,
5817 show_ip_msdp_peer_detail_vrf_all_cmd
,
5818 "show ip msdp vrf all peer [detail|A.B.C.D] [json]",
5823 "MSDP peer information\n"
5829 bool uj
= use_json(argc
, argv
);
5835 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
5839 vty_out(vty
, " \"%s\": ", vrf
->name
);
5842 vty_out(vty
, "VRF: %s\n", vrf
->name
);
5843 if (argv_find(argv
, argc
, "detail", &idx
)
5844 || argv_find(argv
, argc
, "A.B.C.D", &idx
))
5845 ip_msdp_show_peers_detail(vrf
->info
, vty
,
5846 argv
[idx
]->arg
, uj
);
5848 ip_msdp_show_peers(vrf
->info
, vty
, uj
);
5851 vty_out(vty
, "}\n");
5856 static void ip_msdp_show_sa(struct pim_instance
*pim
, struct vty
*vty
, bool uj
)
5858 struct listnode
*sanode
;
5859 struct pim_msdp_sa
*sa
;
5860 char rp_str
[INET_ADDRSTRLEN
];
5861 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5865 json_object
*json
= NULL
;
5866 json_object
*json_group
= NULL
;
5867 json_object
*json_row
= NULL
;
5870 json
= json_object_new_object();
5873 "Source Group RP Local SPT Uptime\n");
5876 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
5877 now
= pim_time_monotonic_sec();
5878 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5879 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5880 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5882 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5884 strlcpy(spt_str
, "no", sizeof(spt_str
));
5887 strlcpy(rp_str
, "-", sizeof(rp_str
));
5888 strlcpy(spt_str
, "-", sizeof(spt_str
));
5890 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5891 strlcpy(local_str
, "yes", sizeof(local_str
));
5893 strlcpy(local_str
, "no", sizeof(local_str
));
5896 char src_str
[PIM_ADDRSTRLEN
];
5897 char grp_str
[PIM_ADDRSTRLEN
];
5899 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
5901 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
5904 json_object_object_get_ex(json
, grp_str
, &json_group
);
5907 json_group
= json_object_new_object();
5908 json_object_object_add(json
, grp_str
,
5912 json_row
= json_object_new_object();
5913 json_object_string_add(json_row
, "source", src_str
);
5914 json_object_string_add(json_row
, "group", grp_str
);
5915 json_object_string_add(json_row
, "rp", rp_str
);
5916 json_object_string_add(json_row
, "local", local_str
);
5917 json_object_string_add(json_row
, "sptSetup", spt_str
);
5918 json_object_string_add(json_row
, "upTime", timebuf
);
5919 json_object_object_add(json_group
, src_str
, json_row
);
5921 vty_out(vty
, "%-15pPAs %15pPAs %15s %5c %3c %8s\n",
5922 &sa
->sg
.src
, &sa
->sg
.grp
, rp_str
, local_str
[0],
5923 spt_str
[0], timebuf
);
5928 vty_json(vty
, json
);
5931 static void ip_msdp_show_sa_entry_detail(struct pim_msdp_sa
*sa
,
5932 const char *src_str
,
5933 const char *grp_str
, struct vty
*vty
,
5934 bool uj
, json_object
*json
)
5936 char rp_str
[INET_ADDRSTRLEN
];
5937 char peer_str
[INET_ADDRSTRLEN
];
5938 char timebuf
[PIM_MSDP_UPTIME_STRLEN
];
5941 char statetimer
[PIM_MSDP_TIMER_STRLEN
];
5943 json_object
*json_group
= NULL
;
5944 json_object
*json_row
= NULL
;
5946 now
= pim_time_monotonic_sec();
5947 pim_time_uptime(timebuf
, sizeof(timebuf
), now
- sa
->uptime
);
5948 if (sa
->flags
& PIM_MSDP_SAF_PEER
) {
5949 pim_inet4_dump("<rp?>", sa
->rp
, rp_str
, sizeof(rp_str
));
5950 pim_inet4_dump("<peer?>", sa
->peer
, peer_str
, sizeof(peer_str
));
5952 strlcpy(spt_str
, "yes", sizeof(spt_str
));
5954 strlcpy(spt_str
, "no", sizeof(spt_str
));
5957 strlcpy(rp_str
, "-", sizeof(rp_str
));
5958 strlcpy(peer_str
, "-", sizeof(peer_str
));
5959 strlcpy(spt_str
, "-", sizeof(spt_str
));
5961 if (sa
->flags
& PIM_MSDP_SAF_LOCAL
) {
5962 strlcpy(local_str
, "yes", sizeof(local_str
));
5964 strlcpy(local_str
, "no", sizeof(local_str
));
5966 pim_time_timer_to_hhmmss(statetimer
, sizeof(statetimer
),
5967 sa
->sa_state_timer
);
5969 json_object_object_get_ex(json
, grp_str
, &json_group
);
5972 json_group
= json_object_new_object();
5973 json_object_object_add(json
, grp_str
, json_group
);
5976 json_row
= json_object_new_object();
5977 json_object_string_add(json_row
, "source", src_str
);
5978 json_object_string_add(json_row
, "group", grp_str
);
5979 json_object_string_add(json_row
, "rp", rp_str
);
5980 json_object_string_add(json_row
, "local", local_str
);
5981 json_object_string_add(json_row
, "sptSetup", spt_str
);
5982 json_object_string_add(json_row
, "upTime", timebuf
);
5983 json_object_string_add(json_row
, "stateTimer", statetimer
);
5984 json_object_object_add(json_group
, src_str
, json_row
);
5986 vty_out(vty
, "SA : %s\n", sa
->sg_str
);
5987 vty_out(vty
, " RP : %s\n", rp_str
);
5988 vty_out(vty
, " Peer : %s\n", peer_str
);
5989 vty_out(vty
, " Local : %s\n", local_str
);
5990 vty_out(vty
, " SPT Setup : %s\n", spt_str
);
5991 vty_out(vty
, " Uptime : %s\n", timebuf
);
5992 vty_out(vty
, " State Timer : %s\n", statetimer
);
5997 static void ip_msdp_show_sa_detail(struct pim_instance
*pim
, struct vty
*vty
,
6000 struct listnode
*sanode
;
6001 struct pim_msdp_sa
*sa
;
6002 json_object
*json
= NULL
;
6005 json
= json_object_new_object();
6008 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
6009 char src_str
[PIM_ADDRSTRLEN
];
6010 char grp_str
[PIM_ADDRSTRLEN
];
6012 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
6013 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
6015 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
, uj
,
6020 vty_json(vty
, json
);
6023 DEFUN (show_ip_msdp_sa_detail
,
6024 show_ip_msdp_sa_detail_cmd
,
6025 "show ip msdp [vrf NAME] sa detail [json]",
6030 "MSDP active-source information\n"
6034 bool uj
= use_json(argc
, argv
);
6036 struct vrf
*vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6041 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
6046 DEFUN (show_ip_msdp_sa_detail_vrf_all
,
6047 show_ip_msdp_sa_detail_vrf_all_cmd
,
6048 "show ip msdp vrf all sa detail [json]",
6053 "MSDP active-source information\n"
6057 bool uj
= use_json(argc
, argv
);
6063 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
6067 vty_out(vty
, " \"%s\": ", vrf
->name
);
6070 vty_out(vty
, "VRF: %s\n", vrf
->name
);
6071 ip_msdp_show_sa_detail(vrf
->info
, vty
, uj
);
6074 vty_out(vty
, "}\n");
6079 static void ip_msdp_show_sa_addr(struct pim_instance
*pim
, struct vty
*vty
,
6080 const char *addr
, bool uj
)
6082 struct listnode
*sanode
;
6083 struct pim_msdp_sa
*sa
;
6084 json_object
*json
= NULL
;
6087 json
= json_object_new_object();
6090 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
6091 char src_str
[PIM_ADDRSTRLEN
];
6092 char grp_str
[PIM_ADDRSTRLEN
];
6094 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
6095 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
6097 if (!strcmp(addr
, src_str
) || !strcmp(addr
, grp_str
)) {
6098 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
6104 vty_json(vty
, json
);
6107 static void ip_msdp_show_sa_sg(struct pim_instance
*pim
, struct vty
*vty
,
6108 const char *src
, const char *grp
, bool uj
)
6110 struct listnode
*sanode
;
6111 struct pim_msdp_sa
*sa
;
6112 json_object
*json
= NULL
;
6115 json
= json_object_new_object();
6118 for (ALL_LIST_ELEMENTS_RO(pim
->msdp
.sa_list
, sanode
, sa
)) {
6119 char src_str
[PIM_ADDRSTRLEN
];
6120 char grp_str
[PIM_ADDRSTRLEN
];
6122 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs", &sa
->sg
.grp
);
6123 snprintfrr(src_str
, sizeof(src_str
), "%pPAs", &sa
->sg
.src
);
6125 if (!strcmp(src
, src_str
) && !strcmp(grp
, grp_str
)) {
6126 ip_msdp_show_sa_entry_detail(sa
, src_str
, grp_str
, vty
,
6132 vty_json(vty
, json
);
6135 DEFUN (show_ip_msdp_sa_sg
,
6136 show_ip_msdp_sa_sg_cmd
,
6137 "show ip msdp [vrf NAME] sa [A.B.C.D [A.B.C.D]] [json]",
6142 "MSDP active-source information\n"
6143 "source or group ip\n"
6147 bool uj
= use_json(argc
, argv
);
6151 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6156 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
6158 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
6162 if (src_ip
&& grp_ip
)
6163 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6165 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
6167 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
6172 DEFUN (show_ip_msdp_sa_sg_vrf_all
,
6173 show_ip_msdp_sa_sg_vrf_all_cmd
,
6174 "show ip msdp vrf all sa [A.B.C.D [A.B.C.D]] [json]",
6179 "MSDP active-source information\n"
6180 "source or group ip\n"
6184 bool uj
= use_json(argc
, argv
);
6189 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ? argv
[idx
++]->arg
6191 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
)
6197 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
6201 vty_out(vty
, " \"%s\": ", vrf
->name
);
6204 vty_out(vty
, "VRF: %s\n", vrf
->name
);
6206 if (src_ip
&& grp_ip
)
6207 ip_msdp_show_sa_sg(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6209 ip_msdp_show_sa_addr(vrf
->info
, vty
, src_ip
, uj
);
6211 ip_msdp_show_sa(vrf
->info
, vty
, uj
);
6214 vty_out(vty
, "}\n");
6219 struct pim_sg_cache_walk_data
{
6222 json_object
*json_group
;
6223 struct in_addr addr
;
6227 static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg
*vxlan_sg
,
6228 struct pim_sg_cache_walk_data
*cwd
)
6230 struct vty
*vty
= cwd
->vty
;
6231 json_object
*json
= cwd
->json
;
6232 json_object
*json_row
;
6233 bool installed
= (vxlan_sg
->up
) ? true : false;
6234 const char *iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
6235 const char *oif_name
;
6237 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
6238 oif_name
= vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
6240 oif_name
= vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
6242 if (cwd
->addr_match
&& pim_addr_cmp(vxlan_sg
->sg
.src
, cwd
->addr
) &&
6243 pim_addr_cmp(vxlan_sg
->sg
.grp
, cwd
->addr
)) {
6247 char src_str
[PIM_ADDRSTRLEN
];
6248 char grp_str
[PIM_ADDRSTRLEN
];
6250 snprintfrr(grp_str
, sizeof(grp_str
), "%pPAs",
6252 snprintfrr(src_str
, sizeof(src_str
), "%pPAs",
6255 json_object_object_get_ex(json
, grp_str
, &cwd
->json_group
);
6257 if (!cwd
->json_group
) {
6258 cwd
->json_group
= json_object_new_object();
6259 json_object_object_add(json
, grp_str
,
6263 json_row
= json_object_new_object();
6264 json_object_string_add(json_row
, "source", src_str
);
6265 json_object_string_add(json_row
, "group", grp_str
);
6266 json_object_string_add(json_row
, "input", iif_name
);
6267 json_object_string_add(json_row
, "output", oif_name
);
6269 json_object_boolean_true_add(json_row
, "installed");
6271 json_object_boolean_false_add(json_row
, "installed");
6272 json_object_object_add(cwd
->json_group
, src_str
, json_row
);
6274 vty_out(vty
, "%-15pPAs %-15pPAs %-15s %-15s %-5s\n",
6275 &vxlan_sg
->sg
.src
, &vxlan_sg
->sg
.grp
, iif_name
,
6276 oif_name
, installed
? "I" : "");
6280 static void pim_show_vxlan_sg_hash_entry(struct hash_bucket
*bucket
, void *arg
)
6282 pim_show_vxlan_sg_entry((struct pim_vxlan_sg
*)bucket
->data
,
6283 (struct pim_sg_cache_walk_data
*)arg
);
6286 static void pim_show_vxlan_sg(struct pim_instance
*pim
,
6287 struct vty
*vty
, bool uj
)
6289 json_object
*json
= NULL
;
6290 struct pim_sg_cache_walk_data cwd
;
6293 json
= json_object_new_object();
6295 vty_out(vty
, "Codes: I -> installed\n");
6297 "Source Group Input Output Flags\n");
6300 memset(&cwd
, 0, sizeof(cwd
));
6303 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
6306 vty_json(vty
, json
);
6309 static void pim_show_vxlan_sg_match_addr(struct pim_instance
*pim
,
6310 struct vty
*vty
, char *addr_str
,
6313 json_object
*json
= NULL
;
6314 struct pim_sg_cache_walk_data cwd
;
6317 memset(&cwd
, 0, sizeof(cwd
));
6318 result
= inet_pton(AF_INET
, addr_str
, &cwd
.addr
);
6320 vty_out(vty
, "Bad address %s: errno=%d: %s\n", addr_str
,
6321 errno
, safe_strerror(errno
));
6326 json
= json_object_new_object();
6328 vty_out(vty
, "Codes: I -> installed\n");
6330 "Source Group Input Output Flags\n");
6335 cwd
.addr_match
= true;
6336 hash_iterate(pim
->vxlan
.sg_hash
, pim_show_vxlan_sg_hash_entry
, &cwd
);
6339 vty_json(vty
, json
);
6342 static void pim_show_vxlan_sg_one(struct pim_instance
*pim
,
6343 struct vty
*vty
, char *src_str
, char *grp_str
,
6346 json_object
*json
= NULL
;
6349 struct pim_vxlan_sg
*vxlan_sg
;
6350 const char *iif_name
;
6352 const char *oif_name
;
6354 result
= inet_pton(AF_INET
, src_str
, &sg
.src
);
6356 vty_out(vty
, "Bad src address %s: errno=%d: %s\n", src_str
,
6357 errno
, safe_strerror(errno
));
6360 result
= inet_pton(AF_INET
, grp_str
, &sg
.grp
);
6362 vty_out(vty
, "Bad grp address %s: errno=%d: %s\n", grp_str
,
6363 errno
, safe_strerror(errno
));
6368 json
= json_object_new_object();
6370 vxlan_sg
= pim_vxlan_sg_find(pim
, &sg
);
6372 installed
= (vxlan_sg
->up
) ? true : false;
6373 iif_name
= vxlan_sg
->iif
?vxlan_sg
->iif
->name
:"-";
6375 if (pim_vxlan_is_orig_mroute(vxlan_sg
))
6377 vxlan_sg
->orig_oif
?vxlan_sg
->orig_oif
->name
:"";
6380 vxlan_sg
->term_oif
?vxlan_sg
->term_oif
->name
:"";
6383 json_object_string_add(json
, "source", src_str
);
6384 json_object_string_add(json
, "group", grp_str
);
6385 json_object_string_add(json
, "input", iif_name
);
6386 json_object_string_add(json
, "output", oif_name
);
6388 json_object_boolean_true_add(json
, "installed");
6390 json_object_boolean_false_add(json
,
6393 vty_out(vty
, "SG : %s\n", vxlan_sg
->sg_str
);
6394 vty_out(vty
, " Input : %s\n", iif_name
);
6395 vty_out(vty
, " Output : %s\n", oif_name
);
6396 vty_out(vty
, " installed : %s\n",
6397 installed
?"yes":"no");
6402 vty_json(vty
, json
);
6405 DEFUN (show_ip_pim_vxlan_sg
,
6406 show_ip_pim_vxlan_sg_cmd
,
6407 "show ip pim [vrf NAME] vxlan-groups [A.B.C.D [A.B.C.D]] [json]",
6412 "VxLAN BUM groups\n"
6413 "source or group ip\n"
6417 bool uj
= use_json(argc
, argv
);
6421 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6426 char *src_ip
= argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
6427 argv
[idx
++]->arg
:NULL
;
6428 char *grp_ip
= idx
< argc
&& argv_find(argv
, argc
, "A.B.C.D", &idx
) ?
6429 argv
[idx
]->arg
:NULL
;
6431 if (src_ip
&& grp_ip
)
6432 pim_show_vxlan_sg_one(vrf
->info
, vty
, src_ip
, grp_ip
, uj
);
6434 pim_show_vxlan_sg_match_addr(vrf
->info
, vty
, src_ip
, uj
);
6436 pim_show_vxlan_sg(vrf
->info
, vty
, uj
);
6441 static void pim_show_vxlan_sg_work(struct pim_instance
*pim
,
6442 struct vty
*vty
, bool uj
)
6444 json_object
*json
= NULL
;
6445 struct pim_sg_cache_walk_data cwd
;
6446 struct listnode
*node
;
6447 struct pim_vxlan_sg
*vxlan_sg
;
6450 json
= json_object_new_object();
6452 vty_out(vty
, "Codes: I -> installed\n");
6454 "Source Group Input Flags\n");
6457 memset(&cwd
, 0, sizeof(cwd
));
6460 for (ALL_LIST_ELEMENTS_RO(pim_vxlan_p
->work_list
, node
, vxlan_sg
))
6461 pim_show_vxlan_sg_entry(vxlan_sg
, &cwd
);
6464 vty_json(vty
, json
);
6467 DEFUN_HIDDEN (show_ip_pim_vxlan_sg_work
,
6468 show_ip_pim_vxlan_sg_work_cmd
,
6469 "show ip pim [vrf NAME] vxlan-work [json]",
6477 bool uj
= use_json(argc
, argv
);
6481 vrf
= pim_cmd_lookup_vrf(vty
, argv
, argc
, &idx
);
6486 pim_show_vxlan_sg_work(vrf
->info
, vty
, uj
);
6491 DEFUN_HIDDEN (no_ip_pim_mlag
,
6499 char mlag_xpath
[XPATH_MAXLEN
];
6501 snprintf(mlag_xpath
, sizeof(mlag_xpath
), FRR_PIM_VRF_XPATH
,
6502 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6503 strlcat(mlag_xpath
, "/mlag", sizeof(mlag_xpath
));
6505 nb_cli_enqueue_change(vty
, mlag_xpath
, NB_OP_DESTROY
, NULL
);
6508 return nb_cli_apply_changes(vty
, NULL
);
6511 DEFUN_HIDDEN (ip_pim_mlag
,
6513 "ip pim mlag INTERFACE role [primary|secondary] state [up|down] addr A.B.C.D",
6517 "peerlink sub interface\n"
6519 "MLAG role primary\n"
6520 "MLAG role secondary\n"
6521 "peer session state\n"
6522 "peer session state up\n"
6523 "peer session state down\n"
6525 "unique ip address\n")
6528 char mlag_peerlink_rif_xpath
[XPATH_MAXLEN
];
6529 char mlag_my_role_xpath
[XPATH_MAXLEN
];
6530 char mlag_peer_state_xpath
[XPATH_MAXLEN
];
6531 char mlag_reg_address_xpath
[XPATH_MAXLEN
];
6533 snprintf(mlag_peerlink_rif_xpath
, sizeof(mlag_peerlink_rif_xpath
),
6535 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6536 strlcat(mlag_peerlink_rif_xpath
, "/mlag/peerlink-rif",
6537 sizeof(mlag_peerlink_rif_xpath
));
6540 nb_cli_enqueue_change(vty
, mlag_peerlink_rif_xpath
, NB_OP_MODIFY
,
6543 snprintf(mlag_my_role_xpath
, sizeof(mlag_my_role_xpath
),
6545 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6546 strlcat(mlag_my_role_xpath
, "/mlag/my-role",
6547 sizeof(mlag_my_role_xpath
));
6550 if (!strcmp(argv
[idx
]->arg
, "primary")) {
6551 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6552 "MLAG_ROLE_PRIMARY");
6554 } else if (!strcmp(argv
[idx
]->arg
, "secondary")) {
6555 nb_cli_enqueue_change(vty
, mlag_my_role_xpath
, NB_OP_MODIFY
,
6556 "MLAG_ROLE_SECONDARY");
6559 vty_out(vty
, "unknown MLAG role %s\n", argv
[idx
]->arg
);
6563 snprintf(mlag_peer_state_xpath
, sizeof(mlag_peer_state_xpath
),
6565 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6566 strlcat(mlag_peer_state_xpath
, "/mlag/peer-state",
6567 sizeof(mlag_peer_state_xpath
));
6570 if (!strcmp(argv
[idx
]->arg
, "up")) {
6571 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6574 } else if (strcmp(argv
[idx
]->arg
, "down")) {
6575 nb_cli_enqueue_change(vty
, mlag_peer_state_xpath
, NB_OP_MODIFY
,
6579 vty_out(vty
, "unknown MLAG state %s\n", argv
[idx
]->arg
);
6583 snprintf(mlag_reg_address_xpath
, sizeof(mlag_reg_address_xpath
),
6585 "frr-pim:pimd", "pim", "default", "frr-routing:ipv4");
6586 strlcat(mlag_reg_address_xpath
, "/mlag/reg-address",
6587 sizeof(mlag_reg_address_xpath
));
6590 nb_cli_enqueue_change(vty
, mlag_reg_address_xpath
, NB_OP_MODIFY
,
6593 return nb_cli_apply_changes(vty
, NULL
);
6596 void pim_cmd_init(void)
6598 if_cmd_init(pim_interface_config_write
);
6600 install_node(&debug_node
);
6602 install_element(ENABLE_NODE
, &pim_test_sg_keepalive_cmd
);
6604 install_element(CONFIG_NODE
, &ip_pim_rp_cmd
);
6605 install_element(VRF_NODE
, &ip_pim_rp_cmd
);
6606 install_element(CONFIG_NODE
, &no_ip_pim_rp_cmd
);
6607 install_element(VRF_NODE
, &no_ip_pim_rp_cmd
);
6608 install_element(CONFIG_NODE
, &ip_pim_rp_prefix_list_cmd
);
6609 install_element(VRF_NODE
, &ip_pim_rp_prefix_list_cmd
);
6610 install_element(CONFIG_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6611 install_element(VRF_NODE
, &no_ip_pim_rp_prefix_list_cmd
);
6612 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6613 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_cmd
);
6614 install_element(CONFIG_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6615 install_element(VRF_NODE
, &no_ip_pim_ssm_prefix_list_name_cmd
);
6616 install_element(CONFIG_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6617 install_element(VRF_NODE
, &ip_pim_ssm_prefix_list_cmd
);
6618 install_element(CONFIG_NODE
, &ip_pim_register_suppress_cmd
);
6619 install_element(CONFIG_NODE
, &no_ip_pim_register_suppress_cmd
);
6620 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6621 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_cmd
);
6622 install_element(CONFIG_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6623 install_element(VRF_NODE
, &ip_pim_spt_switchover_infinity_plist_cmd
);
6624 install_element(CONFIG_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6625 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_cmd
);
6626 install_element(CONFIG_NODE
,
6627 &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6628 install_element(VRF_NODE
, &no_ip_pim_spt_switchover_infinity_plist_cmd
);
6629 install_element(CONFIG_NODE
, &pim_register_accept_list_cmd
);
6630 install_element(VRF_NODE
, &pim_register_accept_list_cmd
);
6631 install_element(CONFIG_NODE
, &ip_pim_joinprune_time_cmd
);
6632 install_element(CONFIG_NODE
, &no_ip_pim_joinprune_time_cmd
);
6633 install_element(CONFIG_NODE
, &ip_pim_keep_alive_cmd
);
6634 install_element(VRF_NODE
, &ip_pim_keep_alive_cmd
);
6635 install_element(CONFIG_NODE
, &ip_pim_rp_keep_alive_cmd
);
6636 install_element(VRF_NODE
, &ip_pim_rp_keep_alive_cmd
);
6637 install_element(CONFIG_NODE
, &no_ip_pim_keep_alive_cmd
);
6638 install_element(VRF_NODE
, &no_ip_pim_keep_alive_cmd
);
6639 install_element(CONFIG_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6640 install_element(VRF_NODE
, &no_ip_pim_rp_keep_alive_cmd
);
6641 install_element(CONFIG_NODE
, &ip_pim_packets_cmd
);
6642 install_element(CONFIG_NODE
, &no_ip_pim_packets_cmd
);
6643 install_element(CONFIG_NODE
, &ip_pim_v6_secondary_cmd
);
6644 install_element(VRF_NODE
, &ip_pim_v6_secondary_cmd
);
6645 install_element(CONFIG_NODE
, &no_ip_pim_v6_secondary_cmd
);
6646 install_element(VRF_NODE
, &no_ip_pim_v6_secondary_cmd
);
6647 install_element(CONFIG_NODE
, &ip_ssmpingd_cmd
);
6648 install_element(VRF_NODE
, &ip_ssmpingd_cmd
);
6649 install_element(CONFIG_NODE
, &no_ip_ssmpingd_cmd
);
6650 install_element(VRF_NODE
, &no_ip_ssmpingd_cmd
);
6651 install_element(CONFIG_NODE
, &ip_msdp_peer_cmd
);
6652 install_element(VRF_NODE
, &ip_msdp_peer_cmd
);
6653 install_element(CONFIG_NODE
, &no_ip_msdp_peer_cmd
);
6654 install_element(VRF_NODE
, &no_ip_msdp_peer_cmd
);
6655 install_element(CONFIG_NODE
, &ip_pim_ecmp_cmd
);
6656 install_element(VRF_NODE
, &ip_pim_ecmp_cmd
);
6657 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_cmd
);
6658 install_element(VRF_NODE
, &no_ip_pim_ecmp_cmd
);
6659 install_element(CONFIG_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6660 install_element(VRF_NODE
, &ip_pim_ecmp_rebalance_cmd
);
6661 install_element(CONFIG_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6662 install_element(VRF_NODE
, &no_ip_pim_ecmp_rebalance_cmd
);
6663 install_element(CONFIG_NODE
, &ip_pim_mlag_cmd
);
6664 install_element(CONFIG_NODE
, &no_ip_pim_mlag_cmd
);
6665 install_element(CONFIG_NODE
, &ip_igmp_group_watermark_cmd
);
6666 install_element(VRF_NODE
, &ip_igmp_group_watermark_cmd
);
6667 install_element(CONFIG_NODE
, &no_ip_igmp_group_watermark_cmd
);
6668 install_element(VRF_NODE
, &no_ip_igmp_group_watermark_cmd
);
6670 install_element(INTERFACE_NODE
, &interface_ip_igmp_cmd
);
6671 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_cmd
);
6672 install_element(INTERFACE_NODE
, &interface_ip_igmp_join_cmd
);
6673 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_join_cmd
);
6674 install_element(INTERFACE_NODE
, &interface_ip_igmp_version_cmd
);
6675 install_element(INTERFACE_NODE
, &interface_no_ip_igmp_version_cmd
);
6676 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_interval_cmd
);
6677 install_element(INTERFACE_NODE
,
6678 &interface_no_ip_igmp_query_interval_cmd
);
6679 install_element(INTERFACE_NODE
,
6680 &interface_ip_igmp_query_max_response_time_cmd
);
6681 install_element(INTERFACE_NODE
,
6682 &interface_no_ip_igmp_query_max_response_time_cmd
);
6683 install_element(INTERFACE_NODE
,
6684 &interface_ip_igmp_query_max_response_time_dsec_cmd
);
6685 install_element(INTERFACE_NODE
,
6686 &interface_no_ip_igmp_query_max_response_time_dsec_cmd
);
6687 install_element(INTERFACE_NODE
,
6688 &interface_ip_igmp_last_member_query_count_cmd
);
6689 install_element(INTERFACE_NODE
,
6690 &interface_no_ip_igmp_last_member_query_count_cmd
);
6691 install_element(INTERFACE_NODE
,
6692 &interface_ip_igmp_last_member_query_interval_cmd
);
6693 install_element(INTERFACE_NODE
,
6694 &interface_no_ip_igmp_last_member_query_interval_cmd
);
6695 install_element(INTERFACE_NODE
, &interface_ip_pim_activeactive_cmd
);
6696 install_element(INTERFACE_NODE
, &interface_ip_pim_ssm_cmd
);
6697 install_element(INTERFACE_NODE
, &interface_no_ip_pim_ssm_cmd
);
6698 install_element(INTERFACE_NODE
, &interface_ip_pim_sm_cmd
);
6699 install_element(INTERFACE_NODE
, &interface_no_ip_pim_sm_cmd
);
6700 install_element(INTERFACE_NODE
, &interface_ip_pim_cmd
);
6701 install_element(INTERFACE_NODE
, &interface_no_ip_pim_cmd
);
6702 install_element(INTERFACE_NODE
, &interface_ip_pim_drprio_cmd
);
6703 install_element(INTERFACE_NODE
, &interface_no_ip_pim_drprio_cmd
);
6704 install_element(INTERFACE_NODE
, &interface_ip_pim_hello_cmd
);
6705 install_element(INTERFACE_NODE
, &interface_no_ip_pim_hello_cmd
);
6706 install_element(INTERFACE_NODE
, &interface_ip_pim_boundary_oil_cmd
);
6707 install_element(INTERFACE_NODE
, &interface_no_ip_pim_boundary_oil_cmd
);
6708 install_element(INTERFACE_NODE
, &interface_ip_igmp_query_generate_cmd
);
6710 // Static mroutes NEB
6711 install_element(INTERFACE_NODE
, &interface_ip_mroute_cmd
);
6712 install_element(INTERFACE_NODE
, &interface_no_ip_mroute_cmd
);
6714 install_element(VIEW_NODE
, &show_ip_igmp_interface_cmd
);
6715 install_element(VIEW_NODE
, &show_ip_igmp_interface_vrf_all_cmd
);
6716 install_element(VIEW_NODE
, &show_ip_igmp_join_cmd
);
6717 install_element(VIEW_NODE
, &show_ip_igmp_join_vrf_all_cmd
);
6718 install_element(VIEW_NODE
, &show_ip_igmp_groups_cmd
);
6719 install_element(VIEW_NODE
, &show_ip_igmp_groups_vrf_all_cmd
);
6720 install_element(VIEW_NODE
, &show_ip_igmp_groups_retransmissions_cmd
);
6721 install_element(VIEW_NODE
, &show_ip_igmp_sources_cmd
);
6722 install_element(VIEW_NODE
, &show_ip_igmp_sources_retransmissions_cmd
);
6723 install_element(VIEW_NODE
, &show_ip_igmp_statistics_cmd
);
6724 install_element(VIEW_NODE
, &show_ip_pim_assert_cmd
);
6725 install_element(VIEW_NODE
, &show_ip_pim_assert_internal_cmd
);
6726 install_element(VIEW_NODE
, &show_ip_pim_assert_metric_cmd
);
6727 install_element(VIEW_NODE
, &show_ip_pim_assert_winner_metric_cmd
);
6728 install_element(VIEW_NODE
, &show_ip_pim_interface_traffic_cmd
);
6729 install_element(VIEW_NODE
, &show_ip_pim_interface_cmd
);
6730 install_element(VIEW_NODE
, &show_ip_pim_interface_vrf_all_cmd
);
6731 install_element(VIEW_NODE
, &show_ip_pim_join_cmd
);
6732 install_element(VIEW_NODE
, &show_ip_pim_join_vrf_all_cmd
);
6733 install_element(VIEW_NODE
, &show_ip_pim_jp_agg_cmd
);
6734 install_element(VIEW_NODE
, &show_ip_pim_local_membership_cmd
);
6735 install_element(VIEW_NODE
, &show_ip_pim_mlag_summary_cmd
);
6736 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_cmd
);
6737 install_element(VIEW_NODE
, &show_ip_pim_mlag_up_vrf_all_cmd
);
6738 install_element(VIEW_NODE
, &show_ip_pim_neighbor_cmd
);
6739 install_element(VIEW_NODE
, &show_ip_pim_neighbor_vrf_all_cmd
);
6740 install_element(VIEW_NODE
, &show_ip_pim_rpf_cmd
);
6741 install_element(VIEW_NODE
, &show_ip_pim_rpf_vrf_all_cmd
);
6742 install_element(VIEW_NODE
, &show_ip_pim_secondary_cmd
);
6743 install_element(VIEW_NODE
, &show_ip_pim_state_cmd
);
6744 install_element(VIEW_NODE
, &show_ip_pim_state_vrf_all_cmd
);
6745 install_element(VIEW_NODE
, &show_ip_pim_upstream_cmd
);
6746 install_element(VIEW_NODE
, &show_ip_pim_upstream_vrf_all_cmd
);
6747 install_element(VIEW_NODE
, &show_ip_pim_channel_cmd
);
6748 install_element(VIEW_NODE
, &show_ip_pim_upstream_join_desired_cmd
);
6749 install_element(VIEW_NODE
, &show_ip_pim_upstream_rpf_cmd
);
6750 install_element(VIEW_NODE
, &show_ip_pim_rp_cmd
);
6751 install_element(VIEW_NODE
, &show_ip_pim_rp_vrf_all_cmd
);
6752 install_element(VIEW_NODE
, &show_ip_pim_bsr_cmd
);
6753 install_element(VIEW_NODE
, &show_ip_multicast_cmd
);
6754 install_element(VIEW_NODE
, &show_ip_multicast_vrf_all_cmd
);
6755 install_element(VIEW_NODE
, &show_ip_multicast_count_cmd
);
6756 install_element(VIEW_NODE
, &show_ip_multicast_count_vrf_all_cmd
);
6757 install_element(VIEW_NODE
, &show_ip_mroute_cmd
);
6758 install_element(VIEW_NODE
, &show_ip_mroute_vrf_all_cmd
);
6759 install_element(VIEW_NODE
, &show_ip_mroute_count_cmd
);
6760 install_element(VIEW_NODE
, &show_ip_mroute_count_vrf_all_cmd
);
6761 install_element(VIEW_NODE
, &show_ip_mroute_summary_cmd
);
6762 install_element(VIEW_NODE
, &show_ip_mroute_summary_vrf_all_cmd
);
6763 install_element(VIEW_NODE
, &show_ip_rib_cmd
);
6764 install_element(VIEW_NODE
, &show_ip_ssmpingd_cmd
);
6765 install_element(VIEW_NODE
, &show_ip_pim_nexthop_cmd
);
6766 install_element(VIEW_NODE
, &show_ip_pim_nexthop_lookup_cmd
);
6767 install_element(VIEW_NODE
, &show_ip_pim_bsrp_cmd
);
6768 install_element(VIEW_NODE
, &show_ip_pim_bsm_db_cmd
);
6769 install_element(VIEW_NODE
, &show_ip_pim_statistics_cmd
);
6771 install_element(ENABLE_NODE
, &clear_ip_mroute_count_cmd
);
6772 install_element(ENABLE_NODE
, &clear_ip_interfaces_cmd
);
6773 install_element(ENABLE_NODE
, &clear_ip_igmp_interfaces_cmd
);
6774 install_element(ENABLE_NODE
, &clear_ip_mroute_cmd
);
6775 install_element(ENABLE_NODE
, &clear_ip_pim_interfaces_cmd
);
6776 install_element(ENABLE_NODE
, &clear_ip_pim_interface_traffic_cmd
);
6777 install_element(ENABLE_NODE
, &clear_ip_pim_oil_cmd
);
6778 install_element(ENABLE_NODE
, &clear_ip_pim_statistics_cmd
);
6779 install_element(ENABLE_NODE
, &clear_ip_pim_bsr_db_cmd
);
6781 install_element(ENABLE_NODE
, &show_debugging_pim_cmd
);
6783 install_element(ENABLE_NODE
, &debug_igmp_cmd
);
6784 install_element(ENABLE_NODE
, &no_debug_igmp_cmd
);
6785 install_element(ENABLE_NODE
, &debug_igmp_events_cmd
);
6786 install_element(ENABLE_NODE
, &no_debug_igmp_events_cmd
);
6787 install_element(ENABLE_NODE
, &debug_igmp_packets_cmd
);
6788 install_element(ENABLE_NODE
, &no_debug_igmp_packets_cmd
);
6789 install_element(ENABLE_NODE
, &debug_igmp_trace_cmd
);
6790 install_element(ENABLE_NODE
, &no_debug_igmp_trace_cmd
);
6791 install_element(ENABLE_NODE
, &debug_igmp_trace_detail_cmd
);
6792 install_element(ENABLE_NODE
, &no_debug_igmp_trace_detail_cmd
);
6793 install_element(ENABLE_NODE
, &debug_mroute_cmd
);
6794 install_element(ENABLE_NODE
, &debug_mroute_detail_cmd
);
6795 install_element(ENABLE_NODE
, &no_debug_mroute_cmd
);
6796 install_element(ENABLE_NODE
, &no_debug_mroute_detail_cmd
);
6797 install_element(ENABLE_NODE
, &debug_pim_static_cmd
);
6798 install_element(ENABLE_NODE
, &no_debug_pim_static_cmd
);
6799 install_element(ENABLE_NODE
, &debug_pim_cmd
);
6800 install_element(ENABLE_NODE
, &debug_pim_nht_cmd
);
6801 install_element(ENABLE_NODE
, &debug_pim_nht_det_cmd
);
6802 install_element(ENABLE_NODE
, &debug_pim_nht_rp_cmd
);
6803 install_element(ENABLE_NODE
, &no_debug_pim_nht_rp_cmd
);
6804 install_element(ENABLE_NODE
, &debug_pim_events_cmd
);
6805 install_element(ENABLE_NODE
, &debug_pim_packets_cmd
);
6806 install_element(ENABLE_NODE
, &debug_pim_packetdump_send_cmd
);
6807 install_element(ENABLE_NODE
, &debug_pim_packetdump_recv_cmd
);
6808 install_element(ENABLE_NODE
, &debug_pim_trace_cmd
);
6809 install_element(ENABLE_NODE
, &debug_pim_trace_detail_cmd
);
6810 install_element(ENABLE_NODE
, &debug_ssmpingd_cmd
);
6811 install_element(ENABLE_NODE
, &no_debug_ssmpingd_cmd
);
6812 install_element(ENABLE_NODE
, &debug_pim_zebra_cmd
);
6813 install_element(ENABLE_NODE
, &debug_pim_mlag_cmd
);
6814 install_element(ENABLE_NODE
, &no_debug_pim_mlag_cmd
);
6815 install_element(ENABLE_NODE
, &debug_pim_vxlan_cmd
);
6816 install_element(ENABLE_NODE
, &no_debug_pim_vxlan_cmd
);
6817 install_element(ENABLE_NODE
, &debug_msdp_cmd
);
6818 install_element(ENABLE_NODE
, &no_debug_msdp_cmd
);
6819 install_element(ENABLE_NODE
, &debug_msdp_events_cmd
);
6820 install_element(ENABLE_NODE
, &no_debug_msdp_events_cmd
);
6821 install_element(ENABLE_NODE
, &debug_msdp_packets_cmd
);
6822 install_element(ENABLE_NODE
, &no_debug_msdp_packets_cmd
);
6823 install_element(ENABLE_NODE
, &debug_mtrace_cmd
);
6824 install_element(ENABLE_NODE
, &no_debug_mtrace_cmd
);
6825 install_element(ENABLE_NODE
, &debug_bsm_cmd
);
6826 install_element(ENABLE_NODE
, &no_debug_bsm_cmd
);
6828 install_element(CONFIG_NODE
, &debug_igmp_cmd
);
6829 install_element(CONFIG_NODE
, &no_debug_igmp_cmd
);
6830 install_element(CONFIG_NODE
, &debug_igmp_events_cmd
);
6831 install_element(CONFIG_NODE
, &no_debug_igmp_events_cmd
);
6832 install_element(CONFIG_NODE
, &debug_igmp_packets_cmd
);
6833 install_element(CONFIG_NODE
, &no_debug_igmp_packets_cmd
);
6834 install_element(CONFIG_NODE
, &debug_igmp_trace_cmd
);
6835 install_element(CONFIG_NODE
, &no_debug_igmp_trace_cmd
);
6836 install_element(CONFIG_NODE
, &debug_igmp_trace_detail_cmd
);
6837 install_element(CONFIG_NODE
, &no_debug_igmp_trace_detail_cmd
);
6838 install_element(CONFIG_NODE
, &debug_mroute_cmd
);
6839 install_element(CONFIG_NODE
, &debug_mroute_detail_cmd
);
6840 install_element(CONFIG_NODE
, &no_debug_mroute_cmd
);
6841 install_element(CONFIG_NODE
, &no_debug_mroute_detail_cmd
);
6842 install_element(CONFIG_NODE
, &debug_pim_static_cmd
);
6843 install_element(CONFIG_NODE
, &no_debug_pim_static_cmd
);
6844 install_element(CONFIG_NODE
, &debug_pim_cmd
);
6845 install_element(CONFIG_NODE
, &debug_pim_nht_cmd
);
6846 install_element(CONFIG_NODE
, &debug_pim_nht_det_cmd
);
6847 install_element(CONFIG_NODE
, &debug_pim_nht_rp_cmd
);
6848 install_element(CONFIG_NODE
, &no_debug_pim_nht_rp_cmd
);
6849 install_element(CONFIG_NODE
, &debug_pim_events_cmd
);
6850 install_element(CONFIG_NODE
, &debug_pim_packets_cmd
);
6851 install_element(CONFIG_NODE
, &debug_pim_packetdump_send_cmd
);
6852 install_element(CONFIG_NODE
, &debug_pim_packetdump_recv_cmd
);
6853 install_element(CONFIG_NODE
, &debug_pim_trace_cmd
);
6854 install_element(CONFIG_NODE
, &debug_pim_trace_detail_cmd
);
6855 install_element(CONFIG_NODE
, &debug_ssmpingd_cmd
);
6856 install_element(CONFIG_NODE
, &no_debug_ssmpingd_cmd
);
6857 install_element(CONFIG_NODE
, &debug_pim_zebra_cmd
);
6858 install_element(CONFIG_NODE
, &debug_pim_mlag_cmd
);
6859 install_element(CONFIG_NODE
, &no_debug_pim_mlag_cmd
);
6860 install_element(CONFIG_NODE
, &debug_pim_vxlan_cmd
);
6861 install_element(CONFIG_NODE
, &no_debug_pim_vxlan_cmd
);
6862 install_element(CONFIG_NODE
, &debug_msdp_cmd
);
6863 install_element(CONFIG_NODE
, &no_debug_msdp_cmd
);
6864 install_element(CONFIG_NODE
, &debug_msdp_events_cmd
);
6865 install_element(CONFIG_NODE
, &no_debug_msdp_events_cmd
);
6866 install_element(CONFIG_NODE
, &debug_msdp_packets_cmd
);
6867 install_element(CONFIG_NODE
, &no_debug_msdp_packets_cmd
);
6868 install_element(CONFIG_NODE
, &debug_mtrace_cmd
);
6869 install_element(CONFIG_NODE
, &no_debug_mtrace_cmd
);
6870 install_element(CONFIG_NODE
, &debug_bsm_cmd
);
6871 install_element(CONFIG_NODE
, &no_debug_bsm_cmd
);
6873 install_element(CONFIG_NODE
, &ip_msdp_timers_cmd
);
6874 install_element(VRF_NODE
, &ip_msdp_timers_cmd
);
6875 install_element(CONFIG_NODE
, &no_ip_msdp_timers_cmd
);
6876 install_element(VRF_NODE
, &no_ip_msdp_timers_cmd
);
6877 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_member_cmd
);
6878 install_element(VRF_NODE
, &ip_msdp_mesh_group_member_cmd
);
6879 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6880 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_member_cmd
);
6881 install_element(CONFIG_NODE
, &ip_msdp_mesh_group_source_cmd
);
6882 install_element(VRF_NODE
, &ip_msdp_mesh_group_source_cmd
);
6883 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6884 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_source_cmd
);
6885 install_element(CONFIG_NODE
, &no_ip_msdp_mesh_group_cmd
);
6886 install_element(VRF_NODE
, &no_ip_msdp_mesh_group_cmd
);
6887 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_cmd
);
6888 install_element(VIEW_NODE
, &show_ip_msdp_peer_detail_vrf_all_cmd
);
6889 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_cmd
);
6890 install_element(VIEW_NODE
, &show_ip_msdp_sa_detail_vrf_all_cmd
);
6891 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_cmd
);
6892 install_element(VIEW_NODE
, &show_ip_msdp_sa_sg_vrf_all_cmd
);
6893 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_cmd
);
6894 install_element(VIEW_NODE
, &show_ip_msdp_mesh_group_vrf_all_cmd
);
6895 install_element(VIEW_NODE
, &show_ip_pim_ssm_range_cmd
);
6896 install_element(VIEW_NODE
, &show_ip_pim_group_type_cmd
);
6897 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_cmd
);
6898 install_element(VIEW_NODE
, &show_ip_pim_vxlan_sg_work_cmd
);
6899 install_element(INTERFACE_NODE
, &interface_pim_use_source_cmd
);
6900 install_element(INTERFACE_NODE
, &interface_no_pim_use_source_cmd
);
6901 /* Install BSM command */
6902 install_element(INTERFACE_NODE
, &ip_pim_bsm_cmd
);
6903 install_element(INTERFACE_NODE
, &no_ip_pim_bsm_cmd
);
6904 install_element(INTERFACE_NODE
, &ip_pim_ucast_bsm_cmd
);
6905 install_element(INTERFACE_NODE
, &no_ip_pim_ucast_bsm_cmd
);
6906 /* Install BFD command */
6907 install_element(INTERFACE_NODE
, &ip_pim_bfd_cmd
);
6908 install_element(INTERFACE_NODE
, &ip_pim_bfd_param_cmd
);
6909 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_profile_cmd
);
6910 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_cmd
);
6912 install_element(INTERFACE_NODE
, &no_ip_pim_bfd_param_cmd
);
6913 #endif /* !HAVE_BFDD */