Skip to content

Commit

Permalink
lib, vtysh: Start cli for nexthop-group
Browse files Browse the repository at this point in the history
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
  • Loading branch information
donaldsharp committed Mar 9, 2018
1 parent 7ee30f2 commit dba3292
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/command.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions lib/command.h
Expand Up @@ -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. */
Expand Down
34 changes: 34 additions & 0 deletions lib/nexthop_group.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions lib/nexthop_group.h
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions lib/subdir.am
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions vtysh/vtysh.c
Expand Up @@ -1499,6 +1499,7 @@ static int vtysh_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:
Expand Down

0 comments on commit dba3292

Please sign in to comment.