lib: Support auto completion of configured keychain.

Problem Statement:
=================
When modules use keychain there is no option for auto completion
of configured keychains.

RCA:
====
Not implemented.

Fix:
====
Changes to support auto completion of configured keychain names.

Risk:
=====
Low risk

Tests Executed:
===============
Have tested auto completion of configured keychain names with newly
implemented auth CLI.

frr(config-if)# ipv6 ospf6 authentication keychain
  KEYCHAIN_NAME  Keychain name
     abcd pqr 12345

Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
This commit is contained in:
Abhinay Ramesh 2021-05-11 08:43:25 +00:00
parent b564209367
commit 166f9103d3

View File

@ -1051,10 +1051,28 @@ static int keychain_config_write(struct vty *vty)
return 0;
}
static void keychain_active_config(vector comps, struct cmd_token *token)
{
struct keychain *keychain;
struct listnode *node;
for (ALL_LIST_ELEMENTS_RO(keychain_list, node, keychain))
vector_set(comps, XSTRDUP(MTYPE_COMPLETION, keychain->name));
}
static const struct cmd_variable_handler keychain_var_handlers[] = {
{.varname = "key_chain", .completions = keychain_active_config},
{.tokenname = "KEYCHAIN_NAME", .completions = keychain_active_config},
{.tokenname = "KCHAIN_NAME", .completions = keychain_active_config},
{.completions = NULL}
};
void keychain_init(void)
{
keychain_list = list_new();
/* Register handler for keychain auto config support */
cmd_variable_handler_register(keychain_var_handlers);
install_node(&keychain_node);
install_node(&keychain_key_node);