]> git.puffer.fish Git - mirror/frr.git/commit
lib: add json API to dump and override row naming convention 16237/head
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 18 Jun 2024 10:11:44 +0000 (12:11 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 18 Jun 2024 12:33:41 +0000 (14:33 +0200)
commit073fec520c75d2468bd0eff0933feaab3283449c
treeed7cfe22d3e7f60f8897462bf29d51a9ea573134
parent045029e2442dbca3b6e7685438d171fa05c0f968
lib: add json API to dump and override row naming convention

The following table is not compliant with caml format when displayed in
json:

>                 ttable_add_row(
>                         tt,
>                         "Vertex|Type|Metric|Next-Hop|Interface|Parent");
>
>                 ttable_json(tt, "ssdsss");

output observed:

> [..]
>        {
>          "Vertex":"r1",
>          "Type":"",
>          "Metric":0,
>          "Next-Hop":"",
>          "Interface":"",
>          "Parent":""
>        }

output expected:

> [..]
>        {
>          "vertex":"r1",
>          "type":"",
>          "metric":0,
>          "nextHop":"",
>          "interface":"",
>          "parent":""
>        }

Override the ttable_json() function with a new function which has an
extra paramter: this parameter will redefine the initial row value for
json:

> ttable_json_with_json_text(tt,
> "vertex|type|metric|nextHop|interface|parent");

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
lib/termtable.c
lib/termtable.h