The Fritz!Box takes part in netOrk's time sync (NetOrk/netork#2360) through napalm-device-types' TimeSyncMixin, over TR-064's Time:1 service.
Changes
get_time_sync(): one call, Time1.GetInfo. ntp_servers are NewNTPServer1/NewNTPServer2 in that order; an empty slot is no server. AVM documents the zone fields as "not supported" (TR-064 Support – Time, version 5, 2025-08-07), and the box fills NewLocalTimeZoneName with a POSIX rule (CET-1CEST,M3.5.0,M10.5.0/3) or nothing. So timezone is None unless the box names an IANA zone. synchronized and daemon are None, because TR-064 reports neither.
configure_time_sync(ntp_servers=[...]): Time1.SetNTPServers, with an empty second slot for one server. time_sync_writes is {"ntp_servers"} because TR-064 cannot write the zone. More than two servers are refused in the write step before anything is sent. A list the box already has (case-insensitive, same order) is not written again, so a poll that aligns the box every time does not churn. verify reads it back.
A box without the Time1 service raises FritzServiceError on read.
napalm-device-types>=4.35.0. The README has a Time sync section and the CHANGELOG is updated. The driver has no get_ntp_servers(), so it has nothing to keep consistent with. get_system_config()'s ntp_server/ntp_server2 name the same servers (test).
NetOrk/netork#2371: TR-064 does not say whether the box serves time to its home network ("FRITZ!Box als Zeitserver im Heimnetz bereitstellen"). Time:1 has only GetInfo and SetNTPServers, and no other service carries the setting. The driver therefore reports nothing about it. Inventing an ntpd service or a socket would be a guess.
pytest: 90 passed, coverage 82.6% (floor 81). The new tests/unit/test_time_sync.py fakes the Time:1 service with AVM's documented answers, and SetNTPServers updates what GetInfo reads. It covers one or two servers, empty slots, the POSIX rule as zone, more than two refused, no rewrite, a refused write (UPnP 606) and a box that keeps its old servers (verify fails).
ruff format, ruff check, mypy, napalm-standard check and ratchet, and bandit are clean.
Not run against a box.
## Summary
The Fritz!Box takes part in netOrk's time sync (NetOrk/netork#2360) through napalm-device-types' `TimeSyncMixin`, over TR-064's `Time:1` service.
## Changes
- `get_time_sync()`: one call, `Time1.GetInfo`. `ntp_servers` are `NewNTPServer1`/`NewNTPServer2` in that order; an empty slot is no server. AVM documents the zone fields as "not supported" ([TR-064 Support – Time](https://fritz.support/resources/TR-064_Time.pdf), version 5, 2025-08-07), and the box fills `NewLocalTimeZoneName` with a POSIX rule (`CET-1CEST,M3.5.0,M10.5.0/3`) or nothing. So `timezone` is `None` unless the box names an IANA zone. `synchronized` and `daemon` are `None`, because TR-064 reports neither.
- `configure_time_sync(ntp_servers=[...])`: `Time1.SetNTPServers`, with an empty second slot for one server. `time_sync_writes` is `{"ntp_servers"}` because TR-064 cannot write the zone. More than two servers are refused in the write step before anything is sent. A list the box already has (case-insensitive, same order) is not written again, so a poll that aligns the box every time does not churn. `verify` reads it back.
- A box without the `Time1` service raises `FritzServiceError` on read.
- `napalm-device-types>=4.35.0`. The README has a *Time sync* section and the CHANGELOG is updated. The driver has no `get_ntp_servers()`, so it has nothing to keep consistent with. `get_system_config()`'s `ntp_server`/`ntp_server2` name the same servers (test).
NetOrk/netork#2371: TR-064 does not say whether the box serves time to its home network ("FRITZ!Box als Zeitserver im Heimnetz bereitstellen"). `Time:1` has only `GetInfo` and `SetNTPServers`, and no other service carries the setting. The driver therefore reports nothing about it. Inventing an `ntpd` service or a socket would be a guess.
## Related Issue
Part of NetOrk/netork#2367 (epic NetOrk/netork#2360); see NetOrk/netork#2371
## Testing
- `pytest`: 90 passed, coverage 82.6% (floor 81). The new `tests/unit/test_time_sync.py` fakes the `Time:1` service with AVM's documented answers, and `SetNTPServers` updates what `GetInfo` reads. It covers one or two servers, empty slots, the POSIX rule as zone, more than two refused, no rewrite, a refused write (UPnP 606) and a box that keeps its old servers (verify fails).
- `ruff format`, `ruff check`, `mypy`, `napalm-standard check` and `ratchet`, and `bandit` are clean.
- Not run against a box.
netOrk keeps one list of NTP servers per site and aligns a device that
differs (NetOrk/netork#2360). The Fritz!Box takes part through TR-064's
Time:1 service: GetInfo reads NewNTPServer1/2, SetNTPServers writes
them.
AVM documents Time:1's zone fields as not supported, and the box keeps
its zone as a POSIX rule or nothing, so the zone is read as None unless
the box names an IANA zone, and time_sync_writes is {"ntp_servers"}.
The box has two server slots: a longer list is refused before anything
is written, and a list the box already has is not written again, so a
poll that aligns the box every time does not churn.
TR-064 says neither whether the clock is synchronised nor whether the
box serves time to its LAN (NetOrk/netork#2371); both stay unreported.
Needs napalm-device-types 4.35.0.
Refs NetOrk/netork#2367
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The Fritz!Box takes part in netOrk's time sync (NetOrk/netork#2360) through napalm-device-types'
TimeSyncMixin, over TR-064'sTime:1service.Changes
get_time_sync(): one call,Time1.GetInfo.ntp_serversareNewNTPServer1/NewNTPServer2in that order; an empty slot is no server. AVM documents the zone fields as "not supported" (TR-064 Support – Time, version 5, 2025-08-07), and the box fillsNewLocalTimeZoneNamewith a POSIX rule (CET-1CEST,M3.5.0,M10.5.0/3) or nothing. SotimezoneisNoneunless the box names an IANA zone.synchronizedanddaemonareNone, because TR-064 reports neither.configure_time_sync(ntp_servers=[...]):Time1.SetNTPServers, with an empty second slot for one server.time_sync_writesis{"ntp_servers"}because TR-064 cannot write the zone. More than two servers are refused in the write step before anything is sent. A list the box already has (case-insensitive, same order) is not written again, so a poll that aligns the box every time does not churn.verifyreads it back.Time1service raisesFritzServiceErroron read.napalm-device-types>=4.35.0. The README has a Time sync section and the CHANGELOG is updated. The driver has noget_ntp_servers(), so it has nothing to keep consistent with.get_system_config()'sntp_server/ntp_server2name the same servers (test).NetOrk/netork#2371: TR-064 does not say whether the box serves time to its home network ("FRITZ!Box als Zeitserver im Heimnetz bereitstellen").
Time:1has onlyGetInfoandSetNTPServers, and no other service carries the setting. The driver therefore reports nothing about it. Inventing anntpdservice or a socket would be a guess.Related Issue
Part of NetOrk/netork#2367 (epic NetOrk/netork#2360); see NetOrk/netork#2371
Testing
pytest: 90 passed, coverage 82.6% (floor 81). The newtests/unit/test_time_sync.pyfakes theTime:1service with AVM's documented answers, andSetNTPServersupdates whatGetInforeads. It covers one or two servers, empty slots, the POSIX rule as zone, more than two refused, no rewrite, a refused write (UPnP 606) and a box that keeps its old servers (verify fails).ruff format,ruff check,mypy,napalm-standard checkandratchet, andbanditare clean.