[26-06-02 09:31:09] START switch_dhcp scenario: cases/switch_dhcp.sh header : verify dhcp enable/disable with pool/gateway/dns, lease allocation, and reload persistence topology: sw1 DHCP server 192.67.0.1; | physical output | tcp access tunnel; veth-dhcp <-> ns client ac1 tap bridge topology: # Topology: topology: # - Diagram: topology: # sw1 DHCP server 192.67.0.1 topology: # ^ ^ topology: # | physical output | tcp access tunnel topology: # veth-dhcp <-> ns client ac1 tap bridge topology: # dhclient lease path dhclient lease path topology: # - Docker mgmt network: 172.245.0.0/24 topology: # sw1=172.245.0.241. topology: # - OpenLAN service network "example": 192.67.0.0/24 topology: # sw1=192.67.0.1, DHCP range 192.67.0.100-192.67.0.120. topology: # - In-container DHCP client namespace: topology: # veth-dhcp is added as a physical output, while dnsmasq listens on hi-example. topology: # - Access point DHCP client: topology: # tests-sw-dhcp.ac1 joins the mgmt network, bridges its tunnel to br-access-dhcp, topology: # then uses dhclient on that bridge after access login succeeds. topology: # Validation: topology: # DHCP config starts dnsmasq on the OpenLAN bridge, both a namespace client and an topology: # access point bridge receive leases, and reload preserves DHCP service/configuration. Started switch pause container: tests-sw-dhcp-pause Started switch frr container: tests-sw-dhcp-frr Started switch ipsec container: tests-sw-dhcp-ipsec Started switch container: tests-sw-dhcp [26-06-02 09:31:10][ASSERT#0001][expect] at cases/switch_dhcp.sh:68 fn=setup_sw1 retry=30 cmd="docker logs -f tests-sw-dhcp" expect="Http.Start" 2026/06/02 09:31:10 INFO|root|Http.LoadToken: file:/etc/openlan/switch/token does not exist 2026/06/02 09:31:10 INFO|root|Wait: ... 2026/06/02 09:31:10 INFO|root|TcpServer.Listen: tcp://0.0.0.0:10002 2026/06/02 09:31:10 INFO|root|Http.Start 0.0.0.0:10000 [26-06-02 09:31:11][ASSERT#0001][OK] cost=1.031s [26-06-02 09:31:11][ASSERT#0002][cmd] at cases/switch_dhcp.sh:70 fn=setup_sw1 cmd="docker exec tests-sw-dhcp sh -c cat > /tmp/example-dhcp.yaml < mtu 1500 qdisc noqueue master br-example state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 link/ether 4e:12:d3:21:6d:8b brd ff:ff:ff:ff:ff:ff [26-06-02 09:31:23][ASSERT#0020][OK] cost=0.057s [26-06-02 09:31:23][ASSERT#0021][cmd] at cases/switch_dhcp.sh:99 fn=setup_dhcp_client_ns cmd="docker exec tests-sw-dhcp ip link set veth-client netns dhcp-client" [26-06-02 09:31:23][ASSERT#0021][OK] cost=0.075s [26-06-02 09:31:23][ASSERT#0022][cmd] at cases/switch_dhcp.sh:100 fn=setup_dhcp_client_ns cmd="docker exec tests-sw-dhcp ip netns exec dhcp-client ip link set lo up" [26-06-02 09:31:23][ASSERT#0022][OK] cost=0.068s [26-06-02 09:31:23][ASSERT#0023][cmd] at cases/switch_dhcp.sh:101 fn=setup_dhcp_client_ns cmd="docker exec tests-sw-dhcp ip netns exec dhcp-client ip link set veth-client up" [26-06-02 09:31:23][ASSERT#0023][OK] cost=0.055s [26-06-02 09:31:23][ASSERT#0024][cmd] at cases/switch_dhcp.sh:105 fn=test_dhcp_lease cmd="docker exec tests-sw-dhcp sh -c command -v dhclient >/dev/null" [26-06-02 09:31:23][ASSERT#0024][OK] cost=0.056s [26-06-02 09:31:23][ASSERT#0025][cmd] at cases/switch_dhcp.sh:106 fn=test_dhcp_lease cmd="docker exec tests-sw-dhcp ip netns exec dhcp-client dhclient -4 -1 veth-client" mv: cannot move '/etc/resolv.conf.dhclient-new.687' to '/etc/resolv.conf': Device or resource busy [26-06-02 09:31:41][ASSERT#0025][OK] cost=17.465s [26-06-02 09:31:41][ASSERT#0026][fuzzy] at cases/switch_dhcp.sh:107 fn=test_dhcp_lease retry=10 cmd="docker exec tests-sw-dhcp ip netns exec dhcp-client ip -4 addr show dev veth-client" pattern="192\.67\.0\.(10[0-9]|11[0-9]|120)/24" 9: veth-client@if10: mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netnsid 0 inet 192.67.0.117/24 brd 192.67.0.255 scope global dynamic veth-client valid_lft 43200sec preferred_lft 43200sec [26-06-02 09:31:41][ASSERT#0026][OK] cost=0.068s [26-06-02 09:31:41][ASSERT#0027][match] at cases/switch_dhcp.sh:108 fn=test_dhcp_lease retry=10 cmd="docker exec tests-sw-dhcp cat /var/openlan/dhcp/example.leases" expect="192.67.0." 1780435900 9a:dd:19:43:7b:8c 192.67.0.117 4c650c68b5d8 * [26-06-02 09:31:41][ASSERT#0027][OK] cost=0.062s Started access container: tests-sw-dhcp.ac1 [26-06-02 09:31:41][ASSERT#0028][expect] at cases/switch_dhcp.sh:123 fn=setup_access_client retry=30 cmd="docker logs -f tests-sw-dhcp.ac1" expect="Worker.OnSuccess" 2026/06/02 09:31:41 INFO|root|SocketClientImpl.update: 172.245.0.2:56908 172.245.0.241:10002 2026/06/02 09:31:41 INFO|root|SocketClientImpl.Try: to connected 2026/06/02 09:31:41 INFO|root|SocketClientImpl.negotiate: send request magic=ffff network= 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|Worker.OnSuccess 2026/06/02 09:31:41 INFO|tcp:172.245.0.241:10002|example|SocketWorker.onLogin: success 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|Worker.OnIpAddr: name:example gateway:192.67.0.1 address:169.254.0.0 netmask:255.255.255.0 routes:[] 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|Access.AddAddr: 169.254.0.0/24 via 192.67.0.1 [26-06-02 09:31:42][ASSERT#0028][OK] cost=1.032s [26-06-02 09:31:42][ASSERT#0029][cmd] at cases/switch_dhcp.sh:124 fn=setup_access_client cmd="docker exec tests-sw-dhcp.ac1 sh -c command -v dhclient >/dev/null" [26-06-02 09:31:42][ASSERT#0029][OK] cost=0.050s [26-06-02 09:31:42][ASSERT#0030][expect] at cases/switch_dhcp.sh:125 fn=setup_access_client retry=30 cmd="docker logs -f tests-sw-dhcp.ac1" expect="Access.OnTap" 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|TapWorker.Initialize: addr 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|TapWorker.close 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|TapWorker.open: >>> tap0 <<< 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|Access.OnTap 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|MixAccess.Start linux 2026/06/02 09:31:41 INFO|172.245.0.241:10002|example|TapWorker.Start 2026/06/02 09:31:41 INFO|tcp:172.245.0.241:10002|example|SocketWorker.Start [26-06-02 09:31:43][ASSERT#0030][OK] cost=1.032s [26-06-02 09:31:43][ASSERT#0031][cmd] at cases/switch_dhcp.sh:141 fn=test_access_dhcp_lease cmd="docker exec tests-sw-dhcp.ac1 dhclient -4 -1 tap0" mv: cannot move '/etc/resolv.conf.dhclient-new.46' to '/etc/resolv.conf': Device or resource busy [26-06-02 09:31:52][ASSERT#0031][OK] cost=8.706s [26-06-02 09:31:52][ASSERT#0032][fuzzy] at cases/switch_dhcp.sh:142 fn=test_access_dhcp_lease retry=10 cmd="docker exec tests-sw-dhcp.ac1 ip -4 addr show dev tap0" pattern="192\.67\.0\.(10[0-9]|11[0-9]|120)/24" 6: tap0: mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 inet 169.254.0.0/24 brd 169.254.0.255 scope global tap0 valid_lft forever preferred_lft forever inet 192.67.0.114/24 brd 192.67.0.255 scope global dynamic tap0 valid_lft 43200sec preferred_lft 43200sec [26-06-02 09:31:52][ASSERT#0032][OK] cost=0.058s [26-06-02 09:31:52][ASSERT#0033][match] at cases/switch_dhcp.sh:143 fn=test_access_dhcp_lease retry=10 cmd="docker exec tests-sw-dhcp.ac1 ping -c 3 192.67.0.117" expect="bytes from 192.67.0.117" PING 192.67.0.117 (192.67.0.117) 56(84) bytes of data. 64 bytes from 192.67.0.117: icmp_seq=1 ttl=64 time=0.685 ms 64 bytes from 192.67.0.117: icmp_seq=2 ttl=64 time=1.34 ms 64 bytes from 192.67.0.117: icmp_seq=3 ttl=64 time=0.908 ms --- 192.67.0.117 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2017ms [26-06-02 09:31:54][ASSERT#0033][OK] cost=2.090s [26-06-02 09:31:54][ASSERT#0034][match] at cases/switch_dhcp.sh:144 fn=test_access_dhcp_lease retry=10 cmd="docker exec tests-sw-dhcp cat /var/openlan/dhcp/example.leases" expect="192.67.0." 1780435912 e2:e7:1d:5a:69:d8 192.67.0.114 f26b670535af * 1780435900 9a:dd:19:43:7b:8c 192.67.0.117 4c650c68b5d8 * [26-06-02 09:31:54][ASSERT#0034][OK] cost=0.065s [26-06-02 09:31:54][ASSERT#0035][cmd] at cases/switch_dhcp.sh:148 fn=test_reload_persistence cmd="docker exec tests-sw-dhcp openlan reload --save" Save configuraion ... success # reloading pid:42 .... PID 42 CMD: /usr/bin/openlan-switch -conf:dir /etc/openlan/switch -log:level 20 # max wait 60s... # during 1s, new pid:759 ... PID 759 CMD: /usr/bin/openlan-switch -conf:dir /etc/openlan/switch -log:level 20 [26-06-02 09:31:55][ASSERT#0035][OK] cost=1.080s [26-06-02 09:31:55][ASSERT#0036][match] at cases/switch_dhcp.sh:149 fn=test_reload_persistence retry=20 cmd="docker exec tests-sw-dhcp cat /var/openlan/dhcp/example.conf" expect="dhcp-range=192.67.0.100,192.67.0.120,12h" except-interface=lo bind-interfaces interface=hi-example dhcp-range=192.67.0.100,192.67.0.120,12h dhcp-leasefile=/var/openlan/dhcp/example.leases dhcp-option=3,192.67.0.1 dhcp-option=6,114.114.114.114,8.8.8.8 [26-06-02 09:31:55][ASSERT#0036][OK] cost=0.067s [26-06-02 09:31:55][ASSERT#0037][match] at cases/switch_dhcp.sh:150 fn=test_reload_persistence retry=20 cmd="docker exec tests-sw-dhcp pgrep -f 'dnsmasq.*example.conf'" expect="[0-9]" 884 [26-06-02 09:31:55][ASSERT#0037][OK] cost=0.070s [26-06-02 09:31:55][ASSERT#0038][match] at cases/switch_dhcp.sh:151 fn=test_reload_persistence retry=10 cmd="docker exec tests-sw-dhcp openlan network --name example" expect="dhcp: enable" bridge: address: 192.67.0.1/24 name: br-example dhcp: enable dhcpConfig: dns: - 114.114.114.114 [26-06-02 09:31:55][ASSERT#0038][OK] cost=0.072s [26-06-02 09:31:55][ASSERT#0039][cmd] at cases/switch_dhcp.sh:155 fn=test_dhcp_disable cmd="docker exec tests-sw-dhcp openlan network --name example dhcp disable" [26-06-02 09:31:56][ASSERT#0039][OK] cost=0.164s [26-06-02 09:31:56][ASSERT#0040][unmatch] at cases/switch_dhcp.sh:156 fn=test_dhcp_disable retry=10 cmd="docker exec tests-sw-dhcp pgrep -f 'dnsmasq.*example.conf'" unexpected="[0-9]" Last output: [26-06-02 09:32:06][ASSERT#0040][OK] cost=10.605s [26-06-02 09:32:06][ASSERT#0041][unmatch] at cases/switch_dhcp.sh:157 fn=test_dhcp_disable retry=10 cmd="docker exec tests-sw-dhcp test -f /var/openlan/dhcp/example.conf && cat /var/openlan/dhcp/example.conf" unexpected="dhcp-range=" Last output: [26-06-02 09:32:17][ASSERT#0041][OK] cost=10.613s [26-06-02 09:32:17][ASSERT#0042][match] at cases/switch_dhcp.sh:158 fn=test_dhcp_disable retry=10 cmd="docker exec tests-sw-dhcp openlan network --name example" expect="dhcp: disable" bridge: address: 192.67.0.1/24 name: br-example dhcp: disable dhcpConfig: dns: - 114.114.114.114 [26-06-02 09:32:17][ASSERT#0042][OK] cost=0.068s [26-06-02 09:32:17] END switch_dhcp status=PASS cost=68.690s