On 6/17/26 10:46 PM, Timothy Redaelli via dev wrote:
> When --format json is passed to ovs-appctl, dpctl/show returns a JSON
> object keyed by datapath name. Each entry contains "flows", "lookups"
> (hit/lost/missed), and "ports" (keyed by port name, each with
> "port-number" and "type"). Optional sections "masks" and "cache" are
> present as null when the datapath does not support them. Port "config"
> and "statistics" sub-objects are included when applicable.
>
> The output_format field is added to struct dpctl_params so the handler
> can select the appropriate callback (show_dpif or show_dpif_json).
> The JSON accumulator is stored in dpctl_params.json, and the reply
> is sent by dpctl_unixctl_handler based on whether json is set. On
> error, the JSON object is discarded and a text error reply is sent.
>
> Example output:
> {"ovs-system": {"flows": 0,
> "lookups": {"hit": 0, "lost": 0, "missed": 0},
> "masks": null, "cache": null,
> "ports": {"br0": {"port-number": 0,
> "type": "internal"}}}}
>
> Signed-off-by: Timothy Redaelli <[email protected]>
> ---
> NEWS | 3 +
> lib/dpctl.c | 233 ++++++++++++++++++++++++++++++++++++++++++++++++-
> lib/dpctl.h | 11 +++
> tests/dpctl.at | 19 ++++
> 4 files changed, 263 insertions(+), 3 deletions(-)
[...]
> diff --git a/tests/dpctl.at b/tests/dpctl.at
> index a87f67f98..7fbeb6745 100644
> --- a/tests/dpctl.at
> +++ b/tests/dpctl.at
> @@ -25,6 +25,25 @@ dummy@br0:
> flows: 0
> port 0: br0 (dummy-internal)
> ])
> +dnl Check dpctl/show JSON output.
> +AT_CHECK([ovs-appctl --format json --pretty dpctl/show dummy@br0], [0], [dnl
> +{
> + "dummy@br0": {
> + "cache": null,
> + "caches": null,
This naming is not great. The 'cache' filed reports the statistics
for the cache hits and the 'caches' reports the names and the sizes
of the configured cache levels. So, maybe something like this would
be easier to understand:
"cache": {
"statistics": { "hits": X, "hit-rate": Y },
"config": [
{ "name": "mask-cache", "size": Z }
]
}
Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev