fix(wan): read the uplink from the gateway's status page (#29)

get_wan_status built its answer from WanIp, WanAccessType,
SystemUpTime, MaxUpstream and MaxDownstream in getBasicInformation.
A VMG4005-B50A sends none of them there, so every gateway's uplink
read as down, with no address and no sync rate; get_nat_translations
built inside_global from the same WanIp and reported ":<port>".

Both now read the DAL's cardpage_status. A bridge has no WAN address
of its own, so it is connected when its DSL line is in sync (a
DslChannelInfo entry with Status "Up"); a router is connected when a
WAN interface that is not IP_Bridged is up with an address. The sync
rates are those of the channels in sync, added up for bonded lines;
a channel out of sync keeps its last rates, which are not reported.
A translation without a WAN address goes to 0.0.0.0, and without
enabled port forwards the status page is not read at all.

The tests read the recorded, anonymised status page of a
VMG4005-B50A bridge whose line was not in sync; the in-sync and
router states are derived from it.

Closes #29
This commit is contained in:
Christian Manivong committed 2026-11-12 19:05:48 +01:00
1 parent a47f9c3970
commit 3213dfaaaa
7 files changed
+672 -28

No files matched your search

-7
View File
@@ -188,13 +188,6 @@ class TestZyxelVMGDriver:
assert facts["fqdn"] == "ZyxelVMG.home"
assert facts["uptime"] == 1234567
def test_get_wan_status(self):
self._setup_mocked_http()
status = self.driver.get_wan_status()
assert status["is_connected"] is True
assert status["external_ip"] == "85.2.34.56"
assert status["connection_type"] == "VDSL"
def test_get_port_forwards_empty(self):
self._setup_mocked_http()
self.driver._session.get.side_effect = None