isisd: Add format func for SID Struct Sub-Sub-TLV

Add a function to return information about an SRv6 SID Structure
Sub-Sub-TLV (RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
This commit is contained in:
Carmine Scarpitta 2023-03-01 16:42:56 +01:00
parent 2d8c968867
commit af4870f600

View File

@ -1975,6 +1975,40 @@ copy_subsubtlv_srv6_sid_structure(
return rv;
}
static void format_subsubtlv_srv6_sid_structure(
struct isis_srv6_sid_structure_subsubtlv *sid_struct, struct sbuf *buf,
struct json_object *json, int indent)
{
if (!sid_struct)
return;
if (json) {
struct json_object *sid_struct_json;
sid_struct_json = json_object_new_object();
json_object_object_add(json, "srv6-sid-structure",
sid_struct_json);
json_object_int_add(sid_struct_json, "loc-block-len",
sid_struct->loc_block_len);
json_object_int_add(sid_struct_json, "loc-node-len",
sid_struct->loc_node_len);
json_object_int_add(sid_struct_json, "func-len",
sid_struct->func_len);
json_object_int_add(sid_struct_json, "arg-len",
sid_struct->arg_len);
} else {
sbuf_push(buf, indent, "SRv6 SID Structure ");
sbuf_push(buf, 0, "Locator Block length: %hhu, ",
sid_struct->loc_block_len);
sbuf_push(buf, 0, "Locator Node length: %hhu, ",
sid_struct->loc_node_len);
sbuf_push(buf, 0, "Function length: %hhu, ",
sid_struct->func_len);
sbuf_push(buf, 0, "Argument length: %hhu, ",
sid_struct->arg_len);
sbuf_push(buf, 0, "\n");
}
}
static struct isis_item *copy_item(enum isis_tlv_context context,
enum isis_tlv_type type,
struct isis_item *item);