[lxc-devel] [lxc-ci/master] bin/test-lxd-ovn: Adds tests for using a physical bridge uplink

tomponline on Github lxc-bot at linuxcontainers.org
Wed Dec 16 16:43:23 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 363 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201216/6fbe2f8d/attachment-0001.bin>
-------------- next part --------------
From 2a082c21078b1646928c5d6b19fdf32ed59e21d9 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 16 Dec 2020 16:42:41 +0000
Subject: [PATCH] bin/test-lxd-ovn: Adds tests for using a physical bridge
 uplink

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 bin/test-lxd-ovn | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/bin/test-lxd-ovn b/bin/test-lxd-ovn
index 2256cac..f1be7fa 100755
--- a/bin/test-lxd-ovn
+++ b/bin/test-lxd-ovn
@@ -385,6 +385,51 @@ lxc delete -f u2 u3
 lxc network delete ovn-virtual-network
 lxc network delete lxdbr0 --project default
 
+# Test physical uplinks using native bridge.
+lxc project switch default
+ip link add dummybr0 type bridge # Create dummy uplink bridge.
+ip address add 192.0.2.1/24 dev dummybr0
+ip address add 2001:db8:1:1::1/64 dev dummybr0
+ip link set dummybr0 up
+lxc network create dummy --type=physical \
+    parent=dummybr0 \
+    ipv4.gateway=192.0.2.1/24 \
+    ipv6.gateway=2001:db8:1:1::1/64 \
+    ipv4.ovn.ranges=192.0.2.10-192.0.2.19
+lxc network create ovn-virtual-network --type=ovn network=dummy
+bridge link show dummybr0 | wc -l | grep 1 # Check we have one port connected to the uplink bridge.
+ovs-vsctl list-br | grep ovn | wc  -l | grep 1 # Check we have one OVS bridge.
+ovnIPv4="$(lxc network get ovn-virtual-network volatile.network.ipv4.address)"
+ovnIPv6="$(lxc network get ovn-virtual-network volatile.network.ipv6.address)"
+ping -c1 -4 "${ovnIPv4}" # Check IPv4 connectivity over dummy bridge to OVN router.
+ping -c1 -6 "${ovnIPv6}" # Check IPv6 connectivity over dummy bridge to OVN router.
+lxc network delete ovn-virtual-network
+lxc network delete dummy
+bridge link show dummybr0 | wc -l | grep 0 # Check the port is removed from the uplink bridge.
+ovs-vsctl list-br | grep ovn | wc  -l | grep 0 # Check the OVS bridge is removed.
+ip link delete dummybr0 # Remove dummy uplink bridge.
+
+# Test physical uplinks using OVS bridge.
+ovs-vsctl add-br dummybr0 # Create dummy uplink bridge.
+ip address add 192.0.2.1/24 dev dummybr0
+ip address add 2001:db8:1:1::1/64 dev dummybr0
+ip link set dummybr0 up
+lxc network create dummy --type=physical \
+    parent=dummybr0 \
+    ipv4.gateway=192.0.2.1/24 \
+    ipv6.gateway=2001:db8:1:1::1/64 \
+    ipv4.ovn.ranges=192.0.2.10-192.0.2.19
+lxc network create ovn-virtual-network --type=ovn network=dummy
+ovs-vsctl list-ports dummybr0 | grep patch-lxd-net | wc -l | grep 1 # Check bridge has an OVN patch port connected.
+ovnIPv4="$(lxc network get ovn-virtual-network volatile.network.ipv4.address)"
+ovnIPv6="$(lxc network get ovn-virtual-network volatile.network.ipv6.address)"
+ping -c1 -4 "${ovnIPv4}" # Check IPv4 connectivity over dummy bridge to OVN router.
+ping -c1 -6 "${ovnIPv6}" # Check IPv6 connectivity over dummy bridge to OVN router.
+lxc network delete ovn-virtual-network
+lxc network delete dummy
+ovs-vsctl list-ports dummybr0 | grep patch-lxd-net | wc -l | grep 0 # Check bridge has no OVN patch port connected.
+ovs-vsctl del-br dummybr0 # Remove dummy uplink bridge.
+
 lxc image delete "${FINGERPRINT}" --project testovn
 lxc image delete "${FINGERPRINT}" --project default
 lxc profile device remove default root --project testovn


More information about the lxc-devel mailing list