diff options
| author | Wesley Coakley <wcoakley@cumulusnetworks.com> | 2020-05-21 15:33:06 -0400 |
|---|---|---|
| committer | Wesley Coakley <wcoakley@cumulusnetworks.com> | 2020-05-27 10:28:02 -0400 |
| commit | dadba1a23f83e23c7d7f2669bcbac319bd7d4674 (patch) | |
| tree | c66ec654fdb41e9dea08c7a998e1bb4f33bdf786 | |
| parent | 81c0078ef4d0bb6471447e6eecd28663e0620cb3 (diff) | |
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>
| -rw-r--r-- | pbrd/pbr_nht.c | 2 | ||||
| -rw-r--r-- | pbrd/pbr_vty.c | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 30135dd9a4..4836a58792 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -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) diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index 505c600184..ae35eb23af 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -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; } |
