diff options
author | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-03-01 16:42:56 +0100 |
---|---|---|
committer | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-09-11 22:11:32 +0200 |
commit | af4870f600e20f1dfcc8359103d135d5695d96dd (patch) | |
tree | 380253f736f39e02e347d32ecfa4419f4cf54ebd /isisd/isis_tlvs.c | |
parent | isisd: Copy SID Struct when copying Sub-Sub-TLVs (diff) | |
download | frr-af4870f600e20f1dfcc8359103d135d5695d96dd.tar.xz frr-af4870f600e20f1dfcc8359103d135d5695d96dd.zip |
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>
Diffstat (limited to 'isisd/isis_tlvs.c')
-rw-r--r-- | isisd/isis_tlvs.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index f9ae8e9fd..dc1a469ed 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -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); |