Christian Manivong 13e0073659
CI / test (3.10) (push) Failing after 7s
CI / test (3.11) (push) Failing after 7s
CI / test (3.9) (push) Failing after 13s
CI / test (3.12) (push) Failing after 5m28s
fix: stop deriving NAT translations from IPv6 pinholes
Closes netork#116.

`get_port_forwards` reports IPv4 mappings and IPv6 pinholes together, which is
right — both are inbound rules someone configured. `get_nat_translations` then
iterated all of them, and that is not: a pinhole is a firewall hole, and IPv6
does not do NAT at all.

The entries it produced were nonsense in two ways. They paired an IPv6 host with
the IPv4 WAN address, and `inside_local` came out as "2001:db8::10:22", where
the last colon is a port separator and everything before it is an address that
also contains colons.

The two failing tests were pulling in opposite directions.
`TestGetNatTranslations` was right and the implementation had drifted past it
when pinhole support landed. `TestGetPortForwards::test_returns_all_rules` was
the opposite: it still expected one rule from before pinholes existed, which put
it in direct contradiction with TestIPv6Pinholes further down the same file.
2026-08-21 13:17:37 +07:00
2026-06-13 03:18:28 +02:00
2026-06-13 03:18:28 +02:00
2026-06-13 03:18:28 +02:00
2026-06-13 03:18:28 +02:00

napalm-fritzbox

NAPALM community driver for AVM FritzBox routers (read-only, via TR-064).

Requirements

Dependency Minimum version
Python 3.9
NAPALM 4.0
fritzconnection 1.13

Installation

pip install napalm-fritzbox

Or from source:

git clone https://github.com/napalm-automation-community/napalm-fritzbox
cd napalm-fritzbox
pip install -e .

Quick start

from napalm import get_network_driver

driver = get_network_driver("fritzbox")
with driver(
    "192.168.178.1",
    "user",
    "pass",
    optional_args={"use_tls": True},
) as d:
    print(d.get_facts())
    print(d.get_wan_status())
    print(d.get_hosts())

Example

driver = get_network_driver("fritzbox")
d = driver("fritz.box", "user", "pass")
d.open()

print(d.get_wan_status())
print(d.get_port_forwards())
print(d.get_ssids())
print(d.get_wireless_clients())
d.close()

Optional arguments

Argument Default Description
use_tls True Use HTTPS (port 49443) instead of HTTP (port 49000)
port 49443 / 49000 Override the TR-064 port

FritzBox serves TR-064 over HTTPS with a self-signed certificate; fritzconnection does not verify it, so no separate verify option is needed.

Limitations

  • Read-only: configuration management methods (load_merge_candidate, commit_config, ...) are not implemented.
  • get_nat_translations() is derived from the enabled port-forwarding rules — TR-064 does not expose a live connection-tracking table.
  • get_vpn_tunnels() returns an empty dict — FritzOS does not expose VPN tunnel status via TR-064.
  • channel_width, tx_power and frequency in get_radio_status() are not available via TR-064 and are reported as 0.

Development

pip install -e ".[dev]"
pytest tests/

CI

This project includes a GitHub Actions workflow that:

  • Runs unit tests across Python 3.9–3.12
  • Builds sdist and wheel

See .github/workflows/ci.yml.

License

Apache 2.0 — see LICENSE.

S
Description
No description provided
Readme
111 KiB
Languages
Python 100%