> Add advertise from static discard routes via ovn-ic
> for work similar to BGP null route.
> 
> Signed-off-by: Lucas Vargas Dias <[email protected]>

Hi Lucas,

some comments inline. Can you please describe the use-case for this patch? E.g
discard the traffic on the remote az.

Regards,
Lorenzo

> ---
>  ic/ovn-ic.c     |  3 ++-
>  tests/ovn-ic.at | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 56 insertions(+), 1 deletion(-)
> 
> diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
> index 13e5534e7..c5ee6707f 100644
> --- a/ic/ovn-ic.c
> +++ b/ic/ovn-ic.c
> @@ -1018,7 +1018,8 @@ parse_route(const char *s_prefix, const char *s_nexthop,
>      }
>  
>      unsigned int nlen;
> -    if (!ip46_parse_cidr(s_nexthop, nexthop, &nlen)) {
> +    if (strcmp(s_nexthop, "discard") != 0 &&

here you can do:

        if (strcmp(s_nexthop, "discard") && ..)

> +        !ip46_parse_cidr(s_nexthop, nexthop, &nlen)) {
>          return false;
>      }
>  
> diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
> index 2d92f3adf..2290c47ca 100644
> --- a/tests/ovn-ic.at
> +++ b/tests/ovn-ic.at
> @@ -4251,3 +4251,57 @@ ovn_as az1 check ovn-nbctl remove logical_router_port 
> lrp-lr11-ts1 options ic-ro
>  OVN_CLEANUP_IC([az1], [az2])
>  AT_CLEANUP
>  ])
> +
> +OVN_FOR_EACH_NORTHD([
> +AT_SETUP([ovn-ic -- Advertise discard static routes])
> +
> +ovn_init_ic_db
> +
> +for i in 1 2; do
> +    ovn_start az$i
> +    ovn_as az$i
> +
> +    # Enable route learning at AZ level
> +    check ovn-nbctl set nb_global . options:ic-route-learn=true
> +    # Enable route advertising at AZ level
> +    check ovn-nbctl set nb_global . options:ic-route-adv=true
> +done
> +
> +# Create new transit switches and LRs. Test topology is next:
> +#
> +# logical router (lr11) -   transit switch (ts11) - logical router (lr12)
> +#
> +
> +# Create lr11, lr12 and ts11 and connect them
> +for i in 1 2; do
> +    ovn_as az$i
> +
> +    lr=lr1$i
> +    check ovn-nbctl lr-add $lr
> +
> +    for j in 1; do

why do you need this for loop here?

> +        ts=ts1$j
> +        check ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
> +
> +        lrp=lrp-$lr-$ts
> +        lsp=lsp-$ts-$lr
> +        # Create LRP and connect to TS
> +        check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 
> 169.254.10$j.$i/24
> +        check ovn-nbctl lsp-add $ts $lsp \
> +                -- lsp-set-addresses $lsp router \
> +                -- lsp-set-type $lsp router \
> +                -- lsp-set-options $lsp router-port=$lrp
> +    done
> +done
> +
> +# Create directly-connected route in lr11
> +check ovn_as az2 ovn-nbctl lr-route-add lr12 192.168.0.0/24 discard
> +OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
> +             grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
> +192.168.0.0/24 169.254.101.2
> +])
> +
> +OVN_CLEANUP_IC([az1], [az2])
> +
> +AT_CLEANUP
> +])
> -- 
> 2.43.0
> 
> 
> -- 
> 
> 
> 
> 
> _'Esta mensagem é direcionada apenas para os endereços constantes no 
> cabeçalho inicial. Se você não está listado nos endereços constantes no 
> cabeçalho, pedimos-lhe que desconsidere completamente o conteúdo dessa 
> mensagem e cuja cópia, encaminhamento e/ou execução das ações citadas estão 
> imediatamente anuladas e proibidas'._
> 
> 
> * **'Apesar do Magazine Luiza tomar 
> todas as precauções razoáveis para assegurar que nenhum vírus esteja 
> presente nesse e-mail, a empresa não poderá aceitar a responsabilidade por 
> quaisquer perdas ou danos causados por esse e-mail ou por seus anexos'.*
> 
> 
> 
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> 
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to