christianmanivong f81d2cd89f
driver / standard (push) Successful in 18s
driver / lint (push) Failing after 7s
driver / test (3.13) (push) Successful in 1m14s
driver / types (push) Successful in 1m25s
driver / test (3.12) (push) Successful in 1m22s
driver / lowest (push) Failing after 5s
driver / build (push) Successful in 41s
driver / security (push) Successful in 1m23s
CI / driver (push) Failing after 3m8s
driver / publish (push) Skipped
Merge pull request 'fix(packages): decide install/uninstall success by exit status (#28)' (#29) from fix/bugs-2026-11-02 into main
2026-11-02 08:40:47 +00:00
2026-05-29 09:10:40 +02:00
2026-05-29 09:10:40 +02:00

napalm-openwrt

NAPALM community driver for OpenWrt routers and access-points.

Communicates over SSH using Netmiko (linux device type).
Requires OpenWrt 19.07 or newer.

Tested devices

Model OpenWrt version Tested
TP-Link TL-WR1043N/ND v5 23.05.3 ✅

Contributions for additional devices and firmware versions are welcome.

Requirements

Dependency Minimum version
Python 3.12
NAPALM 4.0
Netmiko 4.0

Installation

From source:

git clone https://git.netork.io/NAPALM/napalm-openwrt
cd napalm-openwrt
pip install -e .

Quick start

from napalm import get_network_driver

driver = get_network_driver("openwrt")
device = driver("192.168.1.1", "root", "")

device.open()

facts = device.get_facts()
print(facts)

interfaces = device.get_interfaces()
print(interfaces)

device.close()

Supported NAPALM getters

Getter Supported Notes
get_facts ✅ Uses /etc/openwrt_release, /tmp/sysinfo/model, /proc/uptime
get_interfaces ✅ Uses ip link show
get_interfaces_ip ✅ Uses ip addr show
get_interfaces_counters ✅ Uses /proc/net/dev
get_arp_table ✅ Uses ip neigh show
get_mac_address_table ✅ Uses bridge fdb show
get_config ✅ Uses uci export
get_environment ✅ CPU from /proc/stat, memory from /proc/meminfo
get_lldp_neighbors ✅ Requires lldpd installed and running; reads only, never starts or configures it
get_lldp_neighbors_detail ✅ Requires lldpd installed and running; reads only, never starts or configures it
get_listening_sockets ✅ busybox netstat -lntup, procd service from the process's cgroup (napalm-device-types ListeningSocketsMixin); over an SSH exec channel

Configuration management

Configuration is managed via UCI (Unified Configuration Interface).

Merge candidate

device.load_merge_candidate(
    config="""
uci set system.@system[0].hostname='my-router'
uci set network.lan.ipaddr='10.0.0.1'
"""
)

print(device.compare_config())
device.commit_config()

Replace candidate

with open("full-config.uci") as f:
    device.load_replace_candidate(config=f.read())

print(device.compare_config())
device.commit_config()

Rollback

# Reverts to the config state before the last commit_config call
device.rollback()

LLDP agent

configure_lldp_agent(interfaces) (napalm-device-types LldpAgentMixin) installs lldpd where it is missing, sets its interface list (lldpd.config.interface in UCI) to the interfaces given, enables it at boot and restarts it. A VLAN device such as br-ap.10 is written as the device under it (br-ap): lldpd sends on the L2 device. Which interfaces is the caller's choice; at least one is required.

Development

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check napalm_openwrt/
S
Description
No description provided
Readme
743 KiB
0 Stars 1 Watchers 0 Forks
2026-11-17 13:00:59 +00:00
Languages
Python 100%