fix(facts): read the host name from the gateway's System page
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 25s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m15s
CI / driver (pull_request) Successful in 2m37s
driver / publish (pull_request) Skipped

get_facts read HostName from getBasicInformation, which a VMG4005-B50A
does not send, and fell back to the address the driver connects to:
netOrk kept the gateway named 192.168.1.1. The gateway's own System page
reads host name and domain with GET /cgi-bin/System?oid=snmp, sealed like
a DAL answer; get_facts now reads them there. fqdn is the host name with
its domain. A gateway with no name set reports "", and get_facts raises
when the System page cannot be read.
This commit is contained in:
Christian Manivong committed 2026-11-12 16:42:47 +01:00
1 parent ca67c08736
commit 61a6e4f7ba
5 files changed
+149 -5

No files matched your search

+3 -1
View File
@@ -11,7 +11,6 @@ MOCK_BASIC_INFO = {
"ModelName": "VMG4005-B50A",
"SoftwareVersion": "V5.13(ABKS.1)C0",
"SerialNumber": "S220L12345678",
"HostName": "ZyxelVMG",
"WanIp": "85.2.34.56",
"LanIp": "192.168.1.1",
"MacAddress": "00:1A:2B:3C:4D:5E",
@@ -87,6 +86,8 @@ class TestZyxelVMGDriver:
return MockResponse(MOCK_BASIC_INFO)
if "getRSAPublickKey" in url:
return MockResponse({"RSAPublicKey": MOCK_RSA_KEY})
if "cgi-bin/System?oid=snmp" in url: # tests/test_facts.py
return MockResponse([{"HostName": "ZyxelVMG", "DomainName": "home"}])
if "UserLogout" in url:
return MockResponse({})
return MockResponse({})
@@ -183,6 +184,7 @@ class TestZyxelVMGDriver:
assert facts["serial_number"] == "S220L12345678"
assert facts["os_version"] == "V5.13(ABKS.1)C0"
assert facts["hostname"] == "ZyxelVMG"
assert facts["fqdn"] == "ZyxelVMG.home"
def test_get_wan_status(self):
self._setup_mocked_http()