]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: add cli to configure algorithm-prefix-sid
authorHiroki Shirokura <hiroki.shirokura@linecorp.com>
Sun, 12 Dec 2021 12:00:24 +0000 (12:00 +0000)
committerLouis Scalbert <louis.scalbert@6wind.com>
Tue, 18 Apr 2023 08:11:53 +0000 (10:11 +0200)
Add the ability to configure a Segment-Routing prefix SID for a given
algorithm. For example:

> segment-routing prefix 10.10.10.10/32 algorithm 128 index 100

Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
isisd/isis_cli.c

index e752103415ffc9a86fa2bdd8c2213f60d6fd1a01..f4da01bb8e5131dba4e0f03be052788664bfb1c1 100644 (file)
@@ -1769,10 +1769,88 @@ void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode,
        vty_out(vty, "\n");
 }
 
+#ifndef FABRICD
 /*
  * XPath:
  * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid
  */
+DEFPY_YANG(
+       isis_sr_prefix_sid_algorithm, isis_sr_prefix_sid_algorithm_cmd,
+       "segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\
+              algorithm (128-255)$algorithm\
+              <absolute$sid_type (16-1048575)$sid_value|index$sid_type (0-65535)$sid_value>\
+              [<no-php-flag|explicit-null>$lh_behavior] [n-flag-clear$n_flag_clear]",
+       SR_STR
+       "Prefix SID\n"
+       "IPv4 Prefix\n"
+       "IPv6 Prefix\n"
+       "Algorithm Specific Prefix SID Configuration\n"
+       "Algorithm number\n"
+       "Specify the absolute value of Prefix Segment ID\n"
+       "The Prefix Segment ID value\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"
+       "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);
+       nb_cli_enqueue_change(vty, "./sid-value", NB_OP_MODIFY, sid_value_str);
+       if (lh_behavior) {
+               const char *value;
+
+               if (strmatch(lh_behavior, "no-php-flag"))
+                       value = "no-php";
+               else if (strmatch(lh_behavior, "explicit-null"))
+                       value = "explicit-null";
+               else
+                       value = "php";
+
+               nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY,
+                                     value);
+       } 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/algorithm-prefix-sids/algorithm-prefix-sid[prefix='%s'][algo='%s']",
+               prefix_str, algorithm_str);
+}
+
+DEFPY_YANG(
+       no_isis_sr_prefix_algorithm_sid, no_isis_sr_prefix_sid_algorithm_cmd,
+       "no segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\
+              algorithm (128-255)$algorithm\
+              [<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"
+       "Algorithm Specific Prefix SID Configuration\n"
+       "Algorithm number\n"
+       "Specify the absolute value of Prefix Segment ID\n"
+       "The Prefix Segment ID value\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"
+       "Not a node SID\n")
+{
+       nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
+
+       return nb_cli_apply_changes(
+               vty,
+               "./segment-routing/algorithm-prefix-sids/algorithm-prefix-sid[prefix='%s'][algo='%s']",
+               prefix_str, algorithm_str);
+       return CMD_SUCCESS;
+}
+#endif /* ifndef FABRICD */
+
 void cli_show_isis_prefix_sid_algorithm(struct vty *vty,
                                        const struct lyd_node *dnode,
                                        bool show_defaults)
@@ -3301,6 +3379,10 @@ void isis_cli_init(void)
        install_element(ISIS_NODE, &no_isis_sr_node_msd_cmd);
        install_element(ISIS_NODE, &isis_sr_prefix_sid_cmd);
        install_element(ISIS_NODE, &no_isis_sr_prefix_sid_cmd);
+#ifndef FABRICD
+       install_element(ISIS_NODE, &isis_sr_prefix_sid_algorithm_cmd);
+       install_element(ISIS_NODE, &no_isis_sr_prefix_sid_algorithm_cmd);
+#endif /* ifndef FABRICD */
        install_element(ISIS_NODE, &isis_frr_lfa_priority_limit_cmd);
        install_element(ISIS_NODE, &isis_frr_lfa_tiebreaker_cmd);
        install_element(ISIS_NODE, &isis_frr_lfa_load_sharing_cmd);