#include "libfrr.h"
#include "command_graph.h"
#include "frrstr.h"
+#include "json.h"
DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy")
{.fd = -1, .name = "eigrpd", .flag = VTYSH_EIGRPD, .next = NULL},
{.fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .next = NULL},
{.fd = -1, .name = "sharpd", .flag = VTYSH_SHARPD, .next = NULL},
+ {.fd = -1, .name = "fabricd", .flag = VTYSH_FABRICD, .next = NULL},
{.fd = -1, .name = "watchfrr", .flag = VTYSH_WATCHFRR, .next = NULL},
{.fd = -1, .name = "pbrd", .flag = VTYSH_PBRD, .next = NULL},
{.fd = -1, .name = "staticd", .flag = VTYSH_STATICD, .next = NULL},
return NULL;
}
-static char **new_completion(char *text, int start, int end)
+static char **new_completion(const char *text, int start, int end)
{
char **matches;
ISIS_NODE, "%s(config-router)# ",
};
+static struct cmd_node openfabric_node = {
+ OPENFABRIC_NODE, "%s(config-router)# ",
+};
+
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ",
};
LINK_PARAMS_NODE, "%s(config-link-params)# ",
};
-#if defined(HAVE_RPKI)
static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1};
-#endif
#if HAVE_BFDD > 0
static struct cmd_node bfd_node = {
return CMD_SUCCESS;
}
-#if defined(HAVE_RPKI)
DEFUNSH(VTYSH_BGPD,
rpki,
rpki_cmd,
return CMD_SUCCESS;
}
-DEFUNSH(VTYSH_BGPD,
- rpki_exit,
- rpki_exit_cmd,
- "exit",
- "Exit current mode and down to previous mode\n")
-{
- vty->node = CONFIG_NODE;
- return CMD_SUCCESS;
-}
-
-DEFUNSH(VTYSH_BGPD,
- rpki_quit,
- rpki_quit_cmd,
- "quit",
- "Exit current mode and down to previous mode\n")
-{
- return rpki_exit(self, vty, argc, argv);
-}
-#endif
-
DEFUNSH(VTYSH_BGPD, address_family_evpn, address_family_evpn_cmd,
"address-family <l2vpn evpn>",
"Enter Address Family command mode\n"
return CMD_SUCCESS;
}
+DEFUNSH(VTYSH_FABRICD, router_openfabric, router_openfabric_cmd, "router openfabric WORD",
+ ROUTER_STR
+ "OpenFabric routing protocol\n"
+ "ISO Routing area tag\n")
+{
+ vty->node = OPENFABRIC_NODE;
+ return CMD_SUCCESS;
+}
+
DEFUNSH(VTYSH_RMAP, vtysh_route_map, vtysh_route_map_cmd,
"route-map WORD <deny|permit> (1-65535)",
"Create route-map or enter route-map command mode\n"
case LDP_NODE:
case LDP_L2VPN_NODE:
case ISIS_NODE:
+ case OPENFABRIC_NODE:
case RMAP_NODE:
case PBRMAP_NODE:
case VTY_NODE:
case KEYCHAIN_NODE:
case BFD_NODE:
+ case RPKI_NODE:
vtysh_execute("end");
vtysh_execute("configure terminal");
vty->node = CONFIG_NODE;
|| vty->node == BGP_VNC_L2_GROUP_NODE)
vty->node = BGP_NODE;
return CMD_SUCCESS;
+
+}
+
+DEFUNSH(VTYSH_BGPD, rpki_exit, rpki_exit_cmd, "exit",
+ "Exit current mode and down to previous mode\n")
+{
+ vtysh_exit(vty);
+ return CMD_SUCCESS;
+}
+
+DEFUNSH(VTYSH_BGPD, rpki_quit, rpki_quit_cmd, "quit",
+ "Exit current mode and down to previous mode\n")
+{
+ return rpki_exit(self, vty, argc, argv);
}
DEFUNSH(VTYSH_PIMD|VTYSH_ZEBRA, exit_vrf_config, exit_vrf_config_cmd, "exit-vrf",
"Exit current mode and down to previous mode\n")
#endif
+DEFUNSH(VTYSH_FABRICD, vtysh_exit_fabricd, vtysh_exit_fabricd_cmd, "exit",
+ "Exit current mode and down to previous mode\n")
+{
+ return vtysh_exit(vty);
+}
+
+DEFUNSH(VTYSH_FABRICD, vtysh_quit_fabricd, vtysh_quit_fabricd_cmd, "quit",
+ "Exit current mode and down to previous mode\n")
+{
+ return vtysh_exit_fabricd(self, vty, argc, argv);
+}
+
DEFUNSH(VTYSH_ALL, vtysh_exit_line_vty, vtysh_exit_line_vty_cmd, "exit",
"Exit current mode and down to previous mode\n")
{
DEFUN (vtysh_show_work_queues_daemon,
vtysh_show_work_queues_daemon_cmd,
- "show work-queues <zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pbrd>",
+ "show work-queues <zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pbrd|fabricd>",
SHOW_STR
"Work Queue information\n"
"For the zebra daemon\n"
"For the ospfv6 daemon\n"
"For the bgp daemon\n"
"For the isis daemon\n"
- "For the pbr daemon\n")
+ "For the pbr daemon\n"
+ "For the fabricd daemon\n")
{
int idx_protocol = 2;
unsigned int i;
DEFUN (vtysh_show_error_code,
vtysh_show_error_code_cmd,
- "show error (0-4294967296)",
+ "show error <(1-4294967296)|all> [json]",
SHOW_STR
"Information on errors\n"
- "Error code to get info about\n")
+ "Error code to get info about\n"
+ "Information on all errors\n"
+ JSON_STR)
{
+ char *fcmd = argv_concat(argv, argc, 0);
char cmd[256];
+ int rv;
- snprintf(cmd, sizeof(cmd), "do show error %s", argv[2]->arg);
+ snprintf(cmd, sizeof(cmd), "do %s", fcmd);
/* FIXME: Needs to determine which daemon to send to via code ranges */
- return show_per_daemon(cmd, "");
+ rv = show_per_daemon(cmd, "");
+
+ XFREE(MTYPE_TMP, fcmd);
+ return rv;
}
/* Memory */
DEFUN (vtysh_write_terminal,
vtysh_write_terminal_cmd,
- "write terminal [<zebra|ripd|ripngd|ospfd|ospf6d|ldpd|bgpd|isisd|pimd>]",
+ "write terminal [<zebra|ripd|ripngd|ospfd|ospf6d|ldpd|bgpd|isisd|fabricd|pimd>]",
"Write running configuration to memory, network, or terminal\n"
"Write to terminal\n"
"For the zebra daemon\n"
"For the ldpd daemon\n"
"For the bgp daemon\n"
"For the isis daemon\n"
+ "For the fabricd daemon\n"
"For the pim daemon\n")
{
unsigned int i;
DEFUN (vtysh_show_running_config,
vtysh_show_running_config_cmd,
- "show running-config [<zebra|ripd|ripngd|ospfd|ospf6d|ldpd|bgpd|isisd|pimd>]",
+ "show running-config [<zebra|ripd|ripngd|ospfd|ospf6d|ldpd|bgpd|isisd|fabricd|pimd>]",
SHOW_STR
"Current operating configuration\n"
"For the zebra daemon\n"
"For the ldp daemon\n"
"For the bgp daemon\n"
"For the isis daemon\n"
+ "For the fabricd daemon\n"
"For the pim daemon\n")
{
return vtysh_write_terminal(self, vty, argc, argv);
rl_initialize();
rl_bind_key('?', (rl_command_func_t *)vtysh_rl_describe);
rl_completion_entry_function = vtysh_completion_entry_function;
- rl_attempted_completion_function =
- (rl_completion_func_t *)new_completion;
+ rl_attempted_completion_function = new_completion;
}
char *vtysh_prompt(void)
install_node(&keychain_node, NULL);
install_node(&keychain_key_node, NULL);
install_node(&isis_node, NULL);
+ install_node(&openfabric_node, NULL);
install_node(&vty_node, NULL);
-#if defined(HAVE_RPKI)
install_node(&rpki_node, NULL);
-#endif
#if HAVE_BFDD > 0
install_node(&bfd_node, NULL);
install_node(&bfd_peer_node, NULL);
#endif
install_element(ISIS_NODE, &vtysh_exit_isisd_cmd);
install_element(ISIS_NODE, &vtysh_quit_isisd_cmd);
+ install_element(OPENFABRIC_NODE, &vtysh_exit_fabricd_cmd);
+ install_element(OPENFABRIC_NODE, &vtysh_quit_fabricd_cmd);
install_element(KEYCHAIN_NODE, &vtysh_exit_ripd_cmd);
install_element(KEYCHAIN_NODE, &vtysh_quit_ripd_cmd);
install_element(KEYCHAIN_KEY_NODE, &vtysh_exit_ripd_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);
install_element(KEYCHAIN_NODE, &vtysh_end_all_cmd);
install_element(KEYCHAIN_KEY_NODE, &vtysh_end_all_cmd);
install_element(RMAP_NODE, &vtysh_end_all_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);
install_element(BGP_NODE, &address_family_vpnv4_cmd);
install_element(BGP_NODE, &address_family_vpnv6_cmd);
install_element(BGP_FLOWSPECV4_NODE, &exit_address_family_cmd);
install_element(BGP_FLOWSPECV6_NODE, &exit_address_family_cmd);
-#if defined(HAVE_RPKI)
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);
-#endif
/* EVPN commands */
install_element(BGP_EVPN_NODE, &bgp_evpn_vni_cmd);