vtysh: change logical router node name

The logical router node goes from NS_NODE to LOGICALROUTER_NODE.
Vty commands are renamed accordingly.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2018-02-05 16:36:13 +01:00
parent 736d41ad74
commit f5d20fdb4e
4 changed files with 33 additions and 16 deletions

View File

@ -147,7 +147,7 @@ vtysh_cmd_FILES = $(vtysh_scan) \
$(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c \
$(top_srcdir)/lib/vrf.c \
$(top_srcdir)/lib/vty.c $(top_srcdir)/zebra/debug.c \
$(top_srcdir)/lib/ns.c \
$(top_srcdir)/lib/logicalrouter.c \
$(top_srcdir)/zebra/interface.c \
$(top_srcdir)/zebra/irdp_interface.c \
$(top_srcdir)/zebra/rtadv.c $(top_srcdir)/zebra/zebra_vty.c \

View File

@ -87,6 +87,9 @@ foreach (@ARGV) {
elsif ($file =~ /lib\/vrf\.c$/) {
$protocol = "VTYSH_ALL";
}
elsif ($file =~ /lib\/logicalrouter\.c$/) {
$protocol = "VTYSH_ALL";
}
elsif ($file =~ /lib\/filter\.c$/) {
$protocol = "VTYSH_ALL";
}

View File

@ -975,8 +975,8 @@ static struct cmd_node pw_node = {
PW_NODE, "%s(config-pw)# ",
};
static struct cmd_node ns_node = {
NS_NODE, "%s(config-logical-router)# ",
static struct cmd_node logicalrouter_node = {
LOGICALROUTER_NODE, "%s(config-logical-router)# ",
};
static struct cmd_node vrf_node = {
@ -1508,7 +1508,7 @@ static int vtysh_exit(struct vty *vty)
break;
case INTERFACE_NODE:
case PW_NODE:
case NS_NODE:
case LOGICALROUTER_NODE:
case VRF_NODE:
case ZEBRA_NODE:
case BGP_NODE:
@ -1782,16 +1782,25 @@ DEFSH(VTYSH_ZEBRA, vtysh_no_interface_vrf_cmd, "no interface IFNAME vrf NAME",
"Delete a pseudo interface's configuration\n"
"Interface's name\n" VRF_CMD_HELP_STR)
DEFUNSH(VTYSH_NS, vtysh_ns, vtysh_ns_cmd, "logical-router (1-65535) ns NAME",
DEFUNSH(VTYSH_ZEBRA, vtysh_logicalrouter, vtysh_logicalrouter_cmd,
"logical-router (1-65535) ns NAME",
"Enable a logical-router\n"
"Specify the logical-router indentifier\n"
"The Name Space\n"
"The file name in " NS_RUN_DIR ", or a full pathname\n")
{
vty->node = NS_NODE;
vty->node = LOGICALROUTER_NODE;
return CMD_SUCCESS;
}
DEFSH(VTYSH_ZEBRA, vtysh_no_logicalrouter_cmd,
"no logical-router (1-65535) ns NAME",
NO_STR
"Enable a Logical-Router\n"
"Specify the Logical-Router identifier\n"
"The Name Space\n"
"The file name in " NS_RUN_DIR ", or a full pathname\n")
DEFUNSH(VTYSH_VRF, vtysh_vrf, vtysh_vrf_cmd, "vrf NAME",
"Select a VRF to configure\n"
"VRF's name\n")
@ -1804,16 +1813,18 @@ DEFSH(VTYSH_ZEBRA, vtysh_no_vrf_cmd, "no vrf NAME", NO_STR
"Delete a pseudo vrf's configuration\n"
"VRF's name\n")
DEFUNSH(VTYSH_NS, vtysh_exit_ns, vtysh_exit_ns_cmd, "exit",
DEFUNSH(VTYSH_NS, vtysh_exit_logicalrouter,
vtysh_exit_logicalrouter_cmd, "exit",
"Exit current mode and down to previous mode\n")
{
return vtysh_exit(vty);
}
DEFUNSH(VTYSH_NS, vtysh_quit_ns, vtysh_quit_ns_cmd, "quit",
DEFUNSH(VTYSH_NS, vtysh_quit_logicalrouter,
vtysh_quit_logicalrouter_cmd, "quit",
"Exit current mode and down to previous mode\n")
{
return vtysh_exit_ns(self, vty, argc, argv);
return vtysh_exit_logicalrouter(self, vty, argc, argv);
}
DEFUNSH(VTYSH_VRF, vtysh_exit_vrf, vtysh_exit_vrf_cmd, "exit",
@ -3055,7 +3066,7 @@ void vtysh_init_vty(void)
install_node(&interface_node, NULL);
install_node(&pw_node, NULL);
install_node(&link_params_node, NULL);
install_node(&ns_node, NULL);
install_node(&logicalrouter_node, NULL);
install_node(&vrf_node, NULL);
install_node(&rmap_node, NULL);
install_node(&zebra_node, NULL);
@ -3233,11 +3244,14 @@ void vtysh_init_vty(void)
install_element(PW_NODE, &vtysh_exit_interface_cmd);
install_element(PW_NODE, &vtysh_quit_interface_cmd);
install_element(NS_NODE, &vtysh_end_all_cmd);
install_element(LOGICALROUTER_NODE, &vtysh_end_all_cmd);
install_element(CONFIG_NODE, &vtysh_ns_cmd);
install_element(NS_NODE, &vtysh_exit_ns_cmd);
install_element(NS_NODE, &vtysh_quit_ns_cmd);
install_element(CONFIG_NODE, &vtysh_logicalrouter_cmd);
install_element(CONFIG_NODE, &vtysh_no_logicalrouter_cmd);
install_element(LOGICALROUTER_NODE,
&vtysh_exit_logicalrouter_cmd);
install_element(LOGICALROUTER_NODE,
&vtysh_quit_logicalrouter_cmd);
install_element(VRF_NODE, &vtysh_end_all_cmd);
install_element(VRF_NODE, &vtysh_exit_vrf_cmd);

View File

@ -187,7 +187,7 @@ void vtysh_config_parse_line(void *arg, const char *line)
config->index = INTERFACE_NODE;
} else if (config->index == RMAP_NODE
|| config->index == INTERFACE_NODE
|| config->index == NS_NODE
|| config->index == LOGICALROUTER_NODE
|| config->index == VTY_NODE
|| config->index == VRF_NODE)
config_add_line_uniq(config->line, line);
@ -202,7 +202,7 @@ void vtysh_config_parse_line(void *arg, const char *line)
else if (strncmp(line, "pseudowire", strlen("pseudowire")) == 0)
config = config_get(PW_NODE, line);
else if (strncmp(line, "logical-router", strlen("ns")) == 0)
config = config_get(NS_NODE, line);
config = config_get(LOGICALROUTER_NODE, line);
else if (strncmp(line, "vrf", strlen("vrf")) == 0)
config = config_get(VRF_NODE, line);
else if (strncmp(line, "router-id", strlen("router-id")) == 0)