diff options
author | Donald Sharp <donaldsharp72@gmail.com> | 2022-03-13 23:19:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-13 23:19:33 +0100 |
commit | 7baebfb715fe61244930c18821f4c38d392bfeb0 (patch) | |
tree | bc6ab8899a6f9e992cba8dfa6a21e2bee072bde0 /ospf6d | |
parent | Merge pull request #10768 from opensourcerouting/feature/add_join_stats_per_i... (diff) | |
parent | *: Add camelCase JSON keys in addition to PascalCase (diff) | |
download | frr-7baebfb715fe61244930c18821f4c38d392bfeb0.tar.xz frr-7baebfb715fe61244930c18821f4c38d392bfeb0.zip |
Merge pull request #10447 from ton31337/fix/json_with_whitespaces
*: Fix JSON keys with whitespaces and PascalCase
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_gr_helper.c | 19 | ||||
-rw-r--r-- | ospf6d/ospf6_lsa.c | 8 | ||||
-rw-r--r-- | ospf6d/ospf6_top.c | 15 |
3 files changed, 37 insertions, 5 deletions
diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index 5f9b7f029..7b5ffc920 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -960,13 +960,22 @@ static void show_ospf6_gr_helper_details(struct vty *vty, struct ospf6 *ospf6, json, "supportedGracePeriod", ospf6->ospf6_helper_cfg.supported_grace_time); - if (ospf6->ospf6_helper_cfg.last_exit_reason - != OSPF6_GR_HELPER_EXIT_NONE) +#if CONFDATE > 20230131 +CPP_NOTICE("Remove JSON object commands with keys starting with capital") +#endif + if (ospf6->ospf6_helper_cfg.last_exit_reason != + OSPF6_GR_HELPER_EXIT_NONE) { json_object_string_add( json, "LastExitReason", ospf6_exit_reason_desc [ospf6->ospf6_helper_cfg .last_exit_reason]); + json_object_string_add( + json, "lastExitReason", + ospf6_exit_reason_desc + [ospf6->ospf6_helper_cfg + .last_exit_reason]); + } if (OSPF6_HELPER_ENABLE_RTR_COUNT(ospf6)) { struct json_object *json_rid_array = @@ -995,12 +1004,18 @@ static void show_ospf6_gr_helper_details(struct vty *vty, struct ospf6 *ospf6, json_object_object_get_ex( json, "Neighbors", &json_neighbors); + json_object_object_get_ex( + json, "neighbors", + &json_neighbors); if (!json_neighbors) { json_neighbors = json_object_new_object(); json_object_object_add( json, "Neighbors", json_neighbors); + json_object_object_add( + json, "neighbors", + json_neighbors); } } diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 740a94ba8..779076f38 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -85,9 +85,13 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa, start = (uint8_t *)lsa->header + sizeof(struct ospf6_lsa_header); end = (uint8_t *)lsa->header + ntohs(lsa->header->length); - if (use_json) +#if CONFDATE > 20230131 +CPP_NOTICE("Remove JSON object commands with keys starting with capital") +#endif + if (use_json) { json_object_string_add(json_obj, "LsaType", "unknown"); - else { + json_object_string_add(json_obj, "lsaType", "unknown"); + } else { vty_out(vty, " Unknown contents:\n"); for (current = start; current < end; current++) { if ((current - start) % 16 == 0) diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index e64bf24b6..2a6d7cd09 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -2017,6 +2017,9 @@ ospf6_show_vrf_name(struct vty *vty, struct ospf6 *ospf6, } } +#if CONFDATE > 20230131 +CPP_NOTICE("Remove JSON object commands with keys containing whitespaces") +#endif static int ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6, json_object *json, @@ -2037,7 +2040,9 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6, ospf6_show_vrf_name(vty, ospf6, json_vrf); json_object_int_add(json_vrf, "aggregation delay interval", - ospf6->aggr_delay_interval); + ospf6->aggr_delay_interval); + json_object_int_add(json_vrf, "aggregationDelayInterval", + ospf6->aggr_delay_interval); } @@ -2062,12 +2067,18 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6, json_object_string_add(json_aggr, "Summary address", buf); + json_object_string_add(json_aggr, "summaryAddress", + buf); json_object_string_add( json_aggr, "Metric-type", (aggr->mtype == DEFAULT_METRIC_TYPE) ? "E2" : "E1"); + json_object_string_add( + json_aggr, "metricType", + (aggr->mtype == DEFAULT_METRIC_TYPE) ? "E2" + : "E1"); json_object_int_add(json_aggr, "Metric", (aggr->metric != -1) @@ -2080,6 +2091,8 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6, json_object_int_add(json_aggr, "External route count", OSPF6_EXTERNAL_RT_COUNT(aggr)); + json_object_int_add(json_aggr, "externalRouteCount", + OSPF6_EXTERNAL_RT_COUNT(aggr)); if (OSPF6_EXTERNAL_RT_COUNT(aggr) && detail) { json_object_int_add(json_aggr, "ID", |