diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-12-18 08:48:00 -0500 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-01-04 12:21:00 -0500 | 
| commit | 763ec244cfbbcd61e9e3a2dfcdf134cc8ec48925 (patch) | |
| tree | 79b5bf98c1fa022e0a9268a22618328f26a1b3aa /zebra/zebra_mlag.c | |
| parent | 6edbb8b2e3fc0f4636a82931abecabe6833197f1 (diff) | |
zebra: Add test and show commands for mlag
Add a 'test zebra mlag <none|master|slave>` and
a `show zebra mlag` comamnd.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mlag.c')
| -rw-r--r-- | zebra/zebra_mlag.c | 42 | 
1 files changed, 42 insertions, 0 deletions
diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index 26470ed5c0..35be07c024 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -21,10 +21,15 @@   */  #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)  | 
