diff options
author | Abhinay Ramesh <rabhinay@vmware.com> | 2021-05-11 10:43:25 +0200 |
---|---|---|
committer | Abhinay Ramesh <rabhinay@vmware.com> | 2022-02-09 02:49:14 +0100 |
commit | 166f9103d3e97f84d32e0e176beac79daa0b1d33 (patch) | |
tree | 436bc0e95cd31daba4d5d1c5ebe2d33344764643 | |
parent | Merge pull request #8458 from opensourcerouting/xref-5424 (diff) | |
download | frr-166f9103d3e97f84d32e0e176beac79daa0b1d33.tar.xz frr-166f9103d3e97f84d32e0e176beac79daa0b1d33.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | lib/keychain.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/keychain.c b/lib/keychain.c index 02f83ef0a..1d678b949 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -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); |