summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>2022-11-03 08:40:23 +0100
committerCarmine Scarpitta <cscarpit@cisco.com>2023-12-14 14:58:33 +0100
commit69bff19c43c8f263aeb0fb3211ee0e3faf37ec5c (patch)
treeedf4dc0473e770e6927e27db93c1168326678caa /vtysh
parentzebra: Add code to set SRv6 encap source addr in dplane (diff)
downloadfrr-69bff19c43c8f263aeb0fb3211ee0e3faf37ec5c.tar.xz
frr-69bff19c43c8f263aeb0fb3211ee0e3faf37ec5c.zip
zebra, lib, vtysh: Add CLI cmd to set/unset SRv6 encap source address
- Add a new node `SRV6_ENCAP_NODE` to the CLI graph. This node allows users to configure encapsulation parameters for SRv6, including the source address of the outer encapsulating IPv6 header. - Install a new CLI command `source-address` under the `SRV6_ENCAP_NODE` node. This command is used to configure the source address of the outer encapsulating IPv6 header. - Install a new CLI command `no source-address` under the `SRV6_ENCAP_NODE` node. This command is used to unset the source address of the outer encapsulating IPv6 header and restore the default source address. Examples: ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# source-address fc00:0:1::1 ``` ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# no source-address ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/vtysh.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index ac1079bbb..29358336e 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -1335,6 +1335,13 @@ static struct cmd_node srv6_loc_node = {
.prompt = "%s(config-srv6-locator)# ",
};
+static struct cmd_node srv6_encap_node = {
+ .name = "srv6-encap",
+ .node = SRV6_ENCAP_NODE,
+ .parent_node = SRV6_NODE,
+ .prompt = "%s(config-srv6-encap)# "
+};
+
#ifdef HAVE_PBRD
static struct cmd_node pbr_map_node = {
.name = "pbr-map",
@@ -1692,6 +1699,14 @@ DEFUNSH(VTYSH_ZEBRA, srv6_locator, srv6_locator_cmd,
return CMD_SUCCESS;
}
+DEFUNSH(VTYSH_ZEBRA, srv6_encap, srv6_encap_cmd,
+ "encapsulation",
+ "Segment Routing SRv6 encapsulation\n")
+{
+ vty->node = SRV6_ENCAP_NODE;
+ return CMD_SUCCESS;
+}
+
#ifdef HAVE_BGPD
DEFUNSH(VTYSH_BGPD, router_bgp, router_bgp_cmd,
"router bgp [ASNUM [<view|vrf> VIEWVRFNAME] [as-notation <dot|dot+|plain>]]",
@@ -2507,6 +2522,14 @@ DEFUNSH(VTYSH_ZEBRA, exit_srv6_loc_config, exit_srv6_loc_config_cmd, "exit",
return CMD_SUCCESS;
}
+DEFUNSH(VTYSH_ZEBRA, exit_srv6_encap, exit_srv6_encap_cmd, "exit",
+ "Exit from SRv6-encapsulation configuration mode\n")
+{
+ if (vty->node == SRV6_ENCAP_NODE)
+ vty->node = SRV6_NODE;
+ return CMD_SUCCESS;
+}
+
#ifdef HAVE_RIPD
DEFUNSH(VTYSH_RIPD, vtysh_exit_ripd, vtysh_exit_ripd_cmd, "exit",
"Exit current mode and down to previous mode\n")
@@ -5090,6 +5113,7 @@ void vtysh_init_vty(void)
install_element(SRV6_NODE, &srv6_locators_cmd);
install_element(SRV6_NODE, &exit_srv6_config_cmd);
install_element(SRV6_NODE, &vtysh_end_all_cmd);
+ install_element(SRV6_NODE, &srv6_encap_cmd);
install_node(&srv6_locs_node);
install_element(SRV6_LOCS_NODE, &srv6_locator_cmd);
@@ -5100,6 +5124,10 @@ void vtysh_init_vty(void)
install_element(SRV6_LOC_NODE, &exit_srv6_loc_config_cmd);
install_element(SRV6_LOC_NODE, &vtysh_end_all_cmd);
+ install_node(&srv6_encap_node);
+ install_element(SRV6_ENCAP_NODE, &exit_srv6_encap_cmd);
+ install_element(SRV6_ENCAP_NODE, &vtysh_end_all_cmd);
+
install_element(ENABLE_NODE, &vtysh_show_running_config_cmd);
install_element(ENABLE_NODE, &vtysh_copy_running_config_cmd);
install_element(ENABLE_NODE, &vtysh_copy_to_running_cmd);