Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,7 @@ void nexthop_json_helper(json_object *json_nexthop,
json_object *json_backups = NULL;
json_object *json_seg6local = NULL;
json_object *json_seg6local_context = NULL;
json_object *json_srv6_sid_structure = NULL;
json_object *json_seg6 = NULL;
json_object *json_segs = NULL;
int i;
Expand Down Expand Up @@ -1302,6 +1303,10 @@ void nexthop_json_helper(json_object *json_nexthop,
json_object_object_add(json_nexthop, "seg6localContext",
json_seg6local_context);

json_srv6_sid_structure = json_object_new_object();
srv6_sid_structure2json(&nexthop->nh_srv6->seg6local_ctx, json_srv6_sid_structure);
json_object_object_add(json_seg6local, "sidStructure", json_srv6_sid_structure);

if (nexthop->nh_srv6->seg6_segs &&
nexthop->nh_srv6->seg6_segs->num_segs == 1) {
json_seg6 = json_object_new_object();
Expand Down
8 changes: 8 additions & 0 deletions lib/srv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ int snprintf_seg6_segs(char *str,
return strlen(str);
}

void srv6_sid_structure2json(const struct seg6local_context *ctx, json_object *json)
{
json_object_int_add(json, "blockLen", ctx->block_len);
json_object_int_add(json, "nodeLen", ctx->node_len);
json_object_int_add(json, "funcLen", ctx->function_len);
json_object_int_add(json, "argLen", ctx->argument_len);
}

void seg6local_context2json(const struct seg6local_context *ctx,
uint32_t action, json_object *json)
{
Expand Down
1 change: 1 addition & 0 deletions lib/srv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ const char *seg6local_context2str(char *str, size_t size,
uint32_t action);
void seg6local_context2json(const struct seg6local_context *ctx,
uint32_t action, json_object *json);
void srv6_sid_structure2json(const struct seg6local_context *ctx, json_object *json);

static inline const char *srv6_sid_ctx2str(char *str, size_t size,
const struct srv6_sid_ctx *ctx)
Expand Down
Loading
Loading