Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: add json API to dump and override row naming convention #16237

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

pguibert6WIND
Copy link
Member

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");

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 <[email protected]>
Copy link
Contributor

@cscarpitta cscarpitta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@donaldsharp donaldsharp merged commit c7276d1 into FRRouting:master Jun 18, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants