summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-01-26 10:59:15 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-03-09 11:07:41 -0500
commitdba32923eb4198bb17e2cdbcd9e88c7decde81c4 (patch)
tree1098f14b993887494e098bd1256720f32abd5d2b /lib
parent7ee30f288e9d572d971c2a36b68775c7d2fac299 (diff)
lib, vtysh: Start cli for nexthop-group
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/command.c3
-rw-r--r--lib/command.h1
-rw-r--r--lib/nexthop_group.c34
-rw-r--r--lib/nexthop_group.h2
-rw-r--r--lib/subdir.am2
5 files changed, 42 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c
index 6d04ad83c0..5697c1d812 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -65,6 +65,7 @@ const char *node_names[] = {
"logical-router", // LOGICALROUTER_NODE,
"vrf", // VRF_NODE,
"interface", // INTERFACE_NODE,
+ "nexthop-group", // NH_GROUP_NODE,
"zebra", // ZEBRA_NODE,
"table", // TABLE_NODE,
"rip", // RIP_NODE,
@@ -1294,6 +1295,7 @@ void cmd_exit(struct vty *vty)
case PW_NODE:
case LOGICALROUTER_NODE:
case VRF_NODE:
+ case NH_GROUP_NODE:
case ZEBRA_NODE:
case BGP_NODE:
case RIP_NODE:
@@ -1379,6 +1381,7 @@ DEFUN (config_end,
case PW_NODE:
case LOGICALROUTER_NODE:
case VRF_NODE:
+ case NH_GROUP_NODE:
case ZEBRA_NODE:
case RIP_NODE:
case RIPNG_NODE:
diff --git a/lib/command.h b/lib/command.h
index 56e70abf6f..0febf903a3 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -88,6 +88,7 @@ enum node_type {
LOGICALROUTER_NODE, /* Logical-Router node. */
VRF_NODE, /* VRF mode node. */
INTERFACE_NODE, /* Interface mode node. */
+ NH_GROUP_NODE, /* Nexthop-Group mode node. */
ZEBRA_NODE, /* zebra connection node. */
TABLE_NODE, /* rtm_table selection node. */
RIP_NODE, /* RIP protocol mode node. */
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index 8bdc585405..e7f10487d1 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -21,6 +21,12 @@
#include <nexthop.h>
#include <nexthop_group.h>
+#include <vty.h>
+#include <command.h>
+
+#ifndef VTYSH_EXTRACT_PL
+#include "lib/nexthop_group_clippy.c"
+#endif
/* Add nexthop to the end of a nexthop list. */
void nexthop_add(struct nexthop **target, struct nexthop *nexthop)
@@ -64,3 +70,31 @@ void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
nexthop);
}
}
+
+DEFPY (nexthop_group,
+ nexthop_group_cmd,
+ "nexthop-group NAME",
+ "Enter into the nexthop-group submode\n"
+ "Specify the NAME of the nexthop-group\n")
+{
+ return CMD_SUCCESS;
+}
+
+struct cmd_node nexthop_group_node = {
+ NH_GROUP_NODE,
+ "%s(config-nh-group)# ",
+ 1
+};
+
+static int nexthop_group_write(struct vty *vty)
+{
+ vty_out(vty, "!\n");
+
+ return 1;
+}
+
+void nexthop_group_init(void)
+{
+ install_node(&nexthop_group_node, nexthop_group_write);
+ install_element(CONFIG_NODE, &nexthop_group_cmd);
+}
diff --git a/lib/nexthop_group.h b/lib/nexthop_group.h
index 26900959cc..561fe96425 100644
--- a/lib/nexthop_group.h
+++ b/lib/nexthop_group.h
@@ -33,6 +33,8 @@ struct nexthop_group {
struct nexthop *nexthop;
};
+void nexthop_group_init(void);
+
void nexthop_add(struct nexthop **target, struct nexthop *nexthop);
void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
struct nexthop *rparent);
diff --git a/lib/subdir.am b/lib/subdir.am
index 5001b3cecf..7d85b7a24d 100644
--- a/lib/subdir.am
+++ b/lib/subdir.am
@@ -82,6 +82,8 @@ lib_libfrr_la_SOURCES = \
lib/plist_clippy.c: $(CLIPPY_DEPS)
lib/plist.lo: lib/plist_clippy.c
+lib/nexthop_group_clippy.c: $(CLIPPY_DEPS)
+lib/nexthop_group.lo: lib/nexthop_group_clippy.c
pkginclude_HEADERS += \
lib/bfd.h \