fix: connectivity panel rearrangement. LXD VM for repeatable tests.

This commit is contained in:
slawek committed 2026-11-22 15:59:40 +01:00
1 parent 85a1ffa21f
commit da889b4865
15 files changed
+363 -47

No files matched your search

+2 -1
View File
@@ -34,4 +34,5 @@ def run(lab):
lab.expect('core: web state has router and vpn false', r'"router": false, "vpn": false',
'lm-core', 'cat', '/run/linux-manager/web.json')
lab.expect('core: status web service answers the client', r'^200$',
'lm-core-client', 'curl', '-s', '-o', '/dev/null', '-w', '%{http_code}', 'http://172.31.10.10:7081/status')
'lm-core-client', 'curl', '-s', '-o', '/dev/null', '-w', '%{http_code}',
f'http://{lab.address("lm-core").ip}:7081/status')
+10 -7
View File
@@ -18,6 +18,9 @@ def run(lab):
lab.result('nat: package installed and configured', lab.server('lm-nat', 'nat.json'))
lab.echo_server('lm-nat-target')
ext = re.escape(lab.nic_of('lm-nat', 0) or '')
server = str(lab.address('lm-nat').ip)
target = str(lab.address('lm-nat-target').ip)
from_server = f'^{re.escape(server)}$'
lab.expect('nat: setup succeeded', r'^success$',
'lm-nat', 'systemctl', 'show', '-p', 'Result', '--value', 'linux-manager-setup')
@@ -34,9 +37,9 @@ def run(lab):
lab.result('nat: VPN user has a certificate', user is not None and user.get('certificate') is True)
if lab.wireguard_module('lm-nat-client'):
if lab.wireguard_client('lm-nat-client', 'lm-nat', '172.31.11.10', '10.66.0.2', '172.31.11.20/32'):
lab.expect('nat: WireGuard client reaches the target from the server address', r'^172\.31\.11\.10$',
'lm-nat-client', 'curl', '-s', '--max-time', '10', 'http://172.31.11.20:8080/')
if lab.wireguard_client('lm-nat-client', 'lm-nat', server, '10.66.0.2', f'{target}/32'):
lab.expect('nat: WireGuard client reaches the target from the server address', from_server,
'lm-nat-client', 'curl', '-s', '--max-time', '10', f'http://{target}:8080/')
else:
lab.result('nat: WireGuard client set up', False)
lab.on('lm-nat-client', 'bash', '/usr/bin/wg-quick', 'down', 'wg0')
@@ -46,16 +49,16 @@ def run(lab):
profile = (lab.json_of('lm-nat', 'linux-manager-user', '--json', 'profile', 'alice') or {}).get('profile', '')
lab.push_text(profile, 'lm-nat-client', '/root/alice.ovpn', '0600')
lab.push_text(f'alice\n{lab.admin_password}\n', 'lm-nat-client', '/root/alice.pass', '0600')
lab.on('lm-nat-client', 'sh', '-c', 'echo "172.31.11.10 lm-nat.test" >>/etc/hosts')
lab.on('lm-nat-client', 'sh', '-c', f'echo "{server} lm-nat.test" >>/etc/hosts')
lab.on('lm-nat-client', 'openvpn', '--config', '/root/alice.ovpn', '--auth-user-pass', '/root/alice.pass',
'--route-nopull', '--disable-dco', '--route', '172.31.11.20', '255.255.255.255',
'--route-nopull', '--disable-dco', '--route', target, '255.255.255.255',
'--daemon', '--log', '/root/openvpn.log')
for _ in range(12):
if lab.on('lm-nat-client', 'grep', '-q', 'Initialization Sequence Completed', '/root/openvpn.log').returncode == 0:
break
time.sleep(5)
lab.expect('nat: OpenVPN client reaches the target from the server address', r'^172\.31\.11\.10$',
'lm-nat-client', 'curl', '-s', '--max-time', '10', 'http://172.31.11.20:8080/')
lab.expect('nat: OpenVPN client reaches the target from the server address', from_server,
'lm-nat-client', 'curl', '-s', '--max-time', '10', f'http://{target}:8080/')
lab.on('lm-nat-client', 'pkill', 'openvpn')
lab.configure('lm-nat', 'nat-off.json')