summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-06-13 15:02:26 +0200
committerGitHub <noreply@github.com>2021-06-13 15:02:26 +0200
commitc8fa393ae661dc9aae7890081a6af57d0dc21cdf (patch)
tree042045b85c6a3c93f3ef27c866ba55784f681e98 /smoketest
parent7065d0c4fe08b094aaf0970dc12a2045f5b80c86 (diff)
parent5ee0fec71da8384f7841d92a1a3ef529a69b5717 (diff)
downloadvyos-1x-c8fa393ae661dc9aae7890081a6af57d0dc21cdf.tar.gz
vyos-1x-c8fa393ae661dc9aae7890081a6af57d0dc21cdf.zip
Merge pull request #878 from sarthurdev/ipsec_dhcp_smoketest
smoketest: ipsec: T1501: Use VLAN in smoketest to avoid lease from QEMU built-in DHCP server
Diffstat (limited to 'smoketest')
-rwxr-xr-xsmoketest/scripts/cli/test_vpn_ipsec.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/smoketest/scripts/cli/test_vpn_ipsec.py b/smoketest/scripts/cli/test_vpn_ipsec.py
index 820762fc2..627d73d5c 100755
--- a/smoketest/scripts/cli/test_vpn_ipsec.py
+++ b/smoketest/scripts/cli/test_vpn_ipsec.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os
import unittest
from base_vyostest_shim import VyOSUnitTestSHIM
@@ -25,6 +26,8 @@ tunnel_path = ['interfaces', 'tunnel']
nhrp_path = ['protocols', 'nhrp']
base_path = ['vpn', 'ipsec']
+dhcp_waiting_file = '/tmp/ipsec_dhcp_waiting'
+
class TestVPNIPsec(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
self.cli_delete(base_path)
@@ -38,7 +41,7 @@ class TestVPNIPsec(VyOSUnitTestSHIM.TestCase):
self.cli_delete(base_path)
# Interface for dhcp-interface
- self.cli_set(ethernet_path + ['eth0', 'address', 'dhcp'])
+ self.cli_set(ethernet_path + ['eth0', 'vif', '100', 'address', 'dhcp']) # Use VLAN to avoid getting IP from qemu dhcp server
# Set IKE/ESP Groups
self.cli_set(base_path + ["esp-group", "MyESPGroup", "proposal", "1", "encryption", "aes128"])
@@ -48,19 +51,21 @@ class TestVPNIPsec(VyOSUnitTestSHIM.TestCase):
self.cli_set(base_path + ["ike-group", "MyIKEGroup", "proposal", "1", "hash", "sha1"])
# Site to site
- self.cli_set(base_path + ["ipsec-interfaces", "interface", "eth0"])
+ self.cli_set(base_path + ["ipsec-interfaces", "interface", "eth0.100"])
self.cli_set(base_path + ["site-to-site", "peer", "203.0.113.45", "authentication", "mode", "pre-shared-secret"])
self.cli_set(base_path + ["site-to-site", "peer", "203.0.113.45", "authentication", "pre-shared-secret", "MYSECRETKEY"])
self.cli_set(base_path + ["site-to-site", "peer", "203.0.113.45", "ike-group", "MyIKEGroup"])
self.cli_set(base_path + ["site-to-site", "peer", "203.0.113.45", "default-esp-group", "MyESPGroup"])
- self.cli_set(base_path + ["site-to-site", "peer", "203.0.113.45", "dhcp-interface", "eth0"])
+ self.cli_set(base_path + ["site-to-site", "peer", "203.0.113.45", "dhcp-interface", "eth0.100"])
self.cli_set(base_path + ["site-to-site", "peer", "203.0.113.45", "tunnel", "1", "protocol", "gre"])
self.cli_commit()
- ipsec_dhcp_waiting = read_file('/tmp/ipsec_dhcp_waiting')
+ self.assertTrue(os.path.exists(dhcp_waiting_file))
+
+ dhcp_waiting = read_file(dhcp_waiting_file)
+ self.assertIn('eth0.100', dhcp_waiting) # Ensure dhcp-failed interface was added for dhclient hook
- self.assertIn('eth0', ipsec_dhcp_waiting) # Ensure dhcp-failed interface was added for dhclient hook
self.assertTrue(process_named_running('charon')) # Commit should've still succeeded and launched charon
def test_site_to_site(self):