]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: retrofit the 'isis three-way-handshake' command
authorEmanuele Di Pascale <emanuele@voltanet.io>
Wed, 14 Nov 2018 12:09:03 +0000 (13:09 +0100)
committerEmanuele Di Pascale <emanuele@voltanet.io>
Tue, 18 Dec 2018 14:23:49 +0000 (15:23 +0100)
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
isisd/isis_cli.c
isisd/isis_cli.h
isisd/isis_northbound.c
isisd/isis_vty_isisd.c

index f39a83e0efa88b08716915c404c73568970f0984..9125acffd4aa4aeba3eaf0217e3ce0d1b5900360 100644 (file)
@@ -1449,6 +1449,28 @@ void cli_show_ip_isis_hello_multi(struct vty *vty, struct lyd_node *dnode,
        }
 }
 
+/*
+ * XPath:
+ * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
+ */
+DEFPY(isis_threeway_adj, isis_threeway_adj_cmd, "[no] isis three-way-handshake",
+      NO_STR
+      "IS-IS commands\n"
+      "Enable/Disable three-way handshake\n")
+{
+       nb_cli_enqueue_change(vty,
+                             "./frr-isisd:isis/disable-three-way-handshake",
+                             no ? NB_OP_CREATE : NB_OP_DELETE, NULL);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ip_isis_threeway_shake(struct vty *vty, struct lyd_node *dnode,
+                                    bool show_defaults)
+{
+       vty_out(vty, " no isis three-way-handshake\n");
+}
+
 void isis_cli_init(void)
 {
        install_element(CONFIG_NODE, &router_isis_cmd);
@@ -1514,6 +1536,8 @@ void isis_cli_init(void)
 
        install_element(INTERFACE_NODE, &isis_hello_multiplier_cmd);
        install_element(INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
+
+       install_element(INTERFACE_NODE, &isis_threeway_adj_cmd);
 }
 
 #endif /* ifndef FABRICD */
index 987da20212f4456eb643bcf8724832495faa03aa..340e3ce7a9c01711d0ed8214fb3550d820d698b8 100644 (file)
@@ -91,5 +91,7 @@ void cli_show_ip_isis_hello_interval(struct vty *vty, struct lyd_node *dnode,
                                     bool show_defaults);
 void cli_show_ip_isis_hello_multi(struct vty *vty, struct lyd_node *dnode,
                                  bool show_defaults);
+void cli_show_ip_isis_threeway_shake(struct vty *vty, struct lyd_node *dnode,
+                                    bool show_defaults);
 
 #endif /* ISISD_ISIS_CLI_H_ */
index 677950185061d1e242e984746734289e44178a25..0a93f226fd16eba255c0fc66ee62998b0c879e6b 100644 (file)
@@ -2209,14 +2209,28 @@ static int lib_interface_isis_disable_three_way_handshake_create(
        enum nb_event event, 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->disable_threeway_adj = true;
+
        return NB_OK;
 }
 
 static int lib_interface_isis_disable_three_way_handshake_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);
+       circuit->disable_threeway_adj = false;
+
        return NB_OK;
 }
 
@@ -2750,6 +2764,7 @@ const struct frr_yang_module_info frr_isisd_info = {
                        .xpath = "/frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake",
                        .cbs.create = lib_interface_isis_disable_three_way_handshake_create,
                        .cbs.delete = lib_interface_isis_disable_three_way_handshake_delete,
+                       .cbs.cli_show = cli_show_ip_isis_threeway_shake,
                },
                {
                        .xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-unicast",
index a011bf7a62bdcd34c8fe3fce4b738aed809af162..40cbb2d66684badeecfe4aa50610f0506fd27875 100644 (file)
@@ -219,21 +219,6 @@ DEFUN (no_isis_priority_level,
        return CMD_SUCCESS;
 }
 
-DEFUN (isis_threeway_adj,
-       isis_threeway_adj_cmd,
-       "[no] isis three-way-handshake",
-       NO_STR
-       "IS-IS commands\n"
-       "Enable/Disable three-way handshake\n")
-{
-       struct isis_circuit *circuit = isis_circuit_lookup(vty);
-       if (!circuit)
-               return CMD_ERR_NO_MATCH;
-
-       circuit->disable_threeway_adj = !strcmp(argv[0]->text, "no");
-       return CMD_SUCCESS;
-}
-
 DEFUN (isis_hello_padding,
        isis_hello_padding_cmd,
        "isis hello padding",
@@ -358,8 +343,6 @@ void isis_vty_daemon_init(void)
        install_element(INTERFACE_NODE, &isis_priority_level_cmd);
        install_element(INTERFACE_NODE, &no_isis_priority_level_cmd);
 
-       install_element(INTERFACE_NODE, &isis_threeway_adj_cmd);
-
        install_element(INTERFACE_NODE, &isis_hello_padding_cmd);
        install_element(INTERFACE_NODE, &no_isis_hello_padding_cmd);