vtysh: Add support of new link-params CLI
In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 69e9888..fe86083 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -777,6 +777,12 @@
"%s(config-keychain-key)# "
};
+struct cmd_node link_params_node =
+{
+ LINK_PARAMS_NODE,
+ "%s(config-link-params)# ",
+};
+
/* Defined in lib/vty.c */
extern struct cmd_node vty_node;
@@ -1144,6 +1150,9 @@
case KEYCHAIN_KEY_NODE:
vty->node = KEYCHAIN_NODE;
break;
+ case LINK_PARAMS_NODE:
+ vty->node = INTERFACE_NODE;
+ break;
default:
break;
}
@@ -1444,6 +1453,17 @@
return ret;
}
+DEFUNSH (VTYSH_ZEBRA,
+ vtysh_link_params,
+ vtysh_link_params_cmd,
+ "link-params",
+ LINK_PARAMS_STR
+ )
+{
+ vty->node = LINK_PARAMS_NODE;
+ return CMD_SUCCESS;
+}
+
/* Memory */
DEFUN (vtysh_show_memory,
vtysh_show_memory_cmd,
@@ -2394,6 +2414,7 @@
install_node (&bgp_node, NULL);
install_node (&rip_node, NULL);
install_node (&interface_node, NULL);
+ install_node (&link_params_node, NULL);
install_node (&rmap_node, NULL);
install_node (&zebra_node, NULL);
install_node (&bgp_vpnv4_node, NULL);
@@ -2423,6 +2444,7 @@
vtysh_install_default (BGP_NODE);
vtysh_install_default (RIP_NODE);
vtysh_install_default (INTERFACE_NODE);
+ vtysh_install_default (LINK_PARAMS_NODE);
vtysh_install_default (RMAP_NODE);
vtysh_install_default (ZEBRA_NODE);
vtysh_install_default (BGP_VPNV4_NODE);
@@ -2517,6 +2539,8 @@
install_element (INTERFACE_NODE, &no_interface_desc_cmd);
install_element (INTERFACE_NODE, &vtysh_end_all_cmd);
install_element (INTERFACE_NODE, &vtysh_exit_interface_cmd);
+ install_element (LINK_PARAMS_NODE, &vtysh_end_all_cmd);
+ install_element (LINK_PARAMS_NODE, &vtysh_exit_interface_cmd);
install_element (INTERFACE_NODE, &vtysh_quit_interface_cmd);
install_element (CONFIG_NODE, &router_rip_cmd);
#ifdef HAVE_IPV6
@@ -2559,6 +2583,7 @@
install_element (CONFIG_NODE, &vtysh_no_interface_cmd);
install_element (CONFIG_NODE, &vtysh_interface_vrf_cmd);
install_element (CONFIG_NODE, &vtysh_no_interface_vrf_cmd);
+ install_element (INTERFACE_NODE, &vtysh_link_params_cmd);
install_element (ENABLE_NODE, &vtysh_show_running_config_cmd);
install_element (ENABLE_NODE, &vtysh_show_running_config_daemon_cmd);
install_element (ENABLE_NODE, &vtysh_copy_runningconfig_startupconfig_cmd);