diff options
Diffstat (limited to 'zebra/zebra_mlag.c')
| -rw-r--r-- | zebra/zebra_mlag.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index 35be07c024..5012cc2a49 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -25,16 +25,17 @@ #include "hook.h" #include "zebra/zebra_mlag.h" +#include "zebra/zebra_router.h" +#include "zebra/zapi_msg.h" +#include "zebra/debug.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) { - return role; + return zrouter.mlag_info.role; } DEFUN_HIDDEN (show_mlag, @@ -47,7 +48,7 @@ DEFUN_HIDDEN (show_mlag, char buf[80]; vty_out(vty, "MLag is configured to: %s\n", - mlag_role2str(role, buf, sizeof(buf))); + mlag_role2str(zrouter.mlag_info.role, buf, sizeof(buf))); return CMD_SUCCESS; } @@ -62,12 +63,23 @@ DEFPY_HIDDEN (test_mlag, "Mlag is setup to be primary\n" "Mlag is setup to be the secondary\n") { + enum mlag_role orig = zrouter.mlag_info.role; + char buf1[80], buf2[80]; + if (none) - role = MLAG_ROLE_NONE; + zrouter.mlag_info.role = MLAG_ROLE_NONE; if (primary) - role = MLAG_ROLE_PRIMARY; + zrouter.mlag_info.role = MLAG_ROLE_PRIMARY; if (secondary) - role = MLAG_ROLE_SECONDARY; + zrouter.mlag_info.role = MLAG_ROLE_SECONDARY; + + if (IS_ZEBRA_DEBUG_MLAG) + zlog_debug("Test: Changing role from %s to %s", + mlag_role2str(orig, buf1, sizeof(buf1)), + mlag_role2str(orig, buf2, sizeof(buf2))); + + if (orig != zrouter.mlag_info.role) + zsend_capabilities_all_clients(); return CMD_SUCCESS; } |
