lib,zebra: Add SRv6 uSID info to VTY output

In this commit, we extend to print the `SRV6_LOCATOR_USID` flag.
The output appears as follows:

```
{
  "locators":[
    {
      "name":"loc1",
      "prefix":"fc00:0:1::/48",
      "blockBitsLength":32,
      "nodeBitsLength":16,
      "functionBitsLength":16,
      "argumentBitsLength":0,
      "uSID":true,
      "statusUp":true,
      "chunks":[
        {
          "prefix":"fc00:0:1::/48",
          "proto":"bgp"
        }
      ]
    }
  ]
}
```

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
This commit is contained in:
Carmine Scarpitta 2022-10-27 20:01:24 +02:00
parent 05d99980f3
commit a3ff3dff3f
2 changed files with 11 additions and 0 deletions

View File

@ -245,6 +245,10 @@ json_object *srv6_locator_json(const struct srv6_locator *loc)
json_object_int_add(jo_root, "argumentBitsLength",
loc->argument_bits_length);
/* set true if the locator is a Micro-segment (uSID) locator */
if (CHECK_FLAG(loc->flags, SRV6_LOCATOR_USID))
json_object_string_add(jo_root, "behavior", "usid");
/* set status_up */
json_object_boolean_add(jo_root, "statusUp",
loc->status_up);
@ -290,6 +294,10 @@ json_object *srv6_locator_detailed_json(const struct srv6_locator *loc)
json_object_int_add(jo_root, "argumentBitsLength",
loc->argument_bits_length);
/* set true if the locator is a Micro-segment (uSID) locator */
if (CHECK_FLAG(loc->flags, SRV6_LOCATOR_USID))
json_object_string_add(jo_root, "behavior", "usid");
/* set algonum */
json_object_int_add(jo_root, "algoNum", loc->algonum);

View File

@ -174,6 +174,9 @@ DEFUN (show_srv6_locator_detail,
vty_out(vty, "Argument-Bit-Len: %u\n",
locator->argument_bits_length);
if (CHECK_FLAG(locator->flags, SRV6_LOCATOR_USID))
vty_out(vty, "Behavior: uSID\n");
vty_out(vty, "Chunks:\n");
for (ALL_LIST_ELEMENTS_RO((struct list *)locator->chunks, node,
chunk)) {