*: move CLI node names to cmd_node->name

And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2018-09-09 00:15:50 +02:00 committed by David Lamparter
parent 243895805a
commit f4b8291fcb
55 changed files with 178 additions and 95 deletions

View File

@ -60,6 +60,7 @@ static void babel_interface_free (babel_interface_nfo *bi);
static vector babel_enable_if; /* enable interfaces (by cmd). */
static int interface_config_write(struct vty *vty);
static struct cmd_node babel_interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",

View File

@ -72,6 +72,7 @@ static time_t source_expiry_time;
static int babel_config_write (struct vty *vty);
static struct cmd_node cmd_babel_node =
{
.name = "babel",
.node = BABEL_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",

View File

@ -887,6 +887,7 @@ DEFUN_NOSH(show_debugging_bfd,
static int bfdd_write_config(struct vty *vty);
struct cmd_node bfd_node = {
.name = "bfd",
.node = BFD_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-bfd)# ",
@ -894,6 +895,7 @@ struct cmd_node bfd_node = {
};
struct cmd_node bfd_peer_node = {
.name = "bfd peer",
.node = BFD_PEER_NODE,
.parent_node = BFD_NODE,
.prompt = "%s(config-bfd-peer)# ",

View File

@ -1773,6 +1773,7 @@ static void bmp_active_setup(struct bmp_active *ba)
}
static struct cmd_node bmp_node = {
.name = "bmp",
.node = BMP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-bgp-bmp)# "

View File

@ -2284,6 +2284,7 @@ static int bgp_config_write_debug(struct vty *vty)
static int bgp_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = bgp_config_write_debug,

View File

@ -780,6 +780,7 @@ DEFUN (no_dump_bgp_all,
static int config_write_bgp_dump(struct vty *vty);
/* BGP node structure. */
static struct cmd_node bgp_dump_node = {
.name = "dump",
.node = DUMP_NODE,
.prompt = "",
.config_write = config_write_bgp_dump,

View File

@ -669,6 +669,7 @@ static int config_write_as_list(struct vty *vty)
static int config_write_as_list(struct vty *vty);
static struct cmd_node as_list_node = {
.name = "as list",
.node = AS_LIST_NODE,
.prompt = "",
.config_write = config_write_as_list,

View File

@ -144,6 +144,7 @@ static int rpki_sync_socket_rtr;
static int rpki_sync_socket_bgpd;
static struct cmd_node rpki_node = {
.name = "rpki",
.node = RPKI_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-rpki)# ",

View File

@ -15335,6 +15335,7 @@ int bgp_config_write(struct vty *vty)
/* BGP node structure. */
static struct cmd_node bgp_node = {
.name = "bgp",
.node = BGP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
@ -15342,72 +15343,84 @@ static struct cmd_node bgp_node = {
};
static struct cmd_node bgp_ipv4_unicast_node = {
.name = "bgp ipv4 unicast",
.node = BGP_IPV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_multicast_node = {
.name = "bgp ipv4 multicast",
.node = BGP_IPV4M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_labeled_unicast_node = {
.name = "bgp ipv4 labeled unicast",
.node = BGP_IPV4L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_unicast_node = {
.name = "bgp ipv6",
.node = BGP_IPV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_multicast_node = {
.name = "bgp ipv6 multicast",
.node = BGP_IPV6M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_labeled_unicast_node = {
.name = "bgp ipv6 labeled unicast",
.node = BGP_IPV6L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vpnv4_node = {
.name = "bgp vpnv4",
.node = BGP_VPNV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vpnv6_node = {
.name = "bgp vpnv6",
.node = BGP_VPNV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
};
static struct cmd_node bgp_evpn_node = {
.name = "bgp evpn",
.node = BGP_EVPN_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-evpn)# ",
};
static struct cmd_node bgp_evpn_vni_node = {
.name = "bgp evpn vni",
.node = BGP_EVPN_VNI_NODE,
.parent_node = BGP_EVPN_NODE,
.prompt = "%s(config-router-af-vni)# ",
};
static struct cmd_node bgp_flowspecv4_node = {
.name = "bgp ipv4 flowspec",
.node = BGP_FLOWSPECV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv6_node = {
.name = "bgp ipv6 flowspec",
.node = BGP_FLOWSPECV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
@ -17893,6 +17906,7 @@ static int community_list_config_write(struct vty *vty)
static int community_list_config_write(struct vty *vty);
static struct cmd_node community_list_node = {
.name = "community list",
.node = COMMUNITY_LIST_NODE,
.prompt = "",
.config_write = community_list_config_write,

View File

@ -2965,12 +2965,14 @@ DEFUN_NOSH (exit_vnc,
}
static struct cmd_node bgp_vnc_defaults_node = {
.name = "bgp vnc defaults",
.node = BGP_VNC_DEFAULTS_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
};
static struct cmd_node bgp_vnc_nve_group_node = {
.name = "bgp vnc nve",
.node = BGP_VNC_NVE_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
@ -3394,6 +3396,7 @@ DEFUN_NOSH (exit_vrf_policy,
}
static struct cmd_node bgp_vrf_policy_node = {
.name = "bgp vrf policy",
.node = BGP_VRF_POLICY_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
@ -3633,6 +3636,7 @@ DEFUN (vnc_l2_group_rt,
static struct cmd_node bgp_vnc_l2_group_node = {
.name = "bgp vnc l2",
.node = BGP_VNC_L2_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",

View File

@ -175,6 +175,7 @@ static int bgp_vnc_config_write_debug(struct vty *vty)
static int bgp_vnc_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
.name = "vnc debug",
.node = DEBUG_VNC_NODE,
.prompt = "",
.config_write = bgp_vnc_config_write_debug,

View File

@ -840,6 +840,7 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode,
*/
static int eigrp_config_write(struct vty *vty);
static struct cmd_node eigrp_node = {
.name = "eigrp",
.node = EIGRP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
@ -862,6 +863,7 @@ static int eigrp_config_write(struct vty *vty)
static int eigrp_write_interface(struct vty *vty);
static struct cmd_node eigrp_interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",

View File

@ -557,6 +557,7 @@ DEFUN (no_debug_eigrp_packets,
/* Debug node. */
static int config_write_debug(struct vty *vty);
static struct cmd_node eigrp_debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,

View File

@ -1335,6 +1335,7 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
}
struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",

View File

@ -786,6 +786,7 @@ DEFUN_NOSH (show_debugging,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
@ -2128,6 +2129,13 @@ static int isis_config_write(struct vty *vty)
return write;
}
struct cmd_node router_node = {
.name = "openfabric",
.node = OPENFABRIC_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
.config_write = isis_config_write,
};
#else
/* IS-IS configuration write function */
static int isis_config_write(struct vty *vty)
@ -2143,14 +2151,15 @@ static int isis_config_write(struct vty *vty)
return write;
}
#endif /* ifdef FABRICD */
struct cmd_node router_node = {
.node = ROUTER_NODE,
.name = "isis",
.node = ISIS_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
.config_write = isis_config_write,
};
#endif /* ifdef FABRICD */
void isis_init(void)
{

View File

@ -33,6 +33,7 @@ static int ldp_debug_config_write(struct vty *);
/* Debug node. */
struct cmd_node ldp_debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = ldp_debug_config_write,

View File

@ -40,6 +40,7 @@ static int ldp_vty_get_af(struct vty *);
static int ldp_iface_is_configured(struct ldpd_conf *, const char *);
struct cmd_node ldp_node = {
.name = "ldp",
.node = LDP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ldp)# ",
@ -47,30 +48,35 @@ struct cmd_node ldp_node = {
};
struct cmd_node ldp_ipv4_node = {
.name = "ldp ipv4",
.node = LDP_IPV4_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
struct cmd_node ldp_ipv6_node = {
.name = "ldp ipv6",
.node = LDP_IPV6_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
struct cmd_node ldp_ipv4_iface_node = {
.name = "ldp ipv4 interface",
.node = LDP_IPV4_IFACE_NODE,
.parent_node = LDP_IPV4_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
struct cmd_node ldp_ipv6_iface_node = {
.name = "ldp ipv6 interface",
.node = LDP_IPV6_IFACE_NODE,
.parent_node = LDP_IPV6_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
struct cmd_node ldp_l2vpn_node = {
.name = "ldp l2vpn",
.node = LDP_L2VPN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-l2vpn)# ",
@ -78,6 +84,7 @@ struct cmd_node ldp_l2vpn_node = {
};
struct cmd_node ldp_pseudowire_node = {
.name = "ldp",
.node = LDP_PSEUDOWIRE_NODE,
.parent_node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn-pw)# ",

View File

@ -160,6 +160,7 @@ static void agentx_events_update(void)
/* AgentX node. */
static int config_write_agentx(struct vty *vty);
static struct cmd_node agentx_node = {
.name = "smux",
.node = SMUX_NODE,
.prompt = "",
.config_write = config_write_agentx,

View File

@ -73,86 +73,6 @@ const struct message tokennames[] = {
item(END_TKN),
{0},
};
const char *const node_names[] = {
"auth", // AUTH_NODE,
"view", // VIEW_NODE,
"auth enable", // AUTH_ENABLE_NODE,
"enable", // ENABLE_NODE,
"config", // CONFIG_NODE,
"debug", // DEBUG_NODE,
"vrf debug", // VRF_DEBUG_NODE,
"northbound debug", // NORTHBOUND_DEBUG_NODE,
"vnc debug", // DEBUG_VNC_NODE,
"route-map debug", /* RMAP_DEBUG_NODE */
"resolver debug", /* RESOLVER_DEBUG_NODE */
"aaa", // AAA_NODE,
"keychain", // KEYCHAIN_NODE,
"keychain key", // KEYCHAIN_KEY_NODE,
"static ip", // IP_NODE,
"vrf", // VRF_NODE,
"interface", // INTERFACE_NODE,
"nexthop-group", // NH_GROUP_NODE,
"zebra", // ZEBRA_NODE,
"table", // TABLE_NODE,
"rip", // RIP_NODE,
"ripng", // RIPNG_NODE,
"babel", // BABEL_NODE,
"eigrp", // EIGRP_NODE,
"bgp", // BGP_NODE,
"bgp vpnv4", // BGP_VPNV4_NODE,
"bgp vpnv6", // BGP_VPNV6_NODE,
"bgp ipv4 unicast", // BGP_IPV4_NODE,
"bgp ipv4 multicast", // BGP_IPV4M_NODE,
"bgp ipv4 labeled unicast", // BGP_IPV4L_NODE,
"bgp ipv6", // BGP_IPV6_NODE,
"bgp ipv6 multicast", // BGP_IPV6M_NODE,
"bgp ipv6 labeled unicast", // BGP_IPV6L_NODE,
"bgp vrf policy", // BGP_VRF_POLICY_NODE,
"bgp vnc defaults", // BGP_VNC_DEFAULTS_NODE,
"bgp vnc nve", // BGP_VNC_NVE_GROUP_NODE,
"bgp vnc l2", // BGP_VNC_L2_GROUP_NODE,
"rfp defaults", // RFP_DEFAULTS_NODE,
"bgp evpn", // BGP_EVPN_NODE,
"ospf", // OSPF_NODE,
"ospf6", // OSPF6_NODE,
"ldp", // LDP_NODE,
"ldp ipv4", // LDP_IPV4_NODE,
"ldp ipv6", // LDP_IPV6_NODE,
"ldp ipv4 interface", // LDP_IPV4_IFACE_NODE,
"ldp ipv6 interface", // LDP_IPV6_IFACE_NODE,
"ldp l2vpn", // LDP_L2VPN_NODE,
"ldp", // LDP_PSEUDOWIRE_NODE,
"isis", // ISIS_NODE,
"ipv4 access list", // ACCESS_NODE,
"ipv4 prefix list", // PREFIX_NODE,
"ipv6 access list", // ACCESS_IPV6_NODE,
"MAC access list", // ACCESS_MAC_NODE,
"ipv6 prefix list", // PREFIX_IPV6_NODE,
"as list", // AS_LIST_NODE,
"community list", // COMMUNITY_LIST_NODE,
"routemap", // RMAP_NODE,
"pbr-map", // PBRMAP_NODE,
"smux", // SMUX_NODE,
"dump", // DUMP_NODE,
"forwarding", // FORWARDING_NODE,
"protocol", // PROTOCOL_NODE,
"mpls", // MPLS_NODE,
"pw", // PW_NODE,
"vty", // VTY_NODE,
"link-params", // LINK_PARAMS_NODE,
"bgp evpn vni", // BGP_EVPN_VNI_NODE,
"rpki", // RPKI_NODE
"bgp ipv4 flowspec", /* BGP_FLOWSPECV4_NODE
*/
"bgp ipv6 flowspec", /* BGP_FLOWSPECV6_NODE
*/
"bfd", /* BFD_NODE */
"bfd peer", /* BFD_PEER_NODE */
"openfabric", // OPENFABRIC_NODE
"vrrp", /* VRRP_NODE */
"bmp", /* BMP_NODE */
};
/* clang-format on */
/* Command vector which includes some level of command lists. Normally
@ -181,27 +101,32 @@ const char *cmd_domainname_get(void)
/* Standard command node structures. */
static struct cmd_node auth_node = {
.name = "auth",
.node = AUTH_NODE,
.prompt = "Password: ",
};
static struct cmd_node view_node = {
.name = "view",
.node = VIEW_NODE,
.prompt = "%s> ",
};
static struct cmd_node auth_enable_node = {
.name = "auth enable",
.node = AUTH_ENABLE_NODE,
.prompt = "Password: ",
};
static struct cmd_node enable_node = {
.name = "enable",
.node = ENABLE_NODE,
.prompt = "%s# ",
};
static int config_write_host(struct vty *vty);
static struct cmd_node config_node = {
.name = "config",
.node = CONFIG_NODE,
.parent_node = ENABLE_NODE,
.prompt = "%s(config)# ",
@ -395,9 +320,9 @@ void install_element(enum node_type ntype, const struct cmd_element *cmd)
if (cnode == NULL) {
fprintf(stderr,
"%s[%s]:\n"
"\tnode %d (%s) does not exist.\n"
"\tnode %d does not exist.\n"
"\tplease call install_node() before install_element()\n",
cmd->name, cmd->string, ntype, node_names[ntype]);
cmd->name, cmd->string, ntype);
exit(EXIT_FAILURE);
}
@ -406,7 +331,7 @@ void install_element(enum node_type ntype, const struct cmd_element *cmd)
"%s[%s]:\n"
"\tnode %d (%s) already has this command installed.\n"
"\tduplicate install_element call?\n",
cmd->name, cmd->string, ntype, node_names[ntype]);
cmd->name, cmd->string, ntype, cnode->name);
return;
}
@ -444,9 +369,9 @@ void uninstall_element(enum node_type ntype, const struct cmd_element *cmd)
if (cnode == NULL) {
fprintf(stderr,
"%s[%s]:\n"
"\tnode %d (%s) does not exist.\n"
"\tnode %d does not exist.\n"
"\tplease call install_node() before uninstall_element()\n",
cmd->name, cmd->string, ntype, node_names[ntype]);
cmd->name, cmd->string, ntype);
exit(EXIT_FAILURE);
}
@ -455,7 +380,7 @@ void uninstall_element(enum node_type ntype, const struct cmd_element *cmd)
"%s[%s]:\n"
"\tnode %d (%s) does not have this command installed.\n"
"\tduplicate uninstall_element call?\n",
cmd->name, cmd->string, ntype, node_names[ntype]);
cmd->name, cmd->string, ntype, cnode->name);
return;
}
@ -2745,7 +2670,7 @@ DEFUN(find,
if (regexec(&exp, cli->string, 0, NULL, 0) == 0)
vty_out(vty, " (%s) %s\n",
node_names[node->node], cli->string);
node->name, cli->string);
}
}
@ -2793,9 +2718,6 @@ void cmd_init(int terminal)
{
struct utsname names;
if (array_size(node_names) != NODE_TYPE_MAX)
assert(!"Update the CLI node description array!");
uname(&names);
qobj_init();

View File

@ -165,11 +165,12 @@ enum node_type {
extern vector cmdvec;
extern const struct message tokennames[];
extern const char *const node_names[];
/* Node which has some commands and prompt string and configuration
function pointer . */
struct cmd_node {
const char *name;
/* Node index. */
enum node_type node;
enum node_type parent_node;

View File

@ -2814,6 +2814,7 @@ static int config_write_access(struct vty *vty, afi_t afi)
static int config_write_access_mac(struct vty *vty);
static struct cmd_node access_mac_node = {
.name = "MAC access list",
.node = ACCESS_MAC_NODE,
.prompt = "",
.config_write = config_write_access_mac,
@ -2868,6 +2869,7 @@ static void access_list_init_mac(void)
/* Access-list node. */
static int config_write_access_ipv4(struct vty *vty);
static struct cmd_node access_node = {
.name = "ipv4 access list",
.node = ACCESS_NODE,
.prompt = "",
.config_write = config_write_access_ipv4,
@ -2956,6 +2958,7 @@ static void access_list_init_ipv4(void)
static int config_write_access_ipv6(struct vty *vty);
static struct cmd_node access_ipv6_node = {
.name = "ipv6 access list",
.node = ACCESS_IPV6_NODE,
.prompt = "",
.config_write = config_write_access_ipv6,

View File

@ -399,7 +399,7 @@ DEFUN (grammar_findambig,
if (!nodegraph)
continue;
vty_out(vty, "scanning node %d (%s)\n", scannode - 1,
node_names[scannode - 1]);
cnode->name);
}
commands = cmd_graph_permutations(nodegraph);

View File

@ -961,6 +961,7 @@ DEFUN (no_send_lifetime,
static int keychain_config_write(struct vty *vty);
static struct cmd_node keychain_node = {
.name = "keychain",
.node = KEYCHAIN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-keychain)# ",
@ -968,6 +969,7 @@ static struct cmd_node keychain_node = {
};
static struct cmd_node keychain_key_node = {
.name = "keychain key",
.node = KEYCHAIN_KEY_NODE,
.parent_node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain-key)# ",

View File

@ -935,6 +935,7 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,
static int nexthop_group_write(struct vty *vty);
static struct cmd_node nexthop_group_node = {
.name = "nexthop-group",
.node = NH_GROUP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-nh-group)# ",

View File

@ -1675,6 +1675,7 @@ static int nb_debug_config_write(struct vty *vty)
static struct debug_callbacks nb_dbg_cbs = {.debug_set_all = nb_debug_set_all};
static struct cmd_node nb_debug_node = {
.name = "northbound debug",
.node = NORTHBOUND_DEBUG_NODE,
.prompt = "",
.config_write = nb_debug_config_write,

View File

@ -2047,6 +2047,7 @@ static void prefix_list_reset_afi(afi_t afi, int orf)
static int config_write_prefix_ipv4(struct vty *vty);
/* Prefix-list node. */
static struct cmd_node prefix_node = {
.name = "ipv4 prefix list",
.node = PREFIX_NODE,
.prompt = "",
.config_write = config_write_prefix_ipv4,
@ -2113,6 +2114,7 @@ static void prefix_list_init_ipv4(void)
static int config_write_prefix_ipv6(struct vty *vty);
/* Prefix-list node. */
static struct cmd_node prefix_ipv6_node = {
.name = "ipv6 prefix list",
.node = PREFIX_IPV6_NODE,
.prompt = "",
.config_write = config_write_prefix_ipv6,

View File

@ -247,6 +247,7 @@ DEFUN(debug_resolver,
static int resolver_config_write_debug(struct vty *vty);
static struct cmd_node resolver_debug_node = {
.name = "resolver debug",
.node = RESOLVER_DEBUG_NODE,
.prompt = "",
.config_write = resolver_config_write_debug,

View File

@ -3017,6 +3017,7 @@ DEFUN (no_debug_rmap,
/* Debug node. */
static int rmap_config_write_debug(struct vty *vty);
static struct cmd_node rmap_debug_node = {
.name = "route-map debug",
.node = RMAP_DEBUG_NODE,
.prompt = "",
.config_write = rmap_config_write_debug,

View File

@ -1066,6 +1066,7 @@ static int route_map_config_write(struct vty *vty)
/* Route map node structure. */
static int route_map_config_write(struct vty *vty);
static struct cmd_node rmap_node = {
.name = "routemap",
.node = RMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-route-map)# ",

View File

@ -759,6 +759,7 @@ DEFUN (no_vrf,
static struct cmd_node vrf_node = {
.name = "vrf",
.node = VRF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-vrf)# ",
@ -854,6 +855,7 @@ static int vrf_write_host(struct vty *vty)
static int vrf_write_host(struct vty *vty);
static struct cmd_node vrf_debug_node = {
.name = "vrf debug",
.node = VRF_DEBUG_NODE,
.prompt = "",
.config_write = vrf_write_host,

View File

@ -3009,6 +3009,7 @@ static int vty_config_write(struct vty *vty)
static int vty_config_write(struct vty *vty);
struct cmd_node vty_node = {
.name = "vty",
.node = VTY_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-line)# ",

View File

@ -19,6 +19,7 @@
static int nhrp_config_write(struct vty *vty);
static struct cmd_node zebra_node = {
.name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
@ -27,6 +28,7 @@ static struct cmd_node zebra_node = {
static int interface_config_write(struct vty *vty);
static struct cmd_node nhrp_interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",

View File

@ -1945,6 +1945,7 @@ static int config_write_ospf6_interface(struct vty *vty)
static int config_write_ospf6_interface(struct vty *vty);
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",

View File

@ -1115,6 +1115,7 @@ static int config_write_ospf6(struct vty *vty)
static int config_write_ospf6(struct vty *vty);
/* OSPF6 node structure. */
static struct cmd_node ospf6_node = {
.name = "ospf6",
.node = OSPF6_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ospf6)# ",

View File

@ -71,6 +71,7 @@ struct route_node *route_prev(struct route_node *node)
static int config_write_ospf6_debug(struct vty *vty);
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_ospf6_debug,

View File

@ -1643,6 +1643,7 @@ DEFUN_NOSH (show_debugging_ospf_instance,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,

View File

@ -10558,6 +10558,7 @@ void ospf_vty_show_init(void)
static int config_write_interface(struct vty *vty);
/* ospfd's interface node. */
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@ -10676,6 +10677,7 @@ static void ospf_vty_zebra_init(void)
static int ospf_config_write(struct vty *vty);
static struct cmd_node ospf_node = {
.name = "ospf",
.node = OSPF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",

View File

@ -678,6 +678,7 @@ DEFPY (show_pbr_interface,
/* PBR debugging CLI ------------------------------------------------------- */
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = pbr_debug_config_write,
@ -731,6 +732,7 @@ DEFUN_NOSH(show_debugging_pbr,
static int pbr_interface_config_write(struct vty *vty);
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@ -765,6 +767,7 @@ static int pbr_interface_config_write(struct vty *vty)
static int pbr_vty_map_config_write(struct vty *vty);
/* PBR map node structure. */
static struct cmd_node pbr_map_node = {
.name = "pbr-map",
.node = PBRMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pbr-map)# ",

View File

@ -70,6 +70,7 @@
#endif
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@ -77,6 +78,7 @@ static struct cmd_node interface_node = {
};
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = pim_debug_config_write,

View File

@ -175,6 +175,7 @@ DEFUN (no_debug_rip_zebra,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,

View File

@ -1195,6 +1195,7 @@ int rip_show_network_config(struct vty *vty, struct rip *rip)
static int rip_interface_config_write(struct vty *vty);
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",

View File

@ -3330,6 +3330,7 @@ static int config_write_rip(struct vty *vty)
static int config_write_rip(struct vty *vty);
/* RIP node structure. */
static struct cmd_node rip_node = {
.name = "rip",
.node = RIP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",

View File

@ -177,6 +177,7 @@ DEFUN (no_debug_ripng_zebra,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,

View File

@ -957,6 +957,7 @@ static int interface_config_write(struct vty *vty)
static int interface_config_write(struct vty *vty);
/* ripngd's interface node. */
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",

View File

@ -2437,6 +2437,7 @@ static int ripng_config_write(struct vty *vty)
static int ripng_config_write(struct vty *vty);
/* RIPng node structure. */
static struct cmd_node cmd_ripng_node = {
.name = "ripng",
.node = RIPNG_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",

View File

@ -1471,6 +1471,7 @@ DEFUN_NOSH (show_debugging_static,
}
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = static_config_write_debug,

View File

@ -49,96 +49,112 @@ static vector test_cmds;
static char test_buf[32768];
static struct cmd_node bgp_node = {
.name = "bgp",
.node = BGP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node rip_node = {
.name = "rip",
.node = RIP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node isis_node = {
.name = "isis",
.node = ISIS_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
};
static struct cmd_node rmap_node = {
.name = "routemap",
.node = RMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-route-map)# ",
};
static struct cmd_node zebra_node = {
.name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node bgp_vpnv4_node = {
.name = "bgp vpnv4",
.node = BGP_VPNV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_node = {
.name = "bgp ipv4 unicast",
.node = BGP_IPV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4m_node = {
.name = "bgp ipv4 multicast",
.node = BGP_IPV4M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_node = {
.name = "bgp ipv6",
.node = BGP_IPV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6m_node = {
.name = "bgp ipv6 multicast",
.node = BGP_IPV6M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node ospf_node = {
.name = "ospf",
.node = OSPF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ripng_node = {
.name = "ripng",
.node = RIPNG_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ospf6_node = {
.name = "ospf6",
.node = OSPF6_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ospf6)# ",
};
static struct cmd_node keychain_node = {
.name = "keychain",
.node = KEYCHAIN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-keychain)# ",
};
static struct cmd_node keychain_key_node = {
.name = "keychain key",
.node = KEYCHAIN_KEY_NODE,
.parent_node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain-key)# ",

View File

@ -745,6 +745,7 @@ static int vrrp_config_write_interface(struct vty *vty)
}
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@ -752,12 +753,14 @@ static struct cmd_node interface_node = {
};
static struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = vrrp_config_write_debug,
};
static struct cmd_node vrrp_node = {
.name = "vrrp",
.node = VRRP_NODE,
.prompt = "",
.config_write = vrrp_config_write_global,

View File

@ -1173,264 +1173,308 @@ static char **new_completion(const char *text, int start, int end)
/* Vty node structures. */
static struct cmd_node bgp_node = {
.name = "bgp",
.node = BGP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node rip_node = {
.name = "rip",
.node = RIP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node isis_node = {
.name = "isis",
.node = ISIS_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node openfabric_node = {
.name = "openfabric",
.node = OPENFABRIC_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
};
static struct cmd_node pw_node = {
.name = "pw",
.node = PW_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pw)# ",
};
static struct cmd_node vrf_node = {
.name = "vrf",
.node = VRF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-vrf)# ",
};
static struct cmd_node nh_group_node = {
.name = "nexthop-group",
.node = NH_GROUP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-nh-group)# ",
};
static struct cmd_node rmap_node = {
.name = "routemap",
.node = RMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-route-map)# ",
};
static struct cmd_node pbr_map_node = {
.name = "pbr-map",
.node = PBRMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pbr-map)# ",
};
static struct cmd_node zebra_node = {
.name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node bgp_vpnv4_node = {
.name = "bgp vpnv4",
.node = BGP_VPNV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vpnv6_node = {
.name = "bgp vpnv6",
.node = BGP_VPNV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv4_node = {
.name = "bgp ipv4 flowspec",
.node = BGP_FLOWSPECV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv6_node = {
.name = "bgp ipv6 flowspec",
.node = BGP_FLOWSPECV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_node = {
.name = "bgp ipv4 unicast",
.node = BGP_IPV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4m_node = {
.name = "bgp ipv4 multicast",
.node = BGP_IPV4M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4l_node = {
.name = "bgp ipv4 labeled unicast",
.node = BGP_IPV4L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_node = {
.name = "bgp ipv6",
.node = BGP_IPV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6m_node = {
.name = "bgp ipv6 multicast",
.node = BGP_IPV6M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_evpn_node = {
.name = "bgp evpn",
.node = BGP_EVPN_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_evpn_vni_node = {
.name = "bgp evpn vni",
.node = BGP_EVPN_VNI_NODE,
.parent_node = BGP_EVPN_NODE,
.prompt = "%s(config-router-af-vni)# ",
};
static struct cmd_node bgp_ipv6l_node = {
.name = "bgp ipv6 labeled unicast",
.node = BGP_IPV6L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vnc_defaults_node = {
.name = "bgp vnc defaults",
.node = BGP_VNC_DEFAULTS_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
};
static struct cmd_node bgp_vnc_nve_group_node = {
.name = "bgp vnc nve",
.node = BGP_VNC_NVE_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
};
static struct cmd_node bgp_vrf_policy_node = {
.name = "bgp vrf policy",
.node = BGP_VRF_POLICY_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
};
static struct cmd_node bgp_vnc_l2_group_node = {
.name = "bgp vnc l2",
.node = BGP_VNC_L2_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",
};
static struct cmd_node bmp_node = {
.name = "bmp",
.node = BMP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-bgp-bmp)# "
};
static struct cmd_node ospf_node = {
.name = "ospf",
.node = OSPF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node eigrp_node = {
.name = "eigrp",
.node = EIGRP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node babel_node = {
.name = "babel",
.node = BABEL_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ripng_node = {
.name = "ripng",
.node = RIPNG_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ospf6_node = {
.name = "ospf6",
.node = OSPF6_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ospf6)# ",
};
static struct cmd_node ldp_node = {
.name = "ldp",
.node = LDP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ldp)# ",
};
static struct cmd_node ldp_ipv4_node = {
.name = "ldp ipv4",
.node = LDP_IPV4_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
static struct cmd_node ldp_ipv6_node = {
.name = "ldp ipv6",
.node = LDP_IPV6_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
static struct cmd_node ldp_ipv4_iface_node = {
.name = "ldp ipv4 interface",
.node = LDP_IPV4_IFACE_NODE,
.parent_node = LDP_IPV4_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
static struct cmd_node ldp_ipv6_iface_node = {
.name = "ldp ipv6 interface",
.node = LDP_IPV6_IFACE_NODE,
.parent_node = LDP_IPV6_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
static struct cmd_node ldp_l2vpn_node = {
.name = "ldp l2vpn",
.node = LDP_L2VPN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-l2vpn)# ",
};
static struct cmd_node ldp_pseudowire_node = {
.name = "ldp",
.node = LDP_PSEUDOWIRE_NODE,
.parent_node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn-pw)# ",
};
static struct cmd_node keychain_node = {
.name = "keychain",
.node = KEYCHAIN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-keychain)# ",
};
static struct cmd_node keychain_key_node = {
.name = "keychain key",
.node = KEYCHAIN_KEY_NODE,
.parent_node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain-key)# ",
};
struct cmd_node link_params_node = {
.name = "link-params",
.node = LINK_PARAMS_NODE,
.parent_node = INTERFACE_NODE,
.prompt = "%s(config-link-params)# ",
};
static struct cmd_node rpki_node = {
.name = "rpki",
.node = RPKI_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-rpki)# ",
@ -1438,12 +1482,14 @@ static struct cmd_node rpki_node = {
#if HAVE_BFDD > 0
static struct cmd_node bfd_node = {
.name = "bfd",
.node = BFD_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-bfd)# ",
};
static struct cmd_node bfd_peer_node = {
.name = "bfd peer",
.node = BFD_PEER_NODE,
.parent_node = BFD_NODE,
.prompt = "%s(config-bfd-peer)# ",
@ -3568,7 +3614,7 @@ DEFUN(find,
if (regexec(&exp, cli->string, 0, NULL, 0) == 0)
vty_out(vty, " (%s) %s\n",
node_names[node->node], cli->string);
node->name, cli->string);
}
}

View File

@ -473,6 +473,7 @@ DEFPY (debug_zebra_nexthop,
/* Debug node. */
static int config_write_debug(struct vty *vty);
struct cmd_node debug_node = {
.name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,

View File

@ -1666,6 +1666,7 @@ static void interface_update_stats(void)
static int if_config_write(struct vty *vty);
struct cmd_node interface_node = {
.name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@ -2080,6 +2081,7 @@ DEFUN (no_bandwidth_if,
struct cmd_node link_params_node = {
.name = "link-params",
.node = LINK_PARAMS_NODE,
.parent_node = INTERFACE_NODE,
.prompt = "%s(config-link-params)# ",

View File

@ -1941,6 +1941,7 @@ static int fpm_remote_srv_write(struct vty *vty)
static int fpm_remote_srv_write(struct vty *vty);
/* Zebra node */
static struct cmd_node zebra_node = {
.name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "",

View File

@ -452,6 +452,7 @@ DEFUN (no_mpls_label_global_block,
static int zebra_mpls_config(struct vty *vty);
/* MPLS node for MPLS LSP. */
static struct cmd_node mpls_node = {
.name = "mpls",
.node = MPLS_NODE,
.prompt = "",
.config_write = zebra_mpls_config,

View File

@ -549,6 +549,7 @@ static int zebra_pw_config(struct vty *vty)
static int zebra_pw_config(struct vty *vty);
static struct cmd_node pw_node = {
.name = "pw",
.node = PW_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pw)# ",

View File

@ -3480,12 +3480,14 @@ DEFUN_HIDDEN (show_frr,
/* IP node for static routes. */
static int zebra_ip_config(struct vty *vty);
static struct cmd_node ip_node = {
.name = "static ip",
.node = IP_NODE,
.prompt = "",
.config_write = zebra_ip_config,
};
static int config_write_protocol(struct vty *vty);
static struct cmd_node protocol_node = {
.name = "protocol",
.node = PROTOCOL_NODE,
.prompt = "",
.config_write = config_write_protocol,
@ -3493,12 +3495,14 @@ static struct cmd_node protocol_node = {
/* table node for routing tables. */
static int config_write_table(struct vty *vty);
static struct cmd_node table_node = {
.name = "table",
.node = TABLE_NODE,
.prompt = "",
.config_write = config_write_table,
};
static int config_write_forwarding(struct vty *vty);
static struct cmd_node forwarding_node = {
.name = "forwarding",
.node = FORWARDING_NODE,
.prompt = "",
.config_write = config_write_forwarding,