From 8fdf536e77fce004bc39c6eda50b18b1d9704375 Mon Sep 17 00:00:00 2001 From: Gabriel Mougard Date: Fri, 25 Oct 2024 20:58:50 +0200 Subject: [PATCH] tests/network-ovn: Add MicroOVN as a backend for the `network-ovn` test suite Signed-off-by: Gabriel Mougard --- .github/workflows/tests.yml | 1 + tests/network-ovn | 41 ++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f8297712..329ae6b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -97,6 +97,7 @@ jobs: - interception - network-bridge-firewall - network-ovn + - network-ovn "microovn" "22.03/stable" - network-routed - pylxd - snapd diff --git a/tests/network-ovn b/tests/network-ovn index 3d1ae10d..b2f33a63 100755 --- a/tests/network-ovn +++ b/tests/network-ovn @@ -1,25 +1,42 @@ #!/bin/bash set -eux -# Install dependencies -install_deps ovn-host ovn-central bind9-dnsutils jq - # Install LXD install_lxd -# Configure OVN. -ovs-vsctl set open_vswitch . \ - external_ids:ovn-remote=unix:/var/run/ovn/ovnsb_db.sock \ - external_ids:ovn-encap-type=geneve \ - external_ids:ovn-encap-ip=127.0.0.1 - -# Empty controller log so ACL log checks are consistent over repeat runs. -echo "" > /var/log/ovn/ovn-controller.log - # Configure LXD. lxc project switch default lxc storage create default zfs +# If the first parameter is "microovn", we use the MicroOVN snap as a backend for the tests. +if [ "$#" -gt 0 ] && [ "$1" = "microovn" ]; then + if [ -n "$2" ]; then + microovn_channel="$2" + shift 1 + else + microovn_channel="latest/stable" + fi + + snap install microovn --channel="${microovn_channel}" + microovn cluster bootstrap + snap restart microovn + microovnAddr=$(microovn cluster list --format json | jq -r '.[0].address | split(":") | first') + lxc config set network.ovn.northbound_connection ssl:${microovnAddr}:6641 + shift 1 +else + # Install dependencies + install_deps ovn-host ovn-central bind9-dnsutils jq + + # Configure OVN. + ovs-vsctl set open_vswitch . \ + external_ids:ovn-remote=unix:/var/run/ovn/ovnsb_db.sock \ + external_ids:ovn-encap-type=geneve \ + external_ids:ovn-encap-ip=127.0.0.1 + + # Empty controller log so ACL log checks are consistent over repeat runs. + echo "" > /var/log/ovn/ovn-controller.log +fi + # XXX: known DNS resolution on for .lxd domain with 24.04 instances IMAGE="${TEST_IMG:-ubuntu-daily:22.04}"