[ovs-dev] [PATCH] Show total_ports_on_switch when displaying logical_switch:
Mark Michelson
mmichels at redhat.com
Tue Jan 23 15:46:26 UTC 2018
On 01/19/2018 11:08 PM, amginwal at gmail.com wrote:
> From: aginwala <aginwala at ebay.com>
>
> e.g. when running ovn-nbctl show ls, it's good to have total ports that are
> attached to the switch.
>
> Signed-off-by: Aliasgar Ginwala <aginwala at ebay.com>
> ---
> ovn/utilities/ovn-nbctl.c | 1 +
> tests/ovn-nbctl.at | 10 ++++++----
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
> index c9aa2fe..0f1e952 100644
> --- a/ovn/utilities/ovn-nbctl.c
> +++ b/ovn/utilities/ovn-nbctl.c
> @@ -682,6 +682,7 @@ print_ls(const struct nbrec_logical_switch *ls, struct ds *s)
> ds_put_format(s, " router-port: %s\n", router_port);
> }
> }
> + ds_put_format(s, "total_ports_on_switch: %u\n", ls->n_ports);
> }
I think the wording here is a bit strange when compared to other output
from `ovn-nbctl show`. I think something like "total ports" instead of
"total_ports_on_switch" would be more consistent.
I also think that if you're adding this for logical switches, you should
do the same for logical routers.
>
> static void
> diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
> index 5ac4a6d..5fbaffd 100644
> --- a/tests/ovn-nbctl.at
> +++ b/tests/ovn-nbctl.at
> @@ -43,15 +43,17 @@ AT_CHECK([ovn-nbctl ls-list | uuidfilt], [0], [dnl
> q
> AT_CHECK([ovn-nbctl show ls0])
> AT_CHECK([ovn-nbctl ls-add ls0])
> -AT_CHECK([ovn-nbctl show ls0 | uuidfilt], [0],
> - [switch <0> (ls0)
> +AT_CHECK([ovn-nbctl show ls0 | uuidfilt], [0], [dnl
> +switch <0> (ls0)
> +total_ports_on_switch: 0
> ])
> AT_CHECK([ovn-nbctl ls-add ls0], [1], [],
> [ovn-nbctl: ls0: a switch with this name already exists
> ])
> AT_CHECK([ovn-nbctl --may-exist ls-add ls0])
> -AT_CHECK([ovn-nbctl show ls0 | uuidfilt], [0],
> - [switch <0> (ls0)
> +AT_CHECK([ovn-nbctl show ls0 | uuidfilt], [0], [dnl
> +switch <0> (ls0)
> +total_ports_on_switch: 0
> ])
> AT_CHECK([ovn-nbctl --add-duplicate ls-add ls0])
> AT_CHECK([ovn-nbctl --may-exist --add-duplicate ls-add ls0], [1], [],
>
More information about the dev
mailing list