Skip to content

Commit

Permalink
test: BGP (IPv4 over IPv6) data plane tests
Browse files Browse the repository at this point in the history
This testsuite verifies that IPv4 networks advertised
by the OVN to their BGP neighbors (TOR), can be reached via
TOR from external networks.

Now that we have data plane tests, original 'bgp.bats' test suite
was renamed to 'bgp_control_plane.bats'

Signed-off-by: Martin Kalcok <[email protected]>
  • Loading branch information
mkalcok committed Nov 8, 2024
1 parent 6b95718 commit e812936
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
22 changes: 3 additions & 19 deletions tests/test_helper/bats/bgp_data_plane.bats
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ function ping_ovn_int_network_over_bgp_router() {
local guest_lrp_cidr="$guest_lrp_ip/24"
local guest_vm_ip="192.168.10.10"
local guest_vm_cidr="$guest_vm_ip/24"
local guest_vm_mac="02:00:aa:00:00:01"
local guest_vm_lsp="lsp-guest-vm"
local guest_vm_iface="guest-vm"
local guest_vm_ns="ns-guest"

Expand All @@ -78,24 +76,9 @@ function ping_ovn_int_network_over_bgp_router() {
lsp-set-addresses $guest_lsp_to_lr router \
"

echo "# ($TEST_CONTAINER) Create LSP '$guest_vm_lsp' ($guest_vm_cidr)"
lxc_exec "$TEST_CONTAINER" \
"microovn.ovn-nbctl \
-- \
lsp-add $guest_ls $guest_vm_lsp \
-- \
lsp-set-addresses $guest_vm_lsp '$guest_vm_mac $guest_vm_cidr'"

echo "# ($TEST_CONTAINER) Create netns '$guest_vm_ns' and move VM interface '$guest_vm_iface' into it"
echo "# ($TEST_CONTAINER) Create VIF in the OVN's internal network ($guest_vm_ip)"
lxc_exec "$TEST_CONTAINER" "ip netns add $guest_vm_ns"
lxc_exec "$TEST_CONTAINER" \
"microovn.ovs-vsctl \
-- \
add-port br-int $guest_vm_iface \
-- \
set Interface $guest_vm_iface type=internal external_ids:iface-id=$guest_vm_lsp"
netns_ifadd "$TEST_CONTAINER" "$guest_vm_ns" "$guest_vm_iface" "$guest_vm_mac" "$guest_vm_cidr"
wait_until "microovn_lsp_up $TEST_CONTAINER $guest_vm_lsp"
microovn_add_vif "$TEST_CONTAINER" "$guest_vm_ns" "$guest_vm_iface" "$guest_ls" "$guest_vm_cidr"

echo "# ($TEST_CONTAINER) Set VM's default route via $guest_lrp_ip"
lxc_exec "$TEST_CONTAINER" "ip netns exec $guest_vm_ns ip route add default via $guest_lrp_ip"
Expand Down Expand Up @@ -132,6 +115,7 @@ function ping_ovn_int_network_over_bgp_router() {
# Wait for the route to propagate to BGP peer
wait_until "container_has_ipv4_route $BGP_PEER $nat_ext_ip $BGP_CONTAINER_INT_IFACE"

# Check that external host can reach NAT address
echo "# ($EXT_HOST) Reach NAT address $nat_ext_ip with ping" >&3
lxc_exec "$EXT_HOST" "ping -W 1 -c 1 $nat_ext_ip"

Expand Down
7 changes: 6 additions & 1 deletion tests/test_helper/bgp_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ function microovn_bgp_established() {
grep -A 2 "Hostname: $neighbor$" <<< "$status" | grep "BGP state = Established"
}


# microovn_bgp_neighbor_address CONTAINER VRF NEIGHBOR
#
# This function logs into CONTAINER and prints the IP address of
# of a BGP NEIGHBOR. The NEIGHBOR parameter is expected to be an interface
# name which is used to set up BGP unnumbered session.
# Since MicroOVN runs BGP daemon in VRF, the VRF name is required as well.
function microovn_bgp_neighbor_address() {
local container=$1; shift
local vrf=$1; shift
Expand Down

0 comments on commit e812936

Please sign in to comment.