]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Add test and show commands for mlag
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 18 Dec 2018 13:48:00 +0000 (08:48 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 4 Jan 2019 17:21:00 +0000 (12:21 -0500)
Add a 'test zebra mlag <none|master|slave>` and
a `show zebra mlag` comamnd.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/subdir.am
zebra/zebra_mlag.c

index 977990c3810e8d95af74a59e584cd10a4a714135..23c3cd4239530b857a0b64404613b83e8f154cf8 100644 (file)
@@ -10,6 +10,7 @@ vtysh_scan += \
        $(top_srcdir)/zebra/interface.c \
        $(top_srcdir)/zebra/router-id.c \
        $(top_srcdir)/zebra/rtadv.c \
+       $(top_srcdir)/zebra/zebra_mlag.c \
        $(top_srcdir)/zebra/zebra_mpls_vty.c \
        $(top_srcdir)/zebra/zebra_ptm.c \
        $(top_srcdir)/zebra/zebra_pw.c \
@@ -94,10 +95,12 @@ zebra_zebra_SOURCES = \
        zebra/zebra_errors.c \
        # end
 
+zebra/zebra_mlag_clippy.c: $(CLIPPY_DEPS)
+zebra/zebra_mlag.$(OBJEXT): zebra/zebra_mlag_clippy.c
+
 zebra/zebra_vty_clippy.c: $(CLIPPY_DEPS)
 zebra/zebra_vty.$(OBJEXT): zebra/zebra_vty_clippy.c
 
-
 zebra/zebra_routemap_clippy.c: $(CLIPPY_DEPS)
 zebra/zebra_routemap.$(OBJEXT): zebra/zebra_routemap_clippy.c
 
index 26470ed5c0ef67a15c9176fadb7cd485509e3c50..35be07c024e60679d6d40db4e89ac4fd1b42f773 100644 (file)
  */
 #include "zebra.h"
 
+#include "command.h"
 #include "hook.h"
 
 #include "zebra/zebra_mlag.h"
 
+#ifndef VTYSH_EXTRACT_PL
+#include "zebra/zebra_mlag_clippy.c"
+#endif
+
 enum mlag_role role = MLAG_ROLE_NONE;
 
 enum mlag_role zebra_mlag_get_role(void)
@@ -32,8 +37,45 @@ enum mlag_role zebra_mlag_get_role(void)
        return role;
 }
 
+DEFUN_HIDDEN (show_mlag,
+             show_mlag_cmd,
+             "show zebra mlag",
+             SHOW_STR
+             ZEBRA_STR
+             "The mlag role on this machine\n")
+{
+       char buf[80];
+
+       vty_out(vty, "MLag is configured to: %s\n",
+               mlag_role2str(role, buf, sizeof(buf)));
+
+       return CMD_SUCCESS;
+}
+
+DEFPY_HIDDEN (test_mlag,
+             test_mlag_cmd,
+             "test zebra mlag <none$none|primary$primary|secondary$secondary>",
+             "Test code\n"
+             ZEBRA_STR
+             "Modify the Mlag state\n"
+             "Mlag is not setup on the machine\n"
+             "Mlag is setup to be primary\n"
+             "Mlag is setup to be the secondary\n")
+{
+       if (none)
+               role = MLAG_ROLE_NONE;
+       if (primary)
+               role = MLAG_ROLE_PRIMARY;
+       if (secondary)
+               role = MLAG_ROLE_SECONDARY;
+
+       return CMD_SUCCESS;
+}
+
 void zebra_mlag_init(void)
 {
+       install_element(VIEW_NODE, &show_mlag_cmd);
+       install_element(ENABLE_NODE, &test_mlag_cmd);
 }
 
 void zebra_mlag_terminate(void)