Skip to content
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

lib: add seg6localContext json attribute in nexthop information #16535

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

pguibert6WIND
Copy link
Member

Some srv6 behaviors have a context attached that is visible if no json is requested:

show ipv6 route

[..]
B>* 2001:db8:1:1:100::/128 [20/0] is directly connected, vrf10, seg6local End.DT6 table 10, weight 1, 00:00:14
B>* 2001:db8:1:1:200::/128 [20/0] is directly connected, vrf20, seg6local End.DT6 table 20, weight 1, 00:00:14

The json does not dump this attribute:

show ipv6 route 2001:db8:1:1:100::/128 json

[..]
"nexthops":[
{
"flags":3,
"fib":true,
"directlyConnected":true,
"interfaceIndex":6,
"interfaceName":"vrf10",
"active":true,
"weight":1,
"seg6local":{
"action":"End.DT6"
},
}

Add the json support for this.

 "nexthops":[
   {
     "flags":3,
     "fib":true,
     "directlyConnected":true,
     "interfaceIndex":6,
     "interfaceName":"vrf10",
     "active":true,
     "weight":1,
     "seg6local":{
       "action":"End.DT6"
     },
     "seg6localContext":{
       "table":10
     }
   }

@frrbot frrbot bot added the libfrr label Aug 8, 2024
@pguibert6WIND pguibert6WIND force-pushed the srv6_nexthop_context branch 2 times, most recently from ff2db4e to 672d423 Compare August 8, 2024 08:37
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits, other than that LGTM.

lib/srv6.c Outdated
case ZEBRA_SEG6_LOCAL_ACTION_END_DX4:
json_object_string_addf(json, "nh4", "%pI4", &ctx->nh4);
return;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Drop this empty line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

lib/srv6.c Outdated
case ZEBRA_SEG6_LOCAL_ACTION_END_DX6:
json_object_string_addf(json, "nh6", "%pI6", &ctx->nh6);
return;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Drop this empty line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

lib/srv6.c Outdated
case ZEBRA_SEG6_LOCAL_ACTION_END:
json_object_boolean_add(json, "USP", true);
return;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Drop this empty line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

lib/srv6.c Outdated
@@ -71,6 +71,48 @@ int snprintf_seg6_segs(char *str,
return strlen(str);
}

/* return true if json context has been filled in, false otherwise */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misleading comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Some srv6 behaviors have a context attached that is visible if
no json is requested:

> # show ipv6 route
> [..]
> B>* 2001:db8:1:1:100::/128 [20/0] is directly connected, vrf10, seg6local End.DT6 table 10, weight 1, 00:00:14
> B>* 2001:db8:1:1:200::/128 [20/0] is directly connected, vrf20, seg6local End.DT6 table 20, weight 1, 00:00:14
>

The json does not dump this attribute:
> # show ipv6 route 2001:db8:1:1:100::/128 json
> [..]
>      "nexthops":[
>        {
>          "flags":3,
>          "fib":true,
>          "directlyConnected":true,
>          "interfaceIndex":6,
>          "interfaceName":"vrf10",
>          "active":true,
>          "weight":1,
>          "seg6local":{
>            "action":"End.DT6"
>          },
>        }
>

Add the json support for this.

>      "nexthops":[
>        {
>          "flags":3,
>          "fib":true,
>          "directlyConnected":true,
>          "interfaceIndex":6,
>          "interfaceName":"vrf10",
>          "active":true,
>          "weight":1,
>          "seg6local":{
>            "action":"End.DT6"
>          },
>          "seg6localContext":{
>            "table":10
>          }
>        }
>

Signed-off-by: Philippe Guibert <[email protected]>
@ton31337 ton31337 merged commit 536d478 into FRRouting:master Aug 8, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants