summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorCarmine Scarpitta <cscarpit@cisco.com>2024-03-26 08:53:55 +0100
committerCarmine Scarpitta <cscarpit@cisco.com>2024-06-13 14:54:16 +0200
commit51d3cd8a007d5c2ad6bb27af404f2d95164cf4c2 (patch)
tree660a8360a073d8ec783870b043b99e38602cb7bf /zebra
parentvtysh: CLI to override default SID format config (diff)
downloadfrr-51d3cd8a007d5c2ad6bb27af404f2d95164cf4c2.tar.xz
frr-51d3cd8a007d5c2ad6bb27af404f2d95164cf4c2.zip
zebra: CLI to override default SID format config
Add CLI commands to support overriding default configuration of the SID format. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_srv6.c57
-rw-r--r--zebra/zebra_srv6.h42
-rw-r--r--zebra/zebra_srv6_vty.c365
3 files changed, 411 insertions, 53 deletions
diff --git a/zebra/zebra_srv6.c b/zebra/zebra_srv6.c
index fa3b4a733..825f0f7fc 100644
--- a/zebra/zebra_srv6.c
+++ b/zebra/zebra_srv6.c
@@ -92,24 +92,24 @@ static int zebra_srv6_cleanup(struct zserv *client)
/* --- Zebra SRv6 SID format management functions --------------------------- */
-void zebra_srv6_sid_format_register(struct srv6_sid_format *format)
+void srv6_sid_format_register(struct srv6_sid_format *format)
{
struct zebra_srv6 *srv6 = zebra_srv6_get_default();
/* Ensure that the format is registered only once */
- assert(!zebra_srv6_sid_format_lookup(format->name));
+ assert(!srv6_sid_format_lookup(format->name));
listnode_add(srv6->sid_formats, format);
}
-void zebra_srv6_sid_format_unregister(struct srv6_sid_format *format)
+void srv6_sid_format_unregister(struct srv6_sid_format *format)
{
struct zebra_srv6 *srv6 = zebra_srv6_get_default();
listnode_delete(srv6->sid_formats, format);
}
-struct srv6_sid_format *zebra_srv6_sid_format_lookup(const char *name)
+struct srv6_sid_format *srv6_sid_format_lookup(const char *name)
{
struct zebra_srv6 *srv6 = zebra_srv6_get_default();
struct srv6_sid_format *format;
@@ -129,27 +129,23 @@ static struct srv6_sid_format *create_srv6_sid_format_usid_f3216(void)
{
struct srv6_sid_format *format = NULL;
- format = srv6_sid_format_alloc(ZEBRA_SRV6_SID_FORMAT_USID_F3216_NAME);
+ format = srv6_sid_format_alloc(SRV6_SID_FORMAT_USID_F3216_NAME);
format->type = SRV6_SID_FORMAT_TYPE_USID;
/* Define block/node/function length */
- format->block_len = ZEBRA_SRV6_SID_FORMAT_USID_F3216_BLOCK_LEN;
- format->node_len = ZEBRA_SRV6_SID_FORMAT_USID_F3216_NODE_LEN;
- format->function_len = ZEBRA_SRV6_SID_FORMAT_USID_F3216_FUNCTION_LEN;
- format->argument_len = ZEBRA_SRV6_SID_FORMAT_USID_F3216_ARGUMENT_LEN;
+ format->block_len = SRV6_SID_FORMAT_USID_F3216_BLOCK_LEN;
+ format->node_len = SRV6_SID_FORMAT_USID_F3216_NODE_LEN;
+ format->function_len = SRV6_SID_FORMAT_USID_F3216_FUNCTION_LEN;
+ format->argument_len = SRV6_SID_FORMAT_USID_F3216_ARGUMENT_LEN;
/* Define the ranges from which the SID function can be allocated */
- format->config.usid.lib_start =
- ZEBRA_SRV6_SID_FORMAT_USID_F3216_LIB_START;
- format->config.usid.elib_start =
- ZEBRA_SRV6_SID_FORMAT_USID_F3216_ELIB_START;
- format->config.usid.elib_end = ZEBRA_SRV6_SID_FORMAT_USID_F3216_ELIB_END;
- format->config.usid.wlib_start =
- ZEBRA_SRV6_SID_FORMAT_USID_F3216_WLIB_START;
- format->config.usid.wlib_end = ZEBRA_SRV6_SID_FORMAT_USID_F3216_WLIB_END;
- format->config.usid.ewlib_start =
- ZEBRA_SRV6_SID_FORMAT_USID_F3216_EWLIB_START;
+ format->config.usid.lib_start = SRV6_SID_FORMAT_USID_F3216_LIB_START;
+ format->config.usid.elib_start = SRV6_SID_FORMAT_USID_F3216_ELIB_START;
+ format->config.usid.elib_end = SRV6_SID_FORMAT_USID_F3216_ELIB_END;
+ format->config.usid.wlib_start = SRV6_SID_FORMAT_USID_F3216_WLIB_START;
+ format->config.usid.wlib_end = SRV6_SID_FORMAT_USID_F3216_WLIB_END;
+ format->config.usid.ewlib_start = SRV6_SID_FORMAT_USID_F3216_EWLIB_START;
return format;
}
@@ -161,22 +157,19 @@ static struct srv6_sid_format *create_srv6_sid_format_uncompressed(void)
{
struct srv6_sid_format *format = NULL;
- format = srv6_sid_format_alloc(
- ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NAME);
+ format = srv6_sid_format_alloc(SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NAME);
- format->type = ZEBRA_SRV6_SID_FORMAT_TYPE_UNCOMPRESSED;
+ format->type = SRV6_SID_FORMAT_TYPE_UNCOMPRESSED;
/* Define block/node/function length */
- format->block_len = ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_BLOCK_LEN;
- format->node_len = ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE_LEN;
- format->function_len =
- ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_FUNCTION_LEN;
- format->argument_len =
- ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_ARGUMENT_LEN;
+ format->block_len = SRV6_SID_FORMAT_UNCOMPRESSED_F4024_BLOCK_LEN;
+ format->node_len = SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE_LEN;
+ format->function_len = SRV6_SID_FORMAT_UNCOMPRESSED_F4024_FUNCTION_LEN;
+ format->argument_len = SRV6_SID_FORMAT_UNCOMPRESSED_F4024_ARGUMENT_LEN;
/* Define the ranges from which the SID function can be allocated */
format->config.uncompressed.explicit_start =
- ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_EXPLICIT_RANGE_START;
+ SRV6_SID_FORMAT_UNCOMPRESSED_F4024_EXPLICIT_RANGE_START;
return format;
}
@@ -326,11 +319,11 @@ struct zebra_srv6 *zebra_srv6_get_default(void)
/* Create SID format `usid-f3216` */
format_usidf3216 = create_srv6_sid_format_usid_f3216();
- zebra_srv6_sid_format_register(format_usidf3216);
+ srv6_sid_format_register(format_usidf3216);
/* Create SID format `uncompressed` */
format_uncompressed = create_srv6_sid_format_uncompressed();
- zebra_srv6_sid_format_register(format_uncompressed);
+ srv6_sid_format_register(format_uncompressed);
}
return &srv6;
}
@@ -553,7 +546,7 @@ void zebra_srv6_terminate(void)
while (listcount(srv6.sid_formats)) {
format = listnode_head(srv6.sid_formats);
- zebra_srv6_sid_format_unregister(format);
+ srv6_sid_format_unregister(format);
srv6_sid_format_free(format);
}
diff --git a/zebra/zebra_srv6.h b/zebra/zebra_srv6.h
index 57f9d8382..92e4fcf91 100644
--- a/zebra/zebra_srv6.h
+++ b/zebra/zebra_srv6.h
@@ -17,26 +17,26 @@
#include <plist.h>
/* Default config for SRv6 SID `usid-f3216` format */
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_NAME "usid-f3216"
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_BLOCK_LEN 32
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_NODE_LEN 16
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_FUNCTION_LEN 16
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_ARGUMENT_LEN 0
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_LIB_START 0xE000
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_ELIB_START 0xFE00
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_ELIB_END 0xFEFF
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_WLIB_START 0xFFF0
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_WLIB_END 0xFFF7
-#define ZEBRA_SRV6_SID_FORMAT_USID_F3216_EWLIB_START 0xFFF7
+#define SRV6_SID_FORMAT_USID_F3216_NAME "usid-f3216"
+#define SRV6_SID_FORMAT_USID_F3216_BLOCK_LEN 32
+#define SRV6_SID_FORMAT_USID_F3216_NODE_LEN 16
+#define SRV6_SID_FORMAT_USID_F3216_FUNCTION_LEN 16
+#define SRV6_SID_FORMAT_USID_F3216_ARGUMENT_LEN 0
+#define SRV6_SID_FORMAT_USID_F3216_LIB_START 0xE000
+#define SRV6_SID_FORMAT_USID_F3216_ELIB_START 0xFE00
+#define SRV6_SID_FORMAT_USID_F3216_ELIB_END 0xFEFF
+#define SRV6_SID_FORMAT_USID_F3216_WLIB_START 0xFFF0
+#define SRV6_SID_FORMAT_USID_F3216_WLIB_END 0xFFF7
+#define SRV6_SID_FORMAT_USID_F3216_EWLIB_START 0xFFF7
/* Default config for SRv6 SID `uncompressed` format */
-#define ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NAME "uncompressed-f4024"
-#define ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_BLOCK_LEN 40
-#define ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE_LEN 24
-#define ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_FUNCTION_LEN 16
-#define ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_ARGUMENT_LEN 0
-#define ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_EXPLICIT_RANGE_START 0xFF00
-#define ZEBRA_SRV6_SID_FORMAT_UNCOMPRESSED_F4024_FUNC_UNRESERVED_MIN 0x40
+#define SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NAME "uncompressed-f4024"
+#define SRV6_SID_FORMAT_UNCOMPRESSED_F4024_BLOCK_LEN 40
+#define SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE_LEN 24
+#define SRV6_SID_FORMAT_UNCOMPRESSED_F4024_FUNCTION_LEN 16
+#define SRV6_SID_FORMAT_UNCOMPRESSED_F4024_ARGUMENT_LEN 0
+#define SRV6_SID_FORMAT_UNCOMPRESSED_F4024_EXPLICIT_RANGE_START 0xFF00
+#define SRV6_SID_FORMAT_UNCOMPRESSED_F4024_FUNC_UNRESERVED_MIN 0x40
/* SRv6 instance structure. */
struct zebra_srv6 {
@@ -99,8 +99,8 @@ extern int release_daemon_srv6_locator_chunks(struct zserv *client);
extern void zebra_srv6_encap_src_addr_set(struct in6_addr *src_addr);
extern void zebra_srv6_encap_src_addr_unset(void);
-void zebra_srv6_sid_format_register(struct srv6_sid_format *format);
-void zebra_srv6_sid_format_unregister(struct srv6_sid_format *format);
-struct srv6_sid_format *zebra_srv6_sid_format_lookup(const char *name);
+void srv6_sid_format_register(struct srv6_sid_format *format);
+void srv6_sid_format_unregister(struct srv6_sid_format *format);
+struct srv6_sid_format *srv6_sid_format_lookup(const char *name);
#endif /* _ZEBRA_SRV6_H */
diff --git a/zebra/zebra_srv6_vty.c b/zebra/zebra_srv6_vty.c
index ddb092247..e5fe0d58a 100644
--- a/zebra/zebra_srv6_vty.c
+++ b/zebra/zebra_srv6_vty.c
@@ -68,6 +68,27 @@ static struct cmd_node srv6_encap_node = {
.prompt = "%s(config-srv6-encap)# "
};
+static struct cmd_node srv6_sid_formats_node = {
+ .name = "srv6-formats",
+ .node = SRV6_SID_FORMATS_NODE,
+ .parent_node = SRV6_NODE,
+ .prompt = "%s(config-srv6-formats)# ",
+};
+
+static struct cmd_node srv6_sid_format_usid_f3216_node = {
+ .name = "srv6-format-usid-f3216",
+ .node = SRV6_SID_FORMAT_USID_F3216_NODE,
+ .parent_node = SRV6_SID_FORMATS_NODE,
+ .prompt = "%s(config-srv6-format)# "
+};
+
+static struct cmd_node srv6_sid_format_uncompressed_f4024_node = {
+ .name = "srv6-format-uncompressed-f4024",
+ .node = SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE,
+ .parent_node = SRV6_SID_FORMATS_NODE,
+ .prompt = "%s(config-srv6-format)# "
+};
+
DEFPY (show_srv6_manager,
show_srv6_manager_cmd,
"show segment-routing srv6 manager [json]",
@@ -486,11 +507,276 @@ DEFPY (no_srv6_src_addr,
return CMD_SUCCESS;
}
+DEFUN_NOSH(srv6_sid_formats,
+ srv6_sid_formats_cmd,
+ "formats",
+ "Segment Routing SRv6 SID formats\n")
+{
+ vty->node = SRV6_SID_FORMATS_NODE;
+ return CMD_SUCCESS;
+}
+
+DEFUN_NOSH (srv6_sid_format_f3216_usid,
+ srv6_sid_format_f3216_usid_cmd,
+ "format usid-f3216",
+ "Configure SRv6 SID format\n"
+ "Configure the uSID f3216 format\n")
+{
+ struct srv6_sid_format *format;
+
+ format = srv6_sid_format_lookup(SRV6_SID_FORMAT_USID_F3216_NAME);
+ assert(format);
+
+ VTY_PUSH_CONTEXT(SRV6_SID_FORMAT_USID_F3216_NODE, format);
+ return CMD_SUCCESS;
+}
+
+DEFUN(no_srv6_sid_format_f3216_usid,
+ no_srv6_sid_format_f3216_usid_cmd,
+ "no format usid-f3216",
+ NO_STR
+ "Configure SRv6 SID format\n"
+ "Configure the uSID f3216 format\n")
+{
+ struct srv6_sid_format *format;
+
+ format = srv6_sid_format_lookup(SRV6_SID_FORMAT_USID_F3216_NAME);
+ assert(format);
+
+ format->config.usid.lib_start = SRV6_SID_FORMAT_USID_F3216_LIB_START;
+ format->config.usid.elib_start = SRV6_SID_FORMAT_USID_F3216_ELIB_START;
+ format->config.usid.elib_end = SRV6_SID_FORMAT_USID_F3216_ELIB_END;
+ format->config.usid.wlib_start = SRV6_SID_FORMAT_USID_F3216_WLIB_START;
+ format->config.usid.wlib_end = SRV6_SID_FORMAT_USID_F3216_WLIB_END;
+ format->config.usid.ewlib_start = SRV6_SID_FORMAT_USID_F3216_EWLIB_START;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN_NOSH (srv6_sid_format_f4024_uncompressed,
+ srv6_sid_format_uncompressed_cmd,
+ "format uncompressed-f4024",
+ "Configure SRv6 SID format\n"
+ "Configure the uncompressed f4024 format\n")
+{
+ struct srv6_sid_format *format;
+
+ format = srv6_sid_format_lookup(SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NAME);
+ assert(format);
+
+ VTY_PUSH_CONTEXT(SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE, format);
+ return CMD_SUCCESS;
+}
+
+DEFUN(no_srv6_sid_format_f4024_uncompressed,
+ no_srv6_sid_format_f4024_uncompressed_cmd,
+ "no format uncompressed-f4024",
+ NO_STR
+ "Configure SRv6 SID format\n"
+ "Configure the uncompressed f4024 format\n")
+{
+ struct srv6_sid_format *format;
+
+ format = srv6_sid_format_lookup(SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NAME);
+ assert(format);
+
+ format->config.uncompressed.explicit_start =
+ SRV6_SID_FORMAT_UNCOMPRESSED_F4024_EXPLICIT_RANGE_START;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(srv6_sid_format_usid_lib,
+ srv6_sid_format_usid_lib_cmd,
+ "local-id-block start (0-4294967295)$start",
+ "Configure LIB\n"
+ "Configure the start value for the LIB\n"
+ "Specify the start value for the LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ format->config.usid.lib_start = start;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(no_srv6_sid_format_usid_lib,
+ no_srv6_sid_format_usid_lib_cmd,
+ "no local-id-block [start (0-4294967295)]",
+ NO_STR
+ "Configure LIB\n"
+ "Configure the start value for the LIB\n"
+ "Specify the start value for the LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ if (strmatch(format->name, SRV6_SID_FORMAT_USID_F3216_NAME))
+ format->config.usid.lib_start =
+ SRV6_SID_FORMAT_USID_F3216_LIB_START;
+ else
+ assert(0);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(srv6_sid_format_usid_lib_explicit,
+ srv6_sid_format_usid_lib_explicit_cmd,
+ "local-id-block explicit start (0-4294967295)$start end (0-4294967295)$end",
+ "Configure LIB\n"
+ "Configure the Explicit LIB\n"
+ "Configure the start value for the Explicit LIB\n"
+ "Specify the start value for the Explicit LIB\n"
+ "Configure the end value for the Explicit LIB\n"
+ "Specify the end value for the Explicit LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ format->config.usid.elib_start = start;
+ format->config.usid.elib_end = end;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(no_srv6_sid_format_usid_lib_explicit,
+ no_srv6_sid_format_usid_lib_explicit_cmd,
+ "no local-id-block explicit [start (0-4294967295) end (0-4294967295)]",
+ NO_STR
+ "Configure LIB\n"
+ "Configure the Explicit LIB\n"
+ "Configure the start value for the Explicit LIB\n"
+ "Specify the start value for the Explicit LIB\n"
+ "Configure the end value for the Explicit LIB\n"
+ "Specify the end value for the Explicit LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ if (strmatch(format->name, SRV6_SID_FORMAT_USID_F3216_NAME)) {
+ format->config.usid.elib_start =
+ SRV6_SID_FORMAT_USID_F3216_ELIB_START;
+ format->config.usid.elib_end =
+ SRV6_SID_FORMAT_USID_F3216_ELIB_END;
+ } else {
+ assert(0);
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(srv6_sid_format_usid_wlib,
+ srv6_sid_format_usid_wlib_cmd,
+ "wide-local-id-block start (0-4294967295)$start end (0-4294967295)$end",
+ "Configure Wide LIB\n"
+ "Configure the start value for the Wide LIB\n"
+ "Specify the start value for the Wide LIB\n"
+ "Configure the end value for the Wide LIB\n"
+ "Specify the end value for the Wide LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ format->config.usid.wlib_start = start;
+ format->config.usid.wlib_end = end;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(no_srv6_sid_format_usid_wlib,
+ no_srv6_sid_format_usid_wlib_cmd,
+ "no wide-local-id-block [start (0-4294967295) end (0-4294967295)]",
+ NO_STR
+ "Configure Wide LIB\n"
+ "Configure the start value for the Wide LIB\n"
+ "Specify the start value for the Wide LIB\n"
+ "Configure the end value for the Wide LIB\n"
+ "Specify the end value for the Wide LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ if (strmatch(format->name, SRV6_SID_FORMAT_USID_F3216_NAME)) {
+ format->config.usid.wlib_start =
+ SRV6_SID_FORMAT_USID_F3216_WLIB_START;
+ format->config.usid.wlib_end =
+ SRV6_SID_FORMAT_USID_F3216_WLIB_END;
+ } else {
+ assert(0);
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(srv6_sid_format_usid_wide_lib_explicit,
+ srv6_sid_format_usid_wide_lib_explicit_cmd,
+ "wide-local-id-block explicit start (0-4294967295)$start",
+ "Configure Wide LIB\n"
+ "Configure Explicit Wide LIB\n"
+ "Configure the start value for the Explicit Wide LIB\n"
+ "Specify the start value for the Explicit Wide LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ format->config.usid.ewlib_start = start;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(no_srv6_sid_format_usid_wide_lib_explicit,
+ no_srv6_sid_format_usid_wide_lib_explicit_cmd,
+ "no wide-local-id-block explicit [start (0-4294967295)]",
+ NO_STR
+ "Configure Wide LIB\n"
+ "Configure Explicit Wide LIB\n"
+ "Configure the start value for the Explicit Wide LIB\n"
+ "Specify the start value for the Explicit Wide LIB\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ if (strmatch(format->name, SRV6_SID_FORMAT_USID_F3216_NAME))
+ format->config.usid.ewlib_start =
+ SRV6_SID_FORMAT_USID_F3216_EWLIB_START;
+ else
+ assert(0);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(srv6_sid_format_explicit,
+ srv6_sid_format_explicit_cmd,
+ "explicit start (0-4294967295)$start",
+ "Configure Explicit range\n"
+ "Configure the start value for the Explicit range\n"
+ "Specify the start value for the Explicit range\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ format->config.uncompressed.explicit_start = start;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY(no_srv6_sid_format_explicit,
+ no_srv6_sid_format_explicit_cmd,
+ "no explicit [start (0-4294967295)$start]",
+ NO_STR
+ "Configure Explicit range\n"
+ "Configure the start value for the Explicit range\n"
+ "Specify the start value for the Explicit range\n")
+{
+ VTY_DECLVAR_CONTEXT(srv6_sid_format, format);
+
+ if (strmatch(format->name, SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NAME))
+ format->config.usid.ewlib_start =
+ SRV6_SID_FORMAT_UNCOMPRESSED_F4024_EXPLICIT_RANGE_START;
+ else
+ assert(0);
+
+ return CMD_SUCCESS;
+}
+
static int zebra_sr_config(struct vty *vty)
{
struct zebra_srv6 *srv6 = zebra_srv6_get_default();
struct listnode *node;
struct srv6_locator *locator;
+ struct srv6_sid_format *format;
char str[256];
bool display_source_srv6 = false;
@@ -537,6 +823,51 @@ static int zebra_sr_config(struct vty *vty)
}
vty_out(vty, " exit\n");
vty_out(vty, " !\n");
+ vty_out(vty, " formats\n");
+ for (ALL_LIST_ELEMENTS_RO(srv6->sid_formats, node, format)) {
+ if (format->type == SRV6_SID_FORMAT_TYPE_UNCOMPRESSED) {
+ vty_out(vty, " format %s\n", format->name);
+ if (format->config.uncompressed.explicit_start !=
+ SRV6_SID_FORMAT_UNCOMPRESSED_F4024_EXPLICIT_RANGE_START)
+ vty_out(vty, " explicit start %u\n",
+ format->config.uncompressed
+ .explicit_start);
+ }
+ if (format->type ==
+ SRV6_SID_FORMAT_TYPE_COMPRESSED_USID) {
+ vty_out(vty, " format %s\n", format->name);
+ if (format->config.usid.lib_start !=
+ SRV6_SID_FORMAT_USID_F3216_LIB_START)
+ vty_out(vty,
+ " local-id-block start %u\n",
+ format->config.usid.lib_start);
+ if (format->config.usid.elib_start !=
+ SRV6_SID_FORMAT_USID_F3216_ELIB_START ||
+ format->config.usid.elib_end !=
+ SRV6_SID_FORMAT_USID_F3216_ELIB_END)
+ vty_out(vty,
+ " local-id-block explicit start %u end %u\n",
+ format->config.usid.elib_start,
+ format->config.usid.elib_end);
+ if (format->config.usid.wlib_start !=
+ SRV6_SID_FORMAT_USID_F3216_WLIB_START ||
+ format->config.usid.wlib_end !=
+ SRV6_SID_FORMAT_USID_F3216_WLIB_END)
+ vty_out(vty,
+ " wide-local-id-block start %u end %u\n",
+ format->config.usid.wlib_start,
+ format->config.usid.wlib_end);
+ if (format->config.usid.ewlib_start !=
+ SRV6_SID_FORMAT_USID_F3216_EWLIB_START)
+ vty_out(vty,
+ " wide-local-id-block explicit start %u\n",
+ format->config.usid.ewlib_start);
+ }
+ vty_out(vty, " exit\n");
+ vty_out(vty, " !\n");
+ }
+ vty_out(vty, " exit\n");
+ vty_out(vty, " !\n");
vty_out(vty, " exit\n");
vty_out(vty, " !\n");
}
@@ -555,11 +886,17 @@ void zebra_srv6_vty_init(void)
install_node(&srv6_locs_node);
install_node(&srv6_loc_node);
install_node(&srv6_encap_node);
+ install_node(&srv6_sid_formats_node);
+ install_node(&srv6_sid_format_usid_f3216_node);
+ install_node(&srv6_sid_format_uncompressed_f4024_node);
install_default(SEGMENT_ROUTING_NODE);
install_default(SRV6_NODE);
install_default(SRV6_LOCS_NODE);
install_default(SRV6_LOC_NODE);
install_default(SRV6_ENCAP_NODE);
+ install_default(SRV6_SID_FORMATS_NODE);
+ install_default(SRV6_SID_FORMAT_USID_F3216_NODE);
+ install_default(SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE);
/* Command for change node */
install_element(CONFIG_NODE, &segment_routing_cmd);
@@ -567,14 +904,42 @@ void zebra_srv6_vty_init(void)
install_element(SEGMENT_ROUTING_NODE, &no_srv6_cmd);
install_element(SRV6_NODE, &srv6_locators_cmd);
install_element(SRV6_NODE, &srv6_encap_cmd);
+ install_element(SRV6_NODE, &srv6_sid_formats_cmd);
install_element(SRV6_LOCS_NODE, &srv6_locator_cmd);
install_element(SRV6_LOCS_NODE, &no_srv6_locator_cmd);
+ install_element(SRV6_SID_FORMATS_NODE, &srv6_sid_format_f3216_usid_cmd);
+ install_element(SRV6_SID_FORMATS_NODE,
+ &srv6_sid_format_uncompressed_cmd);
+ install_element(SRV6_SID_FORMATS_NODE,
+ &no_srv6_sid_format_f3216_usid_cmd);
+ install_element(SRV6_SID_FORMATS_NODE,
+ &no_srv6_sid_format_f4024_uncompressed_cmd);
/* Command for configuration */
install_element(SRV6_LOC_NODE, &locator_prefix_cmd);
install_element(SRV6_LOC_NODE, &locator_behavior_cmd);
install_element(SRV6_ENCAP_NODE, &srv6_src_addr_cmd);
install_element(SRV6_ENCAP_NODE, &no_srv6_src_addr_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &srv6_sid_format_usid_lib_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &no_srv6_sid_format_usid_lib_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &srv6_sid_format_usid_lib_explicit_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &no_srv6_sid_format_usid_lib_explicit_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &srv6_sid_format_usid_wlib_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &no_srv6_sid_format_usid_wlib_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &srv6_sid_format_usid_wide_lib_explicit_cmd);
+ install_element(SRV6_SID_FORMAT_USID_F3216_NODE,
+ &no_srv6_sid_format_usid_wide_lib_explicit_cmd);
+ install_element(SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE,
+ &srv6_sid_format_explicit_cmd);
+ install_element(SRV6_SID_FORMAT_UNCOMPRESSED_F4024_NODE,
+ &no_srv6_sid_format_explicit_cmd);
/* Command for operation */
install_element(VIEW_NODE, &show_srv6_locator_cmd);