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")
{
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")
}
}
+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),
{
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);
"The file name in " NS_RUN_DIR ", or a full pathname\n")
DEFUNSH(VTYSH_PBRD | VTYSH_SHARPD, vtysh_nexthop_group, vtysh_nexthop_group_cmd,
- "nexthop-group NAME",
+ "nexthop-group NHGNAME",
"Nexthop Group configuration\n"
"Name of the Nexthop Group\n")
{
}
DEFSH(VTYSH_PBRD | VTYSH_SHARPD, vtysh_no_nexthop_group_cmd,
- "no nexthop-group NAME",
+ "no nexthop-group NHGNAME",
NO_STR
"Nexthop Group Configuration\n"
"Name of the Nexthop Group\n")