christianmanivong c587915584
driver / standard (push) Successful in 15s
driver / lint (push) Successful in 13s
driver / types (push) Successful in 58s
driver / test (3.13) (push) Successful in 52s
driver / test (3.12) (push) Successful in 56s
driver / lowest (push) Successful in 29s
driver / build (push) Successful in 30s
driver / security (push) Successful in 59s
CI / driver (push) Successful in 2m8s
driver / publish (push) Skipped
Merge pull request 'feat(time-sync): the box's NTP servers through TimeSyncMixin' (#13) from feature/time-sync-2367 into main
2026-11-11 14:51:42 +00: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.12
NAPALM 4.0
napalm-device-types 4.21.1
fritzconnection 1.13

Installation

pip install napalm-fritzbox

Or from source:

git clone https://git.netork.io/NAPALM/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.

get_system_config()

A snapshot of the box's settings, every field best-effort (a TR-064 service the box does not offer leaves its fields out). Two of them are easy to misread:

  • firmware_version is the version the box offers as an update, empty when it offers none — not the version running, which is get_facts()["os_version"]. firmware_update_available says whether there is one. A box that only answers UserInterface1.GetInfo (not X_AVM-DE_GetInfo) reports firmware_update_available without firmware_version.
  • timezone is the box's time zone name (NewLocalTimeZoneName).

Time sync

get_time_sync() and configure_time_sync() (napalm-device-types' TimeSyncMixin) use TR-064's Time:1 service (AVM: TR-064 Support – Time):

  • ntp_servers are NewNTPServer1 and NewNTPServer2 from GetInfo; an empty slot is no server. configure_time_sync(ntp_servers=[...]) writes them with SetNTPServers: two at most (a longer list is refused before anything is written), a missing second one as an empty slot. Servers the box already has, in that order, are not written again.
  • The zone is not written (time_sync_writes == {"ntp_servers"}): AVM documents the zone fields as not supported. The box reports its zone, if at all, as a POSIX rule (CET-1CEST,M3.5.0,M10.5.0/3), so timezone is None unless it names an IANA zone.
  • synchronized and daemon are None: TR-064 says neither.
  • Whether the box serves time to its home network ("FRITZ!Box als Zeitserver im Heimnetz bereitstellen") is not in TR-064 either, so the driver cannot report it.

Limitations

  • Configuration management methods (load_merge_candidate, commit_config, ...) are not implemented; the only write is the NTP servers (see Time sync).
  • 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

The rules are in STANDARDS.md.

python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest --cov

CI (.gitea/workflows/ci.yml) calls the shared workflow of the NAPALM driver standard: ruff, mypy, the tests on Python 3.12 and 3.13, bandit, pip-audit and a build check.

License

Apache 2.0 — see LICENSE.

S
Description
No description provided
Readme
270 KiB
0 Stars 1 Watchers 0 Forks
2026-10-25 17:59:00 +00:00
Languages
Python 100%