Add m_frr_ns_flags, m_config_external_frr_router_l3, and
m_config_host_frr_router_l3 helpers that were missing after
backporting commit 2d22689f6 ("northd: Fix L3 EVPN when remote
VTEP is not L2 adjacent").
Fixes: 2d22689f6515 ("northd: Fix L3 EVPN when remote VTEP is not L2 adjacent.")
Assisted-by: Claude, with model: claude-opus-4-6
Signed-off-by: Dumitru Ceara <[email protected]>
---
tests/multinode-bgp-macros.at | 143 ++++++++++++++++++++++++++++++++++
1 file changed, 143 insertions(+)
diff --git a/tests/multinode-bgp-macros.at b/tests/multinode-bgp-macros.at
index 2fb4b9b2ff..74c56cca19 100644
--- a/tests/multinode-bgp-macros.at
+++ b/tests/multinode-bgp-macros.at
@@ -4,6 +4,20 @@
OVS_START_SHELL_HELPERS
+# m_frr_ns_flags NETNS
+#
+# Builds the argument flags string to be passed to FRR when running in a
+# network namespace.
+m_frr_ns_flags() {
+ local ns=$1
+
+ if m_is_fedora; then
+ echo "--vty_socket /run/frr/$ns"
+ else
+ echo "-N $ns"
+ fi
+}
+
# 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
@@ -140,6 +154,66 @@ m_config_external_frr_router() {
fi
}
+# m_config_external_frr_router_l3 NODE BGP_AS BGP_ROUTER_ID BGP_IP BGP_IP6
BGP_MAC VNI
+#
+# Configures an external FRR BGP speaker for L3 EVPN 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_IP6
+# and BGP_MAC as mac address.
+m_config_external_frr_router_l3() {
+ local node=$1 bgp_as=$2 bgp_router_id=$3 bgp_ip=$4 bgp_ip6=$5 bgp_mac=$6
vni=$7
+ local frr_flags=$(m_frr_ns_flags frr-ns)
+ local br_name=br-$node
+
+ # NOTE: we set "no bgp ebgp-requires-policy" to simplify EVPN deployments.
+ echo "configure
+ ip prefix-list accept-all seq 5 permit any
+
+ vrf vrf-$vni
+ vni $vni
+ exit-vrf
+
+ router bgp $bgp_as
+ bgp router-id $bgp_router_id
+ no bgp ebgp-requires-policy
+
+ neighbor ext1 soft-reconfiguration inbound
+ neighbor ext1 interface remote-as external
+
+ address-family l2vpn evpn
+ neighbor ext1 activate
+ advertise-all-vni
+ advertise-svi-ip
+ exit-address-family
+ exit
+
+ router bgp $bgp_as vrf vrf-$vni
+ bgp router-id $bgp_router_id
+ no bgp ebgp-requires-policy
+
+ address-family ipv4 unicast
+ redistribute kernel
+ redistribute connected
+ exit-address-family
+
+ address-family ipv6 unicast
+ redistribute kernel
+ redistribute connected
+ exit-address-family
+
+ address-family l2vpn evpn
+ advertise ipv4 unicast
+ advertise ipv6 unicast
+ exit-address-family
+ exit
+ " | podman exec -i $node vtysh $frr_flags
+
+ # Configure VRF.
+ vxlan_ip=$(echo $bgp_ip | cut -f 1 -d '/')
+ m_setup_external_frr_vrf $node $vni $vxlan_ip $bgp_mac $bgp_ip frr-ns
+ check m_as $node ip netns exec frr-ns ip -6 addr add dev br-$vni $bgp_ip6
+}
+
# m_ovn_frr_router_name NODE
m_ovn_frr_router_name() {
local node=$1
@@ -409,4 +483,73 @@ m_config_host_frr_router() {
m_setup_host_frr_vrf $node $vni $vxlan_ip $bgp_mac $bgp_ip
}
+# m_config_host_frr_router_l3 NODE BGP_AS BGP_ROUTER_ID BGP_IP BGP_MAC VNI
+#
+# Sets up an FRR BGP speaker speaker for L3 EVPN 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_l3() {
+ 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
+ vrf vrf-$vni
+ vni $vni
+ exit-vrf
+
+ 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
+
+ ipv6 prefix-list no-default seq 5 deny ::/0
+ ipv6 prefix-list no-default seq 10 permit ::/0 le 128
+
+ router bgp ${bgp_as}
+ bgp router-id $bgp_router_id
+ no bgp ebgp-requires-policy
+ neighbor $br_name interface remote-as external
+
+ address-family l2vpn evpn
+ neighbor $br_name activate
+ advertise-all-vni
+ advertise-svi-ip
+ exit-address-family
+ exit
+
+ router bgp ${bgp_as} vrf vrf-$vni
+ bgp router-id $bgp_router_id
+ no bgp ebgp-requires-policy
+
+ address-family ipv4 unicast
+ redistribute kernel
+ redistribute connected
+ exit-address-family
+
+ address-family ipv6 unicast
+ redistribute kernel
+ redistribute connected
+ exit-address-family
+
+ address-family l2vpn evpn
+ advertise ipv4 unicast
+ advertise ipv6 unicast
+ exit-address-family
+ exit
+ " | podman exec -i $node vtysh
+
+ # Configure VRF.
+ 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
--
2.53.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev