diff options
Diffstat (limited to 'lib/nexthop_group.c')
| -rw-r--r-- | lib/nexthop_group.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index ed22f64494..10f610db37 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -308,7 +308,7 @@ static void nhgc_delete(struct nexthop_group_cmd *nhgc) DEFINE_QOBJ_TYPE(nexthop_group_cmd) -DEFUN_NOSH(nexthop_group, nexthop_group_cmd, "nexthop-group NAME", +DEFUN_NOSH(nexthop_group, nexthop_group_cmd, "nexthop-group NHGNAME", "Enter into the nexthop-group submode\n" "Specify the NAME of the nexthop-group\n") { @@ -321,7 +321,7 @@ DEFUN_NOSH(nexthop_group, nexthop_group_cmd, "nexthop-group NAME", return CMD_SUCCESS; } -DEFUN_NOSH(no_nexthop_group, no_nexthop_group_cmd, "no nexthop-group NAME", +DEFUN_NOSH(no_nexthop_group, no_nexthop_group_cmd, "no nexthop-group NHGNAME", NO_STR "Delete the nexthop-group\n" "Specify the NAME of the nexthop-group\n") @@ -714,6 +714,19 @@ void nexthop_group_interface_state_change(struct interface *ifp, } } +static void nhg_name_autocomplete(vector comps, struct cmd_token *token) +{ + struct nexthop_group_cmd *nhgc; + + RB_FOREACH (nhgc, nhgc_entry_head, &nhgc_entries) { + vector_set(comps, XSTRDUP(MTYPE_COMPLETION, nhgc->name)); + } +} + +static const struct cmd_variable_handler nhg_name_handlers[] = { + {.tokenname = "NHGNAME", .completions = nhg_name_autocomplete}, + {.completions = NULL}}; + void nexthop_group_init(void (*new)(const char *name), void (*add_nexthop)(const struct nexthop_group_cmd *nhg, const struct nexthop *nhop), @@ -723,6 +736,8 @@ void nexthop_group_init(void (*new)(const char *name), { RB_INIT(nhgc_entry_head, &nhgc_entries); + cmd_variable_handler_register(nhg_name_handlers); + install_node(&nexthop_group_node, nexthop_group_write); install_element(CONFIG_NODE, &nexthop_group_cmd); install_element(CONFIG_NODE, &no_nexthop_group_cmd); |
