On 5/29/26 4:51 PM, Naveen Yerramneni wrote:
> - Make outport optional in 'nf-add'.
> - Accept 'vtap' mode in 'nfg-add'.
> 
> Signed-off-by: Naveen Yerramneni <[email protected]>
> Acked-by: Sragdhara Datta Chaudhuri <[email protected]>
> Acked-by: Aditya Mehakare <[email protected]>
> ---

Hi Naveen, Sragdhara,

Thanks for the new revision!

>  tests/ovn-nbctl.at    | 14 ++++++++++++++
>  utilities/ovn-nbctl.c | 20 ++++++++++++--------

We're missing an ovn-nbctl.8.xml update I guess.

>  2 files changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
> index 890d24dbf..95de94b5b 100644
> --- a/tests/ovn-nbctl.at
> +++ b/tests/ovn-nbctl.at
> @@ -3358,6 +3358,20 @@ AT_CHECK([ovn-nbctl nf-list | uuidfilt], [0], [dnl
>  <0> (nf3) id:10 in:svc-port6 out:svc-port7
>  ])
>  AT_CHECK([ovn-nbctl nf-del nf3])
> +
> +# Create network-function with only inport (vtap mode).
> +AT_CHECK([ovn-nbctl nf-add nf0 1 svc-port6])
> +AT_CHECK([ovn-nbctl nf-list | uuidfilt], [0], [dnl
> +<0> (nf0) id:1 in:svc-port6 out:<not_set>
> +])
> +
> +# Create a network-function-group in vtap mode.
> +AT_CHECK([ovn-nbctl nfg-add nfg0 1 vtap nf0])
> +AT_CHECK([ovn-nbctl nfg-list | uuidfilt], [0], [dnl
> +<0> (nfg0)

I think it would be useful to display the "mode" when "ovn-nbctl
nfg-list" is executed.

> +])
> +AT_CHECK([ovn-nbctl nfg-del nfg0])
> +AT_CHECK([ovn-nbctl nf-del nf0])
>  ])
>  
>  AT_SETUP([ovn-nbctl - TLS server name indication (SNI) with 
> --ssl-server-name])
> diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
> index 0900254c4..4c101c63d 100644
> --- a/utilities/ovn-nbctl.c
> +++ b/utilities/ovn-nbctl.c
> @@ -414,7 +414,7 @@ Network function group commands:\n\
>  \n\
>  Network function commands:\n\
>    [--may-exist]\n\
> -  nf-add NETWORK-FUNCTION ID PORT-IN PORT-OUT\n\
> +  nf-add NETWORK-FUNCTION ID PORT-IN [PORT-OUT]\n\
>                             create a network-function\n\
>    [--if-exists]\n\
>    nf-del NETWORK-FUNCTION  delete a network-function\n\
> @@ -2359,9 +2359,9 @@ nbctl_nf_group_add(struct ctl_context *ctx)
>  
>      /* Validate and set mode */
>      const char *nfg_mode = ctx->argv[3];
> -    if (strcmp(nfg_mode, "inline")) {
> +    if (strcmp(nfg_mode, "inline") && strcmp(nfg_mode, "vtap")) {
>          ctl_error(ctx, "Unsupported mode provided for "
> -                  "network-function-group:%s, supported values: inline",
> +                  "network-function-group:%s, supported values: inline, 
> vtap",
>                    nfg_name);
>          return;
>      }
> @@ -2560,10 +2560,14 @@ nbctl_nf_add(struct ctl_context *ctx)
>          ctx->error = error;
>          return;
>      }
> -    error = lsp_by_name_or_uuid(ctx, ctx->argv[4], true, &lsp_out);
> -    if (error) {
> -        ctx->error = error;
> -        return;
> +    if (ctx->argc == 5) {
> +        error = lsp_by_name_or_uuid(ctx, ctx->argv[4], true, &lsp_out);
> +        if (error) {
> +            ctx->error = error;
> +            return;
> +        }
> +    } else {
> +        lsp_out = NULL;
>      }
>  

Aren't we missing a validation here for the case when a user tries to
configure and "inline" nf only with "inport" (no "outport")?

>      /* Validate and parse ID */
> @@ -9404,7 +9408,7 @@ static const struct ctl_command_syntax nbctl_commands[] 
> = {
>        nbctl_nf_group_del_network_function, NULL, "--if-exists", RW },
>  
>      /* network-function commands. */
> -    { "nf-add", 4, 4, "NETWORK-FUNCTION ID PORT-IN PORT-OUT",
> +    { "nf-add", 3, 4, "NETWORK-FUNCTION ID PORT-IN [PORT-OUT]",
>        nbctl_pre_nf_add,
>        nbctl_nf_add,
>        NULL, "--may-exist", RW },

Regards,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to