diff options
| author | Hiroki Shirokura <hiroki.shirokura@linecorp.com> | 2021-12-12 12:00:24 +0000 | 
|---|---|---|
| committer | Louis Scalbert <louis.scalbert@6wind.com> | 2023-04-18 10:11:53 +0200 | 
| commit | 67409447ff0174cf83c2231a8b97414acc670903 (patch) | |
| tree | ac698aceff2a149aa8de035288b1fbb9702aebab /isisd/isis_cli.c | |
| parent | cc4926c1284ea7950c12e9fab89c7276e8370fb8 (diff) | |
isisd: add cli to configure algorithm-prefix-sid
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>
Diffstat (limited to 'isisd/isis_cli.c')
| -rw-r--r-- | isisd/isis_cli.c | 82 | 
1 files changed, 82 insertions, 0 deletions
diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index e752103415..f4da01bb8e 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -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);  | 
