]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_mlag.c
Merge pull request #3569 from donaldsharp/recursive_nexthops
[mirror_frr.git] / zebra / zebra_mlag.c
1 /* Zebra Mlag Code.
2 * Copyright (C) 2018 Cumulus Networks, Inc.
3 * Donald Sharp
4 *
5 * This file is part of FRR.
6 *
7 * FRR is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * FRR is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with FRR; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22 #include "zebra.h"
23
24 #include "command.h"
25 #include "hook.h"
26
27 #include "zebra/zebra_mlag.h"
28
29 #ifndef VTYSH_EXTRACT_PL
30 #include "zebra/zebra_mlag_clippy.c"
31 #endif
32
33 enum mlag_role role = MLAG_ROLE_NONE;
34
35 enum mlag_role zebra_mlag_get_role(void)
36 {
37 return role;
38 }
39
40 DEFUN_HIDDEN (show_mlag,
41 show_mlag_cmd,
42 "show zebra mlag",
43 SHOW_STR
44 ZEBRA_STR
45 "The mlag role on this machine\n")
46 {
47 char buf[80];
48
49 vty_out(vty, "MLag is configured to: %s\n",
50 mlag_role2str(role, buf, sizeof(buf)));
51
52 return CMD_SUCCESS;
53 }
54
55 DEFPY_HIDDEN (test_mlag,
56 test_mlag_cmd,
57 "test zebra mlag <none$none|primary$primary|secondary$secondary>",
58 "Test code\n"
59 ZEBRA_STR
60 "Modify the Mlag state\n"
61 "Mlag is not setup on the machine\n"
62 "Mlag is setup to be primary\n"
63 "Mlag is setup to be the secondary\n")
64 {
65 if (none)
66 role = MLAG_ROLE_NONE;
67 if (primary)
68 role = MLAG_ROLE_PRIMARY;
69 if (secondary)
70 role = MLAG_ROLE_SECONDARY;
71
72 return CMD_SUCCESS;
73 }
74
75 void zebra_mlag_init(void)
76 {
77 install_element(VIEW_NODE, &show_mlag_cmd);
78 install_element(ENABLE_NODE, &test_mlag_cmd);
79 }
80
81 void zebra_mlag_terminate(void)
82 {
83 }