Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing for OVN uplink attached to VLAN #302

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions tests/network-ovn
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,45 @@ ovn_leases_tests() {
lxc network delete lxdbr0
}

ovn_vlan_uplink_tests() {
boltmark marked this conversation as resolved.
Show resolved Hide resolved
echo "==> VLAN uplink"

lxc network create lxdbr0 \
ipv4.address=10.10.10.1/24 ipv4.nat=true \
ipv4.dhcp.ranges=10.10.10.2-10.10.10.199 \

echo "==> Create physical UPLINK network with VLAN config set to 10"
lxc network create UPLINK --type=physical parent=lxdbr0 \
ipv4.ovn.ranges=10.10.10.200-10.10.10.254 \
ipv4.gateway=10.10.10.1/24 \
vlan=10

echo "==> Create OVN network"
lxc network create ovn-virtual-network --type=ovn network=UPLINK
sleep 2

echo "==> Set up containers"
lxc launch "${IMAGE}" c1-ovn -n ovn-virtual-network -s default
lxc launch "${IMAGE}" c1-lxdbr0 -n lxdbr0 -s default --device eth0,vlan=10
sleep 2

lxc exec c1-lxdbr0 -- ip addr add 10.10.10.100/24 dev eth0
lxc exec c1-lxdbr0 -- ip link set dev eth0 up
boltmark marked this conversation as resolved.
Show resolved Hide resolved

echo "==> Ensure OVN network can reach containers on the configured VLAN"
lxc exec c1-ovn -- ping -nc1 -4 -w5 10.10.10.100
boltmark marked this conversation as resolved.
Show resolved Hide resolved

echo "==> Ensure containers on VLAN can reach OVN network"
ovn_address=$(lxc network get ovn-virtual-network volatile.network.ipv4.address)
lxc exec c1-lxdbr0 -- ping -nc1 -4 -w5 "${ovn_address}"

echo "==> Cleanup"
lxc delete -f c1-lxdbr0 c1-ovn
lxc network delete ovn-virtual-network
lxc network delete UPLINK
lxc network delete lxdbr0
}

# Allow for running a specific set of tests.
if [ "$#" -gt 0 ]; then
TEST_CURRENT="ovn_${1}_tests"
Expand All @@ -2163,6 +2202,11 @@ else
else
echo "Skipping ovn_l3only_tests, not supported"
fi
if hasNeededAPIExtension network_ovn_uplink_vlan; then
ovn_vlan_uplink_tests
else
echo "Skipping ovn_vlan_uplink_tests, not supported"
fi
ovn_leases_tests
fi

Expand Down
Loading