staticd: add non-uSID SRv6 SID behaviors
Extend the srv6 sid CLI to support non-uSID SRv6 endpoint behaviors (End, End_X, End_DT6, End_DT4, End_DT46), including VRF/interface/nexthop handling when applicable. The CLI keyword End_X represents the SRv6 End.X behavior (dot replaced by underscore for CLI token parsing).
Indeed, a documentation update is needed.
Anyway, it turns out the situation is more complex than expected after further testing. The show segment-routing srv6 sid command does not behave the same when the locator has behavior usid configured versus when it doesn’t.
Example with behavior usid on the locator:
f915aef81415# configure f915aef81415(config)# segment-routing f915aef81415(config-sr)# srv6 f915aef81415(config-srv6)# static-sids f915aef81415(config-srv6-sids)# sid fcbb:bbbb:1:fe01::/64 locator LOC1 behavior uDT4 vrf Vrf1 f915aef81415(config-srv6-sids)# exit f915aef81415(config-srv6)# locators f915aef81415(config-srv6-locators)# locator LOC1 f915aef81415(config-srv6-locator)# prefix fcbb:bbbb:1::/48 f915aef81415(config-srv6-locator)# behavior usid f915aef81415(config-srv6-locator)# do show segment-routing srv6 sid SID Behavior Context Daemon/Instance Locator AllocationType
fcbb:bbbb:1:fe01:: uDT4 VRF 'Vrf1' static(0) LOC1 explicit
Example without behavior usid on the locator
f915aef81415# configure f915aef81415(config)# segment-routing f915aef81415(config-sr)# srv6 f915aef81415(config-srv6)# static-sids f915aef81415(config-srv6-sids)# sid fcbb:bbbb:1:fe01::/64 locator LOC1 behavior uDT4 vrf Vrf1 f915aef81415(config-srv6-sids)# exit f915aef81415(config-srv6)# locators f915aef81415(config-srv6-locators)# locator LOC1 f915aef81415(config-srv6-locator)# do show segment-routing srv6 sid SID Behavior Context Daemon/Instance Locator AllocationType
fcbb:bbbb:1:fe01:: End.DT4 VRF 'Vrf1' static(0) LOC1 explicit
Internally, do_show_srv6_sid_json() uses different functions to format the SID behavior depending on whether the locator uses a uSID SID format:
447│ json_object_string_addf(json_sid, "sid", "%pI6", &entry->sid_value); 448├───────────────> if ((entry->locator->sid_format && 449│ entry->locator->sid_format->type == SRV6_SID_FORMAT_TYPE_USID) || 450│ (!entry->locator->sid_format && 451│ CHECK_FLAG(entry->locator->flags, SRV6_LOCATOR_USID))) { 452│ json_object_string_add(json_sid, "behavior", 453│ show_srv6_sid_seg6_action(sid_ctx->ctx.behavior)); 454│ } else { 455│ json_object_string_add(json_sid, "behavior", 456│ seg6local_action2str(sid_ctx->ctx.behavior)); 457│ }
However, in zebra, the installed nexthop always uses the NEXT_CSID flavor.
So currently staticd always tries to install SIDs as uSID format, regardless of the locator.
To properly support non-uSID locators, we have two possible approaches:
Option A — Automatic behavior selection
- If the locator is not uSID → automatically use classic End.DT4
- If the locator is uSID → automatically use uDT4
Option B — Strict validation
- Reject mismatched combinations such as:
- uDT4 with a non-uSID locator
- End.DT4 with a uSID locator
Another issue: CLI parsing prevents the use of a dot (.) in non-uSID behaviors (e.g., End.DT4). I had to temporarily switch to an alternative form (e.g., End_DT4) but changing WORD in the lexer breaks other commands.
do we need to discuss what we should do here in the meeting?
do we need to discuss what we should do here in the meeting?
Yes we can
A feedback from @cscarpitta may be enough, I think
I had an update from @cscarpitta : " I saw your comment and looked into the issue. There is a problem with how the SID Manager stores SIDs in its internal database. I have already developed a fix for this. It will enable non uSID support "