[lxc-devel] [lxc-ci/master] bin/test-lxd-ovn: Adds test for passing external IP subnet into network

tomponline on Github lxc-bot at linuxcontainers.org
Wed Oct 28 10:47:53 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/20201028/8a72a91c/attachment.bin>
-------------- next part --------------
From 65216a680d6c62671460d2e9de418351a76226f3 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 28 Oct 2020 10:47:04 +0000
Subject: [PATCH] bin/test-lxd-ovn: Adds test for passing external IP subnet
 into network

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

diff --git a/bin/test-lxd-ovn b/bin/test-lxd-ovn
index fb0480e..a2844cd 100755
--- a/bin/test-lxd-ovn
+++ b/bin/test-lxd-ovn
@@ -161,6 +161,26 @@ U1_EXT_IPV4="$(lxc list u1 --project testovn -c4 --format=csv | cut -d' ' -f1)"
 U1_EXT_IPV6="$(lxc list u1 --project testovn -c6 --format=csv | cut -d' ' -f1)"
 ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat | grep "${U1_EXT_IPV4},${U1_EXT_IPV4},dnat_and_snat"
 ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat | grep "${U1_EXT_IPV6},${U1_EXT_IPV6},dnat_and_snat"
+lxc stop -f u1 --project testovn
+
+# Test external IPs routed to OVN NIC.
+lxc network set ovn-virtual-network --project testovn \
+    ipv4.address=auto \
+    ipv6.address=auto \
+    ipv4.nat=true \
+    ipv6.nat=true
+
+! lxc config device set u1 eth0 ipv4.routes.external=198.51.100.0/24 --project testovn || false
+! lxc config device set u1 eth0 ipv6.routes.external=2001:db8:1:2::/64 --project testovn || false
+lxc config device set u1 eth0 ipv4.routes.external=198.51.100.0/26 --project testovn
+lxc config device set u1 eth0 ipv6.routes.external=2001:db8:1:2::/122 --project testovn
+lxc start u1 --project testovn
+ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat
+ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat | grep "198.51.100.0,198.51.100.0,dnat_and_snat"
+ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat | grep "198.51.100.63,198.51.100.63,dnat_and_snat"
+ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat | grep "2001:db8:1:2::,2001:db8:1:2::,dnat_and_snat"
+ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat | grep "2001:db8:1:2::3f,2001:db8:1:2::3f,dnat_and_snat"
+ovn-nbctl --bare --format=csv --column=external_ip,logical_ip,type find nat | wc -l | grep 132
 
 lxc delete -f u1 --project testovn
 lxc network delete ovn-virtual-network --project testovn


More information about the lxc-devel mailing list