Commit Graph
8 Commits
Author SHA1 Message Date
Christian Manivong 6fdc3ff2c7 feat(time-sync): read the time servers and zone of config.xml (NetOrk/netork#2363)
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / test (3.13) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Successful in 2m33s
driver / publish (pull_request) Skipped
netOrk aligns every device with one list of time servers and a zone per
site (NetOrk/netork#2360) through napalm-device-types 4.35.0's
TimeSyncMixin. OPNsense keeps both in config.xml, <system><timeservers>
and <system><timezone>, set on the legacy pages services_ntpd.php and
system_general.php. No API controller reads or writes them, on 26.7 and
on master, so get_time_sync() reads them from the configuration download
get_config already uses and asks /api/ntpd/service/status whether ntpd
follows a system peer.

The driver writes neither value: time_sync_writes is empty and
configure_time_sync is None. Restoring an edited config.xml or running
the initial setup wizard would rewrite far more than the clock, on a box
that is often the gateway and its LAN's time server. TIME_SERVERS_MENU
and TIME_ZONE_MENU say where a person sets them, as SSH_SETTINGS_MENU
does for the SSH algorithms.

get_ntp_servers() now returns the same configured list. It read a
"peers" field the status endpoint does not have (it answers with ntpq's
associations as "rows") and so never found a server.
2026-11-11 15:20:29 +01:00
Christian Manivong b50732c63c feat(ssh): say where the SSH algorithm lists are set
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m13s
driver / test (3.13) (pull_request) Successful in 1m13s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 37s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 2m37s
driver / publish (pull_request) Skipped
OPNsense writes sshd_config from config.xml (<system><ssh>), set on the
legacy Administration page; no API controller reads or writes that
section (26.1, 26.7, master). The driver cannot harden the SSH server,
so it declares, as data, the page and the field of each algorithm list:
SSH_SETTINGS_MENU and SSH_SETTINGS_FIELDS, keyed like device-types'
SSH_ALGORITHM_CLASSES. An application tells a person what to set there.

The CARP master check moves to virtual_ips, next to the CARP reader, so
opnsense.py stays under its line ratchet.

Refs NetOrk/netork#1769
2026-11-07 16:39:12 +01:00
Christian Manivong 6ac7a6f6a2 refactor(dhcp): move the Kea subnet lookup into kea_reservations
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m17s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m56s
driver / publish (pull_request) Skipped
create_dhcp_reservation and _kea_subnet_uuid_for each walked the
searchSubnet rows for the one holding an address. Both now call the
pure subnet_containing(), which brings create_dhcp_reservation under
the complexity limit and back below its recorded length after #40;
the quality baseline records the shrunk entries.
2026-11-02 08:51:21 +01:00
Christian Manivong ea0a52717e fix(dhcp): match Kea reservations on address and MAC
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 56s
driver / test (3.12) (pull_request) Successful in 1m16s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m45s
driver / publish (pull_request) Skipped
create_dhcp_reservation and delete_dhcp_reservation_and_lease looked a
reservation up by its address alone. A reservation another MAC held for
the address, made by hand or left from an earlier host, was overwritten
on create and removed on delete, together with that host's lease.

Create now raises instead of taking it over, and delete leaves another
MAC's reservation and lease in place and names that MAC in the new
reservation_other_mac field. The matching lives in kea_reservations, a
module under strict typing.

Closes #26
2026-11-01 21:50:15 +01:00
Christian Manivong 4fc7b2424e fix(dns): raise when the host overrides cannot be read
The Unbound and Dnsmasq override reads logged any error and returned an
empty list. sync_dns_zone took that for "no overrides": it deleted
nothing and added every record again, so a transient API error left
each record twice on the firewall. The reads now raise, which stops the
sync before it writes and lets get_dns_entries callers tell a failed
read from an empty one.

Closes #14
2026-11-01 21:45:12 +01:00
Christian Manivong 0bb59b60a0 refactor: the SNMP agent config step keeps under the complexity ratchet (#36)
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m22s
driver / test (3.13) (pull_request) Successful in 1m18s
driver / lowest (pull_request) Successful in 34s
driver / build (pull_request) Successful in 25s
driver / security (pull_request) Successful in 55s
CI / driver (pull_request) Successful in 55s
driver / publish (pull_request) Skipped
_write_snmp_agent_config came out at complexity 11 and failed the
standard job. The community check and the listen address now live in
their own helpers; the baseline follows the file's new length.
2026-11-01 07:25:49 +01:00
Christian Manivong eaafa540e5 refactor: WireGuard tunnels are read in their own module (#32)
driver / lint (pull_request) Successful in 13s
driver / standard (pull_request) Successful in 14s
driver / test (3.10) (pull_request) Failing after 6s
driver / types (pull_request) Successful in 1m2s
driver / test (3.11) (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 33s
driver / test (3.13) (pull_request) Successful in 59s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Failing after 2m25s
driver / publish (pull_request) Skipped
get_vpn_tunnels() grew past the quality baseline with the key fix. The
WireGuard part is pure parsing of /api/wireguard/service/show, like the
listen ports in listening.py, so it moves to wireguard.py and the driver
calls it. opnsense.py shrinks from 3125 to 3082 lines.
2026-10-27 10:03:30 +01:00
Christian Manivong 6e0e206e06 chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 1m38s
driver / test (3.10) (pull_request) Successful in 1m1s
driver / test (3.11) (pull_request) Successful in 52s
driver / test (3.12) (pull_request) Successful in 49s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 29s
driver / security (pull_request) Successful in 47s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 7m11s
driver / publish (pull_request) Skipped
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; .github/ is gone.
- setuptools>=77 with the SPDX license string, no License classifier,
  Python 3.10-3.13 classifiers, napalm-device-types>=4.21.1, a dev extra
  with floors, links to git.netork.io, LICENSE file, py.typed.
- CHANGELOG.md in Keep-a-Changelog form; README names Python 3.10, the
  Gitea clone URL and the new CI.
- mypy strict for the package; exempt for now (52 errors): ha, listening,
  opnsense, ospf_mixin, ping_mixin, port_forwards, resolver_mixin.
  Recorded in the quality baseline with the long and complex functions,
  the 3100-line opnsense.py and one unannotated public method.
- Coverage floor 79 % (measured 79.20 %).
2026-10-23 08:35:15 +02:00