-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zebra: Add CLI to display SRv6 SIDs allocated #16836
base: master
Are you sure you want to change the base?
Conversation
When daemons allocate End.X SIDs they should also pass the interface index. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
When isisd allocates an End.X SID it should also pass the interface index down to zebra. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Add a function to show SRv6 SID information: zclients, behavior, SID context. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Add a function to show detailed SRv6 SIDs information. ``` router# show segment-routing srv6 sid fc00:0:1:e000:: detail SID Behavior Context Daemon/Instance ----------------- ---------- --------------------- ----------------- fc00:0:1:e000:: uA Interface 'eth-sw1' isis(0) Locator: loc1 Allocation type: dynamic ``` Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Add a function to show detailed SRv6 SIDs information in json format. ``` [ { "sid":"fc00:0:1::", "behavior":"uN", "context":"-", "daemons":"isis(0)" }, { "sid":"fc00:0:1:fe00::", "behavior":"uDT6", "context":"VRF 'vrf10'", "daemons":"bgp(0)" }, { "sid":"fc00:0:1:fe01::", "behavior":"uDT6", "context":"VRF 'vrf20'", "daemons":"bgp(0)" }, { "sid":"fc00:0:1:e000::", "behavior":"uA", "context":"Interface 'eth-sw1'", "daemons":"isis(0)" }, { "sid":"fc00:0:1:e001::", "behavior":"uA", "context":"Interface 'eth-sw1'", "daemons":"isis(0)" } ] ``` Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Add a function to show SRv6 SIDs information. ``` SID Behavior Context Daemon/Instance ----------------- ---------- --------------------- ----------------- fc00:0:1:: uN - isis(0) fc00:0:1:fe00:: uDT6 VRF 'vrf10' bgp(0) fc00:0:1:fe01:: uDT6 VRF 'vrf20' bgp(0) fc00:0:1:e000:: uA Interface 'eth-sw1' isis(0) fc00:0:1:e001:: uA Interface 'eth-sw1' isis(0) ``` Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Add a function to show SRv6 SIDs information in json format. ``` [ { "sid":"fc00:0:1::", "behavior":"uN", "context":"-", "daemons":"isis(0)" }, { "sid":"fc00:0:1:fe00::", "behavior":"uDT6", "context":"VRF 'vrf10'", "daemons":"bgp(0)" }, { "sid":"fc00:0:1:fe01::", "behavior":"uDT6", "context":"VRF 'vrf20'", "daemons":"bgp(0)" }, { "sid":"fc00:0:1:e000::", "behavior":"uA", "context":"Interface 'eth-sw1'", "daemons":"isis(0)" }, { "sid":"fc00:0:1:e001::", "behavior":"uA", "context":"Interface 'eth-sw1'", "daemons":"isis(0)" } ] ``` Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Add a command to show SRv6 SIDs allocated. Output examples: ``` router# show segment-routing srv6 sid SID Behavior Context Daemon/Instance ----------------- ---------- --------------------- ----------------- fc00:0:1:: uN - isis(0) fc00:0:1:fe00:: uDT6 VRF 'vrf10' bgp(0) fc00:0:1:fe01:: uDT6 VRF 'vrf20' bgp(0) fc00:0:1:e000:: uA Interface 'eth-sw1' isis(0) fc00:0:1:e001:: uA Interface 'eth-sw1' isis(0) ``` ``` router# show segment-routing srv6 sid fc00:0:1:e000:: detail SID Behavior Context Daemon/Instance ----------------- ---------- --------------------- ----------------- fc00:0:1:e000:: uA Interface 'eth-sw1' isis(0) Locator: loc1 Allocation type: dynamic ``` ``` router# show segment-routing srv6 sid json [ { "sid":"fc00:0:1::", "behavior":"uN", "context":"-", "daemons":"isis(0)" }, { "sid":"fc00:0:1:fe00::", "behavior":"uDT6", "context":"VRF 'vrf10'", "daemons":"bgp(0)" }, { "sid":"fc00:0:1:fe01::", "behavior":"uDT6", "context":"VRF 'vrf20'", "daemons":"bgp(0)" }, { "sid":"fc00:0:1:e000::", "behavior":"uA", "context":"Interface 'eth-sw1'", "daemons":"isis(0)" }, { "sid":"fc00:0:1:e001::", "behavior":"uA", "context":"Interface 'eth-sw1'", "daemons":"isis(0)" } ] ``` Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Extend the usage of the detail keyword to display locator and allocation type when needed. Now, the locator and the allocation type is also displayed when using the json format. > ubuntu2204hwe# show segment-routing srv6 sid > SID Behavior Context Daemon/Instance > ---------------- ---------- --------------- ----------------- > 2001::40:0:0:1 End - isis(0) > 2001::41:0:0:1 End.DT4 VRF 'default' bgp(0) > > ubuntu2204hwe# show segment-routing srv6 sid detail > SID Behavior Context Daemon/Instance Locator AllocationType > ---------------- ---------- --------------- ------------------------------------------ > 2001::40:0:0:1 End - isis(0) AV dynamic > 2001::41:0:0:1 End.DT4 VRF 'default' bgp(0) AV dynamic > > ubuntu2204hwe# show segment-routing srv6 sid 2001::40:0:0:1 > SID Behavior Context Daemon/Instance > ---------------- ---------- --------- ----------------- > 2001::40:0:0:1 End - isis(0) > > ubuntu2204hwe# show segment-routing srv6 sid 2001::40:0:0:1 detail > SID Behavior Context Daemon/Instance > ---------------- ---------- --------- ----------------- > 2001::40:0:0:1 End - isis(0) > > Locator: AV > Allocation type: dynamic > ubuntu2204hwe# show segment-routing srv6 sid 2001::40:0:0:1 json > [ > { > "sid":"2001::40:0:0:1", > "behavior":"End", > "context":"-", > "daemons":"isis(0)" > } > ] > ubuntu2204hwe# show segment-routing srv6 sid 2001::40:0:0:1 detail json > [ > { > "sid":"2001::40:0:0:1", > "behavior":"End", > "context":"-", > "daemons":"isis(0)", > "locator":"AV", > "allocationType":"dynamic" > } > ] > ubuntu2204hwe# show segment-routing srv6 sid json > [ > { > "sid":"2001::40:0:0:1", > "behavior":"End", > "context":"-", > "daemons":"isis(0)" > }, > { > "sid":"2001::41:0:0:1", > "behavior":"End.DT4", > "context":"VRF 'default'", > "daemons":"bgp(0)" > } > ] > ubuntu2204hwe# show segment-routing srv6 sid detail json > [ > { > "sid":"2001::40:0:0:1", > "behavior":"End", > "context":"-", > "daemons":"isis(0)", > "locator":"AV", > "allocationType":"dynamic" > }, > { > "sid":"2001::41:0:0:1", > "behavior":"End.DT4", > "context":"VRF 'default'", > "daemons":"bgp(0)", > "locator":"AV", > "allocationType":"dynamic" > } > ] > Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
|
||
/* Zclients */ | ||
if (listcount(sid->client_list)) { | ||
bool first = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this set to false?
SRV6_SID_FORMAT_TYPE_USID) || | ||
(!sid->locator->sid_format && | ||
CHECK_FLAG(sid->locator->flags, SRV6_LOCATOR_USID))) { | ||
switch (sid->ctx->ctx.behavior) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be moved to a separate helper function that just returns the string based on the behavior
?
|
||
table = ttable_dump(tt, "\n"); | ||
vty_out(vty, "%s\n", table); | ||
XFREE(MTYPE_TMP, table); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use MTYPE_TMP_TTABLE here, because it's not MTYPE_TMP anymore.
|
||
table = ttable_dump(tt, "\n"); | ||
vty_out(vty, "%s\n", table); | ||
XFREE(MTYPE_TMP, table); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
if (locator_name) { | ||
locator = zebra_srv6_locator_lookup(locator_name); | ||
if (!locator) { | ||
if (uj == false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, it's easier for an operator to get a valid JSON all the time when the operator expects it {}
(empty) instead of just an empty string.
} | ||
|
||
if (!sid_ctx) { | ||
if (uj == false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
|
||
if (locator && sid_ctx) | ||
if (!sid_ctx->sid || sid_ctx->sid->locator != locator) { | ||
if (uj == false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
I think the json should have the daemon name and the instance name as separate entities not combined |
case ZEBRA_SEG6_LOCAL_ACTION_END_AS: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_AM: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_BPF: | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an enum please remove the default selection.
case ZEBRA_SEG6_LOCAL_ACTION_END_AM: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_BPF: | ||
case ZEBRA_SEG6_LOCAL_ACTION_UNSPEC: | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, please remove the default case. If someone adds a new local action, I want the compile to fail and the person adding the new action be responsible for fixing it.
@@ -1424,4 +1424,5 @@ void zebra_srv6_vty_init(void) | |||
install_element(VIEW_NODE, &show_srv6_locator_cmd); | |||
install_element(VIEW_NODE, &show_srv6_locator_detail_cmd); | |||
install_element(VIEW_NODE, &show_srv6_manager_cmd); | |||
install_element(VIEW_NODE, &show_srv6_sid_cmd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs with the previous commit
Add a CLI to display the information regarding SRv6 local SID(s) allocated from a given locator.
Usage examples: