sharpd: add uSID block and function length parameters to seg6local route

Add the possibility to configure uSID seg6local route with specific
block and node length.

> ubuntu2204hwe# sharp install seg6local-routes 1005::1 nexthop-seg6local loop1 uN usid-block-length 40 usid-function-length 8 1
> ubuntu2204hwe# Ctrl-D
> # ip -6 ro show
> 1005::1 nhid 26  encap seg6local action End flavors next-csid lblen 40 nflen 8 dev loop1 proto 194 metric 20 pref medium

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2025-04-08 10:20:12 +02:00
parent 542a0f7518
commit a65e5eab3e
2 changed files with 17 additions and 0 deletions

View file

@ -200,6 +200,8 @@ keyword. At present, no sharp commands will be preserved in the config.
router# sharp install seg6local-routes 1::6 nexthop-seg6local dum0 End_DT46 10 1
router# sharp install seg6local-routes 1::7 nexthop-seg6local dum0 uN 1
router# sharp install seg6local-routes 1::8 nexthop-seg6local dum0 uA 2001::1 1
router# sharp install seg6local-routes 1::9 nexthop-seg6local dum0 uN usid-block-length 40 usid-function-length 8 1
router# sharp install seg6local-routes 1::10 nexthop-seg6local dum0 uA 2001::1 usid-block-length 40 usid-function-length 8 1
router# show ipv6 route
D>* 1::1/128 [150/0] is directly connected, dum0, seg6local End -, weight 1, 00:00:05
@ -210,6 +212,8 @@ keyword. At present, no sharp commands will be preserved in the config.
D>* 1::6/128 [150/0] is directly connected, dum0, seg6local End.DT46 table 10, weight 1, 00:00:05
D>* 1::7/128 [150/0] is directly connected, dum0, seg6local End -, weight 1, 00:00:05
D>* 1::8/128 [150/0] is directly connected, dum0, seg6local End.X nh6 2001::1, weight 1, 00:01:17
D>* 1::9/128 [150/0] is directly connected, dum0, seg6local End -, weight 1, 00:00:12
D>* 1::10/128 [150/0] is directly connected, dum0, seg6local End.X nh6 2001::1, weight 1, 00:00:05
bash# ip -6 route
1::1 encap seg6local action End dev dum0 proto 194 metric 20 pref medium
@ -220,6 +224,8 @@ keyword. At present, no sharp commands will be preserved in the config.
1::6 encap seg6local action End.DT46 table 10 dev dum0 proto 194 metric 20 pref medium
1::7 encap seg6local action End flavors next-csid lblen 32 nflen 16 dev dum0 proto 194 metric 20 pref medium
1::8 encap seg6local action End.X nh6 2001::1 flavors next-csid lblen 32 nflen 16 dev dum0 proto 194 metric 20 pref medium
1::9 encap seg6local action End flavors next-csid lblen 40 nflen 8 dev dum0 proto 194 metric 20 pref medium
1::10 encap seg6local action End.X nh6 2001::1 flavors next-csid lblen 40 nflen 8 dev dum0 proto 194 metric 20 pref medium
.. clicmd:: show sharp segment-routing srv6

View file

@ -460,6 +460,7 @@ DEFPY (install_seg6local_routes,
uDT4$seg6l_micro_enddt4 (1-4294967295)$seg6l_micro_enddt4_table|\
End_DT46$seg6l_enddt46 (1-4294967295)$seg6l_enddt46_table|\
uDT46$seg6l_micro_enddt46 (1-4294967295)$seg6l_micro_enddt46_table>\
[usid-block-length (1-128)$lcblen] [usid-function-length (1-128)$lcfunclen] \
(1-1000000)$routes [repeat (2-1000)$rpt]",
"Sharp routing Protocol\n"
"install some routes\n"
@ -499,6 +500,10 @@ DEFPY (install_seg6local_routes,
"Redirect table id to use\n"
"SRv6 uDT46 function to use\n"
"Redirect table id to use\n"
"uSID locator block length\n"
"Value in bits\n"
"uSID node Function length\n"
"Value in bits\n"
"How many to create\n"
"Should we repeat this command\n"
"How many times to repeat this command\n")
@ -594,6 +599,12 @@ DEFPY (install_seg6local_routes,
} else
action = ZEBRA_SEG6_LOCAL_ACTION_END;
if (CHECK_SRV6_FLV_OP(ctx.flv.flv_ops, ZEBRA_SEG6_LOCAL_FLV_OP_NEXT_CSID)) {
if (lcblen)
ctx.flv.lcblock_len = lcblen;
if (lcfunclen)
ctx.flv.lcnode_func_len = lcfunclen;
}
sg.r.nhop.type = NEXTHOP_TYPE_IFINDEX;
sg.r.nhop.ifindex = ifname2ifindex(seg6l_oif, vrf->vrf_id);
sg.r.nhop.vrf_id = vrf->vrf_id;