Files
napalm-zyxel/README.md
T
Christian Manivong 3213dfaaaa fix(wan): read the uplink from the gateway's status page (#29)
get_wan_status built its answer from WanIp, WanAccessType,
SystemUpTime, MaxUpstream and MaxDownstream in getBasicInformation.
A VMG4005-B50A sends none of them there, so every gateway's uplink
read as down, with no address and no sync rate; get_nat_translations
built inside_global from the same WanIp and reported ":<port>".

Both now read the DAL's cardpage_status. A bridge has no WAN address
of its own, so it is connected when its DSL line is in sync (a
DslChannelInfo entry with Status "Up"); a router is connected when a
WAN interface that is not IP_Bridged is up with an address. The sync
rates are those of the channels in sync, added up for bonded lines;
a channel out of sync keeps its last rates, which are not reported.
A translation without a WAN address goes to 0.0.0.0, and without
enabled port forwards the status page is not read at all.

The tests read the recorded, anonymised status page of a
VMG4005-B50A bridge whose line was not in sync; the in-sync and
router states are derived from it.

Closes #29
2026-11-12 19:05:48 +01:00

76 lines
2.7 KiB
Markdown

# napalm-zyxel
NAPALM driver for Zyxel VMG series residential gateways (VMG4005-B50A and similar), built on
[napalm-device-types](https://git.netork.io/NAPALM/napalm-device-types)
(`ResidentialGatewayDriver`).
## Tested against
| Model | Firmware |
|---|---|
| not recorded yet | not recorded yet |
## Connection
The gateway's web API (the Zyxel DAL protocol) over HTTP on port 80, or HTTPS on port 443
with `use_tls`. The driver fetches the gateway's RSA public key, sends a fresh AES key
encrypted with it, and logs in with the web interface account; every request and response
after that is AES-encrypted.
```python
from napalm import get_network_driver
driver = get_network_driver("zyxel")
with driver("192.0.2.1", "admin", "secret", optional_args={"use_tls": True}) as device:
print(device.get_facts())
```
| Optional argument | Default | Meaning |
|---|---|---|
| `use_tls` | `False` | HTTPS instead of HTTP |
| `port` | `443` with `use_tls`, else `80` | port of the web interface |
| `verify` | `False` | verify the gateway's TLS certificate |
## Supported
| Getter / action | Source |
|---|---|
| `get_facts` | basic device information |
| `get_interfaces`, `get_interfaces_ip` | basic device information (WAN, LAN, Wi-Fi) |
| `get_arp_table` | derived from the active LAN hosts |
| `get_wan_status` | DAL `cardpage_status`: the DSL line and the WAN interfaces |
| `get_hosts` | DAL `lanhosts`, else the DHCP page |
| `get_port_forwards`, `get_nat_translations` | DAL `nat`, else the status page |
| `get_wireless_clients`, `get_ssids`, `get_radio_status` | DAL, else the wireless page |
| `get_diagnostics` | DAL `DIAGNOSTICS` |
| `is_alive` | the session is open and the web port answers; without a session `False`, no connection |
| `reboot_host` | DAL `REBOOT` |
| `restart_wifi` | DAL `WIFI_RESTART` |
Every DAL answer is read the way the gateway sends it: AES-encrypted, with its data
under `Object`. The Wi-Fi getters read `WIFI_CLIENTS`, `WIFI_SSIDS` and `WIFI_RADIO`,
names that have not been checked against a gateway with Wi-Fi yet; a VMG4005-B50A
has no Wi-Fi.
## Not supported
Configuration changes (`load_merge_candidate` and `load_replace_candidate` raise
`NotImplementedError`), `get_config`, LLDP, BGP, NTP, SNMP, users, routes, MAC address
table, optics, environment, traceroute, VPN tunnels and the CLI.
`ping` returns an error and `SUPPORTS_PING` is `False`: the DAL accepts a `PINGTEST`
request but does not report whether the target answered.
## Development
The rules are in [STANDARDS.md](https://git.netork.io/NAPALM/driver-standard/src/branch/main/STANDARDS.md).
```bash
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest --cov
```
## License
Apache-2.0