summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorNathan Bahr <nbahr@atcorp.com>2024-10-30 21:16:30 +0000
committerNathan Bahr <nbahr@atcorp.com>2025-01-09 21:58:22 +0000
commit8b00575fbb358bc214a9281c948cb0d703aa7605 (patch)
treef503c99acd0fcffe72fa529f20640edbb6728236 /pimd/pim_cmd.c
parent7e3d4048a69b3cd178c0d6ec4ebb7919bdcf94a1 (diff)
pimd,yang: Expand rpf-lookup-mode command
Add options for group-list and source-list, both of which take a prefix list name. The prefix list is used to determine the lookup mode for specific sources and/or groups. Any number of lookup modes can be configured as long as the combination of group and source list is unique. A global lookup mode (empty group and source lists) is always added and defaults to mrib-then-urib as it currently functions. The global lookup mode can be changed as it current exists with the command `rpf-lookup-mode MODE`. When determinig which mode to use, match source (and group if provided) against the lists, if they are set. If a lookup does not specify a group, then only use lookup modes that do not have a group list defined. A lookup by definition will have a source, so no special handling there. Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index a34fb344fe..30baa6a2a4 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -8878,21 +8878,31 @@ done:
}
DEFPY_YANG(pim_rpf_lookup_mode, pim_rpf_lookup_mode_cmd,
- "[no] rpf-lookup-mode ![urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix]$mode",
+ "[no] rpf-lookup-mode\
+ ![urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix]$mode\
+ [{group-list PREFIX_LIST$grp_list|source-list PREFIX_LIST$src_list}]",
NO_STR
"RPF lookup behavior\n"
"Lookup in unicast RIB only\n"
"Lookup in multicast RIB only\n"
"Try multicast RIB first, fall back to unicast RIB\n"
"Lookup both, use entry with lower distance\n"
- "Lookup both, use entry with longer prefix\n")
-{
- if (no)
- nb_cli_enqueue_change(vty, "./mcast-rpf-lookup", NB_OP_DESTROY, NULL);
- else
- nb_cli_enqueue_change(vty, "./mcast-rpf-lookup", NB_OP_MODIFY, mode);
+ "Lookup both, use entry with longer prefix\n"
+ "Set a specific mode matching group\n"
+ "Multicast group prefix list\n"
+ "Set a specific mode matching source address\n"
+ "Source address prefix list\n")
+{
+ if (no) {
+ nb_cli_enqueue_change(vty, "./mode", NB_OP_DESTROY, NULL);
+ nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
+ } else {
+ nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
+ nb_cli_enqueue_change(vty, "./mode", NB_OP_MODIFY, mode);
+ }
- return nb_cli_apply_changes(vty, NULL);
+ return nb_cli_apply_changes(vty, "./mcast-rpf-lookup[group-list='%s'][source-list='%s']",
+ (grp_list ? grp_list : ""), (src_list ? src_list : ""));
}
struct cmd_node pim_node = {