diff options
Diffstat (limited to 'isisd/isis_cli.c')
| -rw-r--r-- | isisd/isis_cli.c | 123 |
1 files changed, 115 insertions, 8 deletions
diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index d303cbe98d..203fa8eb8d 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -1628,17 +1628,18 @@ DEFPY_YANG (isis_sr_prefix_sid, "segment-routing prefix\ <A.B.C.D/M|X:X::X:X/M>$prefix\ <absolute$sid_type (16-1048575)$sid_value|index$sid_type (0-65535)$sid_value>\ - [<no-php-flag|explicit-null>$lh_behavior]", + [<no-php-flag|explicit-null>$lh_behavior] [n-flag-clear$n_flag_clear]", SR_STR "Prefix SID\n" "IPv4 Prefix\n" "IPv6 Prefix\n" - "Specify the absolute value of Prefix Segement ID\n" + "Specify the absolute value of Prefix Segment ID\n" "The Prefix Segment ID value\n" - "Specify the index of Prefix Segement ID\n" + "Specify the index of Prefix Segment ID\n" "The Prefix Segment ID index\n" "Don't request Penultimate Hop Popping (PHP)\n" - "Upstream neighbor must replace prefix-sid with explicit null label\n") + "Upstream neighbor must replace prefix-sid with explicit null label\n" + "Not a node SID\n") { nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); nb_cli_enqueue_change(vty, "./sid-value-type", NB_OP_MODIFY, sid_type); @@ -1656,6 +1657,8 @@ DEFPY_YANG (isis_sr_prefix_sid, } else nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, NULL); + nb_cli_enqueue_change(vty, "./n-flag-clear", NB_OP_MODIFY, + n_flag_clear ? "true" : "false"); return nb_cli_apply_changes( vty, "./segment-routing/prefix-sid-map/prefix-sid[prefix='%s']", @@ -1665,18 +1668,20 @@ DEFPY_YANG (isis_sr_prefix_sid, DEFPY_YANG (no_isis_sr_prefix_sid, no_isis_sr_prefix_sid_cmd, "no segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\ - [<absolute$sid_type (16-1048575)|index (0-65535)> [<no-php-flag|explicit-null>]]", + [<absolute$sid_type (16-1048575)|index (0-65535)> [<no-php-flag|explicit-null>]]\ + [n-flag-clear]", NO_STR SR_STR "Prefix SID\n" "IPv4 Prefix\n" "IPv6 Prefix\n" - "Specify the absolute value of Prefix Segement ID\n" + "Specify the absolute value of Prefix Segment ID\n" "The Prefix Segment ID value\n" - "Specify the index of Prefix Segement ID\n" + "Specify the index of Prefix Segment ID\n" "The Prefix Segment ID index\n" "Don't request Penultimate Hop Popping (PHP)\n" - "Upstream neighbor must replace prefix-sid with explicit null label\n") + "Upstream neighbor must replace prefix-sid with explicit null label\n" + "Not a node SID\n") { nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); @@ -1692,11 +1697,13 @@ void cli_show_isis_prefix_sid(struct vty *vty, struct lyd_node *dnode, const char *lh_behavior; const char *sid_value_type; const char *sid_value; + bool n_flag_clear; prefix = yang_dnode_get_string(dnode, "./prefix"); lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior"); sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type"); sid_value = yang_dnode_get_string(dnode, "./sid-value"); + n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear"); vty_out(vty, " segment-routing prefix %s", prefix); if (strmatch(sid_value_type, "absolute")) @@ -1708,6 +1715,8 @@ void cli_show_isis_prefix_sid(struct vty *vty, struct lyd_node *dnode, vty_out(vty, " no-php-flag"); else if (strmatch(lh_behavior, "explicit-null")) vty_out(vty, " explicit-null"); + if (n_flag_clear) + vty_out(vty, " n-flag-clear"); vty_out(vty, "\n"); } @@ -2368,6 +2377,102 @@ void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode, } /* + * XPath: /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/ti-lfa/enable + */ +DEFPY(isis_ti_lfa, isis_ti_lfa_cmd, + "[no] isis fast-reroute ti-lfa [level-1|level-2]$level [node-protection$node_protection]", + NO_STR + "IS-IS routing protocol\n" + "Interface IP Fast-reroute configuration\n" + "Enable TI-LFA computation\n" + "Enable TI-LFA computation for Level 1 only\n" + "Enable TI-LFA computation for Level 2 only\n" + "Protect against node failures\n") +{ + if (!level || strmatch(level, "level-1")) { + if (no) { + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable", + NB_OP_MODIFY, "false"); + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection", + NB_OP_MODIFY, "false"); + } else { + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable", + NB_OP_MODIFY, "true"); + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection", + NB_OP_MODIFY, + node_protection ? "true" : "false"); + } + } + if (!level || strmatch(level, "level-2")) { + if (no) { + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable", + NB_OP_MODIFY, "false"); + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection", + NB_OP_MODIFY, "false"); + } else { + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable", + NB_OP_MODIFY, "true"); + nb_cli_enqueue_change( + vty, + "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection", + NB_OP_MODIFY, + node_protection ? "true" : "false"); + } + } + + return nb_cli_apply_changes(vty, NULL); +} + +void cli_show_ip_isis_ti_lfa(struct vty *vty, struct lyd_node *dnode, + bool show_defaults) +{ + bool l1_enabled, l2_enabled; + bool l1_node_protection, l2_node_protection; + + l1_enabled = yang_dnode_get_bool(dnode, "./level-1/ti-lfa/enable"); + l2_enabled = yang_dnode_get_bool(dnode, "./level-2/ti-lfa/enable"); + l1_node_protection = + yang_dnode_get_bool(dnode, "./level-1/ti-lfa/node-protection"); + l2_node_protection = + yang_dnode_get_bool(dnode, "./level-2/ti-lfa/node-protection"); + + if (l1_enabled == l2_enabled + && l1_node_protection == l2_node_protection) { + vty_out(vty, " isis fast-reroute ti-lfa"); + if (l1_node_protection) + vty_out(vty, " node-protection"); + vty_out(vty, "\n"); + } else { + if (l1_enabled) { + vty_out(vty, " isis fast-reroute ti-lfa level-1"); + if (l1_node_protection) + vty_out(vty, " node-protection"); + vty_out(vty, "\n"); + } + if (l2_enabled) { + vty_out(vty, " isis fast-reroute ti-lfa level-2"); + if (l2_node_protection) + vty_out(vty, " node-protection"); + vty_out(vty, "\n"); + } + } +} + +/* * XPath: /frr-isisd:isis/instance/log-adjacency-changes */ DEFPY_YANG(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes", @@ -2661,6 +2766,8 @@ void isis_cli_init(void) install_element(INTERFACE_NODE, &isis_priority_cmd); install_element(INTERFACE_NODE, &no_isis_priority_cmd); + install_element(INTERFACE_NODE, &isis_ti_lfa_cmd); + install_element(ISIS_NODE, &log_adj_changes_cmd); install_element(ISIS_NODE, &isis_mpls_ldp_sync_cmd); |
