A GET of the DAL answers sealed ({"content", "iv"}), like a PUT does.
_read_dal_or_page parsed the envelope as it came, so hosts, the ARP
table, port forwards and the Wi-Fi getters found nothing on every
gateway, and since nothing raised the HTML fallback never ran either.
Every DAL GET now goes through one helper that decrypts the answer,
checks for ZCFG_SUCCESS and returns its Object list; the status page
and the System page share the decryption. Hosts are read from
lanhosts and port forwards from nat, the names the gateway's web
interface uses: LAN_HOSTS and NAT_PORTMAP are answered like any
unknown name, with an empty Object. The new parsers live in
napalm_zyxel/parsers.py, under strict mypy.
Tests seal recorded, anonymised answers of a VMG4005-B50A
(V5.17(ABQA.3.1)C0) with a real ZyxelCrypto, so the driver decrypts
them. The Wi-Fi DAL names stay unverified: that gateway has no Wi-Fi.
Closes #25
84 lines
5.3 KiB
Markdown
84 lines
5.3 KiB
Markdown
# Changelog
|
||
|
||
All notable changes to this driver. The format follows
|
||
[Keep a Changelog](https://keepachangelog.com/), versions follow
|
||
[Semantic Versioning](https://semver.org/).
|
||
|
||
## [Unreleased]
|
||
|
||
### Changed
|
||
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
|
||
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
|
||
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
|
||
3.12 venv no longer has.
|
||
|
||
### Fixed
|
||
- `get_hosts()`, `get_arp_table()` and `get_port_forwards()` report what the gateway
|
||
has (#25). They parsed the DAL's answer without decrypting it, found none of their
|
||
keys in the sealed envelope and reported nothing, on every gateway; the Wi-Fi
|
||
getters did the same. Every DAL answer is now decrypted and read from its `Object`.
|
||
Hosts come from `lanhosts` and port forwards from `nat`, the names the gateway's own
|
||
web interface reads them by: the gateway answers the names the driver used
|
||
(`LAN_HOSTS`, `NAT_PORTMAP`) like any name it does not know, with nothing. A host
|
||
the gateway has no name for (`"Unknown"`) has the host name `""`, a host's
|
||
interface type is `LAN` or `WLAN`, only a DHCP host reports the time left on its
|
||
lease, a TCP-and-UDP forward is reported once per protocol, and a forward limited
|
||
to one source address reports it as `remote_host`.
|
||
- `get_facts()` reports the gateway's serial number and uptime (#27). It read them
|
||
from `getBasicInformation`, which a VMG4005-B50A does not send them in, and reported
|
||
`""` and `0`. They now come from `DeviceInfo` in the DAL's `cardpage_status`, the
|
||
answer the interfaces are read from; `get_facts()` reads that answer once for both.
|
||
- `get_facts()` reports the gateway's host name and domain: `hostname` is the name on
|
||
the gateway's System page (`GET /cgi-bin/System?oid=snmp`), `fqdn` that name with its
|
||
domain (`VMG4005-B50A.home`). Both were read from `getBasicInformation`, which a
|
||
VMG4005-B50A does not send them in, so they fell back to the address the driver
|
||
connects to and netOrk kept the device named `192.168.1.1`. A gateway with no name
|
||
set reports `""`; `get_facts()` raises when the System page cannot be read.
|
||
- `is_alive()` returns `False` without touching the network when the driver has no
|
||
open session (never opened, or closed), and with an open session reports whether the
|
||
gateway still answers on its port (#19). It connected to the gateway in every case,
|
||
so each garbage-collected driver (NAPALM's `__del__` asks `is_alive()`) connected
|
||
once more and could stall for up to five seconds.
|
||
- A failed request to the gateway raises instead of reading as empty data (#15). A
|
||
timeout, a refused session or an HTTP error made `get_hosts`, `get_arp_table`,
|
||
`get_port_forwards`, `get_nat_translations`, `get_wireless_clients`, `get_ssids`,
|
||
`get_radio_status` and `get_diagnostics` report a gateway with nothing configured.
|
||
They raise `ConnectionException` when the gateway does not answer or refuses the
|
||
session (HTTP 401/403) and `RuntimeError` naming the request otherwise. A getter
|
||
whose DAL request fails still reads the HTML page, and raises when that fails too.
|
||
`get_facts` no longer reports an empty interface list when the interfaces cannot be
|
||
read, and `reboot_host` / `restart_wifi` raise the same way when the request fails.
|
||
- `get_arp_table()` reports an unknown age as `-1.0` (napalm-device-types'
|
||
`ARP_AGE_UNKNOWN`) instead of `0.0`, which means "confirmed just now": the host
|
||
list says a host is active, not when the gateway last saw it (NetOrk/netork#1327).
|
||
- The HTTP fingerprint no longer counts `gs1920` and `gs2210` as evidence for this
|
||
driver: they are Zyxel switches, and discovery offered this gateway driver for
|
||
them (#4).
|
||
- Discovery tells a DAL gateway from any other Zyxel device (#13). The Zyxel
|
||
enterprise OID, a Zyxel OUI and "zyxel" on the web page fit every Zyxel switch,
|
||
firewall or NAS, and together they were this driver's whole maximum score. Discovery
|
||
now also fetches `/getRSAPublickKey` on ports 80 and 443 (the key exchange the
|
||
driver logs in with, answered without a login), and its `"RSAPublicKey"` answer
|
||
weighs 24. Vendor-wide evidence alone comes to 28 of 52, below "high"; a gateway
|
||
with SNMP scores 52 of 52, one without SNMP 37 of 52.
|
||
- Every HTTP request to the gateway carries the driver's `timeout`. It was set on
|
||
the session, where requests ignores it, so an unresponsive gateway could hang a
|
||
call indefinitely (#3).
|
||
- `ping()` no longer reports every target as alive. The DAL only acknowledges a
|
||
`PINGTEST` request and never says whether the target answered, so `ping()` now
|
||
returns an error and the driver opts out of ping sweeps (`SUPPORTS_PING = False`):
|
||
a LAN scan through this gateway marked every address alive (#2).
|
||
|
||
## [0.3.0] - 2026-10-23
|
||
|
||
The first release on PyPI.
|
||
|
||
### Changed
|
||
- The driver follows the NAPALM driver standard
|
||
(https://git.netork.io/NAPALM/driver-standard): CI on Gitea runs ruff, mypy, the
|
||
tests on Python 3.10–3.13 and at the lowest declared versions, bandit, pip-audit and
|
||
a build check, and a release tag publishes to PyPI. The package now ships `py.typed`,
|
||
a README and a LICENSE file. **Python 3.9 is no longer supported**; napalm-device-types
|
||
never ran on it. It needs napalm-device-types 4.21.1 or later.
|
||
- A failed login keeps the underlying error as the cause of the `ConnectionException`.
|