From bb76575715682594d4d6d73d8b9e87692bdc6841 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 1 Nov 2020 10:46:46 +0100 Subject: openvpn: T2994: remove workarounds for individual ipv4 and ipv6 keys Remove workaround which split (local|remote)_address and also subnet keys into individual keys for the assigned IP address family (4/6). During template rendering check IP version by introducing new ipv4 and ipv6 Jinja2 filters {% if foo | ipv4 %} or {% if bar | ipv6 %} options. --- smoketest/scripts/cli/test_interfaces_openvpn.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/test_interfaces_openvpn.py b/smoketest/scripts/cli/test_interfaces_openvpn.py index 2dbad21cd..9485cb913 100755 --- a/smoketest/scripts/cli/test_interfaces_openvpn.py +++ b/smoketest/scripts/cli/test_interfaces_openvpn.py @@ -382,6 +382,7 @@ class TestInterfacesOpenVPN(unittest.TestCase): with self.assertRaises(ConfigSessionError): self.session.commit() self.session.set(path + ['local-address', '10.0.0.1']) + self.session.set(path + ['local-address', '2001:db8:1::1']) # check validate() - cannot specify more than 1 IPv4 local-address self.session.set(path + ['local-address', '10.0.0.2']) @@ -389,11 +390,18 @@ class TestInterfacesOpenVPN(unittest.TestCase): self.session.commit() self.session.delete(path + ['local-address', '10.0.0.2']) + # check validate() - cannot specify more than 1 IPv6 local-address + self.session.set(path + ['local-address', '2001:db8:1::2']) + with self.assertRaises(ConfigSessionError): + self.session.commit() + self.session.delete(path + ['local-address', '2001:db8:1::2']) + # check validate() - IPv4 "local-address" requires IPv4 "remote-address" # or IPv4 "local-address subnet" with self.assertRaises(ConfigSessionError): self.session.commit() self.session.set(path + ['remote-address', '192.168.0.1']) + self.session.set(path + ['remote-address', '2001:db8:ffff::1']) # check validate() - Cannot specify more than 1 IPv4 "remote-address" self.session.set(path + ['remote-address', '192.168.0.2']) @@ -401,6 +409,12 @@ class TestInterfacesOpenVPN(unittest.TestCase): self.session.commit() self.session.delete(path + ['remote-address', '192.168.0.2']) + # check validate() - Cannot specify more than 1 IPv6 "remote-address" + self.session.set(path + ['remote-address', '2001:db8:ffff::2']) + with self.assertRaises(ConfigSessionError): + self.session.commit() + self.session.delete(path + ['remote-address', '2001:db8:ffff::2']) + # check validate() - Must specify one of "shared-secret-key-file" and "tls" with self.assertRaises(ConfigSessionError): self.session.commit() -- cgit v1.2.3