summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-09-08 19:48:48 +0200
committerGitHub <noreply@github.com>2018-09-08 19:48:48 +0200
commit714e135429aaca467bd2ed654edfe977b5cd1a9c (patch)
treefa3d60c363844150764df32237d1d9799820694f /vtysh
parentMerge pull request #2991 from donaldsharp/mac_compiling (diff)
parentisisd: silence SA warnings (diff)
downloadfrr-714e135429aaca467bd2ed654edfe977b5cd1a9c.tar.xz
frr-714e135429aaca467bd2ed654edfe977b5cd1a9c.zip
Merge pull request #2875 from opensourcerouting/fabricd
OpenFabric support
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/Makefile.am4
-rwxr-xr-xvtysh/extract.pl.in41
-rw-r--r--vtysh/vtysh.c43
-rw-r--r--vtysh/vtysh.h7
-rw-r--r--vtysh/vtysh_config.c3
5 files changed, 85 insertions, 13 deletions
diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am
index 936640c83..350b6fede 100644
--- a/vtysh/Makefile.am
+++ b/vtysh/Makefile.am
@@ -64,7 +64,9 @@ if ISISD
vtysh_scan += $(top_srcdir)/isisd/isis_redist.c
vtysh_scan += $(top_srcdir)/isisd/isis_spf.c
vtysh_scan += $(top_srcdir)/isisd/isis_te.c
-vtysh_scan += $(top_srcdir)/isisd/isis_vty.c
+vtysh_scan += $(top_srcdir)/isisd/isis_vty_common.c
+vtysh_scan += $(top_srcdir)/isisd/isis_vty_fabricd.c
+vtysh_scan += $(top_srcdir)/isisd/isis_vty_isisd.c
vtysh_scan += $(top_srcdir)/isisd/isisd.c
endif
diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in
index 92b5686a9..690e9a12c 100755
--- a/vtysh/extract.pl.in
+++ b/vtysh/extract.pl.in
@@ -35,10 +35,12 @@ EOF
my $cli_stomp = 0;
-foreach (@ARGV) {
- $file = $_;
+sub scan_file {
+ my ( $file, $fabricd) = @_;
+
+ $cppadd = $fabricd ? "-DFABRICD=1" : "";
- open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/bgpd -I@top_srcdir@/@LIBRFP@ -I@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $file |");
+ open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/bgpd -I@top_srcdir@/@LIBRFP@ -I@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $cppadd $file |");
local $/; undef $/;
$line = <FH>;
close (FH);
@@ -77,6 +79,10 @@ foreach (@ARGV) {
$cmd =~ s/^\s+//g;
$cmd =~ s/\s+$//g;
+ if ($fabricd) {
+ $cmd = "fabricd_" . $cmd;
+ }
+
# $protocol is VTYSH_PROTO format for redirection of user input
if ($file =~ /lib\/keychain\.c$/) {
$protocol = "VTYSH_RIPD";
@@ -107,9 +113,9 @@ foreach (@ARGV) {
}
elsif ($file =~ /lib\/plist\.c$/) {
if ($defun_array[1] =~ m/ipv6/) {
- $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_BABELD|VTYSH_ISISD";
+ $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD";
} else {
- $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_ISISD";
+ $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD";
}
}
elsif ($file =~ /lib\/distribute\.c$/) {
@@ -132,6 +138,9 @@ foreach (@ARGV) {
elsif ($file =~ /librfp\/.*\.c$/ || $file =~ /rfapi\/.*\.c$/) {
$protocol = "VTYSH_BGPD";
}
+ elsif ($fabricd) {
+ $protocol = "VTYSH_FABRICD";
+ }
else {
($protocol) = ($file =~ /^.*\/([a-z0-9]+)\/[a-zA-Z0-9_\-]+\.c$/);
$protocol = "VTYSH_" . uc $protocol;
@@ -170,6 +179,10 @@ foreach (@ARGV) {
$ecmd =~ s/^\s+//g;
$ecmd =~ s/\s+$//g;
+ if ($fabricd) {
+ $ecmd = "fabricd_" . $ecmd;
+ }
+
# Register $ecmd
if (defined ($cmd2str{$ecmd})) {
my ($key);
@@ -187,6 +200,24 @@ foreach (@ARGV) {
}
}
+foreach (@ARGV) {
+ if (/\/isisd\//) {
+ # We scan all the IS-IS files twice, once for isisd,
+ # once for fabricd. Exceptions are made for the files
+ # that are not shared between the two.
+ if (/isis_vty_isisd.c/) {
+ scan_file($_, 0);
+ } elsif (/isis_vty_fabricd.c/) {
+ scan_file($_, 1);
+ } else {
+ scan_file($_, 0);
+ scan_file($_, 1);
+ }
+ } else {
+ scan_file($_, 0);
+ }
+}
+
# When we have cli commands that map to the same function name, we
# can introduce subtle bugs due to code not being called when
# we think it is.
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index bcae4407c..39b756dda 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -132,6 +132,7 @@ struct vtysh_client vtysh_client[] = {
{.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},
@@ -1141,6 +1142,10 @@ static struct cmd_node isis_node = {
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)# ",
};
@@ -1653,6 +1658,15 @@ DEFUNSH(VTYSH_ISISD, router_isis, router_isis_cmd, "router isis WORD",
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"
@@ -1767,6 +1781,7 @@ static int vtysh_exit(struct vty *vty)
case LDP_NODE:
case LDP_L2VPN_NODE:
case ISIS_NODE:
+ case OPENFABRIC_NODE:
case RMAP_NODE:
case PBRMAP_NODE:
case VTY_NODE:
@@ -2042,6 +2057,18 @@ ALIAS(vtysh_exit_bfdd, vtysh_quit_bfdd_cmd, "quit",
"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")
{
@@ -2245,7 +2272,7 @@ DEFUN (vtysh_show_work_queues,
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"
@@ -2255,7 +2282,8 @@ DEFUN (vtysh_show_work_queues_daemon,
"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;
@@ -2593,7 +2621,7 @@ DEFUNSH(VTYSH_ALL, no_vtysh_config_enable_password,
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"
@@ -2604,6 +2632,7 @@ DEFUN (vtysh_write_terminal,
"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;
@@ -2630,7 +2659,7 @@ DEFUN (vtysh_write_terminal,
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"
@@ -2641,6 +2670,7 @@ DEFUN (vtysh_show_running_config,
"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);
@@ -3493,6 +3523,7 @@ void vtysh_init_vty(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);
@@ -3587,6 +3618,8 @@ void vtysh_init_vty(void)
#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);
@@ -3647,6 +3680,7 @@ void vtysh_init_vty(void)
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);
@@ -3696,6 +3730,7 @@ void vtysh_init_vty(void)
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);
diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h
index 5bff01a50..ee980d512 100644
--- a/vtysh/vtysh.h
+++ b/vtysh/vtysh.h
@@ -41,6 +41,7 @@ DECLARE_MGROUP(MVTYSH)
#define VTYSH_PBRD 0x04000
#define VTYSH_STATICD 0x08000
#define VTYSH_BFDD 0x10000
+#define VTYSH_FABRICD 0x20000
#define VTYSH_WAS_ACTIVE (-2)
@@ -49,9 +50,9 @@ DECLARE_MGROUP(MVTYSH)
/* watchfrr is not in ALL since library CLI functions should not be
* run on it (logging & co. should stay in a fixed/frozen config, and
* things like prefix lists are not even initialised) */
-#define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_SHARPD|VTYSH_PBRD|VTYSH_STATICD|VTYSH_BFDD
-#define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_SHARPD
-#define VTYSH_INTERFACE VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_PBRD
+#define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_SHARPD|VTYSH_PBRD|VTYSH_STATICD|VTYSH_BFDD|VTYSH_FABRICD
+#define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_SHARPD|VTYSH_FABRICD
+#define VTYSH_INTERFACE VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_PBRD|VTYSH_FABRICD
#define VTYSH_NS VTYSH_ZEBRA
#define VTYSH_VRF VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_STATICD
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 42f08342c..9f6e20f2b 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -245,6 +245,9 @@ void vtysh_config_parse_line(void *arg, const char *line)
else if (strncmp(line, "router isis", strlen("router isis"))
== 0)
config = config_get(ISIS_NODE, line);
+ else if (strncmp(line, "router openfabric", strlen("router openfabric"))
+ == 0)
+ config = config_get(OPENFABRIC_NODE, line);
else if (strncmp(line, "route-map", strlen("route-map")) == 0)
config = config_get(RMAP_NODE, line);
else if (strncmp(line, "pbr-map", strlen("pbr-map")) == 0)