diff options
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 549 |
1 files changed, 296 insertions, 253 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index bb158f3c9..0c85c0e81 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1934,6 +1934,13 @@ DEFUNSH(VTYSH_PBRD, vtysh_pbr_map, vtysh_pbr_map_cmd, return CMD_SUCCESS; } +DEFSH(VTYSH_PBRD, vtysh_no_pbr_map_cmd, "no pbr-map PBRMAP [seq (1-700)]", + NO_STR + "Delete pbr-map\n" + "The name of the PBR MAP\n" + "Sequence to delete from existing pbr-map entry\n" + "Sequence number\n") + #if HAVE_BFDD > 0 DEFUNSH(VTYSH_BFDD, bfd_enter, bfd_enter_cmd, "bfd", "Configure BFD peers\n") { @@ -1969,13 +1976,6 @@ DEFUNSH(VTYSH_BFDD, bfd_profile_enter, bfd_profile_enter_cmd, } #endif /* HAVE_BFDD */ -DEFSH(VTYSH_PBRD, vtysh_no_pbr_map_cmd, "no pbr-map PBRMAP [seq (1-700)]", - NO_STR - "Delete pbr-map\n" - "The name of the PBR MAP\n" - "Sequence to delete from existing pbr-map entry\n" - "Sequence number\n") - DEFUNSH(VTYSH_ALL, vtysh_line_vty, vtysh_line_vty_cmd, "line vty", "Configure a terminal line\n" "Virtual terminal\n") @@ -2097,14 +2097,6 @@ DEFUNSH(VTYSH_BGPD, bmp_quit, bmp_quit_cmd, "quit", return bmp_exit(self, vty, argc, argv); } -DEFUNSH(VTYSH_VRF, exit_vrf_config, exit_vrf_config_cmd, "exit-vrf", - "Exit from VRF configuration mode\n") -{ - if (vty->node == VRF_NODE) - vty->node = CONFIG_NODE; - return CMD_SUCCESS; -} - DEFUNSH(VTYSH_BGPD, exit_vrf_policy, exit_vrf_policy_cmd, "exit-vrf-policy", "Exit from VRF policy configuration mode\n") { @@ -2113,6 +2105,14 @@ DEFUNSH(VTYSH_BGPD, exit_vrf_policy, exit_vrf_policy_cmd, "exit-vrf-policy", return CMD_SUCCESS; } +DEFUNSH(VTYSH_VRF, exit_vrf_config, exit_vrf_config_cmd, "exit-vrf", + "Exit from VRF configuration mode\n") +{ + if (vty->node == VRF_NODE) + vty->node = CONFIG_NODE; + return CMD_SUCCESS; +} + DEFUNSH(VTYSH_RIPD, vtysh_exit_ripd, vtysh_exit_ripd_cmd, "exit", "Exit current mode and down to previous mode\n") { @@ -3783,331 +3783,374 @@ void vtysh_init_vty(void) cmd_init(0); cmd_variable_handler_register(vtysh_var_handler); - /* Install nodes. */ + /* bgpd */ install_node(&bgp_node); - install_node(&rip_node); - install_node(&interface_node); - install_node(&pw_node); - install_node(&link_params_node); - install_node(&vrf_node); - install_node(&nh_group_node); - install_node(&rmap_node); - install_node(&pbr_map_node); - install_node(&zebra_node); + install_element(CONFIG_NODE, &router_bgp_cmd); + install_element(BGP_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_NODE, &vtysh_end_all_cmd); + install_node(&bgp_vpnv4_node); + install_element(BGP_NODE, &address_family_ipv4_vpn_cmd); +#ifdef KEEP_OLD_VPN_COMMANDS + install_element(BGP_NODE, &address_family_vpnv4_cmd); +#endif /* KEEP_OLD_VPN_COMMANDS */ + install_element(BGP_VPNV4_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VPNV4_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VPNV4_NODE, &vtysh_end_all_cmd); + install_element(BGP_VPNV4_NODE, &exit_address_family_cmd); + install_node(&bgp_vpnv6_node); + install_element(BGP_NODE, &address_family_ipv6_vpn_cmd); +#ifdef KEEP_OLD_VPN_COMMANDS + install_element(BGP_NODE, &address_family_vpnv6_cmd); +#endif /* KEEP_OLD_VPN_COMMANDS */ + install_element(BGP_VPNV6_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VPNV6_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VPNV6_NODE, &vtysh_end_all_cmd); + install_element(BGP_VPNV6_NODE, &exit_address_family_cmd); + install_node(&bgp_flowspecv4_node); + install_element(BGP_NODE, &address_family_flowspecv4_cmd); + install_element(BGP_FLOWSPECV4_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_FLOWSPECV4_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_FLOWSPECV4_NODE, &vtysh_end_all_cmd); + install_element(BGP_FLOWSPECV4_NODE, &exit_address_family_cmd); + install_node(&bgp_flowspecv6_node); + install_element(BGP_NODE, &address_family_flowspecv6_cmd); + install_element(BGP_FLOWSPECV6_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_FLOWSPECV6_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_FLOWSPECV6_NODE, &vtysh_end_all_cmd); + install_element(BGP_FLOWSPECV6_NODE, &exit_address_family_cmd); + install_node(&bgp_ipv4_node); + install_element(BGP_NODE, &address_family_ipv4_cmd); + install_element(BGP_IPV4_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_IPV4_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_IPV4_NODE, &vtysh_end_all_cmd); + install_element(BGP_IPV4_NODE, &exit_address_family_cmd); + install_node(&bgp_ipv4m_node); + install_element(BGP_NODE, &address_family_ipv4_multicast_cmd); + install_element(BGP_IPV4M_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_IPV4M_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_IPV4M_NODE, &vtysh_end_all_cmd); + install_element(BGP_IPV4M_NODE, &exit_address_family_cmd); + install_node(&bgp_ipv4l_node); + install_element(BGP_NODE, &address_family_ipv4_labeled_unicast_cmd); + install_element(BGP_IPV4L_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_IPV4L_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_IPV4L_NODE, &vtysh_end_all_cmd); + install_element(BGP_IPV4L_NODE, &exit_address_family_cmd); + install_node(&bgp_ipv6_node); + install_element(BGP_NODE, &address_family_ipv6_cmd); + install_element(BGP_IPV6_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_IPV6_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_IPV6_NODE, &vtysh_end_all_cmd); + install_element(BGP_IPV6_NODE, &exit_address_family_cmd); + install_node(&bgp_ipv6m_node); + install_element(BGP_NODE, &address_family_ipv6_multicast_cmd); + install_element(BGP_IPV6M_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_IPV6M_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_IPV6M_NODE, &vtysh_end_all_cmd); + install_element(BGP_IPV6M_NODE, &exit_address_family_cmd); + install_node(&bgp_ipv6l_node); + install_element(BGP_NODE, &address_family_ipv6_labeled_unicast_cmd); + install_element(BGP_IPV6L_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_IPV6L_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_IPV6L_NODE, &vtysh_end_all_cmd); + install_element(BGP_IPV6L_NODE, &exit_address_family_cmd); + +#if defined(ENABLE_BGP_VNC) install_node(&bgp_vrf_policy_node); - install_node(&bgp_evpn_node); - install_node(&bgp_evpn_vni_node); + install_element(BGP_NODE, &vnc_vrf_policy_cmd); + install_element(BGP_VRF_POLICY_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VRF_POLICY_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VRF_POLICY_NODE, &vtysh_end_all_cmd); + install_element(BGP_VRF_POLICY_NODE, &exit_vrf_policy_cmd); + install_node(&bgp_vnc_defaults_node); + install_element(BGP_NODE, &vnc_defaults_cmd); + install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_end_all_cmd); + install_element(BGP_VNC_DEFAULTS_NODE, &exit_vnc_config_cmd); + install_node(&bgp_vnc_nve_group_node); + install_element(BGP_NODE, &vnc_nve_group_cmd); + install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_end_all_cmd); + install_element(BGP_VNC_NVE_GROUP_NODE, &exit_vnc_config_cmd); + install_node(&bgp_vnc_l2_group_node); - install_node(&ospf_node); - install_node(&eigrp_node); - install_node(&babel_node); - install_node(&ripng_node); - install_node(&ospf6_node); - install_node(&ldp_node); - install_node(&ldp_ipv4_node); - install_node(&ldp_ipv6_node); - install_node(&ldp_ipv4_iface_node); - install_node(&ldp_ipv6_iface_node); - install_node(&ldp_l2vpn_node); - install_node(&ldp_pseudowire_node); - install_node(&keychain_node); - install_node(&keychain_key_node); - install_node(&isis_node); - install_node(&openfabric_node); - install_node(&vty_node); - install_node(&rpki_node); - install_node(&bmp_node); -#if HAVE_BFDD > 0 - install_node(&bfd_node); - install_node(&bfd_peer_node); - install_node(&bfd_profile_node); -#endif /* HAVE_BFDD */ + install_element(BGP_NODE, &vnc_l2_group_cmd); + install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_end_all_cmd); + install_element(BGP_VNC_L2_GROUP_NODE, &exit_vnc_config_cmd); +#endif - struct cmd_node *node; - for (unsigned int i = 0; i < vector_active(cmdvec); i++) { - node = vector_slot(cmdvec, i); - if (!node || node->node == VIEW_NODE) - continue; - vtysh_install_default(node->node); - } + install_node(&bgp_evpn_node); + install_element(BGP_NODE, &address_family_evpn_cmd); +#if defined(HAVE_CUMULUS) + install_element(BGP_NODE, &address_family_evpn2_cmd); +#endif + install_element(BGP_EVPN_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_EVPN_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_EVPN_NODE, &vtysh_end_all_cmd); + install_element(BGP_EVPN_NODE, &exit_address_family_cmd); - install_element(VIEW_NODE, &vtysh_enable_cmd); - install_element(ENABLE_NODE, &vtysh_config_terminal_cmd); - install_element(ENABLE_NODE, &vtysh_disable_cmd); + install_node(&bgp_evpn_vni_node); + install_element(BGP_EVPN_NODE, &bgp_evpn_vni_cmd); + install_element(BGP_EVPN_VNI_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_EVPN_VNI_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_EVPN_VNI_NODE, &vtysh_end_all_cmd); + install_element(BGP_EVPN_VNI_NODE, &exit_vni_cmd); - /* "exit" command. */ - install_element(VIEW_NODE, &vtysh_exit_all_cmd); - install_element(CONFIG_NODE, &vtysh_exit_all_cmd); - install_element(VIEW_NODE, &vtysh_quit_all_cmd); - install_element(CONFIG_NODE, &vtysh_quit_all_cmd); + install_node(&rpki_node); + install_element(CONFIG_NODE, &rpki_cmd); + install_element(RPKI_NODE, &rpki_exit_cmd); + install_element(RPKI_NODE, &rpki_quit_cmd); + install_element(RPKI_NODE, &vtysh_end_all_cmd); + + install_node(&bmp_node); + install_element(BGP_NODE, &bmp_targets_cmd); + install_element(BMP_NODE, &bmp_exit_cmd); + install_element(BMP_NODE, &bmp_quit_cmd); + install_element(BMP_NODE, &vtysh_end_all_cmd); + + /* ripd */ + install_node(&rip_node); + install_element(CONFIG_NODE, &router_rip_cmd); install_element(RIP_NODE, &vtysh_exit_ripd_cmd); install_element(RIP_NODE, &vtysh_quit_ripd_cmd); + install_element(RIP_NODE, &vtysh_end_all_cmd); + + /* ripngd */ + install_node(&ripng_node); + install_element(CONFIG_NODE, &router_ripng_cmd); install_element(RIPNG_NODE, &vtysh_exit_ripngd_cmd); install_element(RIPNG_NODE, &vtysh_quit_ripngd_cmd); + install_element(RIPNG_NODE, &vtysh_end_all_cmd); + + /* ospfd */ + install_node(&ospf_node); + install_element(CONFIG_NODE, &router_ospf_cmd); install_element(OSPF_NODE, &vtysh_exit_ospfd_cmd); install_element(OSPF_NODE, &vtysh_quit_ospfd_cmd); - install_element(EIGRP_NODE, &vtysh_exit_eigrpd_cmd); - install_element(EIGRP_NODE, &vtysh_quit_eigrpd_cmd); - install_element(BABEL_NODE, &vtysh_exit_babeld_cmd); - install_element(BABEL_NODE, &vtysh_quit_babeld_cmd); + install_element(OSPF_NODE, &vtysh_end_all_cmd); + + /* ospf6d */ + install_node(&ospf6_node); + install_element(CONFIG_NODE, &router_ospf6_cmd); install_element(OSPF6_NODE, &vtysh_exit_ospf6d_cmd); install_element(OSPF6_NODE, &vtysh_quit_ospf6d_cmd); + install_element(OSPF6_NODE, &vtysh_end_all_cmd); + + /* ldpd */ #if defined(HAVE_LDPD) + install_node(&ldp_node); + install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd); install_element(LDP_NODE, &vtysh_exit_ldpd_cmd); install_element(LDP_NODE, &vtysh_quit_ldpd_cmd); + install_element(LDP_NODE, &vtysh_end_all_cmd); + + install_node(&ldp_ipv4_node); + install_element(LDP_NODE, &ldp_address_family_ipv4_cmd); install_element(LDP_IPV4_NODE, &vtysh_exit_ldpd_cmd); install_element(LDP_IPV4_NODE, &vtysh_quit_ldpd_cmd); install_element(LDP_IPV4_NODE, &ldp_exit_address_family_cmd); + install_element(LDP_IPV4_NODE, &vtysh_end_all_cmd); + + install_node(&ldp_ipv6_node); + install_element(LDP_NODE, &ldp_address_family_ipv6_cmd); install_element(LDP_IPV6_NODE, &vtysh_exit_ldpd_cmd); install_element(LDP_IPV6_NODE, &vtysh_quit_ldpd_cmd); install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd); + install_element(LDP_IPV6_NODE, &vtysh_end_all_cmd); + + install_node(&ldp_ipv4_iface_node); + install_element(LDP_IPV4_NODE, &ldp_interface_ifname_cmd); install_element(LDP_IPV4_IFACE_NODE, &vtysh_exit_ldpd_cmd); install_element(LDP_IPV4_IFACE_NODE, &vtysh_quit_ldpd_cmd); + install_element(LDP_IPV4_IFACE_NODE, &vtysh_end_all_cmd); + + install_node(&ldp_ipv6_iface_node); + install_element(LDP_IPV6_NODE, &ldp_interface_ifname_cmd); install_element(LDP_IPV6_IFACE_NODE, &vtysh_exit_ldpd_cmd); install_element(LDP_IPV6_IFACE_NODE, &vtysh_quit_ldpd_cmd); + install_element(LDP_IPV6_IFACE_NODE, &vtysh_end_all_cmd); + + install_node(&ldp_l2vpn_node); + install_element(CONFIG_NODE, &ldp_l2vpn_word_type_vpls_cmd); install_element(LDP_L2VPN_NODE, &vtysh_exit_ldpd_cmd); install_element(LDP_L2VPN_NODE, &vtysh_quit_ldpd_cmd); + install_element(LDP_L2VPN_NODE, &vtysh_end_all_cmd); + + install_node(&ldp_pseudowire_node); + install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_ifname_cmd); install_element(LDP_PSEUDOWIRE_NODE, &vtysh_exit_ldpd_cmd); install_element(LDP_PSEUDOWIRE_NODE, &vtysh_quit_ldpd_cmd); + install_element(LDP_PSEUDOWIRE_NODE, &vtysh_end_all_cmd); #endif - install_element(BGP_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_VPNV4_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_VPNV4_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_VPNV6_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_VPNV6_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_FLOWSPECV4_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_FLOWSPECV4_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_FLOWSPECV6_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_FLOWSPECV6_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_IPV4_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_IPV4_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_IPV4M_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_IPV4M_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_IPV4L_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_IPV4L_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_IPV6_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_IPV6_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_IPV6M_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_IPV6M_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_EVPN_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_EVPN_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_EVPN_VNI_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_EVPN_VNI_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_IPV6L_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_IPV6L_NODE, &vtysh_quit_bgpd_cmd); -#if defined(ENABLE_BGP_VNC) - install_element(BGP_VRF_POLICY_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_VRF_POLICY_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_quit_bgpd_cmd); - install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_exit_bgpd_cmd); - install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_quit_bgpd_cmd); -#endif + + /* eigrpd */ + install_node(&eigrp_node); + install_element(CONFIG_NODE, &router_eigrp_cmd); + install_element(EIGRP_NODE, &vtysh_exit_eigrpd_cmd); + install_element(EIGRP_NODE, &vtysh_quit_eigrpd_cmd); + install_element(EIGRP_NODE, &vtysh_end_all_cmd); + + /* babeld */ + install_node(&babel_node); + install_element(CONFIG_NODE, &router_babel_cmd); + install_element(BABEL_NODE, &vtysh_exit_babeld_cmd); + install_element(BABEL_NODE, &vtysh_quit_babeld_cmd); + install_element(BABEL_NODE, &vtysh_end_all_cmd); + + /* isisd */ + install_node(&isis_node); + install_element(CONFIG_NODE, &router_isis_cmd); install_element(ISIS_NODE, &vtysh_exit_isisd_cmd); install_element(ISIS_NODE, &vtysh_quit_isisd_cmd); + install_element(ISIS_NODE, &vtysh_end_all_cmd); + + /* fabricd */ + install_node(&openfabric_node); + install_element(CONFIG_NODE, &router_openfabric_cmd); install_element(OPENFABRIC_NODE, &vtysh_exit_fabricd_cmd); install_element(OPENFABRIC_NODE, &vtysh_quit_fabricd_cmd); - install_element(KEYCHAIN_NODE, &vtysh_exit_keys_cmd); - install_element(KEYCHAIN_NODE, &vtysh_quit_keys_cmd); - install_element(KEYCHAIN_KEY_NODE, &vtysh_exit_keys_cmd); - install_element(KEYCHAIN_KEY_NODE, &vtysh_quit_keys_cmd); - install_element(RMAP_NODE, &vtysh_exit_rmap_cmd); - install_element(RMAP_NODE, &vtysh_quit_rmap_cmd); + install_element(OPENFABRIC_NODE, &vtysh_end_all_cmd); + + /* pbrd */ + install_node(&pbr_map_node); + install_element(CONFIG_NODE, &vtysh_pbr_map_cmd); + install_element(CONFIG_NODE, &vtysh_no_pbr_map_cmd); install_element(PBRMAP_NODE, &vtysh_exit_pbr_map_cmd); install_element(PBRMAP_NODE, &vtysh_quit_pbr_map_cmd); + install_element(PBRMAP_NODE, &vtysh_end_all_cmd); + + /* bfdd */ #if HAVE_BFDD > 0 - /* Enter node. */ + install_node(&bfd_node); install_element(CONFIG_NODE, &bfd_enter_cmd); - install_element(BFD_NODE, &bfd_peer_enter_cmd); - install_element(BFD_NODE, &bfd_profile_enter_cmd); - - /* Exit/quit node. */ install_element(BFD_NODE, &vtysh_exit_bfdd_cmd); install_element(BFD_NODE, &vtysh_quit_bfdd_cmd); + install_element(BFD_NODE, &vtysh_end_all_cmd); + + install_node(&bfd_peer_node); + install_element(BFD_NODE, &bfd_peer_enter_cmd); install_element(BFD_PEER_NODE, &vtysh_exit_bfdd_cmd); install_element(BFD_PEER_NODE, &vtysh_quit_bfdd_cmd); + install_element(BFD_PEER_NODE, &vtysh_end_all_cmd); + + install_node(&bfd_profile_node); + install_element(BFD_NODE, &bfd_profile_enter_cmd); install_element(BFD_PROFILE_NODE, &vtysh_exit_bfdd_cmd); install_element(BFD_PROFILE_NODE, &vtysh_quit_bfdd_cmd); - - /* End/exit all. */ - install_element(BFD_NODE, &vtysh_end_all_cmd); - install_element(BFD_PEER_NODE, &vtysh_end_all_cmd); install_element(BFD_PROFILE_NODE, &vtysh_end_all_cmd); #endif /* HAVE_BFDD */ - install_element(VTY_NODE, &vtysh_exit_line_vty_cmd); - install_element(VTY_NODE, &vtysh_quit_line_vty_cmd); - /* "end" command. */ - install_element(CONFIG_NODE, &vtysh_end_all_cmd); - install_element(ENABLE_NODE, &vtysh_end_all_cmd); - install_element(RIP_NODE, &vtysh_end_all_cmd); - install_element(RIPNG_NODE, &vtysh_end_all_cmd); - install_element(OSPF_NODE, &vtysh_end_all_cmd); - install_element(EIGRP_NODE, &vtysh_end_all_cmd); - install_element(BABEL_NODE, &vtysh_end_all_cmd); - install_element(OSPF6_NODE, &vtysh_end_all_cmd); - install_element(LDP_NODE, &vtysh_end_all_cmd); - install_element(LDP_IPV4_NODE, &vtysh_end_all_cmd); - install_element(LDP_IPV6_NODE, &vtysh_end_all_cmd); - install_element(LDP_IPV4_IFACE_NODE, &vtysh_end_all_cmd); - install_element(LDP_IPV6_IFACE_NODE, &vtysh_end_all_cmd); - install_element(LDP_L2VPN_NODE, &vtysh_end_all_cmd); - install_element(LDP_PSEUDOWIRE_NODE, &vtysh_end_all_cmd); - install_element(BGP_NODE, &vtysh_end_all_cmd); - install_element(BGP_IPV4_NODE, &vtysh_end_all_cmd); - install_element(BGP_IPV4M_NODE, &vtysh_end_all_cmd); - install_element(BGP_IPV4L_NODE, &vtysh_end_all_cmd); - install_element(BGP_VPNV4_NODE, &vtysh_end_all_cmd); - install_element(BGP_VPNV6_NODE, &vtysh_end_all_cmd); - install_element(BGP_FLOWSPECV4_NODE, &vtysh_end_all_cmd); - install_element(BGP_FLOWSPECV6_NODE, &vtysh_end_all_cmd); - install_element(BGP_IPV6_NODE, &vtysh_end_all_cmd); - install_element(BGP_IPV6M_NODE, &vtysh_end_all_cmd); - install_element(BGP_IPV6L_NODE, &vtysh_end_all_cmd); - install_element(BGP_VRF_POLICY_NODE, &vtysh_end_all_cmd); - install_element(BGP_EVPN_NODE, &vtysh_end_all_cmd); - install_element(BGP_EVPN_VNI_NODE, &vtysh_end_all_cmd); - install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_end_all_cmd); - install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_end_all_cmd); - install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_end_all_cmd); - install_element(ISIS_NODE, &vtysh_end_all_cmd); - install_element(OPENFABRIC_NODE, &vtysh_end_all_cmd); + /* keychain */ + install_node(&keychain_node); + install_element(CONFIG_NODE, &key_chain_cmd); + install_element(KEYCHAIN_NODE, &key_chain_cmd); + install_element(KEYCHAIN_NODE, &vtysh_exit_keys_cmd); + install_element(KEYCHAIN_NODE, &vtysh_quit_keys_cmd); install_element(KEYCHAIN_NODE, &vtysh_end_all_cmd); + + install_node(&keychain_key_node); + install_element(KEYCHAIN_NODE, &key_cmd); + install_element(KEYCHAIN_KEY_NODE, &key_chain_cmd); + install_element(KEYCHAIN_KEY_NODE, &vtysh_exit_keys_cmd); + install_element(KEYCHAIN_KEY_NODE, &vtysh_quit_keys_cmd); install_element(KEYCHAIN_KEY_NODE, &vtysh_end_all_cmd); - install_element(RMAP_NODE, &vtysh_end_all_cmd); - install_element(PBRMAP_NODE, &vtysh_end_all_cmd); - install_element(VTY_NODE, &vtysh_end_all_cmd); + /* nexthop-group */ + install_node(&nh_group_node); + install_element(CONFIG_NODE, &vtysh_nexthop_group_cmd); + install_element(CONFIG_NODE, &vtysh_no_nexthop_group_cmd); + install_element(NH_GROUP_NODE, &vtysh_end_all_cmd); + install_element(NH_GROUP_NODE, &vtysh_exit_nexthop_group_cmd); + install_element(NH_GROUP_NODE, &vtysh_quit_nexthop_group_cmd); + + /* zebra and all */ + install_node(&zebra_node); + + install_node(&interface_node); + install_element(CONFIG_NODE, &vtysh_interface_cmd); install_element(INTERFACE_NODE, &vtysh_end_all_cmd); install_element(INTERFACE_NODE, &vtysh_exit_interface_cmd); + install_element(INTERFACE_NODE, &vtysh_quit_interface_cmd); + + install_node(&link_params_node); + install_element(INTERFACE_NODE, &vtysh_link_params_cmd); install_element(LINK_PARAMS_NODE, &exit_link_params_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_node(&pw_node); + install_element(CONFIG_NODE, &vtysh_pseudowire_cmd); install_element(PW_NODE, &vtysh_end_all_cmd); install_element(PW_NODE, &vtysh_exit_interface_cmd); install_element(PW_NODE, &vtysh_quit_interface_cmd); - install_element(CONFIG_NODE, &vtysh_nexthop_group_cmd); - install_element(NH_GROUP_NODE, &vtysh_end_all_cmd); - install_element(NH_GROUP_NODE, &vtysh_exit_nexthop_group_cmd); - install_element(NH_GROUP_NODE, &vtysh_quit_nexthop_group_cmd); - + install_node(&vrf_node); + install_element(CONFIG_NODE, &vtysh_vrf_cmd); + install_element(VRF_NODE, &vtysh_vrf_netns_cmd); + install_element(VRF_NODE, &vtysh_no_vrf_netns_cmd); + install_element(VRF_NODE, &exit_vrf_config_cmd); install_element(VRF_NODE, &vtysh_end_all_cmd); install_element(VRF_NODE, &vtysh_exit_vrf_cmd); install_element(VRF_NODE, &vtysh_quit_vrf_cmd); + + install_node(&rmap_node); + install_element(CONFIG_NODE, &vtysh_route_map_cmd); + install_element(RMAP_NODE, &vtysh_exit_rmap_cmd); + install_element(RMAP_NODE, &vtysh_quit_rmap_cmd); + install_element(RMAP_NODE, &vtysh_end_all_cmd); - install_element(CONFIG_NODE, &router_eigrp_cmd); - install_element(CONFIG_NODE, &router_babel_cmd); - install_element(CONFIG_NODE, &router_rip_cmd); - install_element(CONFIG_NODE, &router_ripng_cmd); - install_element(CONFIG_NODE, &router_ospf_cmd); - install_element(CONFIG_NODE, &router_ospf6_cmd); -#if defined(HAVE_LDPD) - install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd); - install_element(LDP_NODE, &ldp_address_family_ipv4_cmd); - install_element(LDP_NODE, &ldp_address_family_ipv6_cmd); - install_element(LDP_IPV4_NODE, &ldp_interface_ifname_cmd); - install_element(LDP_IPV6_NODE, &ldp_interface_ifname_cmd); - install_element(CONFIG_NODE, &ldp_l2vpn_word_type_vpls_cmd); - install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_ifname_cmd); -#endif - install_element(CONFIG_NODE, &router_isis_cmd); - install_element(CONFIG_NODE, &router_openfabric_cmd); - install_element(CONFIG_NODE, &router_bgp_cmd); -#ifdef KEEP_OLD_VPN_COMMANDS - install_element(BGP_NODE, &address_family_vpnv4_cmd); - install_element(BGP_NODE, &address_family_vpnv6_cmd); -#endif /* KEEP_OLD_VPN_COMMANDS */ -#if defined(ENABLE_BGP_VNC) - install_element(BGP_NODE, &vnc_vrf_policy_cmd); - install_element(BGP_NODE, &vnc_defaults_cmd); - install_element(BGP_NODE, &vnc_nve_group_cmd); - install_element(BGP_NODE, &vnc_l2_group_cmd); -#endif - install_element(BGP_NODE, &address_family_ipv4_cmd); - install_element(BGP_NODE, &address_family_ipv4_multicast_cmd); - install_element(BGP_NODE, &address_family_ipv4_vpn_cmd); - install_element(BGP_NODE, &address_family_ipv4_labeled_unicast_cmd); - install_element(BGP_NODE, &address_family_ipv6_cmd); - install_element(BGP_NODE, &address_family_ipv6_multicast_cmd); - install_element(BGP_NODE, &address_family_ipv6_vpn_cmd); - install_element(BGP_NODE, &address_family_ipv6_labeled_unicast_cmd); - install_element(BGP_NODE, &address_family_evpn_cmd); - install_element(BGP_NODE, &address_family_flowspecv4_cmd); - install_element(BGP_NODE, &address_family_flowspecv6_cmd); -#if defined(HAVE_CUMULUS) - install_element(BGP_NODE, &address_family_evpn2_cmd); -#endif - install_element(BGP_VPNV4_NODE, &exit_address_family_cmd); - install_element(BGP_VPNV6_NODE, &exit_address_family_cmd); - install_element(BGP_IPV4_NODE, &exit_address_family_cmd); - install_element(BGP_IPV4M_NODE, &exit_address_family_cmd); - install_element(BGP_IPV4L_NODE, &exit_address_family_cmd); - install_element(BGP_IPV6_NODE, &exit_address_family_cmd); - install_element(BGP_IPV6M_NODE, &exit_address_family_cmd); - install_element(BGP_EVPN_NODE, &exit_address_family_cmd); - install_element(BGP_IPV6L_NODE, &exit_address_family_cmd); - install_element(BGP_FLOWSPECV4_NODE, &exit_address_family_cmd); - install_element(BGP_FLOWSPECV6_NODE, &exit_address_family_cmd); + install_node(&vty_node); + install_element(CONFIG_NODE, &vtysh_line_vty_cmd); + install_element(VTY_NODE, &vtysh_exit_line_vty_cmd); + install_element(VTY_NODE, &vtysh_quit_line_vty_cmd); + install_element(VTY_NODE, &vtysh_end_all_cmd); - install_element(BGP_NODE, &bmp_targets_cmd); - install_element(BMP_NODE, &bmp_exit_cmd); - install_element(BMP_NODE, &bmp_quit_cmd); - install_element(BMP_NODE, &vtysh_end_all_cmd); - install_element(CONFIG_NODE, &rpki_cmd); - install_element(RPKI_NODE, &rpki_exit_cmd); - install_element(RPKI_NODE, &rpki_quit_cmd); - install_element(RPKI_NODE, &vtysh_end_all_cmd); + struct cmd_node *node; + for (unsigned int i = 0; i < vector_active(cmdvec); i++) { + node = vector_slot(cmdvec, i); + if (!node || node->node == VIEW_NODE) + continue; + vtysh_install_default(node->node); + } - /* EVPN commands */ - install_element(BGP_EVPN_NODE, &bgp_evpn_vni_cmd); - install_element(BGP_EVPN_VNI_NODE, &exit_vni_cmd); + /* vtysh */ - install_element(BGP_VRF_POLICY_NODE, &exit_vrf_policy_cmd); - install_element(BGP_VNC_DEFAULTS_NODE, &exit_vnc_config_cmd); - install_element(BGP_VNC_NVE_GROUP_NODE, &exit_vnc_config_cmd); - install_element(BGP_VNC_L2_GROUP_NODE, &exit_vnc_config_cmd); + install_element(VIEW_NODE, &vtysh_enable_cmd); + install_element(ENABLE_NODE, &vtysh_config_terminal_cmd); + install_element(ENABLE_NODE, &vtysh_disable_cmd); + + /* "exit" command. */ + install_element(VIEW_NODE, &vtysh_exit_all_cmd); + install_element(CONFIG_NODE, &vtysh_exit_all_cmd); + install_element(VIEW_NODE, &vtysh_quit_all_cmd); + install_element(CONFIG_NODE, &vtysh_quit_all_cmd); + + /* "end" command. */ + install_element(CONFIG_NODE, &vtysh_end_all_cmd); + install_element(ENABLE_NODE, &vtysh_end_all_cmd); - install_element(CONFIG_NODE, &key_chain_cmd); - install_element(CONFIG_NODE, &vtysh_route_map_cmd); - install_element(CONFIG_NODE, &vtysh_pbr_map_cmd); - install_element(CONFIG_NODE, &vtysh_no_pbr_map_cmd); - install_element(CONFIG_NODE, &vtysh_line_vty_cmd); - install_element(KEYCHAIN_NODE, &key_cmd); - install_element(KEYCHAIN_NODE, &key_chain_cmd); - install_element(KEYCHAIN_KEY_NODE, &key_chain_cmd); - install_element(CONFIG_NODE, &vtysh_interface_cmd); - install_element(CONFIG_NODE, &vtysh_pseudowire_cmd); - install_element(INTERFACE_NODE, &vtysh_link_params_cmd); install_element(ENABLE_NODE, &vtysh_show_running_config_cmd); install_element(ENABLE_NODE, &vtysh_copy_running_config_cmd); install_element(ENABLE_NODE, &vtysh_copy_to_running_cmd); - install_element(CONFIG_NODE, &vtysh_vrf_cmd); - install_element(VRF_NODE, &vtysh_vrf_netns_cmd); - install_element(VRF_NODE, &vtysh_no_vrf_netns_cmd); - install_element(VRF_NODE, &exit_vrf_config_cmd); - - install_element(CONFIG_NODE, &vtysh_no_nexthop_group_cmd); - /* "write terminal" command. */ install_element(ENABLE_NODE, &vtysh_write_terminal_cmd); |