vty_out(vty, " isis network point-to-point\n");
}
+/*
+ * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority
+ */
+DEFPY(isis_priority, isis_priority_cmd,
+ "isis priority (0-127)$prio [level-1|level-2]$level",
+ "IS-IS routing protocol\n"
+ "Set priority for Designated Router election\n"
+ "Priority value\n"
+ "Specify priority for level-1 routing\n"
+ "Specify priority for level-2 routing\n")
+{
+ if (!level || strmatch(level, "level-1"))
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1",
+ NB_OP_MODIFY, prio_str);
+ if (!level || strmatch(level, "level-2"))
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2",
+ NB_OP_MODIFY, prio_str);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_isis_priority, no_isis_priority_cmd,
+ "no isis priority [(0-127)] [level-1|level-2]$level",
+ NO_STR
+ "IS-IS routing protocol\n"
+ "Set priority for Designated Router election\n"
+ "Priority value\n"
+ "Specify priority for level-1 routing\n"
+ "Specify priority for level-2 routing\n")
+{
+ if (!level || strmatch(level, "level-1"))
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1",
+ NB_OP_MODIFY, NULL);
+ if (!level || strmatch(level, "level-2"))
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2",
+ NB_OP_MODIFY, NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ const char *l1 = yang_dnode_get_string(dnode, "./level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+
+ if (strmatch(l1, l2))
+ vty_out(vty, " isis priority %s\n", l1);
+ else {
+ vty_out(vty, " isis priority %s level-1\n", l1);
+ vty_out(vty, " isis priority %s level-2\n", l2);
+ }
+}
+
void isis_cli_init(void)
{
install_element(CONFIG_NODE, &router_isis_cmd);
install_element(INTERFACE_NODE, &no_isis_circuit_type_cmd);
install_element(INTERFACE_NODE, &isis_network_cmd);
+
+ install_element(INTERFACE_NODE, &isis_priority_cmd);
+ install_element(INTERFACE_NODE, &no_isis_priority_cmd);
}
#endif /* ifndef FABRICD */
bool show_defaults);
void cli_show_ip_isis_network_type(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
+void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults);
#endif /* ISISD_ISIS_CLI_H_ */
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ struct isis_circuit *circuit;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ circuit = yang_dnode_get_entry(dnode, true);
+ circuit->priority[0] = yang_dnode_get_uint8(dnode, NULL);
+
return NB_OK;
}
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ struct isis_circuit *circuit;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ circuit = yang_dnode_get_entry(dnode, true);
+ circuit->priority[1] = yang_dnode_get_uint8(dnode, NULL);
+
return NB_OK;
}
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/metric/level-2",
.cbs.modify = lib_interface_isis_metric_level_2_modify,
},
+ {
+ .xpath = "/frr-interface:lib/interface/frr-isisd:isis/priority",
+ .cbs.cli_show = cli_show_ip_isis_priority,
+ },
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/priority/level-1",
.cbs.modify = lib_interface_isis_priority_level_1_modify,
install_element(INTERFACE_NODE, &isis_bfd_cmd);
install_element(INTERFACE_NODE, &no_isis_bfd_cmd);
+#ifdef FABRICD
isis_vty_daemon_init();
+#endif /* ifdef FABRICD */
}
+++ /dev/null
-/*
- * IS-IS Rout(e)ing protocol - isis_vty_isisd.c
- *
- * This file contains the CLI that is specific to IS-IS
- *
- * Copyright (C) 2001,2002 Sampo Saaristo
- * Tampere University of Technology
- * Institute of Communications Engineering
- * Copyright (C) 2016 David Lamparter, for NetDEF, Inc.
- * Copyright (C) 2018 Christian Franke, for NetDEF, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public Licenseas published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <zebra.h>
-
-#include "command.h"
-
-#include "isis_circuit.h"
-#include "isis_csm.h"
-#include "isis_misc.h"
-#include "isis_mt.h"
-#include "isisd.h"
-#include "isis_vty_common.h"
-
-static int level_for_arg(const char *arg)
-{
- if (!strcmp(arg, "level-1"))
- return IS_LEVEL_1;
- else
- return IS_LEVEL_2;
-}
-
-DEFUN (isis_priority,
- isis_priority_cmd,
- "isis priority (0-127)",
- "IS-IS routing protocol\n"
- "Set priority for Designated Router election\n"
- "Priority value\n")
-{
- uint8_t prio = atoi(argv[2]->arg);
- struct isis_circuit *circuit = isis_circuit_lookup(vty);
- if (!circuit)
- return CMD_ERR_NO_MATCH;
-
- circuit->priority[0] = prio;
- circuit->priority[1] = prio;
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_isis_priority,
- no_isis_priority_cmd,
- "no isis priority [(0-127)]",
- NO_STR
- "IS-IS routing protocol\n"
- "Set priority for Designated Router election\n"
- "Priority value\n")
-{
- struct isis_circuit *circuit = isis_circuit_lookup(vty);
- if (!circuit)
- return CMD_ERR_NO_MATCH;
-
- circuit->priority[0] = DEFAULT_PRIORITY;
- circuit->priority[1] = DEFAULT_PRIORITY;
-
- return CMD_SUCCESS;
-}
-
-DEFUN (isis_priority_level,
- isis_priority_level_cmd,
- "isis priority (0-127) <level-1|level-2>",
- "IS-IS routing protocol\n"
- "Set priority for Designated Router election\n"
- "Priority value\n"
- "Specify priority for level-1 routing\n"
- "Specify priority for level-2 routing\n")
-{
- uint8_t prio = atoi(argv[2]->arg);
- struct isis_circuit *circuit = isis_circuit_lookup(vty);
- if (!circuit)
- return CMD_ERR_NO_MATCH;
-
- circuit->priority[level_for_arg(argv[3]->text)] = prio;
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_isis_priority_level,
- no_isis_priority_level_cmd,
- "no isis priority [(0-127)] <level-1|level-2>",
- NO_STR
- "IS-IS routing protocol\n"
- "Set priority for Designated Router election\n"
- "Priority value\n"
- "Specify priority for level-1 routing\n"
- "Specify priority for level-2 routing\n")
-{
- struct isis_circuit *circuit = isis_circuit_lookup(vty);
- int level = level_for_arg(argv[argc - 1]->text);
- if (!circuit)
- return CMD_ERR_NO_MATCH;
-
- circuit->priority[level] = DEFAULT_PRIORITY;
-
- return CMD_SUCCESS;
-}
-
-void isis_vty_daemon_init(void)
-{
- install_element(INTERFACE_NODE, &isis_priority_cmd);
- install_element(INTERFACE_NODE, &no_isis_priority_cmd);
- install_element(INTERFACE_NODE, &isis_priority_level_cmd);
- install_element(INTERFACE_NODE, &no_isis_priority_level_cmd);
-}
$(top_srcdir)/isisd/isis_te.c \
$(top_srcdir)/isisd/isis_vty_common.c \
$(top_srcdir)/isisd/isis_vty_fabricd.c \
- $(top_srcdir)/isisd/isis_vty_isisd.c \
$(top_srcdir)/isisd/isisd.c \
# end
man8 += $(MANBUILD)/isisd.8
isisd_libisis_a_SOURCES = \
$(LIBISIS_SOURCES) \
- isisd/isis_vty_isisd.c \
isisd/isis_northbound.c \
isisd/isis_cli.c \
#end