feat(time-sync): the switch's NTP servers and zone through TimeSyncMixin
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 56s
driver / test (3.12) (pull_request) Successful in 53s
driver / test (3.13) (pull_request) Successful in 51s
driver / lowest (pull_request) Successful in 25s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 57s
CI / driver (pull_request) Successful in 2m16s
driver / publish (pull_request) Skipped

netOrk aligns every device's NTP servers and time zone with its site's
(NetOrk/netork#2360, #2366). A ProCurve keeps them as configuration
lines: sntp server priority <1-3> (or ntp server lines when 16.x runs
timesync ntp), time timezone <minutes> and time daylight-time-rule.

get_time_sync() reads those lines from show running-config, over REST
through the /cli endpoint, and the zone as None: the switch keeps
minutes and a rule, no name. configure_time_sync() writes the servers
in the protocol the switch runs (SNTP unless it runs NTP, switching
TimeP to sntp unicast), keeping those already in place from the first
on; the zone as minutes and the switch's own US/EU rule, or user-defined
dates for other Sunday rules, from the zone's POSIX rule. What the switch
cannot take is refused before anything is sent: more than 3 SNTP or 8
NTP servers, host names, half an hour of summer time, a change on a
weekday. A change is saved with write memory; values already in place
are not sent again, so the alignment on every poll does not churn.

Over REST the writes need the CLI, so the temporary SSH session
configure_snmp_agent opened is now the _config_cli() context manager
both use. get_ntp_servers() reads through get_time_sync() on every
transport; it and get_ntp_stats() move to time_sync.py with the rest of
the clock, so procurve.py shrinks (1383 -> 1339 lines). The unused
parse_ntp_servers() and ProcurveApiClient.get_ntp_servers() are gone.
This commit is contained in:
Christian Manivong committed 2026-11-11 15:25:06 +01:00
1 parent bb8b3a7182
commit 6bd3372933
11 files changed
+801 -111

No files matched your search

+21
View File
@@ -6,7 +6,28 @@ All notable changes to this driver. The format follows
## [Unreleased]
### Added
- `get_time_sync()` and `configure_time_sync()` through napalm-device-types'
`TimeSyncMixin` (4.35.0, NetOrk/netork#2366). The read takes the switch's time lines
from `show running-config` (over REST through the `/cli` endpoint): the SNTP servers
by priority, or the `ntp server` lines on a switch running `timesync ntp`; the zone
reads as `None`, since the switch keeps minutes and a summer-time rule, not a name.
A write puts the servers in the protocol the switch runs, at most 3 SNTP or 8 NTP
servers, IP addresses only, and turns a switch on TimeP or no protocol to `timesync
sntp` and `sntp unicast`. Servers already in place from the first one on are kept,
the rest replaced. An IANA zone is written as `time timezone <minutes>` and a
`time daylight-time-rule` from its POSIX rule: the US and EU dates as the switch's own
rules, other Sunday rules as `user-defined` dates; a zone the switch cannot keep (half
an hour of summer time, a change on a weekday other than Sunday) is refused before
anything is sent. A change is saved with `write memory`; what the switch already has
is not sent again. Over REST the writes run on a temporary SSH session, as
`configure_snmp_agent` does.
### Changed
- Needs napalm-device-types 4.35.0.
- `get_ntp_servers()` lists the configured servers as `get_time_sync()` reads them, over
every transport. Over SSH it took every IPv4 address in `show ntp associations` (or
`show timesync`), over REST the `ntp/server` resource. `get_ntp_stats()` is unchanged.
- The floor on napalm-device-types is 4.23.0, the first release with what this driver uses.
- `ssl_verify` (`verify_ssl`, `verify`) no longer has any effect: the REST certificate is
verified by its fingerprint instead. Callers that set it to `True` had their login