diff options
author | John Estabrook <jestabro@vyos.io> | 2025-04-29 17:06:28 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2025-04-29 21:04:52 -0500 |
commit | 4fb731756e9cc7c5b2589c05f738d24b8e50c18d (patch) | |
tree | e03ae2c4d531dd24b9ff4494d5a61d0126e2fc49 | |
parent | 10dabd1f6523e055a4a77b4820a8e97b5c509c42 (diff) | |
download | vyos-1x-4fb731756e9cc7c5b2589c05f738d24b8e50c18d.tar.gz vyos-1x-4fb731756e9cc7c5b2589c05f738d24b8e50c18d.zip |
https: T7393: add smoketest for https listen-address
-rwxr-xr-x | smoketest/scripts/cli/test_service_https.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index 04c4a2e51..b4fe35d81 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -16,6 +16,7 @@ import unittest import json +import psutil from requests import request from urllib3.exceptions import InsecureRequestWarning @@ -113,6 +114,29 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): # Check for stopped process self.assertFalse(process_named_running(PROCESS_NAME)) + def test_listen_address(self): + test_prefix = ['192.0.2.1/26', '2001:db8:1::ffff/64'] + test_addr = [ i.split('/')[0] for i in test_prefix ] + for i, addr in enumerate(test_prefix): + self.cli_set(['interfaces', 'dummy', f'dum{i}', 'address', addr]) + + key = 'MySuperSecretVyOS' + self.cli_set(base_path + ['api', 'keys', 'id', 'key-01', 'key', key]) + # commit base config first, for testing update of listen-address + self.cli_commit() + + for addr in test_addr: + self.cli_set(base_path + ['listen-address', addr]) + self.cli_commit() + + res = set() + t = psutil.net_connections(kind="tcp") + for c in t: + if c.laddr.port == 443: + res.add(c.laddr.ip) + + self.assertEqual(res, set(test_addr)) + def test_certificate(self): cert_name = 'test_https' dh_name = 'dh-test' |