summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorEmanuele Di Pascale <emanuele@voltanet.io>2018-11-14 12:51:45 +0100
committerEmanuele Di Pascale <emanuele@voltanet.io>2018-12-18 15:23:49 +0100
commit3e20c83affb657cb9cc792ac86843df75343ca47 (patch)
tree57a698765616eea1e81f27aea99d5361b5a47336 /isisd
parentisisd: retrofit the 'isis passive' command (diff)
downloadfrr-3e20c83affb657cb9cc792ac86843df75343ca47.tar.xz
frr-3e20c83affb657cb9cc792ac86843df75343ca47.zip
isisd: retrofit the 'isis password' command
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_cli.c46
-rw-r--r--isisd/isis_cli.h2
-rw-r--r--isisd/isis_northbound.c34
-rw-r--r--isisd/isis_vty_common.c50
-rw-r--r--isisd/isis_vty_fabricd.c50
5 files changed, 128 insertions, 54 deletions
diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c
index 16c34a73e..607408853 100644
--- a/isisd/isis_cli.c
+++ b/isisd/isis_cli.c
@@ -1236,6 +1236,49 @@ void cli_show_ip_isis_passive(struct vty *vty, struct lyd_node *dnode,
vty_out(vty, " isis passive\n");
}
+/*
+ * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
+ */
+
+DEFPY(isis_passwd, isis_passwd_cmd, "isis password <md5|clear>$type WORD$pwd",
+ "IS-IS routing protocol\n"
+ "Configure the authentication password for a circuit\n"
+ "HMAC-MD5 authentication\n"
+ "Cleartext password\n"
+ "Circuit password\n")
+{
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_CREATE,
+ NULL);
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password",
+ NB_OP_MODIFY, pwd);
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password-type",
+ NB_OP_MODIFY, type);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_isis_passwd, no_isis_passwd_cmd, "no isis password [<md5|clear> WORD]",
+ NO_STR
+ "IS-IS routing protocol\n"
+ "Configure the authentication password for a circuit\n"
+ "HMAC-MD5 authentication\n"
+ "Cleartext password\n"
+ "Circuit password\n")
+{
+ nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_DELETE,
+ NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ip_isis_password(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty, " isis password %s %s\n",
+ yang_dnode_get_string(dnode, "./password-type"),
+ yang_dnode_get_string(dnode, "./password"));
+}
+
void isis_cli_init(void)
{
install_element(CONFIG_NODE, &router_isis_cmd);
@@ -1289,6 +1332,9 @@ void isis_cli_init(void)
install_element(ISIS_NODE, &isis_topology_cmd);
install_element(INTERFACE_NODE, &isis_passive_cmd);
+
+ install_element(INTERFACE_NODE, &isis_passwd_cmd);
+ install_element(INTERFACE_NODE, &no_isis_passwd_cmd);
}
#endif /* ifndef FABRICD */
diff --git a/isisd/isis_cli.h b/isisd/isis_cli.h
index 35ade792e..8a95ead12 100644
--- a/isisd/isis_cli.h
+++ b/isisd/isis_cli.h
@@ -83,5 +83,7 @@ void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
void cli_show_ip_isis_passive(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
+void cli_show_ip_isis_password(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults);
#endif /* ISISD_ISIS_CLI_H_ */
diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c
index ec341566d..e76e72c29 100644
--- a/isisd/isis_northbound.c
+++ b/isisd/isis_northbound.c
@@ -2087,14 +2087,20 @@ static int lib_interface_isis_password_create(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
return NB_OK;
}
static int lib_interface_isis_password_delete(enum nb_event event,
const struct lyd_node *dnode)
{
- /* TODO: implement me. */
+ struct isis_circuit *circuit;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ circuit = yang_dnode_get_entry(dnode, true);
+ isis_circuit_passwd_unset(circuit);
+
return NB_OK;
}
@@ -2106,7 +2112,17 @@ lib_interface_isis_password_password_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ struct isis_circuit *circuit;
+ const char *password;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ password = yang_dnode_get_string(dnode, NULL);
+ circuit = yang_dnode_get_entry(dnode, true);
+ circuit->passwd.len = strlen(password);
+ strncpy((char *)circuit->passwd.passwd, password, 255);
+
return NB_OK;
}
@@ -2118,7 +2134,16 @@ lib_interface_isis_password_password_type_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ struct isis_circuit *circuit;
+ uint8_t pass_type;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ pass_type = yang_dnode_get_enum(dnode, NULL);
+ circuit = yang_dnode_get_entry(dnode, true);
+ circuit->passwd.type = pass_type;
+
return NB_OK;
}
@@ -2645,6 +2670,7 @@ const struct frr_yang_module_info frr_isisd_info = {
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/password",
.cbs.create = lib_interface_isis_password_create,
.cbs.delete = lib_interface_isis_password_delete,
+ .cbs.cli_show = cli_show_ip_isis_password,
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/password/password",
diff --git a/isisd/isis_vty_common.c b/isisd/isis_vty_common.c
index bd53594e7..8ee1bf2cc 100644
--- a/isisd/isis_vty_common.c
+++ b/isisd/isis_vty_common.c
@@ -56,53 +56,6 @@ struct isis_circuit *isis_circuit_lookup(struct vty *vty)
return circuit;
}
-DEFUN (isis_passwd,
- isis_passwd_cmd,
- PROTO_NAME " password <md5|clear> WORD",
- PROTO_HELP
- "Configure the authentication password for a circuit\n"
- "HMAC-MD5 authentication\n"
- "Cleartext password\n"
- "Circuit password\n")
-{
- int idx_encryption = 2;
- int idx_word = 3;
- struct isis_circuit *circuit = isis_circuit_lookup(vty);
- ferr_r rv;
-
- if (!circuit)
- return CMD_ERR_NO_MATCH;
-
- if (argv[idx_encryption]->arg[0] == 'm')
- rv = isis_circuit_passwd_hmac_md5_set(circuit,
- argv[idx_word]->arg);
- else
- rv = isis_circuit_passwd_cleartext_set(circuit,
- argv[idx_word]->arg);
-
- CMD_FERR_RETURN(rv, "Failed to set circuit password: $ERR");
- return CMD_SUCCESS;
-}
-
-DEFUN (no_isis_passwd,
- no_isis_passwd_cmd,
- "no " PROTO_NAME " password [<md5|clear> WORD]",
- NO_STR
- PROTO_HELP
- "Configure the authentication password for a circuit\n"
- "HMAC-MD5 authentication\n"
- "Cleartext password\n"
- "Circuit password\n")
-{
- struct isis_circuit *circuit = isis_circuit_lookup(vty);
- if (!circuit)
- return CMD_ERR_NO_MATCH;
-
- CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit),
- "Failed to unset circuit password: $ERR");
- return CMD_SUCCESS;
-}
-
DEFUN (isis_metric,
isis_metric_cmd,
PROTO_NAME " metric (0-16777215)",
@@ -410,9 +363,6 @@ DEFUN (no_isis_bfd,
void isis_vty_init(void)
{
- install_element(INTERFACE_NODE, &isis_passwd_cmd);
- install_element(INTERFACE_NODE, &no_isis_passwd_cmd);
-
install_element(INTERFACE_NODE, &isis_metric_cmd);
install_element(INTERFACE_NODE, &no_isis_metric_cmd);
diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c
index f7deea3d8..0dcf12aa0 100644
--- a/isisd/isis_vty_fabricd.c
+++ b/isisd/isis_vty_fabricd.c
@@ -723,6 +723,53 @@ DEFUN (no_isis_passive,
return CMD_SUCCESS;
}
+DEFUN (isis_passwd,
+ isis_passwd_cmd,
+ PROTO_NAME " password <md5|clear> WORD",
+ PROTO_HELP
+ "Configure the authentication password for a circuit\n"
+ "HMAC-MD5 authentication\n"
+ "Cleartext password\n"
+ "Circuit password\n")
+{
+ int idx_encryption = 2;
+ int idx_word = 3;
+ struct isis_circuit *circuit = isis_circuit_lookup(vty);
+ ferr_r rv;
+
+ if (!circuit)
+ return CMD_ERR_NO_MATCH;
+
+ if (argv[idx_encryption]->arg[0] == 'm')
+ rv = isis_circuit_passwd_hmac_md5_set(circuit,
+ argv[idx_word]->arg);
+ else
+ rv = isis_circuit_passwd_cleartext_set(circuit,
+ argv[idx_word]->arg);
+
+ CMD_FERR_RETURN(rv, "Failed to set circuit password: $ERR");
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_isis_passwd,
+ no_isis_passwd_cmd,
+ "no " PROTO_NAME " password [<md5|clear> WORD]",
+ NO_STR
+ PROTO_HELP
+ "Configure the authentication password for a circuit\n"
+ "HMAC-MD5 authentication\n"
+ "Cleartext password\n"
+ "Circuit password\n")
+{
+ struct isis_circuit *circuit = isis_circuit_lookup(vty);
+ if (!circuit)
+ return CMD_ERR_NO_MATCH;
+
+ CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit),
+ "Failed to unset circuit password: $ERR");
+ return CMD_SUCCESS;
+}
+
void isis_vty_daemon_init(void)
{
install_element(ROUTER_NODE, &fabric_tier_cmd);
@@ -764,4 +811,7 @@ void isis_vty_daemon_init(void)
install_element(INTERFACE_NODE, &isis_passive_cmd);
install_element(INTERFACE_NODE, &no_isis_passive_cmd);
+
+ install_element(INTERFACE_NODE, &isis_passwd_cmd);
+ install_element(INTERFACE_NODE, &no_isis_passwd_cmd);
}