feat(time-sync): TimeSyncMixin, PosixTimeSyncMixin and the posix_tz helpers
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 19s
driver / types (pull_request) Successful in 57s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m14s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Successful in 2m23s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 19s
driver / types (pull_request) Successful in 57s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m14s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Successful in 2m23s
driver / publish (pull_request) Skipped
netOrk gets one list of NTP servers and a time zone per site and aligns every device that differs (NetOrk/netork#2360). The contract comes first, so the drivers can be built against it at the same time (#2361): TimeSyncMixin declares get_time_sync() -> TimeSyncDict (servers in the device's order, the zone as an IANA name, synchronised, the client) and carries configure_time_sync(ntp_servers=None, timezone=None) as a fix template: None leaves a value alone, the device ends up with exactly the servers given, and a verify step reads it back. time_sync_writes says which of the two values a driver writes; anything else, an unknown zone, a malformed server or an empty list is refused before anything is written. PosixTimeSyncMixin implements it over run_command for Linux-like hosts: one reading as the login user (timedatectl, chrony's configuration and chronyc, timedatectl show-timesync, ntpd and OpenNTPD), the zone through timedatectl set-timezone, chrony's servers in a file of their own with every other source commented out, systemd-timesyncd's in a drop-in that resets NTP= and empties FallbackNTP=. ntpd and OpenNTPD are read only. posix_tz moves here from netOrk, so OpenWrt can write the POSIX rule and a switch the UTC offset and summer-time rule (parse_posix_tz). It reads the tzdata package, now a dependency. Release 4.35.0: the drivers that implement it need it on PyPI.
This commit is contained in:
1 parent
278a707157
commit
073087da69
12 files changed
+2032
-2
No files matched your search
@@ -7,6 +7,33 @@ recorded here; their history is the git log.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [4.35.0] - 2026-11-11
|
||||
|
||||
### Added
|
||||
- `TimeSyncMixin`: a device's time sources and time zone. `get_time_sync()` (declared only)
|
||||
returns `TimeSyncDict` -- the configured NTP servers in the device's order, the zone as an
|
||||
IANA name (None where the device keeps no name), whether the clock is synchronised now,
|
||||
and the client (`chrony`, `systemd-timesyncd`, `ntpd`, `openntpd`; None for the device's
|
||||
own). `configure_time_sync(ntp_servers=None, timezone=None)` is a fix template: None
|
||||
leaves a value alone, the device ends up with exactly the servers given, in order, and a
|
||||
`verify` step reads it back. An unknown zone, a malformed server, an empty list or a value
|
||||
outside the driver's `time_sync_writes` is refused before anything is written.
|
||||
`TIME_SYNC_VALUES` and `check_ntp_servers` are public (NetOrk/netork#2361).
|
||||
- `PosixTimeSyncMixin` implements it over `run_command`: read in one round trip as the login
|
||||
user (`timedatectl`, chrony's configuration and `chronyc -n sources`, `timedatectl
|
||||
show-timesync`, ntpd's and OpenNTPD's configuration); the zone by `timedatectl
|
||||
set-timezone`; chrony's servers in a file of their own (`sources.d`, else a `confdir` or
|
||||
an included file) with every other source commented out, then `chronyc reload sources` or
|
||||
a restart; systemd-timesyncd's in a drop-in that resets `NTP=` and empties `FallbackNTP=`.
|
||||
ntpd and OpenNTPD are read, not written. `parse_time_sync` is public.
|
||||
- `napalm_device_types.posix_tz` (from netOrk): `posix_tz`, `is_iana_zone`, `is_posix_tz` and
|
||||
`UnknownTimezone`, and `parse_posix_tz`, which takes a POSIX rule apart into the UTC
|
||||
offset and the summer-time transitions a switch wants (`PosixTzDict`,
|
||||
`DstTransitionDict`).
|
||||
|
||||
### Changed
|
||||
- Needs `tzdata` (2024.1 or later): the zones' rules come from its TZif files.
|
||||
|
||||
## [4.34.0] - 2026-11-10
|
||||
|
||||
### Added
|
||||
|
||||
Reference in new issue
Block a user