Commit Graph
88 Commits
Author SHA1 Message Date
Christian Manivong 0f730a4b9d fix(dhcp): raise when the Kea reservation search fails
create_dhcp_reservation searched for an existing reservation so a retry
updates it, but a failed search was logged at debug level and the add
went ahead: a write based on a read that did not happen. Raise a
RuntimeError naming searchReservation before anything is written.

Closes #40
2026-11-02 08:37:06 +01:00
Christian Manivong 901df1b523 fix(dns): raise when the DNS service detection fails
_detect_active_dns caught every error from /api/core/service/search and
returned None, so get_dns_entries() reported a transient API error as an
empty list (no DNS service) and sync_dns_zone() blamed the DNS service.
Let the request error propagate; None only when the list was read and
neither Unbound nor Dnsmasq runs.

Closes #39
2026-11-02 08:35:49 +01:00
christianmanivong 91a17b54a8 Merge pull request 'fix: is_alive port, DNS override read failure, Kea reservation MAC (#15, #14, #26)' (#38) from fix/bugs-2026-11 into main
driver / lint (push) Successful in 13s
driver / test (3.13) (push) Successful in 1m13s
driver / lowest (push) Successful in 47s
driver / build (push) Successful in 32s
driver / security (push) Successful in 1m15s
driver / publish (push) Skipped
driver / standard (push) Successful in 16s
driver / types (push) Successful in 1m3s
driver / test (3.12) (push) Successful in 1m26s
CI / driver (push) Successful in 3m10s
2026-11-01 22:00:10 +00:00
Christian Manivong ea0a52717e fix(dhcp): match Kea reservations on address and MAC
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 / 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 / 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 4e377923db fix(connection): probe the API port from base_url in is_alive
is_alive always opened port 443 on the hostname, so a firewall whose API
is reached through base_url on another port (https://fw:8443) read as
dead. The probe now takes host and port from base_url, falling back to
the scheme's default port.

Closes #15
2026-11-01 21:44:51 +01:00
christianmanivong e2cac52a12 Merge pull request 'fix: the SNMP agent setup sends only what os-net-snmp 26.x knows (#36)' (#37) from fix/snmp-agent-26x into main
driver / lint (push) Successful in 14s
driver / lowest (push) Successful in 51s
driver / test (3.13) (push) Successful in 1m9s
driver / build (push) Successful in 36s
driver / security (push) Successful in 1m19s
driver / publish (push) Skipped
driver / standard (push) Successful in 15s
driver / test (3.12) (push) Failing after 5s
driver / types (push) Successful in 1m10s
CI / driver (push) Failing after 2m30s
2026-11-01 06:29:28 +00:00
Christian Manivong 0bb59b60a0 refactor: the SNMP agent config step keeps under the complexity ratchet (#36)
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 / 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 / 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 8bf76aa346 fix: the SNMP agent setup sends only what os-net-snmp 26.x knows (#36)
driver / test (3.13) (pull_request) Successful in 1m1s
driver / lowest (pull_request) Successful in 31s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Failing after 2m15s
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Failing after 16s
driver / types (pull_request) Successful in 1m9s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / publish (pull_request) Skipped
The configure step posted contact, location, sysobjid and bindip, and
listen in the shape get returns. OPNsense 26.x refuses a field its model
does not have with HTTP 500, so the setup failed on every current box.
It now sends syscontact/syslocation, listen as a string, and contact and
location only when the caller gives them: an empty one would have blanked
the operator's.
2026-10-31 07:17:04 +01:00
christianmanivong c02a745bb3 Merge pull request 'fix: an ARP entry's expiry is no age' (#35) from fix/arp-unknown-age into main
driver / lint (push) Successful in 15s
driver / lowest (push) Successful in 43s
driver / test (3.13) (push) Successful in 1m13s
driver / build (push) Failing after 5s
driver / security (push) Successful in 1m12s
driver / publish (push) Skipped
driver / standard (push) Successful in 17s
driver / types (push) Successful in 1m13s
driver / test (3.12) (push) Successful in 1m34s
CI / driver (push) Failing after 3m15s
2026-10-30 09:11:49 +00:00
Christian Manivong bb0810d693 fix: an ARP entry's expiry is no age
driver / lowest (pull_request) Successful in 37s
driver / test (3.13) (pull_request) Successful in 1m27s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m12s
CI / driver (pull_request) Successful in 3m12s
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m27s
driver / publish (pull_request) Skipped
get_arp_table and get_ipv6_neighbors_table reported expires, the seconds
left until the entry expires: an entry refreshed a second ago looked 20
minutes old. Both now report ARP_AGE_UNKNOWN (-1.0).

NetOrk/netork#1327
2026-10-30 08:37:08 +01:00
christianmanivong 0176656743 Merge pull request 'chore: Python 3.12 is the floor (NAPALM/driver-standard#6)' (#34) from chore/python-312-floor into main
driver / lint (push) Successful in 12s
driver / test (3.13) (push) Successful in 1m0s
driver / lowest (push) Successful in 30s
driver / build (push) Successful in 28s
driver / security (push) Successful in 56s
driver / publish (push) Skipped
driver / standard (push) Successful in 17s
driver / types (push) Successful in 57s
driver / test (3.12) (push) Successful in 1m3s
CI / driver (push) Successful in 2m28s
2026-10-27 11:13:50 +00:00
Christian Manivong b49fd8f56d fix: the floor on napalm is 5.1 (NAPALM/driver-standard#6)
driver / test (3.13) (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Successful in 2m27s
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 54s
driver / test (3.12) (pull_request) Successful in 1m0s
driver / publish (pull_request) Skipped
napalm 5.0 and older import pkg_resources, which a Python 3.12 venv no
longer has, so the lowest job failed on them.
2026-10-27 10:49:30 +01:00
Christian Manivong 72b4806c65 chore: Python 3.12 is the floor (NAPALM/driver-standard#6)
driver / lowest (pull_request) Failing after 38s
driver / test (3.13) (pull_request) Successful in 1m13s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Failing after 2m49s
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 52s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / publish (pull_request) Skipped
netOrk runs every driver in its own containers on Python 3.12, so 3.10
and 3.11 are no longer supported or tested. requires-python, mypy and
ruff move to 3.12, along with what ruff's pyupgrade rules then rewrite.
2026-10-27 10:18:58 +01:00
christianmanivong 9115628abe Merge pull request 'fix: WireGuard peers keep their tunnel key when others come and go (#32)' (#33) from fix/wireguard-stable-keys-32 into main
driver / lint (push) Successful in 16s
driver / test (3.11) (push) Successful in 1m28s
driver / lowest (push) Successful in 40s
driver / test (3.13) (push) Successful in 1m8s
driver / build (push) Successful in 32s
driver / security (push) Successful in 1m11s
driver / publish (push) Skipped
driver / standard (push) Successful in 20s
driver / types (push) Successful in 1m1s
driver / test (3.10) (push) Successful in 1m19s
driver / test (3.12) (push) Successful in 1m18s
CI / driver (push) Successful in 3m31s
2026-10-27 09:06:56 +00:00
Christian Manivong eaafa540e5 refactor: WireGuard tunnels are read in their own module (#32)
driver / test (3.10) (pull_request) Failing after 6s
driver / test (3.11) (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 / lint (pull_request) Successful in 13s
driver / standard (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m5s
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 9f45952605 fix: WireGuard peers keep their tunnel key when others come and go (#32)
driver / test (3.10) (pull_request) Failing after 3s
driver / test (3.11) (pull_request) Failing after 6s
driver / lowest (pull_request) Successful in 59s
driver / test (3.13) (pull_request) Successful in 1m39s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m11s
CI / driver (pull_request) Failing after 3m12s
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Failing after 17s
driver / types (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m42s
driver / publish (pull_request) Skipped
get_vpn_tunnels() keyed WireGuard peers with a running counter over the
peer rows, so a peer added ahead of an existing one renumbered every peer
after it. Whatever a consumer stores per key moved with it: netOrk's site
link and tunnel check ended up on a new, offline peer and alarmed while the
real tunnel was up.

The key is now the interface and the start of the public key, as in
napalm-linux, made URL-safe because the key is a path segment. Two peers
sharing the prefix get the whole key; a row without a public key keeps its
position. IPsec and OpenVPN keys were already stable.

Every WireGuard key changes once; netOrk carries its
per-tunnel metadata across (netork#1654).
2026-10-27 09:20:30 +01:00
christianmanivong 63ce6e78bd Merge pull request 'chore: adopt the NAPALM driver standard' (#31) from chore/driver-standard into main
driver / lint (push) Successful in 16s
driver / test (3.11) (push) Successful in 1m8s
driver / lowest (push) Successful in 41s
driver / test (3.13) (push) Successful in 1m17s
driver / build (push) Successful in 35s
driver / security (push) Successful in 1m9s
driver / publish (push) Successful in 29s
driver / standard (push) Successful in 17s
driver / types (push) Successful in 1m6s
driver / test (3.10) (push) Successful in 1m8s
driver / test (3.12) (push) Successful in 1m10s
CI / driver (push) Successful in 3m47s
v0.5.0
2026-10-23 10:37:38 +00:00
Christian Manivong ae732fd7c8 chore(release): 0.5.0
driver / test (3.10) (pull_request) Successful in 1m50s
driver / test (3.11) (pull_request) Successful in 1m9s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 29s
driver / security (pull_request) Successful in 45s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 7m45s
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 50s
driver / publish (pull_request) Skipped
2026-10-23 10:29:08 +02:00
Christian Manivong 6e0e206e06 chore: adopt the NAPALM driver standard
driver / test (3.10) (pull_request) Successful in 1m1s
driver / test (3.11) (pull_request) Successful in 52s
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 / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 1m38s
driver / test (3.12) (pull_request) Successful in 49s
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
Christian Manivong 8815c4a584 fix: what bandit and the remaining lint rules found
- The module logger and the refresh constants of opnsense.py move below
  the imports (E402).
- Two long result messages are wrapped in parentheses (E501).
- nosec for the two wildcard addresses (B104): one is the address
  sockstat reports for "*", the other a route's gateway compared with
  0.0.0.0. Neither binds a socket; both are false positives.
2026-10-23 08:33:21 +02:00
Christian Manivong 571d9abb5f style: ruff format and the lint rules of the driver standard
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff
cannot fix comes in the next commit.
2026-10-23 08:32:41 +02:00
christianmanivong 692a584fd2 Merge pull request 'fix: get_dhcp_leases raises when no lease source answered (#27)' (#29) from fix/dhcp-leases-raise-when-unread into master
CI / test (3.10) (push) Successful in 59s
CI / test (3.11) (push) Successful in 49s
CI / test (3.12) (push) Successful in 47s
2026-10-20 23:36:59 +00:00
christianmanivong 68dbd5891c Merge pull request 'fix: leave an unchanged Kea reservation and Kea alone' (#28) from fix/kea-skip-unchanged-reservation into master
CI / test (3.10) (push) Successful in 40s
CI / test (3.11) (push) Successful in 36s
CI / test (3.12) (push) Successful in 35s
2026-10-20 23:36:54 +00:00
Christian Manivong 5a6e573300 fix: get_dhcp_leases raises when no lease source answered (#27)
CI / test (3.10) (push) Successful in 32s
CI / test (3.11) (push) Successful in 34s
CI / test (3.12) (push) Successful in 33s
CI / test (3.10) (pull_request) Successful in 32s
CI / test (3.12) (pull_request) Successful in 34s
CI / test (3.11) (pull_request) Successful in 29s
When Kea, ISC DHCP and the ARP fallback all failed, get_dhcp_leases()
returned [], which a caller cannot tell from a server with no leases. It now
raises a RuntimeError naming each failure, and returns [] only when a source
answered with nothing. An empty ARP table after both lease sources failed
counts as unread too, since ARP rows are no lease data.

Closes #27
2026-10-21 01:01:52 +02:00
Christian Manivong 59796b3fa1 fix: leave an unchanged Kea reservation and Kea alone
CI / test (3.10) (push) Successful in 35s
CI / test (3.11) (push) Successful in 32s
CI / test (3.12) (push) Successful in 34s
CI / test (3.10) (pull_request) Successful in 31s
CI / test (3.12) (pull_request) Successful in 34s
CI / test (3.11) (pull_request) Successful in 30s
create_dhcp_reservation rewrote an existing reservation and called
service/reconfigure even when it already held exactly what was asked, e.g.
on a retried provisioning job. reconfigure stops and starts Kea (the Kea
service controller keeps reconfigureForceRestart() = true and configd has no
reload action), which once left a firewall without DHCP. A reservation whose
subnet, MAC (normalised), IP, hostname and description already match is now
left alone.

Refs NetOrk/netork#1187
2026-10-21 01:01:52 +02:00
christianmanivong 6a91f43fc3 Merge pull request 'feat: public methods for the upgrade, Unbound forwards and OSPF (0.4.0)' (#23) from feat/public-contracts-1113 into master
CI / test (3.10) (push) Successful in 31s
CI / test (3.11) (push) Successful in 28s
CI / test (3.12) (push) Successful in 30s
2026-10-18 13:14:03 +00:00
Christian Manivong fc4658f016 feat: public methods for the upgrade, Unbound forwards and OSPF (0.4.0)
CI / test (3.10) (push) Successful in 31s
CI / test (3.11) (push) Successful in 29s
CI / test (3.10) (pull_request) Successful in 31s
CI / test (3.12) (pull_request) Successful in 30s
CI / test (3.12) (push) Successful in 31s
CI / test (3.11) (pull_request) Successful in 28s
netOrk reached these through the private _get/_post (netOrk #1113); they
are napalm-device-types 4.17's contracts now:

- apply_updates passes the packages it is given (it dropped them) and
  get_update_progress reports the upgrade's state and log.
- get_dns_forwards, set_dns_forward (an existing forward of the domain
  is changed, not doubled) and remove_dns_forward, each applied with a
  reconfigure; a refusal is raised.
- get_ospf translates FRR's diagnostics into neutral terms.

Requires napalm-device-types 4.17.0.
2026-10-18 15:07:28 +02:00
christianmanivong 7183da24fb Merge pull request 'feat: drop get_device_warnings; the pending updates are the fact (0.3.0)' (#22) from feat/facts-not-warnings into master
CI / test (3.10) (push) Successful in 31s
CI / test (3.11) (push) Successful in 29s
CI / test (3.12) (push) Successful in 30s
2026-10-17 08:34:57 +00:00
Christian Manivong 5ab33d67f3 feat: drop get_device_warnings; the pending updates are the fact (0.3.0)
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 28s
CI / test (3.12) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.12) (pull_request) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
updates_available came from the cached firmware status with ten package
names; netOrk builds it from get_available_updates with the full list
(netOrk #1111).
2026-10-17 09:38:34 +02:00
christianmanivong 39cc177bf2 Merge pull request 'fix!: the SNMP agent takes the caller's values and opens only to its sources (0.2.0)' (#21) from feat/snmp-agent-template into master
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 31s
CI / test (3.12) (push) Successful in 34s
2026-10-17 06:48:18 +00:00
Christian Manivong c4edfc88e4 fix!: the SNMP agent takes the caller's values and opens only to its sources (0.2.0)
CI / test (3.10) (push) Successful in 38s
CI / test (3.11) (push) Successful in 32s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.12) (pull_request) Successful in 31s
CI / test (3.12) (push) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
fix_snmp enabled os-net-snmp with community "public", contact
netork@localhost and location "Managed by netOrk", and added a
floating pass rule for UDP/161 from any source on every interface: a
firewall managed over WAN answered its SNMP tree to anyone there (#13).

The driver implements napalm-device-types 4.13's configure_snmp_agent
steps instead:
- install: os-net-snmp only when missing (a reinstall resets it);
- configure: community, contact, location and listen address from the
  caller; a DNS name is not a listen address; a refused save fails;
- firewall: one floating pass rule per allowed source, the old
  any-source rule and rules of an earlier run replaced, operators'
  rules untouched; no sources, no change;
- start: restart net-snmp.
The hand-built UDP probe goes; the caller asks the agent itself.

BREAKING CHANGE: run_device_action is removed. Requires
napalm-device-types 4.13.

Closes #13
2026-10-17 08:26:15 +02:00
christianmanivong 9fe6245940 Merge pull request 'fix: name and version from system_information; a CARP address on its MASTER's interface' (#20) from fix/hostname-and-carp-addresses into master
CI / test (3.10) (push) Successful in 32s
CI / test (3.11) (push) Successful in 32s
CI / test (3.12) (push) Successful in 31s
2026-10-16 13:50:03 +00:00
Christian Manivong e3ed0f1bdd fix: name and version from system_information; a CARP address on its MASTER's interface
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 29s
CI / test (3.10) (pull_request) Successful in 30s
CI / test (3.12) (pull_request) Successful in 29s
CI / test (3.12) (push) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
get_facts read hostname and version from /api/core/system/status, which on
OPNsense 26.7 carries neither: every firewall read as nameless and "unknown",
and netOrk kept naming one by its address. /api/diagnostics/system/system_information
has both (name is the FQDN, versions[0] "OPNsense 26.7.7-amd64"). The status
answer still counts where the new one gives nothing.

get_interfaces_ip listed each interface's primary address only, so a CARP address
never showed as the holder's. It now lists an address bound to a VHID on the node
that is MASTER for it, and leaves it off a BACKUP -- as keepalived puts the address
on the master alone. netOrk's VIP badge sits on that interface (netOrk #1121).
2026-10-16 15:37:43 +02:00
christianmanivong 055ec3da71 Merge pull request 'feat: report Kea's HA peers and the firewall's config sync' (#19) from feat/dhcp-ha-config-sync into master
CI / test (3.10) (push) Successful in 37s
CI / test (3.11) (push) Successful in 33s
CI / test (3.12) (push) Successful in 33s
2026-10-16 13:32:24 +00:00
Christian Manivong e334dc0058 feat: report Kea's HA peers and the firewall's config sync
CI / test (3.10) (push) Successful in 32s
CI / test (3.11) (push) Successful in 33s
CI / test (3.10) (pull_request) Successful in 38s
CI / test (3.12) (pull_request) Successful in 38s
CI / test (3.12) (push) Successful in 34s
CI / test (3.11) (pull_request) Successful in 37s
get_dhcp_ha reads kea/dhcpv4/get (the ha section) and
kea/dhcpv4/searchPeer: whether Kea's HA hook is on, this firewall's peer
name -- the % twin when left at its default -- and each peer's name,
role and HA URL. get_config_sync reads core/hasync/get: the address this
firewall pushes its configuration to and the ticked sync items, mapped to
the service names get_services reports; items that are no service stay
under `unmapped`. Both raise when the request fails.

Configuration, not state: Kea's control agent, which knows whether the
pair is in hot standby right now, listens on localhost only.

Needs napalm-device-types 4.11.0 (ConfigSyncMixin). NetOrk/netork#1125.
2026-10-16 15:18:45 +02:00
christianmanivong 5a1aa66db4 Merge pull request 'fix: sync_dns_zone no longer copies an override made by hand' (#18) from fix/hand-made-override-copies into master
CI / test (3.10) (push) Successful in 36s
CI / test (3.11) (push) Successful in 35s
CI / test (3.12) (push) Successful in 33s
2026-10-16 09:55:28 +00:00
Christian Manivong 5b54174cc4 fix: sync_dns_zone no longer copies an override made by hand
CI / test (3.10) (push) Successful in 32s
CI / test (3.11) (push) Successful in 32s
CI / test (3.12) (push) Successful in 40s
CI / test (3.10) (pull_request) Successful in 38s
CI / test (3.12) (pull_request) Successful in 38s
CI / test (3.11) (pull_request) Successful in 35s
The records netOrk sends include what its poll read off the same
firewall, hand-made host overrides among them. sync_dns_zone deletes only
tagged overrides and then added every record again under the tag, so each
hand-made override ended up on the device twice (NetOrk/netork#1123).

An enabled, untagged override with the same name, type and address in the
zone now stands in for its record. A copy made earlier is tagged, so the
next sync deletes it and does not add it again.
2026-10-16 11:48:58 +02:00
christianmanivong 2af99995e9 Merge pull request 'feat: report the firewall's CARP addresses as virtual IPs' (#17) from feat/carp-virtual-ips into master
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 28s
CI / test (3.12) (push) Successful in 31s
2026-10-16 09:21:22 +00:00
Christian Manivong c868d41322 refactor: the CARP state table lives with the driver that speaks CARP
CI / test (3.10) (push) Failing after 15s
CI / test (3.11) (push) Failing after 15s
CI / test (3.10) (pull_request) Successful in 30s
CI / test (3.12) (pull_request) Successful in 29s
CI / test (3.12) (push) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
carp_virtual_ip() and its state table moved here from napalm-device-types
(4.10.1, NAPALM/napalm-device-types#39): under the agreed structure the base
package carries only the shape of the reading, and what a CARP state means is
protocol knowledge. Tests moved along (test_carp_states.py).
2026-10-16 11:11:45 +02:00
Christian Manivong 00172f7a69 feat: report the firewall's CARP addresses as virtual IPs
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 29s
CI / test (3.12) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.12) (pull_request) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
get_virtual_ips() reads every address bound to a CARP VHID -- the CARP
address and IP aliases on its VHID alike -- from
/api/interfaces/overview/export, with this node's CARP state, so the reading
says who holds each address. interfaces/vip_settings would list the same
addresses with each VHID's CARP password; it is not read.

vip_manager and keepalived are Linux mechanisms and are None here. Needs
napalm-device-types 4.10.0 (carp_virtual_ip).

netOrk #1121.
2026-10-16 11:07:08 +02:00
christianmanivong e318c97c20 Merge pull request 'fix: get_config reads the backup as text, not JSON' (#12) from fix/get-config-xml into master
CI / test (3.10) (push) Successful in 37s
CI / test (3.11) (push) Successful in 37s
CI / test (3.12) (push) Successful in 39s
2026-10-11 16:35:58 +00:00
Christian Manivong 852c1d59df fix: get_config reads the backup as text, not JSON
CI / test (3.10) (push) Successful in 36s
CI / test (3.11) (push) Successful in 34s
CI / test (3.12) (push) Successful in 39s
CI / test (3.10) (pull_request) Successful in 32s
CI / test (3.12) (pull_request) Successful in 33s
CI / test (3.11) (pull_request) Successful in 31s
/api/core/backup/download/this answers with config.xml itself, but
get_config went through _get(), which calls .json(). That raised on
every real device, the except swallowed it, and "running" came back
empty. The unit tests replaced _get with a lambda, so they never saw it.

_get_text() returns the body as text. A failed read now raises instead
of returning an empty string, so the caller sees why it failed.

Closes #11
2026-10-11 18:35:44 +02:00
christianmanivong fa88850535 Merge pull request 'feat: report what listens, and which OPNsense service it is' (#10) from feat/listening-sockets into master
CI / test (3.10) (push) Successful in 29s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 29s
2026-10-07 05:24:06 +00:00
Christian Manivong 2fb1226734 feat: report what listens, and which OPNsense service it is
CI / test (3.10) (push) Successful in 40s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 31s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.12) (pull_request) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
get_listening_sockets reads /api/diagnostics/interface/get_socket_statistics:
netstat's sockets with sockstat's user, command and PID, collected by
configd as root, so no SSH is needed. A listening socket is one without a
peer (*:*); "*" is the any-address of the socket's family.

Which service: the socket's unit is a name of the firewall's own service
list, so netOrk can match it to the service. The command (cut to ten
characters by FreeBSD) matches a service name, the start of one, or one
of the daemons whose service is called otherwise (sshd is openssh, the
FRR daemons are frr, kea-ctrl-agent is kea-dhcp). lighttpd is the web UI,
or the captive portal when it runs as www. WireGuard's sockets belong to
the kernel and are told by the listen ports of /api/wireguard/service/show.

The fixture is a real OPNsense 26.7.5 firewall's answer, cut down, with
documentation addresses. For netOrk#673.
2026-10-07 07:20:27 +02:00
christianmanivong 8ce7ea52e7 Merge pull request 'feat: restart the firewall (reboot_host)' (#9) from feat/reboot-host into master
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 34s
CI / test (3.12) (push) Successful in 41s
2026-10-06 11:05:44 +00:00
Christian Manivong a6c1d77791 feat: restart the firewall (reboot_host)
CI / test (3.10) (push) Successful in 36s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 34s
CI / test (3.10) (pull_request) Successful in 33s
CI / test (3.12) (pull_request) Successful in 33s
CI / test (3.11) (pull_request) Successful in 33s
netOrk asks a driver for reboot_host before it offers a restart, and the
OPNsense driver had none, so a firewall could not be restarted from netOrk
(netOrk #637). reboot_host asks the firmware API (POST
/api/core/firmware/reboot); a refusal raises.
2026-10-06 13:05:27 +02:00
christianmanivong b3e89f003c Merge pull request 'feat: read pending updates from the cached firmware status, and run the check on request' (#8) from feat/cached-update-reader into master
CI / test (3.10) (push) Successful in 28s
CI / test (3.11) (push) Successful in 28s
CI / test (3.12) (push) Successful in 29s
2026-10-05 22:20:11 +00:00
Christian Manivong fdda745388 feat: read pending updates from the cached firmware status, and run the check on request
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 29s
CI / test (3.10) (pull_request) Successful in 28s
CI / test (3.12) (pull_request) Successful in 29s
CI / test (3.12) (push) Successful in 30s
CI / test (3.11) (pull_request) Successful in 27s
get_available_updates triggered firmware/check and slept up to 15 s, too
long for a poll, and returned [] when the check had not finished. For netOrk
MVP 5 it now reads the cached GET /api/core/firmware/status:

- [] only when the last check found nothing; it raises when the firewall
  never checked (no last_check) or its connection/repository is not "ok".
- refresh_available_updates(): POST firmware/check, then waits up to 60 s
  for last_check to change.
- get_host_status(): reboot_required from the status' needs_reboot.
2026-10-06 00:20:10 +02:00
christianmanivong 0f172f02c0 Merge pull request 'feat(firewall): report the gateway a filter rule policy-routes to' (#7) from feat/firewall-rule-gateway into master
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 33s
2026-10-05 04:47:55 +00:00