diff options
Diffstat (limited to 'tests/vty')
-rw-r--r-- | tests/vty/vty_transcript_test.c | 29 | ||||
-rw-r--r-- | tests/vty/vty_transcript_test.vty | 59 |
2 files changed, 86 insertions, 2 deletions
diff --git a/tests/vty/vty_transcript_test.c b/tests/vty/vty_transcript_test.c index abe37027..c9ecf186 100644 --- a/tests/vty/vty_transcript_test.c +++ b/tests/vty/vty_transcript_test.c @@ -232,6 +232,23 @@ DEFUN(cfg_attr_test, cfg_attr_test_cmd, return CMD_SUCCESS; } +DEFUN_DEPRECATED(cfg_attr_deprecated, + cfg_attr_deprecated_cmd, + "foo-deprecated", + "This command is deprecated\n") +{ + return CMD_WARNING; +} + +DEFUN_HIDDEN(cfg_attr_hidden, + cfg_attr_hidden_cmd, + "foo-hidden [expert-mode]", + "This command is hidden\n" + "But can be seen in the expert mode\n") +{ + return CMD_SUCCESS; +} + DEFUN_ATTR(cfg_attr_immediate, cfg_attr_immediate_cmd, "foo-immediate", "Applies immediately\n", @@ -293,6 +310,15 @@ DEFUN_USRATTR(cfg_app_attr_unbelievable_wonderful, return CMD_SUCCESS; } +DEFUN_ATTR_USRATTR(cfg_attr_hidden_app_attr_unbelievable, + cfg_attr_hidden_app_attr_unbelievable_cmd, + CMD_ATTR_HIDDEN, X(TEST_ATTR_UNBELIEVABLE), + "app-hidden-unbelievable", + "Hidden, but still unbelievable help message\n") +{ + return CMD_SUCCESS; +} + static void init_vty_cmds() { install_element_ve(&single0_cmd); @@ -302,6 +328,8 @@ static void init_vty_cmds() install_element(CONFIG_NODE, &cfg_attr_test_cmd); install_node(&attr_test_node, NULL); + install_element(ATTR_TEST_NODE, &cfg_attr_deprecated_cmd); + install_element(ATTR_TEST_NODE, &cfg_attr_hidden_cmd); install_element(ATTR_TEST_NODE, &cfg_attr_immediate_cmd); install_element(ATTR_TEST_NODE, &cfg_attr_node_exit_cmd); @@ -311,6 +339,7 @@ static void init_vty_cmds() install_element(ATTR_TEST_NODE, &cfg_app_attr_unbelievable_magnificent_cmd); install_element(ATTR_TEST_NODE, &cfg_app_attr_unbelievable_wonderful_cmd); + install_element(ATTR_TEST_NODE, &cfg_attr_hidden_app_attr_unbelievable_cmd); } int main(int argc, char **argv) diff --git a/tests/vty/vty_transcript_test.vty b/tests/vty/vty_transcript_test.vty index 2c618d89..7b8241eb 100644 --- a/tests/vty/vty_transcript_test.vty +++ b/tests/vty/vty_transcript_test.vty @@ -87,6 +87,7 @@ ok argc=0 vty_transcript_test> show vty-attributes Global attributes: + ^ This command is hidden (check expert mode) ! This command applies immediately @ This command applies on VTY node exit Library specific attributes: @@ -104,7 +105,7 @@ vty_transcript_test# configure terminal vty_transcript_test(config)# attribute-test vty_transcript_test(config-attr-test)# list -... +... !foo-(hidden|deprecated) foo-immediate foo-node-exit app-unbelievable @@ -112,9 +113,53 @@ vty_transcript_test(config-attr-test)# list app-wonderful app-unbelievable-magnificent app-unbelievable-wonderful +... !app-hidden-* vty_transcript_test(config-attr-test)# list with-flags -... +... !foo-(hidden|deprecated) + ! ... foo-immediate + @ ... foo-node-exit + . u.. app-unbelievable + . .m. app-magnificent + . ..w app-wonderful + . um. app-unbelievable-magnificent + . u.w app-unbelievable-wonderful +... !app-hidden-* + +vty_transcript_test(config-attr-test)# foo-deprecated? +% There is no matched command. +vty_transcript_test(config-attr-test)# foo-hidden? +% There is no matched command. +vty_transcript_test(config-attr-test)# app-hidden-unbelievable? +% There is no matched command. + +vty_transcript_test(config-attr-test)# end +vty_transcript_test# disable + +vty_transcript_test> enable? + enable Turn on privileged mode command +vty_transcript_test> enable ? + [expert-mode] Enable the expert mode (show hidden commands) + +vty_transcript_test> enable expert-mode +vty_transcript_test# configure terminal +vty_transcript_test(config)# attribute-test + +vty_transcript_test(config-attr-test)# list +... !foo-deprected + foo-hidden [expert-mode] + foo-immediate + foo-node-exit + app-unbelievable + app-magnificent + app-wonderful + app-unbelievable-magnificent + app-unbelievable-wonderful + app-hidden-unbelievable + +vty_transcript_test(config-attr-test)# list with-flags +... !foo-deprected + ^ ... foo-hidden [expert-mode] ! ... foo-immediate @ ... foo-node-exit . u.. app-unbelievable @@ -122,3 +167,13 @@ vty_transcript_test(config-attr-test)# list with-flags . ..w app-wonderful . um. app-unbelievable-magnificent . u.w app-unbelievable-wonderful + ^ u.. app-hidden-unbelievable + +vty_transcript_test(config-attr-test)# foo-deprecated? +% There is no matched command. +vty_transcript_test(config-attr-test)# foo-hidden? + foo-hidden This command is hidden +vty_transcript_test(config-attr-test)# foo-hidden ? + [expert-mode] But can be seen in the expert mode +vty_transcript_test(config-attr-test)# app-hidden-unbelievable? + app-hidden-unbelievable Hidden, but still unbelievable help message |