diff --git a/CHANGELOG.md b/CHANGELOG.md index 51369b2..5c5a22d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). - `get_interfaces()` reports the `wan` speed in Mbit/s as NAPALM defines it: a 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 diff --git a/napalm_fritzbox/fritzbox.py b/napalm_fritzbox/fritzbox.py index 0ee4466..0c54e9c 100644 --- a/napalm_fritzbox/fritzbox.py +++ b/napalm_fritzbox/fritzbox.py @@ -405,7 +405,7 @@ class FritzBoxDriver(ResidentialGatewayDriver): time_info = self._call("Time1", "GetInfo") result["ntp_server"] = time_info.get("NewNTPServer1", "") result["ntp_server2"] = time_info.get("NewNTPServer2", "") - result["timezone"] = time_info.get("NewCurrentLocalTime", "") + result["timezone"] = time_info.get("NewLocalTimeZoneName", "") except _OPTIONAL_SERVICE_ERRORS: pass diff --git a/tests/unit/test_driver.py b/tests/unit/test_driver.py index bccc8dc..dca3d8f 100644 --- a/tests/unit/test_driver.py +++ b/tests/unit/test_driver.py @@ -161,6 +161,8 @@ TIME_INFO = { "NewNTPServer1": "ntp.example.com", "NewNTPServer2": "", "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} @@ -712,6 +714,16 @@ class TestGetSystemConfig: def test_ntp_server(self, driver): 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): del driver.fc.services["WANDSLInterfaceConfig1"] cfg = driver.get_system_config()