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

Acked-by: Lorenzo Bianconi <[email protected]>

> ---
>  ic/ovn-ic.c     |  3 ++-
>  tests/ovn-ic.at | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 54 insertions(+), 1 deletion(-)
> 
> diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
> index 304953767..eea51df1f 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") &&
> +        !ip46_parse_cidr(s_nexthop, nexthop, &nlen)) {
>          return false;
>      }
>  
> diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
> index ced3fc9ed..33ce54735 100644
> --- a/tests/ovn-ic.at
> +++ b/tests/ovn-ic.at
> @@ -4304,3 +4304,55 @@ 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
> +
> +    ts=ts11
> +    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:a1:0$i 169.254.101.$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
> +
> +# 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