Add flavors display in json nexthop attributes.
> # ip -6 route add 2007::1 encap seg6local action End flavors psp dev dum1
> # vtysh -c "show ipv6 route json"
> [..]
> ,"2007::1/128":[{"prefix":"2007::1/128","prefixLen":128,"protocol":"kernel","vrfId":0,
> "vrfName":"default","selected":true,"destSelected":true,"distance":0,"metric":1024,
> "installed":true,"table":254,"internalStatus":16,"internalFlags":8,"internalNextHopNum":1,
> "internalNextHopActiveNum":1,"nexthopGroupId":28,"installedNexthopGroupId":28,"uptime":"00:04:20",
> "nexthops":[{"flags":3,"fib":true,"directlyConnected":true,"interfaceIndex":19,"interfaceName":"dum1",
> "active":true,"weight":1,"seg6local":{"action":"End","sidStructure":{"blockLen":0,"nodeLen":0,"funcLen":0,"argLen":0}},
> "seg6localContext":{"flavors":["psp"]}}]}]
> [..]
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
return strlen(str);
}
+static void seg6local_flavors2json(json_object *json, const struct seg6local_flavors_info *flv_info)
+{
+ json_object *json_flavors;
+
+ json_flavors = json_object_new_array();
+ json_object_object_add(json, "flavors", json_flavors);
+
+ if (CHECK_SRV6_FLV_OP(flv_info->flv_ops, ZEBRA_SEG6_LOCAL_FLV_OP_PSP))
+ json_array_string_add(json_flavors, "psp");
+ if (CHECK_SRV6_FLV_OP(flv_info->flv_ops, ZEBRA_SEG6_LOCAL_FLV_OP_USP))
+ json_array_string_add(json_flavors, "usp");
+ if (CHECK_SRV6_FLV_OP(flv_info->flv_ops, ZEBRA_SEG6_LOCAL_FLV_OP_USD))
+ json_array_string_add(json_flavors, "usd");
+}
+
void srv6_sid_structure2json(const struct seg6local_context *ctx, json_object *json)
{
json_object_int_add(json, "blockLen", ctx->block_len);
void seg6local_context2json(const struct seg6local_context *ctx,
uint32_t action, json_object *json)
{
+ seg6local_flavors2json(json, &ctx->flv);
switch (action) {
case ZEBRA_SEG6_LOCAL_ACTION_END:
return;