While the existing tests don't really need this explicitly, an upcoming
commit (adding a multinode L3 EVPN test) will need it.  It's better to
have fixed addresses anyway.

Signed-off-by: Dumitru Ceara <[email protected]>
---
 tests/multinode-bgp-macros.at | 35 ++++++++++++++++++++---------------
 tests/multinode.at            | 20 ++++++++++++--------
 2 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/tests/multinode-bgp-macros.at b/tests/multinode-bgp-macros.at
index 95273af847..d41892b5eb 100644
--- a/tests/multinode-bgp-macros.at
+++ b/tests/multinode-bgp-macros.at
@@ -4,12 +4,12 @@
 
 OVS_START_SHELL_HELPERS
 
-# m_setup_external_frr_vrf NODE VNI LOCAL_IP NETNS
+# m_setup_external_frr_vrf NODE VNI VXLAN_IP LOCAL_MAC LOCAL_IP NETNS
 #
 # Sets up a VRF in NETNS so that it can be used by FRR running in that
 # namespace to advertise EVPN routes.
 m_setup_external_frr_vrf() {
-    local node=$1 vni=$2 local_ip=$3 ns=$4
+    local node=$1 vni=$2 vxlan_ip=$3 local_mac=$4 local_ip=$5 ns=$6
 
     local ns_prefix="ip netns exec $ns "
     local vrf=vrf-$vni
@@ -25,10 +25,13 @@ m_setup_external_frr_vrf() {
     check m_as $node $ns_prefix ip link add $br type bridge
     on_exit "m_as $node $ns_prefix ip link del $br"
     check m_as $node $ns_prefix ip link set $br master $vrf addrgenmode none
+    check m_as $node $ns_prefix ip link set $br address $local_mac
+    check m_as $node $ns_prefix ip addr add dev $br $local_ip
     check m_as $node $ns_prefix ip link set dev $br up
 
     # Add VXLAN VTEP for the VNI.
-    check m_as $node $ns_prefix ip link add $vxlan type vxlan id $vni dstport 
4789 local $local_ip nolearning
+    check m_as $node $ns_prefix ip link add $vxlan type vxlan \
+        id $vni dstport 4789 local $vxlan_ip nolearning
     on_exit "m_as $node $ns_prefix ip link del $vxlan"
     check m_as $node $ns_prefix ip link set dev $vxlan up
     check m_as $node $ns_prefix ip link set $vxlan master $br
@@ -41,13 +44,14 @@ 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 [VNI]
+# m_setup_external_frr_router NODE BGP_AS BGP_ROUTER_ID BGP_IP BGP_MAC [VNI]
 #
 # 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
+# BGP_AS.  The speaker uses as BGP IP address, BGP_IP and BGP_MAC as mac
+# address.
 m_setup_external_frr_router() {
-    local node=$1 bgp_as=$2 bgp_router_id=$3 bgp_ip=$4 vni=$5
+    local node=$1 bgp_as=$2 bgp_router_id=$3 bgp_ip=$4 bgp_mac=$5 vni=$6
     local br_name=br-$node
 
     check m_as $node ovs-vsctl add-br $br_name
@@ -120,9 +124,9 @@ m_setup_external_frr_router() {
     " | podman exec -i $node vtysh $frr_flags
 
     # Configure VRF, if any provided.
-    bgp_ip=$(echo $bgp_ip | cut -f 1 -d '/')
+    vxlan_ip=$(echo $bgp_ip | cut -f 1 -d '/')
     if [[[ -n "$vni" ]]]; then
-        m_setup_external_frr_vrf $node $vni $bgp_ip frr-ns
+        m_setup_external_frr_vrf $node $vni $vxlan_ip $bgp_mac $bgp_ip frr-ns
     fi
 }
 
@@ -266,12 +270,12 @@ m_setup_ovn_frr_router() {
     " | podman exec -i $node vtysh
 }
 
-# m_setup_host_frr_vrf NODE VNI LOCAL_IP
+# m_setup_host_frr_vrf NODE VNI VXLAN_IP LOCAL_MAC LOCAL_IP
 #
 # Sets up a VRF in the default net namespace so that it can be used by OVN
 # and FRR to advertise EVPN routes.
 m_setup_host_frr_vrf() {
-    local node=$1 vni=$2 local_ip=$3
+    local node=$1 vni=$2 vxlan_ip=$3 local_mac=$4 local_ip=$5
 
     local vrf=vrf-$vni
     local br=br-$vni
@@ -288,6 +292,7 @@ m_setup_host_frr_vrf() {
     check m_as $node ip link add $br type bridge
     on_exit "m_as $node ip link del $br"
     check m_as $node ip link set $br master $vrf addrgenmode none
+    check m_as $node ip link set $br address $local_mac
     check m_as $node ip link set dev $br up
 
     # Add VXLAN VTEP for the VNI (linked to the OVS vxlan_sys_<port> 
interface).
@@ -298,7 +303,7 @@ m_setup_host_frr_vrf() {
     local dstport=$((60000 + $vni))
     check m_as $node ip link add $vxlan type vxlan   \
         dev vxlan_sys_${vxlan_port}                  \
-        id $vni dstport $dstport local $local_ip nolearning
+        id $vni dstport $dstport local $vxlan_ip nolearning
     on_exit "m_as $node ip link del $vxlan"
     check m_as $node ip link set dev $vxlan up
     check m_as $node ip link set $vxlan master $br
@@ -311,7 +316,7 @@ m_setup_host_frr_vrf() {
     check m_as $node ip link set $lo up
 }
 
-# m_setup_host_frr_router NODE BGP_AS BGP_ROUTER_ID BGP_IP VNI
+# m_setup_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
@@ -320,7 +325,7 @@ m_setup_host_frr_vrf() {
 # The BGP autonomous system is configured to be BGP_AS and the FRR instance
 # runs in vrf-VNI.
 m_setup_host_frr_router() {
-    local node=$1 bgp_as=$2 bgp_router_id=$3 bgp_ip=$4 vni=$5
+    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)
@@ -363,8 +368,8 @@ m_setup_host_frr_router() {
     " | podman exec -i $node vtysh
 
     # Configure VRF.
-    bgp_ip=$(echo $bgp_ip | cut -f 1 -d '/')
-    m_setup_host_frr_vrf $node $vni $bgp_ip
+    vxlan_ip=$(echo $bgp_ip | cut -f 1 -d '/')
+    m_setup_host_frr_vrf $node $vni $vxlan_ip $bgp_mac $bgp_ip
 }
 
 OVS_END_SHELL_HELPERS
diff --git a/tests/multinode.at b/tests/multinode.at
index c6a414af3f..de61903d71 100644
--- a/tests/multinode.at
+++ b/tests/multinode.at
@@ -3055,11 +3055,11 @@ 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
-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 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-2 4200000200 42.42.42.42 42.42.42.42/32
-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 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
 
 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'])
@@ -3624,9 +3624,13 @@ CHECK_VRF()
 
 vni=10
 ext_bgp_ip_gw1=42.42.$vni.11
+ext_bgp_mac_gw1=00:00:01:00:00:$vni
 host_bgp_ip_gw1=42.42.$vni.12
+host_bgp_mac_gw1=00:00:00:01:00:$vni
 ext_bgp_ip_gw2=42.42.$vni.21
+ext_bgp_mac_gw2=00:00:02:00:00:$vni
 host_bgp_ip_gw2=42.42.$vni.22
+host_bgp_mac_gw2=00:00:00:02:00:$vni
 
 # Create an flat, distributed OVN localnet switch, with EVPN configured.
  check m_as ovn-gw-1 ovs-vsctl set open . 
external-ids:ovn-bridge-mappings=public:br-ex
@@ -3637,11 +3641,11 @@ host_bgp_ip_gw2=42.42.$vni.22
  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 $vni
-m_setup_host_frr_router     ovn-gw-1 4210000000 $host_bgp_ip_gw1 
$host_bgp_ip_gw1/24 $vni
+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-2 4200000200 $ext_bgp_ip_gw2 
$ext_bgp_ip_gw2/24 $vni
-m_setup_host_frr_router     ovn-gw-2 4210000000 $host_bgp_ip_gw2 
$host_bgp_ip_gw2/24 $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
 
 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

Reply via email to