Add IPv6 and VLAN devices to the web UI and router-setup
The web UI lists physical and VLAN interfaces and takes a VLAN uplink as a device name (enp2s0.1001); it has IPv6 checkboxes for the WAN and each LAN. router-setup asks whether to create VLANs before WAN and LAN are picked, and whether to enable IPv6. --config-only writes the configuration without installing, which the setup test uses for a PPPoE uplink on a VLAN. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
This commit is contained in:
+39
-1
@@ -31,9 +31,32 @@ let
|
||||
|
||||
answers = pkgs.writeText "answers" ''
|
||||
/dev/vda
|
||||
n
|
||||
eth1
|
||||
eth2
|
||||
dhcp
|
||||
n
|
||||
gw
|
||||
192.168.10.1
|
||||
hunter2hunter2
|
||||
hunter2hunter2
|
||||
|
||||
/dev/vda
|
||||
'';
|
||||
|
||||
# PPPoE on VLAN 1001 of the NIC that also serves the LAN, with IPv6.
|
||||
vlanAnswers = pkgs.writeText "vlan-answers" ''
|
||||
/dev/vda
|
||||
y
|
||||
eth1
|
||||
1001
|
||||
n
|
||||
eth1.1001
|
||||
eth1
|
||||
pppoe
|
||||
someone@isp
|
||||
pppoe-secret
|
||||
|
||||
gw
|
||||
192.168.10.1
|
||||
hunter2hunter2
|
||||
@@ -105,7 +128,22 @@ pkgs.testers.runNixOSTest {
|
||||
installer.wait_for_unit("multi-user.target")
|
||||
|
||||
with subtest("router-setup refuses to install without the disk name"):
|
||||
installer.fail("printf '/dev/vda\\neth1\\neth2\\ndhcp\\n\\n\\nhunter2hunter2\\nhunter2hunter2\\n\\nno\\n' | router-setup")
|
||||
installer.fail("printf '/dev/vda\\nn\\neth1\\neth2\\ndhcp\\nn\\n\\n\\nhunter2hunter2\\nhunter2hunter2\\n\\nno\\n' | router-setup")
|
||||
installer.fail("blkid /dev/vda1")
|
||||
|
||||
with subtest("router-setup writes a PPPoE uplink on a VLAN, shared with the LAN, with IPv6"):
|
||||
installer.succeed("router-setup --config-only /tmp/vlan-config < ${vlanAnswers} >&2")
|
||||
s = installer.succeed("cat /tmp/vlan-config/config/settings.json")
|
||||
import json
|
||||
r = json.loads(s)["router"]
|
||||
assert r["wan"]["interface"] == "eth1", s
|
||||
assert r["wan"]["ipv4"]["pppoe"]["vlan"] == 1001, s
|
||||
assert r["wan"]["ipv4"]["pppoe"]["username"] == "someone@isp", s
|
||||
assert r["wan"]["ipv6"] == {"enable": True, "transport": "ppp"}, s
|
||||
assert r["lans"]["lan"]["interface"] == "eth1" and r["lans"]["lan"]["ipv6"] == {"pd": True}, s
|
||||
assert "vlan" not in r["lans"]["lan"], s
|
||||
assert "pppoe-secret" not in s
|
||||
installer.succeed("grep -qx pppoe-secret /tmp/vlan-config/pppoe-password")
|
||||
installer.fail("blkid /dev/vda1")
|
||||
|
||||
with subtest("router-setup builds the answered configuration offline and installs it"):
|
||||
|
||||
Reference in New Issue
Block a user