Skip to content

Commit

Permalink
tests/network-(bridge-firewall|ovn): add IPv6 CIDR size checks tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Oct 17, 2024
2 parents 83b0e32 + 5668a13 commit ff4477a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/network-bridge-firewall
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ lxc network create lxdbr0 \
ipv4.address=192.0.2.1/24 \
ipv6.address=2001:db8::1/64 \
ipv4.dhcp.ranges=192.0.2.2-192.0.2.199

if hasNeededAPIExtension warnings; then
echo "=> Ensure that IPv6 CIDR size checks in LXD are correct"
# Check that we produce a warning if user sets a prefix larger than /64
lxc network set lxdbr0 ipv6.address=2001:db8::1/48
lxc warning list | grep "IPv6 networks with a prefix larger than 64"
# Check that there is no warning if user sets prefix smaller than /64
lxc network set lxdbr0 ipv6.address=2001:db8::1/65
! lxc warning list | grep "IPv6 networks with a prefix larger than 64" || false
# set a right subnet for the test
lxc network set lxdbr0 ipv6.address=2001:db8::1/64
fi

lxc profile device add default root disk path=/ pool=default

echo "=> Setting up firewall tooling and checking versions"
Expand Down
10 changes: 10 additions & 0 deletions tests/network-ovn
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,22 @@ ovn_basic_tests() {
ipv4.nat=false \
ipv6.nat=false

echo "===> Ensure that IPv6 CIDR size checks in LXD are correct"
# Check that user can set prefix larger than /64
lxc network set ovn-virtual-network ipv6.address=2001:db8:1:2::1/48
# Check that user can't set prefix smaller than /64
! lxc network set ovn-virtual-network ipv6.address=2001:db8:1:2::1/65 || false
# set a right subnet for the test
lxc network set ovn-virtual-network ipv6.address=2001:db8:1:2::1/64

echo "==> Check network external subnet overlap is prevented"
! lxc network create ovn-virtual-network2 --type=ovn --project default network=dummy \
ipv4.address=198.51.100.1/26 \
ipv4.nat=false || false

! lxc network create ovn-virtual-network2 --type=ovn --project default network=dummy \
ipv6.address=2001:db8:1:2::1/122 \
ipv6.dhcp.stateful=true \
ipv6.nat=false || false

# Check uplink dns.nameservers changes are applied to dependent OVN networks.
Expand All @@ -208,6 +217,7 @@ ovn_basic_tests() {
ipv4.address=198.51.100.1/26 \
ipv4.nat=false \
ipv6.address=2001:db8:1:2::1/122 \
ipv6.dhcp.stateful=true \
ipv6.nat=false

lxc network delete ovn-virtual-network2 --project default
Expand Down

0 comments on commit ff4477a

Please sign in to comment.