Add "nofixedip" option to LAN_IF

This commit is contained in:
Albrecht Lohofener
2024-10-28 21:14:13 +01:00
parent 2b2910eb2b
commit aaab668d70
4 changed files with 32 additions and 11 deletions
+14 -2
View File
@@ -235,8 +235,8 @@ def test_openwrt_booted(docker_services):
@pytest.mark.parametrize("parameter",
[('LAN_IF','veth'),('LAN_IF','ens5'),('LAN_IF',''),('LAN_IF','host')], indirect=True,
ids=['LAN_IF=veth', 'LAN_IF=ens5', 'LAN_IF=""', 'LAN_IF="host"'])
[('LAN_IF','veth'),('LAN_IF','veth,nofixedip'),('LAN_IF','ens5'),('LAN_IF',''),('LAN_IF','host')], indirect=True,
ids=['LAN_IF=veth','LAN_IF=veth,nofixedip', 'LAN_IF=ens5', 'LAN_IF=""', 'LAN_IF="host"'])
def test_openwrt_lan(docker_services, parameter):
wait_for_openwrt_startup(docker_services)
@@ -248,6 +248,18 @@ def test_openwrt_lan(docker_services, parameter):
assert True, 'ping timeout'
return
case 'veth,nofixedip':
# Get all IPv4 addresses
process = subprocess.run(['sh','-c','ip addr show veth-openwrt0 | grep -oP "(?<=inet\s)\d+(\.\d+){3}"'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True)
# No IP address shall be found
assert ('' in process.stdout) == True
return
case '' | 'host':
response = run_openwrt_shell_command("ip", "addr", "add", "192.168.1.15/24", "dev", "br-lan")
assert response['exitcode'] == 0