2 * IS-IS Rout(e)ing protocol - isis_vty_isisd.c
4 * This file contains the CLI that is specific to IS-IS
6 * Copyright (C) 2001,2002 Sampo Saaristo
7 * Tampere University of Technology
8 * Institute of Communications Engineering
9 * Copyright (C) 2016 David Lamparter, for NetDEF, Inc.
10 * Copyright (C) 2018 Christian Franke, for NetDEF, Inc.
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public Licenseas published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
17 * This program is distributed in the hope that it will be useful,but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
22 * You should have received a copy of the GNU General Public License along
23 * with this program; see the file COPYING; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include "isis_circuit.h"
33 #include "isis_misc.h"
36 #include "isis_vty_common.h"
38 static int level_for_arg(const char *arg
)
40 if (!strcmp(arg
, "level-1"))
48 "isis priority (0-127)",
49 "IS-IS routing protocol\n"
50 "Set priority for Designated Router election\n"
53 uint8_t prio
= atoi(argv
[2]->arg
);
54 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
56 return CMD_ERR_NO_MATCH
;
58 circuit
->priority
[0] = prio
;
59 circuit
->priority
[1] = prio
;
64 DEFUN (no_isis_priority
,
66 "no isis priority [(0-127)]",
68 "IS-IS routing protocol\n"
69 "Set priority for Designated Router election\n"
72 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
74 return CMD_ERR_NO_MATCH
;
76 circuit
->priority
[0] = DEFAULT_PRIORITY
;
77 circuit
->priority
[1] = DEFAULT_PRIORITY
;
82 DEFUN (isis_priority_level
,
83 isis_priority_level_cmd
,
84 "isis priority (0-127) <level-1|level-2>",
85 "IS-IS routing protocol\n"
86 "Set priority for Designated Router election\n"
88 "Specify priority for level-1 routing\n"
89 "Specify priority for level-2 routing\n")
91 uint8_t prio
= atoi(argv
[2]->arg
);
92 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
94 return CMD_ERR_NO_MATCH
;
96 circuit
->priority
[level_for_arg(argv
[3]->text
)] = prio
;
101 DEFUN (no_isis_priority_level
,
102 no_isis_priority_level_cmd
,
103 "no isis priority [(0-127)] <level-1|level-2>",
105 "IS-IS routing protocol\n"
106 "Set priority for Designated Router election\n"
108 "Specify priority for level-1 routing\n"
109 "Specify priority for level-2 routing\n")
111 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
112 int level
= level_for_arg(argv
[argc
- 1]->text
);
114 return CMD_ERR_NO_MATCH
;
116 circuit
->priority
[level
] = DEFAULT_PRIORITY
;
121 void isis_vty_daemon_init(void)
123 install_element(INTERFACE_NODE
, &isis_priority_cmd
);
124 install_element(INTERFACE_NODE
, &no_isis_priority_cmd
);
125 install_element(INTERFACE_NODE
, &isis_priority_level_cmd
);
126 install_element(INTERFACE_NODE
, &no_isis_priority_level_cmd
);