pbrd: show directives give arrays where appropos

The new json output for the `show pbr` directives return arrays instead
of associative arrays, which are more meaningful in this context

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
This commit is contained in:
Wesley Coakley 2020-05-21 15:33:06 -04:00
parent 81c0078ef4
commit dadba1a23f
2 changed files with 6 additions and 7 deletions

View file

@ -1092,7 +1092,7 @@ static void pbr_nht_json_nhg(struct hash_bucket *b, void *data)
json_object_object_add(this_group, "nexthops", group_hops);
}
json_object_object_add(j, pnhgc->name, this_group);
json_object_array_add(j, this_group);
}
void pbr_nht_show_nexthop_group(struct vty *vty, const char *name)

View file

@ -691,7 +691,7 @@ DEFPY (show_pbr_map,
json_object *j = NULL;
if (json)
j = json_object_new_object();
j = json_object_new_array();
RB_FOREACH (pbrm, pbr_map_entry_head, &pbr_maps) {
json_object *this_map = NULL;
@ -704,7 +704,7 @@ DEFPY (show_pbr_map,
if (this_map) {
vty_json_pbr_map(this_map, vty, pbrm);
json_object_object_add(j, pbrm->name, this_map);
json_object_array_add(j, this_map);
continue;
}
@ -733,7 +733,7 @@ DEFPY(show_pbr_nexthop_group,
json_object *j = NULL;
if (json)
j = json_object_new_object();
j = json_object_new_array();
if (j) {
pbr_nht_json_nexthop_group(j, word);
@ -765,7 +765,7 @@ DEFPY (show_pbr_interface,
json_object *j = NULL;
if (json)
j = json_object_new_object();
j = json_object_new_array();
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
FOR_ALL_INTERFACES(vrf, ifp) {
@ -798,8 +798,7 @@ DEFPY (show_pbr_interface,
json_object_boolean_add(this_iface, "isValid",
pbrm);
json_object_object_add(j, ifp->name,
this_iface);
json_object_array_add(j, this_iface);
continue;
}