summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_vty.h
diff options
context:
space:
mode:
authorDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-08-27 03:48:53 +0200
committerDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-08-27 16:05:39 +0200
commit5cb5f4d04de6cfd844999179687670ac20fee690 (patch)
treea52c36142e6f8252fc50f2d413a5c8e8c9661555 /bgpd/bgp_vty.h
parentMerge pull request #4880 from ddutt/master (diff)
downloadfrr-5cb5f4d04de6cfd844999179687670ac20fee690.tar.xz
frr-5cb5f4d04de6cfd844999179687670ac20fee690.zip
bgpd: Eliminate all incorrect formulations of afi/safi in JSON
In a number of places, the JSON output had invalid key names for AFI/SAFI. For example, the key name in JSON was "IPv4 Unicast" which is invalid as a JSON Key name. Many JSON tools such as those used in Ansible, jq etc. all fail to parse the output in these scenarios. The valid name is ipv4Unicast. There's already a routine afi_safi_json() defined to handle this change, but it was not consistently called. The non-JSON version was called afi_safi_print() and it merely returned the CLI version of the string, didn't print anything. This patch deals with this issue by: - Renaming afi_safi_print to get_afi_safi_str() - get_afi_safi_str takes an additional param, for_json which if true will return the JSON-valid string - Renaming afi_safi_json to get_afi_safi_json_str() - Creating a new routine get_afi_safi_vty_str() for printing to vty - Consistently using get_afi_safi_str() with the appropriate for_json value Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
Diffstat (limited to 'bgpd/bgp_vty.h')
-rw-r--r--bgpd/bgp_vty.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h
index d9df2b4cf..961467e22 100644
--- a/bgpd/bgp_vty.h
+++ b/bgpd/bgp_vty.h
@@ -45,8 +45,7 @@ struct bgp;
"Address Family modifier\n"
extern void bgp_vty_init(void);
-extern const char *afi_safi_print(afi_t afi, safi_t safi);
-extern const char *afi_safi_json(afi_t afi, safi_t safi);
+extern const char *get_afi_safi_str(afi_t afi, safi_t safi, bool for_json);
extern void bgp_config_write_update_delay(struct vty *vty, struct bgp *bgp);
extern void bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp);
extern void bgp_config_write_rpkt_quanta(struct vty *vty, struct bgp *bgp);