]> git.proxmox.com Git - mirror_frr.git/commitdiff
isisd: retrofit the 'isis hello-padding' command
authorEmanuele Di Pascale <emanuele@voltanet.io>
Wed, 14 Nov 2018 13:16:41 +0000 (14:16 +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 9125acffd4aa4aeba3eaf0217e3ce0d1b5900360..a584817507b2aae5c6043e4bdbfc9f305d834d8c 100644 (file)
@@ -1471,6 +1471,30 @@ void cli_show_ip_isis_threeway_shake(struct vty *vty, struct lyd_node *dnode,
        vty_out(vty, " no isis three-way-handshake\n");
 }
 
+/*
+ * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
+ */
+DEFPY(isis_hello_padding, isis_hello_padding_cmd, "[no] isis hello padding",
+      NO_STR
+      "IS-IS routing protocol\n"
+      "Add padding to IS-IS hello packets\n"
+      "Pad hello packets\n")
+{
+       nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding",
+                             NB_OP_MODIFY, no ? "false" : "true");
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ip_isis_hello_padding(struct vty *vty, struct lyd_node *dnode,
+                                   bool show_defaults)
+{
+       if (!yang_dnode_get_bool(dnode, NULL))
+               vty_out(vty, " no");
+
+       vty_out(vty, " isis hello padding\n");
+}
+
 void isis_cli_init(void)
 {
        install_element(CONFIG_NODE, &router_isis_cmd);
@@ -1538,6 +1562,8 @@ void isis_cli_init(void)
        install_element(INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
 
        install_element(INTERFACE_NODE, &isis_threeway_adj_cmd);
+
+       install_element(INTERFACE_NODE, &isis_hello_padding_cmd);
 }
 
 #endif /* ifndef FABRICD */
index 340e3ce7a9c01711d0ed8214fb3550d820d698b8..5162618a281c421ab8d8e9d2bf5ac53ac5811dbd 100644 (file)
@@ -93,5 +93,7 @@ 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);
+void cli_show_ip_isis_hello_padding(struct vty *vty, struct lyd_node *dnode,
+                                   bool show_defaults);
 
 #endif /* ISISD_ISIS_CLI_H_ */
index 0a93f226fd16eba255c0fc66ee62998b0c879e6b..c03ebd56eba5ad77a1f0ce838f6a59e0c653b884 100644 (file)
@@ -1896,7 +1896,14 @@ static int lib_interface_isis_hello_padding_modify(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->pad_hellos = yang_dnode_get_bool(dnode, NULL);
+
        return NB_OK;
 }
 
@@ -2690,6 +2697,7 @@ const struct frr_yang_module_info frr_isisd_info = {
                {
                        .xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/padding",
                        .cbs.modify = lib_interface_isis_hello_padding_modify,
+                       .cbs.cli_show = cli_show_ip_isis_hello_padding,
                },
                {
                        .xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/interval",
index 40cbb2d66684badeecfe4aa50610f0506fd27875..13ae164cc7d024df5dbf2aeaa6a9443d889f1d2a 100644 (file)
@@ -219,39 +219,6 @@ DEFUN (no_isis_priority_level,
        return CMD_SUCCESS;
 }
 
-DEFUN (isis_hello_padding,
-       isis_hello_padding_cmd,
-       "isis hello padding",
-       "IS-IS routing protocol\n"
-       "Add padding to IS-IS hello packets\n"
-       "Pad hello packets\n")
-{
-       struct isis_circuit *circuit = isis_circuit_lookup(vty);
-       if (!circuit)
-               return CMD_ERR_NO_MATCH;
-
-       circuit->pad_hellos = 1;
-
-       return CMD_SUCCESS;
-}
-
-DEFUN (no_isis_hello_padding,
-       no_isis_hello_padding_cmd,
-       "no isis hello padding",
-       NO_STR
-       "IS-IS routing protocol\n"
-       "Add padding to IS-IS hello packets\n"
-       "Pad hello packets\n")
-{
-       struct isis_circuit *circuit = isis_circuit_lookup(vty);
-       if (!circuit)
-               return CMD_ERR_NO_MATCH;
-
-       circuit->pad_hellos = 0;
-
-       return CMD_SUCCESS;
-}
-
 DEFUN (csnp_interval_level,
        csnp_interval_level_cmd,
        "isis csnp-interval (1-600) <level-1|level-2>",
@@ -343,9 +310,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_hello_padding_cmd);
-       install_element(INTERFACE_NODE, &no_isis_hello_padding_cmd);
-
        install_element(INTERFACE_NODE, &csnp_interval_level_cmd);
        install_element(INTERFACE_NODE, &no_csnp_interval_level_cmd);