fix(system): report the time zone, not the current time
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 59s
driver / test (3.13) (pull_request) Successful in 6m8s
driver / test (3.12) (pull_request) Successful in 6m19s
driver / lowest (pull_request) Successful in 5m43s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 7m50s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 59s
driver / test (3.13) (pull_request) Successful in 6m8s
driver / test (3.12) (pull_request) Successful in 6m19s
driver / lowest (pull_request) Successful in 5m43s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 7m50s
driver / publish (pull_request) Skipped
Time1.GetInfo's NewCurrentLocalTime is the box's clock, so `timezone` held a timestamp that changed on every poll. NewLocalTimeZoneName is the zone the box is set to. The other half of the issue, firmware_version being the version on offer, stays open: the field is documented and consumed that way. Refs #3
This commit is contained in:
1 parent
3783f74eb8
commit
245c2f030c
3 files changed
+15
-1
No files matched your search
@@ -18,6 +18,8 @@ All notable changes to this driver. The format follows
|
|||||||
list says a host is active, not when the box last saw it (NetOrk/netork#1327).
|
list says a host is active, not when the box last saw it (NetOrk/netork#1327).
|
||||||
- `get_interfaces()` reports the `wan` speed in Mbit/s as NAPALM defines it: a
|
- `get_interfaces()` reports the `wan` speed in Mbit/s as NAPALM defines it: a
|
||||||
250 Mbit/s line was shown as 250000 (#2).
|
250 Mbit/s line was shown as 250000 (#2).
|
||||||
|
- `get_system_config()` reports the box's time zone (`NewLocalTimeZoneName`) as
|
||||||
|
`timezone`; it held the box's current local time (#3).
|
||||||
|
|
||||||
## [0.3.0] - 2026-10-23
|
## [0.3.0] - 2026-10-23
|
||||||
|
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ class FritzBoxDriver(ResidentialGatewayDriver):
|
|||||||
time_info = self._call("Time1", "GetInfo")
|
time_info = self._call("Time1", "GetInfo")
|
||||||
result["ntp_server"] = time_info.get("NewNTPServer1", "")
|
result["ntp_server"] = time_info.get("NewNTPServer1", "")
|
||||||
result["ntp_server2"] = time_info.get("NewNTPServer2", "")
|
result["ntp_server2"] = time_info.get("NewNTPServer2", "")
|
||||||
result["timezone"] = time_info.get("NewCurrentLocalTime", "")
|
result["timezone"] = time_info.get("NewLocalTimeZoneName", "")
|
||||||
except _OPTIONAL_SERVICE_ERRORS:
|
except _OPTIONAL_SERVICE_ERRORS:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,8 @@ TIME_INFO = {
|
|||||||
"NewNTPServer1": "ntp.example.com",
|
"NewNTPServer1": "ntp.example.com",
|
||||||
"NewNTPServer2": "",
|
"NewNTPServer2": "",
|
||||||
"NewCurrentLocalTime": "2026-06-24T16:00:00+02:00",
|
"NewCurrentLocalTime": "2026-06-24T16:00:00+02:00",
|
||||||
|
"NewLocalTimeZone": "+01:00",
|
||||||
|
"NewLocalTimeZoneName": "CET-1CEST,M3.5.0,M10.5.0/3",
|
||||||
}
|
}
|
||||||
|
|
||||||
IPV6_FIREWALL_STATUS = {"NewFirewallEnabled": True, "NewInboundPinholeAllowed": True}
|
IPV6_FIREWALL_STATUS = {"NewFirewallEnabled": True, "NewInboundPinholeAllowed": True}
|
||||||
@@ -712,6 +714,16 @@ class TestGetSystemConfig:
|
|||||||
def test_ntp_server(self, driver):
|
def test_ntp_server(self, driver):
|
||||||
assert driver.get_system_config()["ntp_server"] == "ntp.example.com"
|
assert driver.get_system_config()["ntp_server"] == "ntp.example.com"
|
||||||
|
|
||||||
|
def test_timezone_is_the_zone_name_not_the_clock(self, driver):
|
||||||
|
assert driver.get_system_config()["timezone"] == "CET-1CEST,M3.5.0,M10.5.0/3"
|
||||||
|
|
||||||
|
def test_timezone_empty_when_box_names_none(self, driver):
|
||||||
|
time_info = {k: v for k, v in TIME_INFO.items() if k != "NewLocalTimeZoneName"}
|
||||||
|
driver.fc.call_action.side_effect = lambda svc, act, **kw: (
|
||||||
|
time_info if (svc, act) == ("Time1", "GetInfo") else _call_action(svc, act, **kw)
|
||||||
|
)
|
||||||
|
assert driver.get_system_config()["timezone"] == ""
|
||||||
|
|
||||||
def test_empty_when_no_dsl_service(self, driver):
|
def test_empty_when_no_dsl_service(self, driver):
|
||||||
del driver.fc.services["WANDSLInterfaceConfig1"]
|
del driver.fc.services["WANDSLInterfaceConfig1"]
|
||||||
cfg = driver.get_system_config()
|
cfg = driver.get_system_config()
|
||||||
|
|||||||
Reference in new issue
Block a user