Skip to content

Commit

Permalink
tests: Ensure network forward create fails with other OVN volatile IP (
Browse files Browse the repository at this point in the history
…#333)

This PR adds a quick check to ensure that network forward creates fail
when referencing the volatile IP of another OVN network on the same
uplink.
  • Loading branch information
tomponline authored Oct 30, 2024
2 parents 10697f8 + 8292796 commit ebf6d04
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/network-ovn
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,6 @@ ovn_forward_tests() {
! lxc network set ovn-virtual-network2 ipv4.address=192.168.0.1/24 || false
! lxc network set ovn-virtual-network2 ipv6.address=2001:db8:1:3::1/64 || false

echo "==> Check network forwards are removed when network is removed"
[ "$(ovn-nbctl list load_balancer | grep -cF name)" = 4 ]
lxc network delete ovn-virtual-network2
[ "$(ovn-nbctl list load_balancer | grep -cF name)" = 2 ]

echo "==> Create instance connected to ovn-virtual-network"
lxc launch "${IMAGE}" u1 -n ovn-virtual-network -s default
waitInstanceBooted u1
Expand Down Expand Up @@ -858,6 +853,18 @@ EOF
dig a +tcp @192.0.2.1 u2.lxd
dig aaaa +tcp @2001:db8:1:2::1 u2.lxd

echo "==> Check a forward cannot conflict with the volatile IP of other OVN networks on the same uplink"
ip4VolatileIP2=$(lxc network get ovn-virtual-network2 volatile.network.ipv4.address)
ip6VolatileIP2=$(lxc network get ovn-virtual-network2 volatile.network.ipv6.address)
lxc network set lxdbr0 ipv4.routes="${ip4VolatileIP2}/32" ipv6.routes="${ip6VolatileIP2}/128" --project=default
! lxc network forward create ovn-virtual-network "${ip4VolatileIP2}" || false
! lxc network forward create ovn-virtual-network "${ip6VolatileIP2}" || false

echo "==> Check network forwards are removed when network is removed"
[ "$(ovn-nbctl list load_balancer | grep -cF name)" = 6 ]
lxc network delete ovn-virtual-network2
[ "$(ovn-nbctl list load_balancer | grep -cF name)" = 4 ]

echo "==> Clean up"
lxc delete -f u1
lxc delete -f u2
Expand Down

0 comments on commit ebf6d04

Please sign in to comment.