Skip to main content

napalm-qnap-qts

NAPALM driver for QNAP NAS systems running QTS, over SSH.

QTS is a Linux distribution, so this driver inherits the whole OS surface from napalm-linux — packages, services, users, processes, Docker — and adds QNAP's storage, QPKG and virtualisation layers on top.

Targets QTS 4.x and QTS 5.x.

Status

The class scaffold, discovery fingerprints and version/tool detection are in place. The storage, QPKG and VM parsers are not written yet: they are blocked on capturing real command output from hardware (see Harvesting fixtures). Writing parsers against guessed output is how a driver ends up passing its own tests and failing on a real NAS.

Method Source Status
get_facts getcfg, getsysinfo, /proc/uptime pending harvest
get_interfaces, get_interfaces_ip ip / ifconfig pending harvest
get_disks qcli_storage -d, get_hd_smartinfo pending harvest
get_disk_pools qcli_storage -p, /proc/mdstat pending harvest
get_volumes qcli_storage -v, df pending harvest
get_shares /etc/config/smb.conf, /etc/exports pending harvest
get_storage_services getcfg, ss -lntup pending harvest
get_disk_smart get_hd_smartinfo pending harvest
get_packages QPKG (qpkg.conf / qpkg_cli) pending harvest
get_vms virsh (Virtualization Station) pending harvest
start_vm, stop_vm, reboot_vm virsh pending harvest
set_service_enabled setcfg, /etc/init.d pending harvest
get_device_warnings derived from the above pending harvest
container_engines, open_container_engine Container Station's docker, system dial-stdio ✅
get_services, get_users, get_processes inherited from LinuxDriver ✅
get_health_metrics inherited (UCD-MIB over SNMP) ✅
ping, ping_sweep inherited from LinuxDriver ✅
Snapshots, quotas, replication, QPKG install/remove — out of scope for v1

Requirements

SSH must be enabled on the NAS: Control Panel → Telnet/SSH → Allow SSH connection. The driver connects on port 22 by default; the QTS web UI on 443/8080 is not used.

Install

pip install -e vendor/napalm-device-types/ -e vendor/napalm-linux/ -e vendor/napalm-qnap-qts/

Usage

from napalm_qnap_qts import QnapQtsDriver

driver = QnapQtsDriver("nas.example.lan", "admin", "secret")
driver.open()
print(driver.get_facts())
driver.close()

Recognised optional_args: everything napalm-linux accepts (port, sudo_password, secret, …). Unknown keys are ignored.

Design notes

Inheritance order

class QnapQtsDriver(StorageDriver, LinuxDriver):

StorageDriver precedes LinuxDriver in the MRO, so its NotImplementedError stubs shadow LinuxDriver's working implementations wherever the names collide — get_services, get_packages, install_package. Each collision is resolved with an explicit forwarding method; TestMroForwarding guards that they stay resolved.

NAS services are exposed as get_storage_services(), not get_services(): netOrk's poller reads the former for the storage snapshot and the latter for the OS service list. Same convention as napalm-openmediavault.

Device class

The driver sets DEVICE_CLASS = "storage" explicitly. Without it netOrk's issubclass chain reaches OSDriver before StorageDriver and would file a QNAP under "linux", hiding its Storage tab. VMs and containers stay visible through capability introspection (supports_vms), not through this key — a QNAP running Virtualization Station is a NAS and a hypervisor, and device_class only holds one of those.

Docker

Container Station does not put docker on PATH; it lives under /share/<pool>/.qpkg/container-station/. This driver only says where: _container_engine_binary("docker") returns the path it found, and open_container_engine("docker") from napalm-device-types reaches the Engine API through it. What runs on the engine is netOrk's (NetOrk/netork#765).

Harvesting fixtures

./tools/harvest.sh admin@nas4.example.lan qts4
./tools/harvest.sh admin@nas5.example.lan qts5
./tools/sanitize.py tools/harvest-out/qts5 --extra-host mynas

harvest.sh runs the command set this driver parses over a single SSH session and writes one file per command. sanitize.py replaces serial numbers, MACs, IP addresses and hostnames with stable placeholders — cross-references between files survive, so the fixtures still describe one coherent device.

Read the sanitised output before committing it. The sanitiser catches patterns, not judgement, and fixtures live in git forever. Raw harvest output is gitignored and must never be committed.

Where QTS 4 and QTS 5 differ, keep both fixtures and parametrise the test over the pair, so the version divergence is part of the test matrix rather than a later surprise.

Development

pip install -e ".[dev]"
python -m pytest -q
ruff check .

License

Apache-2.0

Metadata

Release files for napalm-qnap-qts 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for napalm-qnap-qts 0.6.0
File Size Uploaded Provenance Actions
napalm_qnap_qts-0.6.0.tar.gz 16.1 kB Without provenance Details for napalm_qnap_qts-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for napalm-qnap-qts 0.6.0
File Interpreter ABI Platform Actions
napalm_qnap_qts-0.6.0-py3-none-any.whl Python 3 none any Details for napalm_qnap_qts-0.6.0-py3-none-any.whl

Total release size: 28.0 kB

Release files / napalm_qnap_qts-0.6.0.tar.gz

Download URL napalm_qnap_qts-0.6.0.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
418dbf77f4463b918ab9a35e9a3f26a22e4272e1ab8ba366e1c29298d2f17a09
BLAKE2b-256 checksum
How to use checksums
73921c0ea07a02bb57669864e8b786bb265e487bfbc36095a66d3641f2d0b894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / napalm_qnap_qts-0.6.0-py3-none-any.whl

Download URL napalm_qnap_qts-0.6.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dda7a93a78ce3bb62eba688d9761bccc6f0f5346e7f0721298047fa002e7e712
BLAKE2b-256 checksum
How to use checksums
21ed56776f312acac53171baa4eda407b2217f8565ee2b12896cbd89929dcd43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for napalm-qnap-qts 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page