]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_cli.c
isisd: retrofit the 'max-lsp-lifetime' command
[mirror_frr.git] / isisd / isis_cli.c
index 36caae5703958f54616fa94b143adf8fc4707ee6..d28af98a08d4cbf60d376af16631c5e8edbd009d 100644 (file)
@@ -444,6 +444,297 @@ void cli_show_isis_attached(struct vty *vty, struct lyd_node *dnode,
        vty_out(vty, " set-attached-bit\n");
 }
 
+/*
+ * XPath: /frr-isisd:isis/instance/metric-style
+ */
+DEFPY(metric_style, metric_style_cmd,
+         "metric-style <narrow|transition|wide>$style",
+      "Use old-style (ISO 10589) or new-style packet formats\n"
+      "Use old style of TLVs with narrow metric\n"
+      "Send and accept both styles of TLVs during transition\n"
+      "Use new style of TLVs to carry wider metric\n")
+{
+       nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, style);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_metric_style, no_metric_style_cmd,
+         "no metric-style [narrow|transition|wide]",
+         NO_STR
+         "Use old-style (ISO 10589) or new-style packet formats\n"
+      "Use old style of TLVs with narrow metric\n"
+      "Send and accept both styles of TLVs during transition\n"
+      "Use new style of TLVs to carry wider metric\n")
+{
+       nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, "narrow");
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_isis_metric_style(struct vty *vty, struct lyd_node *dnode,
+                               bool show_defaults)
+{
+       int metric = yang_dnode_get_enum(dnode, NULL);
+
+       switch (metric) {
+       case ISIS_NARROW_METRIC:
+               vty_out(vty, " metric-style narrow\n");
+               break;
+       case ISIS_WIDE_METRIC:
+               vty_out(vty, " metric-style wide\n");
+               break;
+       case ISIS_TRANSITION_METRIC:
+               vty_out(vty, " metric-style transition\n");
+               break;
+       }
+}
+
+/*
+ * XPath: /frr-isisd:isis/instance/area-password
+ */
+DEFPY(area_passwd, area_passwd_cmd,
+      "area-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]",
+      "Configure the authentication password for an area\n"
+      "Clear-text authentication type\n"
+      "MD5 authentication type\n"
+      "Level-wide password\n"
+      "Authentication\n"
+      "SNP PDUs\n"
+      "Send but do not check PDUs on receiving\n"
+      "Send and check PDUs on receiving\n")
+{
+       nb_cli_enqueue_change(vty, "./area-password", NB_OP_CREATE, NULL);
+       nb_cli_enqueue_change(vty, "./area-password/password", NB_OP_MODIFY,
+                             pwd);
+       nb_cli_enqueue_change(vty, "./area-password/password-type",
+                             NB_OP_MODIFY, pwd_type);
+       nb_cli_enqueue_change(vty, "./area-password/authenticate-snp",
+                             NB_OP_MODIFY, snp ? snp : "none");
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_isis_area_pwd(struct vty *vty, struct lyd_node *dnode,
+                           bool show_defaults)
+{
+       const char *snp;
+
+       vty_out(vty, " area-password %s %s",
+               yang_dnode_get_string(dnode, "./password-type"),
+               yang_dnode_get_string(dnode, "./password"));
+       snp = yang_dnode_get_string(dnode, "./authenticate-snp");
+       if (!strmatch("none", snp))
+               vty_out(vty, " authenticate snp %s", snp);
+       vty_out(vty, "\n");
+}
+
+/*
+ * XPath: /frr-isisd:isis/instance/domain-password
+ */
+DEFPY(domain_passwd, domain_passwd_cmd,
+      "domain-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]",
+      "Set the authentication password for a routing domain\n"
+      "Clear-text authentication type\n"
+      "MD5 authentication type\n"
+      "Level-wide password\n"
+      "Authentication\n"
+      "SNP PDUs\n"
+      "Send but do not check PDUs on receiving\n"
+      "Send and check PDUs on receiving\n")
+{
+       nb_cli_enqueue_change(vty, "./domain-password", NB_OP_CREATE, NULL);
+       nb_cli_enqueue_change(vty, "./domain-password/password", NB_OP_MODIFY,
+                             pwd);
+       nb_cli_enqueue_change(vty, "./domain-password/password-type",
+                             NB_OP_MODIFY, pwd_type);
+       nb_cli_enqueue_change(vty, "./domain-password/authenticate-snp",
+                             NB_OP_MODIFY, snp ? snp : "none");
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_area_passwd, no_area_passwd_cmd,
+      "no <area-password|domain-password>$cmd",
+      NO_STR
+      "Configure the authentication password for an area\n"
+      "Set the authentication password for a routing domain\n")
+{
+       nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+
+       return nb_cli_apply_changes(vty, "./%s", cmd);
+}
+
+void cli_show_isis_domain_pwd(struct vty *vty, struct lyd_node *dnode,
+                             bool show_defaults)
+{
+       const char *snp;
+
+       vty_out(vty, " domain-password %s %s",
+               yang_dnode_get_string(dnode, "./password-type"),
+               yang_dnode_get_string(dnode, "./password"));
+       snp = yang_dnode_get_string(dnode, "./authenticate-snp");
+       if (!strmatch("none", snp))
+               vty_out(vty, " authenticate snp %s", snp);
+       vty_out(vty, "\n");
+}
+
+/*
+ * XPath: /frr-isisd:isis/instance/lsp/generation-interval
+ */
+DEFPY(lsp_gen_interval, lsp_gen_interval_cmd,
+      "lsp-gen-interval [level-1|level-2]$level (1-120)$val",
+      "Minimum interval between regenerating same LSP\n"
+      "Set interval for level 1 only\n"
+      "Set interval for level 2 only\n"
+      "Minimum interval in seconds\n")
+{
+       if (!level || strmatch(level, "level-1"))
+               nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-1",
+                                     NB_OP_MODIFY, val_str);
+       if (!level || strmatch(level, "level-2"))
+               nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-2",
+                                     NB_OP_MODIFY, val_str);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_lsp_gen_interval, no_lsp_gen_interval_cmd,
+      "no lsp-gen-interval [level-1|level-2]$level [(1-120)]",
+      NO_STR
+      "Minimum interval between regenerating same LSP\n"
+      "Set interval for level 1 only\n"
+      "Set interval for level 2 only\n"
+      "Minimum interval in seconds\n")
+{
+       if (!level || strmatch(level, "level-1"))
+               nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-1",
+                                     NB_OP_MODIFY, NULL);
+       if (!level || strmatch(level, "level-2"))
+               nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-2",
+                                     NB_OP_MODIFY, NULL);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_isis_lsp_gen_interval(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, " lsp-gen-interval %s\n", l1);
+       else {
+               vty_out(vty, " lsp-gen-interval level-1 %s\n", l1);
+               vty_out(vty, " lsp-gen-interval level-2 %s\n", l2);
+       }
+}
+
+/*
+ * XPath: /frr-isisd:isis/instance/lsp/refresh-interval
+ */
+DEFPY(lsp_refresh_interval, lsp_refresh_interval_cmd,
+      "lsp-refresh-interval [level-1|level-2]$level (1-65235)$val",
+      "LSP refresh interval\n"
+      "LSP refresh interval for Level 1 only\n"
+      "LSP refresh interval for Level 2 only\n"
+      "LSP refresh interval in seconds\n")
+{
+       if (!level || strmatch(level, "level-1"))
+               nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-1",
+                                     NB_OP_MODIFY, val_str);
+       if (!level || strmatch(level, "level-2"))
+               nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-2",
+                                     NB_OP_MODIFY, val_str);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_lsp_refresh_interval, no_lsp_refresh_interval_cmd,
+      "no lsp-refresh-interval [level-1|level-2]$level [(1-65235)]",
+      NO_STR
+      "LSP refresh interval\n"
+      "LSP refresh interval for Level 1 only\n"
+      "LSP refresh interval for Level 2 only\n"
+      "LSP refresh interval in seconds\n")
+{
+       if (!level || strmatch(level, "level-1"))
+               nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-1",
+                                     NB_OP_MODIFY, NULL);
+       if (!level || strmatch(level, "level-2"))
+               nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-2",
+                                     NB_OP_MODIFY, NULL);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_isis_lsp_ref_interval(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, " lsp-refresh-interval %s\n", l1);
+       else {
+               vty_out(vty, " lsp-refresh-interval level-1 %s\n", l1);
+               vty_out(vty, " lsp-refresh-interval level-2 %s\n", l2);
+       }
+}
+
+/*
+ * XPath: /frr-isisd:isis/instance/lsp/maximum-lifetime
+ */
+DEFPY(max_lsp_lifetime, max_lsp_lifetime_cmd,
+      "max-lsp-lifetime [level-1|level-2]$level (350-65535)$val",
+      "Maximum LSP lifetime\n"
+      "Maximum LSP lifetime for Level 1 only\n"
+      "Maximum LSP lifetime for Level 2 only\n"
+      "LSP lifetime in seconds\n")
+{
+       if (!level || strmatch(level, "level-1"))
+               nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-1",
+                                     NB_OP_MODIFY, val_str);
+       if (!level || strmatch(level, "level-2"))
+               nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-2",
+                                     NB_OP_MODIFY, val_str);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_max_lsp_lifetime, no_max_lsp_lifetime_cmd,
+      "no max-lsp-lifetime [level-1|level-2]$level [(350-65535)]",
+      NO_STR
+      "Maximum LSP lifetime\n"
+      "Maximum LSP lifetime for Level 1 only\n"
+      "Maximum LSP lifetime for Level 2 only\n"
+      "LSP lifetime in seconds\n")
+{
+       if (!level || strmatch(level, "level-1"))
+               nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-1",
+                                     NB_OP_MODIFY, NULL);
+       if (!level || strmatch(level, "level-2"))
+               nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-2",
+                                     NB_OP_MODIFY, NULL);
+
+       return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_isis_lsp_max_lifetime(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, " max-lsp-lifetime %s\n", l1);
+       else {
+               vty_out(vty, " max-lsp-lifetime level-1 %s\n", l1);
+               vty_out(vty, " max-lsp-lifetime level-2 %s\n", l2);
+       }
+}
+
 void isis_cli_init(void)
 {
        install_element(CONFIG_NODE, &router_isis_cmd);
@@ -462,6 +753,20 @@ void isis_cli_init(void)
 
        install_element(ISIS_NODE, &set_overload_bit_cmd);
        install_element(ISIS_NODE, &set_attached_bit_cmd);
+
+       install_element(ISIS_NODE, &metric_style_cmd);
+       install_element(ISIS_NODE, &no_metric_style_cmd);
+
+       install_element(ISIS_NODE, &area_passwd_cmd);
+       install_element(ISIS_NODE, &domain_passwd_cmd);
+       install_element(ISIS_NODE, &no_area_passwd_cmd);
+
+       install_element(ISIS_NODE, &lsp_gen_interval_cmd);
+       install_element(ISIS_NODE, &no_lsp_gen_interval_cmd);
+       install_element(ISIS_NODE, &lsp_refresh_interval_cmd);
+       install_element(ISIS_NODE, &no_lsp_refresh_interval_cmd);
+       install_element(ISIS_NODE, &max_lsp_lifetime_cmd);
+       install_element(ISIS_NODE, &no_max_lsp_lifetime_cmd);
 }
 
 #endif /* ifndef FABRICD */