chore: adopt the NAPALM driver standard #33
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, master]
|
||||||
|
tags: ["v*"]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
driver:
|
||||||
|
uses: NAPALM/driver-standard/.gitea/workflows/driver.yml@main
|
||||||
|
with:
|
||||||
|
standard-ref: main
|
||||||
|
# Until napalm-device-types 4.22.0 (AptProxyMixin, #53) is on PyPI.
|
||||||
|
pre-install: "git+https://git.netork.io/NAPALM/napalm-device-types.git"
|
||||||
|
secrets:
|
||||||
|
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ["**"]
|
|
||||||
pull_request:
|
|
||||||
branches: ["**"]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.10", "3.11", "3.12"]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
cache: pip
|
|
||||||
|
|
||||||
- name: Install package with dev extras
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
# napalm-device-types lives in git.netork.io/NAPALM, not on PyPI: without this
|
|
||||||
# pip looks there, finds an unrelated 0.1.0 and the job dies before any test.
|
|
||||||
python -m pip install "napalm-device-types @ git+https://git.netork.io/NAPALM/napalm-device-types.git"
|
|
||||||
python -m pip install -e ".[dev]"
|
|
||||||
|
|
||||||
- name: Run unit tests
|
|
||||||
run: |
|
|
||||||
python -m pytest -q --tb=short
|
|
||||||
|
|
||||||
- name: Build wheel and sdist
|
|
||||||
run: |
|
|
||||||
python -m pip install build
|
|
||||||
python -m build
|
|
||||||
|
|
||||||
- name: Upload dist artifacts
|
|
||||||
# v4 refuses to run on Gitea ("not currently supported on GHES").
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: dist-${{ matrix.python-version }}
|
|
||||||
path: dist/*
|
|
||||||
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- The driver follows the NAPALM driver standard
|
||||||
|
(https://git.netork.io/NAPALM/driver-standard): CI on Gitea runs ruff, mypy, the
|
||||||
|
tests on Python 3.10–3.13 and at the lowest declared versions, bandit, pip-audit and
|
||||||
|
a build check, and a release tag publishes to PyPI. The package now ships `py.typed`.
|
||||||
|
**Python 3.9 is no longer supported**; napalm-device-types never ran on it.
|
||||||
|
- Exceptions the driver deliberately ignores (closing the node's SSH session, the
|
||||||
|
`is_alive()` probe) are now logged at debug level.
|
||||||
|
- The project links point at git.netork.io.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- apt's proxy (napalm-device-types' `AptProxyMixin`, NetOrk/netork#1397): `get_package_proxy()`, `get_package_proxy_report()`, `check_package_proxy(url, expect)` and the fix `configure_package_proxy(url)`, as on any Debian host. The node is logged in as root, so the file is written and other proxy lines are commented out over the exec path. Requires napalm-device-types 4.22.0; version 0.7.0.
|
- apt's proxy (napalm-device-types' `AptProxyMixin`, NetOrk/netork#1397): `get_package_proxy()`, `get_package_proxy_report()`, `check_package_proxy(url, expect)` and the fix `configure_package_proxy(url)`, as on any Debian host. The node is logged in as root, so the file is written and other proxy lines are commented out over the exec path. Requires napalm-device-types 4.22.0; version 0.7.0.
|
||||||
- `get_service_packages()` (napalm-device-types' `ServicePackagesMixin`, NetOrk/netork#1236): which installed packages each systemd unit of the node is made of — the one shipping its unit file and the one shipping its `ExecStart` binary. Read-only, over the exec path. Requires napalm-device-types 4.20.0; version 0.6.0.
|
- `get_service_packages()` (napalm-device-types' `ServicePackagesMixin`, NetOrk/netork#1236): which installed packages each systemd unit of the node is made of — the one shipping its unit file and the one shipping its `ExecStart` binary. Read-only, over the exec path. Requires napalm-device-types 4.20.0; version 0.6.0.
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ It supports all three networking domains of Proxmox VE:
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Python ≥ 3.9
|
- Python ≥ 3.10
|
||||||
- NAPALM ≥ 5.0.0
|
- NAPALM ≥ 5.0.0
|
||||||
|
- napalm-device-types ≥ 4.22.0
|
||||||
- proxmoxer ≥ 2.0.0
|
- proxmoxer ≥ 2.0.0
|
||||||
- netaddr ≥ 0.9.0
|
- netaddr ≥ 0.9.0
|
||||||
- requests ≥ 2.31.0
|
- requests ≥ 2.31.0
|
||||||
@@ -27,7 +28,7 @@ pip install napalm-proxmox
|
|||||||
Or directly from source:
|
Or directly from source:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/example/napalm-proxmox.git
|
git clone https://git.netork.io/NAPALM/napalm-proxmox.git
|
||||||
cd napalm-proxmox
|
cd napalm-proxmox
|
||||||
pip install -e .
|
pip install -e .
|
||||||
```
|
```
|
||||||
|
|||||||
Whitespace-only changes.
+44
-18
@@ -1,5 +1,5 @@
|
|||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools>=61", "wheel"]
|
requires = ["setuptools>=77"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
@@ -7,22 +7,20 @@ name = "napalm-proxmox"
|
|||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
description = "NAPALM driver for Proxmox VE (classic Linux networking, SDN, OVS)"
|
description = "NAPALM driver for Proxmox VE (classic Linux networking, SDN, OVS)"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "Apache-2.0" }
|
license = "Apache-2.0"
|
||||||
authors = [{ name = "Christian Manivong" }]
|
authors = [{ name = "Christian Manivong" }]
|
||||||
keywords = ["napalm", "proxmox", "network", "sdn", "ovs", "automation"]
|
keywords = ["napalm", "proxmox", "network", "sdn", "ovs", "automation"]
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 3 - Alpha",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"Intended Audience :: System Administrators",
|
"Intended Audience :: System Administrators",
|
||||||
"License :: OSI Approved :: Apache Software License",
|
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
"Topic :: System :: Networking",
|
"Topic :: System :: Networking",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"napalm>=5.0.0",
|
"napalm>=5.0.0",
|
||||||
"napalm_device_types>=4.22.0",
|
"napalm_device_types>=4.22.0",
|
||||||
@@ -33,22 +31,23 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = ["pytest>=8", "pytest-cov>=5", "mypy>=1.11", "ruff>=0.6"]
|
||||||
"pytest>=7.4",
|
|
||||||
"pytest-cov>=4.1",
|
|
||||||
"pytest-mock>=3.12",
|
|
||||||
"responses>=0.24",
|
|
||||||
"ruff>=0.1",
|
|
||||||
"mypy>=1.7",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.entry-points."napalm.drivers"]
|
[project.entry-points."napalm.drivers"]
|
||||||
proxmox = "napalm_proxmox:ProxmoxDriver"
|
proxmox = "napalm_proxmox:ProxmoxDriver"
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Repository = "https://git.netork.io/NAPALM/napalm-proxmox"
|
||||||
|
Issues = "https://git.netork.io/NAPALM/napalm-proxmox/issues"
|
||||||
|
Changelog = "https://git.netork.io/NAPALM/napalm-proxmox/src/branch/main/CHANGELOG.md"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["."]
|
where = ["."]
|
||||||
include = ["napalm_proxmox*"]
|
include = ["napalm_proxmox*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
napalm_proxmox = ["py.typed"]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 100
|
line-length = 100
|
||||||
target-version = "py310"
|
target-version = "py310"
|
||||||
@@ -60,11 +59,38 @@ select = ["E", "F", "I", "UP", "B"]
|
|||||||
# Recorded device output keeps its lines.
|
# Recorded device output keeps its lines.
|
||||||
"tests/**" = ["E501"]
|
"tests/**" = ["E501"]
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
python_version = "3.10"
|
||||||
|
strict = true
|
||||||
|
# napalm itself is untyped, so every driver subclasses Any.
|
||||||
|
disallow_subclassing_any = false
|
||||||
|
|
||||||
|
[[tool.mypy.overrides]]
|
||||||
|
module = ["napalm.*", "proxmoxer.*", "paramiko.*", "netaddr.*", "yaml.*"]
|
||||||
|
ignore_missing_imports = true
|
||||||
|
|
||||||
|
[[tool.mypy.overrides]]
|
||||||
|
# Not yet under strict mypy (quality baseline); may only shrink.
|
||||||
|
module = [
|
||||||
|
"napalm_proxmox.config_mixin",
|
||||||
|
"napalm_proxmox.driver",
|
||||||
|
"napalm_proxmox.interfaces_mixin",
|
||||||
|
"napalm_proxmox.lldp_mixin",
|
||||||
|
"napalm_proxmox.routing_mixin",
|
||||||
|
"napalm_proxmox.sdn_mixin",
|
||||||
|
"napalm_proxmox.system_mixin",
|
||||||
|
"napalm_proxmox.utils",
|
||||||
|
"napalm_proxmox.vm_contract_mixin",
|
||||||
|
"napalm_proxmox.vm_mixin",
|
||||||
|
"napalm_proxmox.vm_provision_mixin",
|
||||||
|
]
|
||||||
|
ignore_errors = true
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
addopts = "--cov=napalm_proxmox --cov-report=term-missing"
|
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.coverage.run]
|
||||||
python_version = "3.9"
|
source = ["napalm_proxmox"]
|
||||||
warn_return_any = true
|
|
||||||
warn_unused_configs = true
|
[tool.coverage.report]
|
||||||
|
fail_under = 68
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"coverage_floor": 68.0,
|
||||||
|
"function_complexity": {
|
||||||
|
"napalm_proxmox/driver.py::ProxmoxDriver._resolve_node": 13,
|
||||||
|
"napalm_proxmox/driver.py::ProxmoxDriver.get_facts": 16,
|
||||||
|
"napalm_proxmox/interfaces_mixin.py::ProxmoxInterfaceMixin.get_interfaces_counters": 14,
|
||||||
|
"napalm_proxmox/interfaces_mixin.py::ProxmoxInterfaceMixin.get_mac_address_table": 22,
|
||||||
|
"napalm_proxmox/routing_mixin.py::ProxmoxRoutingMixin.get_route_to": 13,
|
||||||
|
"napalm_proxmox/routing_mixin.py::ProxmoxRoutingMixin.ping": 12,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin._find_switch_uplink": 13,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin._get_ovs_bridge_for_port": 13,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin._get_vm_vlan_tags": 11,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin._is_cluster_master": 13,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin.get_network_instances": 13,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin.get_vlans": 16,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin.set_vlan": 13,
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.get_disk_smart": 22,
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.get_packages": 16,
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.get_users": 15,
|
||||||
|
"napalm_proxmox/utils.py::addresses_from_node_network": 15,
|
||||||
|
"napalm_proxmox/vm_contract_mixin.py::parse_vm_config": 16,
|
||||||
|
"napalm_proxmox/vm_mixin.py::ProxmoxVMMixin._get_vm_disk_and_boot": 16,
|
||||||
|
"napalm_proxmox/vm_mixin.py::ProxmoxVMMixin.get_vm_interfaces": 37,
|
||||||
|
"napalm_proxmox/vm_mixin.py::ProxmoxVMMixin.get_vms": 21,
|
||||||
|
"napalm_proxmox/vm_provision_mixin.py::ProxmoxVMProvisionMixin.create_vm_from_cloud_init": 26,
|
||||||
|
"napalm_proxmox/vm_provision_mixin.py::ProxmoxVMProvisionMixin.get_vm_status": 16
|
||||||
|
},
|
||||||
|
"function_lines": {
|
||||||
|
"napalm_proxmox/driver.py::ProxmoxDriver.get_facts": 82,
|
||||||
|
"napalm_proxmox/interfaces_mixin.py::ProxmoxInterfaceMixin.get_mac_address_table": 71,
|
||||||
|
"napalm_proxmox/lldp_mixin.py::ProxmoxLLDPMixin.get_lldp_neighbors_detail": 52,
|
||||||
|
"napalm_proxmox/routing_mixin.py::ProxmoxRoutingMixin.ping": 78,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin._get_vm_vlan_tags": 54,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin.get_vlans": 66,
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin.set_vlan": 70,
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.get_disk_smart": 74,
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.get_packages": 66,
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.get_users": 51,
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.set_hostname": 124,
|
||||||
|
"napalm_proxmox/vm_mixin.py::ProxmoxVMMixin.get_vm_interfaces": 179,
|
||||||
|
"napalm_proxmox/vm_mixin.py::ProxmoxVMMixin.get_vms": 114,
|
||||||
|
"napalm_proxmox/vm_provision_mixin.py::ProxmoxVMProvisionMixin._download_cloud_image": 61,
|
||||||
|
"napalm_proxmox/vm_provision_mixin.py::ProxmoxVMProvisionMixin.create_vm_from_cloud_init": 232,
|
||||||
|
"napalm_proxmox/vm_provision_mixin.py::ProxmoxVMProvisionMixin.destroy_vm": 65,
|
||||||
|
"napalm_proxmox/vm_provision_mixin.py::ProxmoxVMProvisionMixin.get_vm_status": 92
|
||||||
|
},
|
||||||
|
"mypy_relaxed": [
|
||||||
|
"napalm_proxmox.config_mixin",
|
||||||
|
"napalm_proxmox.driver",
|
||||||
|
"napalm_proxmox.interfaces_mixin",
|
||||||
|
"napalm_proxmox.lldp_mixin",
|
||||||
|
"napalm_proxmox.routing_mixin",
|
||||||
|
"napalm_proxmox.sdn_mixin",
|
||||||
|
"napalm_proxmox.system_mixin",
|
||||||
|
"napalm_proxmox.utils",
|
||||||
|
"napalm_proxmox.vm_contract_mixin",
|
||||||
|
"napalm_proxmox.vm_mixin",
|
||||||
|
"napalm_proxmox.vm_provision_mixin"
|
||||||
|
],
|
||||||
|
"python_file_lines": {},
|
||||||
|
"untyped_public": [
|
||||||
|
"napalm_proxmox/sdn_mixin.py::ProxmoxSDNMixin.set_vlan",
|
||||||
|
"napalm_proxmox/system_mixin.py::ProxmoxSystemMixin.get_snmp_config"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user