On Tue, Oct 14, 2025 at 2:14 PM Dumitru Ceara via dev <
[email protected]> wrote:

> The new m_setup_*() helpers configure the Linux interfaces and bridges
> while the m_config_*() helpers set up the FRR configuration and
> additional VRFs (if needed).
>
> This allows the m_setup_*() macros to be reused by upcoming commits for
> other similar BGP tests.
>
> Signed-off-by: Dumitru Ceara <[email protected]>
> ---
>  tests/multinode-bgp-macros.at | 65 +++++++++++++++++++++++++++++------
>  tests/multinode.at            | 24 ++++++++-----
>  2 files changed, 70 insertions(+), 19 deletions(-)
>
> diff --git a/tests/multinode-bgp-macros.at b/tests/multinode-bgp-macros.at
> index d41892b5eb..06d1806eae 100644
> --- a/tests/multinode-bgp-macros.at
> +++ b/tests/multinode-bgp-macros.at
> @@ -44,14 +44,13 @@ m_setup_external_frr_vrf() {
>      check m_as $node $ns_prefix ip link set $lo up
>  }
>
> -# m_setup_external_frr_router NODE BGP_AS BGP_ROUTER_ID BGP_IP BGP_MAC
> [VNI]
> +# m_setup_external_frr_router NODE BGP_IP
>  #
>  # Sets up an external FRR BGP speaker in a network namespace on the
> -# ovn-fake-multinode node NODE.  The BGP autonomous system is configured
> to be
> -# BGP_AS.  The speaker uses as BGP IP address, BGP_IP and BGP_MAC as mac
> +# ovn-fake-multinode node NODE.  The speaker uses as BGP IP address,
> BGP_IP.
>  # address.
>  m_setup_external_frr_router() {
> -    local node=$1 bgp_as=$2 bgp_router_id=$3 bgp_ip=$4 bgp_mac=$5 vni=$6
> +    local node=$1 bgp_ip=$2
>      local br_name=br-$node
>
>      check m_as $node ovs-vsctl add-br $br_name
> @@ -95,6 +94,17 @@ m_setup_external_frr_router() {
>      fi
>      on_exit "m_as $node systemctl stop frr"
>      check m_as $node systemctl start frr
> +}
> +
> +# m_config_external_frr_router NODE BGP_AS BGP_ROUTER_ID BGP_IP BGP_MAC
> [VNI]
> +#
> +# Configures an external FRR BGP speaker in a network namespace on the
> +# ovn-fake-multinode node NODE.  The BGP autonomous system is configured
> to be
> +# BGP_AS.  The speaker uses as BGP IP address, BGP_IP and BGP_MAC as mac
> +# address.
> +m_config_external_frr_router() {
> +    local node=$1 bgp_as=$2 bgp_router_id=$3 bgp_ip=$4 bgp_mac=$5 vni=$6
> +    local br_name=br-$node
>
>      frr_flags="-N frr-ns"
>      if m_is_fedora; then
> @@ -173,17 +183,17 @@ m_ovn_frr_switch_localnet_port_name() {
>  }
>
>  # m_setup_ovn_frr_router NODE BGP_AS BGP_IP BGP_MAC VNI
> +# m_setup_ovn_frr_router NODE BGP_MAC VNI
>  #
>  # Sets up an FRR BGP speaker in a VRF in the default network namespace on
> the
>  # ovn-fake-multinode node NODE.  This speaker is running on an interface
> bound
> -# to a local OVN logical switch, ls-NODE-ext0, and uses the same BGP_IP
> and
> -# BGP_MAC address as a logical router, lr-NODE-ext0, with
> -# routing-protocol-redirect enabled.
> +# to a local OVN logical switch, ls-NODE-ext0, and uses the same BGP_MAC
> +# address as a logical router, lr-NODE-ext0, with
> routing-protocol-redirect
> +# enabled.
>  #
> -# The BGP autonomous system is configured to be BGP_AS and the FRR
> instance
> -# runs in vrf VNI.
> +# The FRR instance runs in vrf VNI.
>  m_setup_ovn_frr_router() {
> -    local node=$1 bgp_as=$2 bgp_ip=$3 bgp_mac=$4 vni=$5
> +    local node=$1 bgp_mac=$2 vni=$3
>      local br_name=br-$node physnet=physnet_${node}_ext0
>      local lr=$(m_ovn_frr_router_name $node)
>      local lrp=$(m_ovn_frr_router_port_name $node)
> @@ -243,8 +253,21 @@ m_setup_ovn_frr_router() {
>
>      check multinode_nbctl --wait=hv sync
>      m_wait_for_ports_up
> +}
>
> -    echo "configure
> +# m_config_ovn_frr_router NODE BGP_AS BGP_IP VNI
> +#
> +# Configures an FRR BGP speaker in a VRF in the default network namespace
> on
> +# the ovn-fake-multinode node NODE.  This speaker is running on an
> interface
> +# bound to a local OVN logical switch, ls-NODE-ext0, and uses the same
> BGP_IP
> +# as a logical router, lr-NODE-ext0, with routing-protocol-redirect
> enabled.
> +#
> +# The BGP autonomous system is configured to be BGP_AS and the FRR
> instance
> +# runs in vrf VNI.
> +m_config_ovn_frr_router() {
> +    local node=$1 bgp_as=$2 bgp_ip=$3 vni=$4
> +
> +echo "configure
>      ip prefix-list no-default seq 5 deny 0.0.0.0/0
>      ip prefix-list no-default seq 10 permit 0.0.0.0/0 le 32
>
> @@ -338,6 +361,26 @@ m_setup_host_frr_router() {
>      # Configure the BGP IP on the bridge LOCAL interface.
>      check m_as $node ip addr add $bgp_ip dev $br_name
>      check m_as $node ip link set $br_name up
> +}
> +
> +# m_config_host_frr_router NODE BGP_AS BGP_ROUTER_ID BGP_IP BGP_MAC VNI
> +#
> +# Sets up an FRR BGP speaker in the default network namespace on the
> +# ovn-fake-multinode node NODE.  This speaker is running on a ovs bridge
> +# interface (simulating the fabric connection).
> +#
> +# The BGP autonomous system is configured to be BGP_AS and the FRR
> instance
> +# runs in vrf-VNI.
> +m_config_host_frr_router() {
> +    local node=$1 bgp_as=$2 bgp_router_id=$3 bgp_ip=$4 bgp_mac=$5 vni=$6
> +
> +    local br_name=br-$node physnet=physnet_${node}_ext0
> +    local lr=$(m_ovn_frr_router_name $node)
> +    local lrp=$(m_ovn_frr_router_port_name $node)
> +    local ls=$(m_ovn_frr_switch_name $node)
> +    local lsp=$(m_ovn_frr_switch_port_name $node)
> +    local lsp_bgp=$(m_ovn_frr_switch_bgp_port_name $node)
> +    local lsp_ln=$(m_ovn_frr_switch_localnet_port_name $node)
>
>      # NOTE: we set "no bgp ebgp-requires-policy" to simplify EVPN
> deployments.
>      echo "configure
> diff --git a/tests/multinode.at b/tests/multinode.at
> index de61903d71..604a9bd0f2 100644
> --- a/tests/multinode.at
> +++ b/tests/multinode.at
> @@ -3055,11 +3055,15 @@ add_guest_vm_and_connections() {
>          $default_route $default_route_gw $lrp_guest_join
>  }
>
> -m_setup_external_frr_router ovn-gw-1 4200000100 41.41.41.41
> 41.41.41.41/32 12:fb:d6:66:99:0c
> -m_setup_ovn_frr_router      ovn-gw-1 4210000000 14.14.14.14
>   12:fb:d6:66:99:1c 10
> +m_setup_external_frr_router  ovn-gw-1
> 41.41.41.41/32
> +m_config_external_frr_router ovn-gw-1 4200000100 41.41.41.41
> 41.41.41.41/32 12:fb:d6:66:99:0c
> +m_setup_ovn_frr_router       ovn-gw-1
>    12:fb:d6:66:99:1c 10
> +m_config_ovn_frr_router      ovn-gw-1 4210000000 14.14.14.14
>                     10
>
> -m_setup_external_frr_router ovn-gw-2 4200000200 42.42.42.42
> 42.42.42.42/32 22:fb:d6:66:99:0c
> -m_setup_ovn_frr_router      ovn-gw-2 4210000000 24.24.24.24
>   22:fb:d6:66:99:2c 20
> +m_setup_external_frr_router  ovn-gw-2
> 42.42.42.42/32
> +m_config_external_frr_router ovn-gw-2 4200000200 42.42.42.42
> 42.42.42.42/32 22:fb:d6:66:99:0c
> +m_setup_ovn_frr_router       ovn-gw-2
>    22:fb:d6:66:99:2c 20
> +m_config_ovn_frr_router      ovn-gw-2 4210000000 24.24.24.24
>                     20
>
>  OVS_WAIT_UNTIL([m_as ovn-gw-2 vtysh -c 'show bgp vrf ovnvrf20 neighbors'
> | grep -qE 'Connections established 1'])
>  OVS_WAIT_UNTIL([m_as ovn-gw-1 vtysh -c 'show bgp vrf ovnvrf10 neighbors'
> | grep -qE 'Connections established 1'])
> @@ -3641,11 +3645,15 @@ host_bgp_mac_gw2=00:00:00:02:00:$vni
>   check m_as ovn-gw-1 ovs-vsctl set open .
> external-ids:ovn-evpn-vxlan-ports=4789
>   check m_as ovn-gw-2 ovs-vsctl set open .
> external-ids:ovn-evpn-vxlan-ports=4789
>
> -m_setup_external_frr_router ovn-gw-1 4200000100 $ext_bgp_ip_gw1
> $ext_bgp_ip_gw1/24  $ext_bgp_mac_gw1  $vni
> -m_setup_host_frr_router     ovn-gw-1 4210000000 $host_bgp_ip_gw1
> $host_bgp_ip_gw1/24 $host_bgp_mac_gw1 $vni
> +m_setup_external_frr_router  ovn-gw-1
>  $ext_bgp_ip_gw1/24
> +m_config_external_frr_router ovn-gw-1 4200000100 $ext_bgp_ip_gw1
> $ext_bgp_ip_gw1/24  $ext_bgp_mac_gw1 $vni
> +m_setup_host_frr_router      ovn-gw-1 4210000000 $host_bgp_ip_gw1
> $host_bgp_ip_gw1/24 $host_bgp_mac_gw1 $vni
> +m_config_host_frr_router     ovn-gw-1 4210000000 $host_bgp_ip_gw1
> $host_bgp_ip_gw1/24 $host_bgp_mac_gw1 $vni
>
> -m_setup_external_frr_router ovn-gw-2 4200000200 $ext_bgp_ip_gw2
> $ext_bgp_ip_gw2/24  $ext_bgp_mac_gw2  $vni
> -m_setup_host_frr_router     ovn-gw-2 4210000000 $host_bgp_ip_gw2
> $host_bgp_ip_gw2/24 $host_bgp_mac_gw2 $vni
> +m_setup_external_frr_router  ovn-gw-2
>  $ext_bgp_ip_gw2/24
> +m_config_external_frr_router ovn-gw-2 4200000200 $ext_bgp_ip_gw2
> $ext_bgp_ip_gw2/24  $ext_bgp_mac_gw2 $vni
> +m_setup_host_frr_router      ovn-gw-2 4210000000 $host_bgp_ip_gw2
> $host_bgp_ip_gw2/24 $host_bgp_mac_gw2 $vni
> +m_config_host_frr_router     ovn-gw-2 4210000000 $host_bgp_ip_gw2
> $host_bgp_ip_gw2/24 $host_bgp_mac_gw2 $vni
>
>  OVS_WAIT_UNTIL([m_as ovn-gw-1 vtysh -c 'show bgp neighbors' | grep -qE
> 'Connections established 1'])
>  OVS_WAIT_UNTIL([m_as ovn-gw-2 vtysh -c 'show bgp neighbors' | grep -qE
> 'Connections established 1'])
> --
> 2.51.0
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Looks good to me, thanks.
Acked-by: Ales Musil <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to