Commit Graph
24 Commits
Author SHA1 Message Date
christianmanivong f9b8a54673 feat(hypervisor): add StorageTargetDict and get_image_storages(), storage param on create_vm_from_cloud_init
Lets callers select which node-available storage pool a new VM's root
disk lands on, instead of always trusting the driver's auto-detected
default.
2026-07-07 22:35:33 +02:00
christianmanivong d9a23e08f2 Merge feature/create-vm-from-image: create_vm_from_cloud_init downloads images directly 2026-07-07 10:38:03 +02:00
christianmanivong 5059df6b25 feat(hypervisor): create_vm_from_cloud_init downloads a cloud image directly
Replaces template-clone semantics (template: str, existing Proxmox template
VMID) with image_url: str — the driver now downloads the cloud image itself
and imports it as the VM's root disk, rather than requiring an admin to have
pre-built a template. Adds image_checksum for optional verification and a
separate download_timeout since image downloads can take much longer than
the rest of provisioning.
2026-07-07 10:25:45 +02:00
christianmanivong a37dc8d632 Merge feature/network-target-vlan-tag: expose fixed VLAN tag for SDN vnets 2026-07-07 10:20:42 +02:00
christianmanivong cb274156a4 feat(models): add fixed_vlan_tag to NetworkTargetDict for SDN vnets 2026-07-07 10:20:36 +02:00
christianmanivong a16ca77156 Merge feature/network-targets: add get_network_targets() interface 2026-07-07 09:09:57 +02:00
christianmanivong fcf72b6dad feat(hypervisor): add get_network_targets() interface for VM NIC provisioning
Returns selectable bridge/vnet targets for a new VM's NIC, distinguishing
real bridges (Linux, OVS) from SDN vnets, and exposing whether a NIC on that
target may additionally carry a vlan_tag (Linux bridge vlan_aware flag, OVS
always, SDN vnet never — the VLAN is already fixed by the vnet's zone/tag).
2026-07-07 09:03:44 +02:00
christianmanivong 2cc93885b4 Reapply "Merge feature/generic-vm-provisioning: generalize create_vm_from_cloud_init interface"
This reverts commit 97cab9754b.
2026-07-07 08:20:55 +02:00
christianmanivong 97cab9754b Revert "Merge feature/generic-vm-provisioning: generalize create_vm_from_cloud_init interface"
This reverts commit 7d18c12579, reversing
changes made to 7f0dd789b0.
2026-07-07 00:53:06 +02:00
christianmanivong 7d18c12579 Merge feature/generic-vm-provisioning: generalize create_vm_from_cloud_init interface 2026-07-07 00:46:30 +02:00
christianmanivong d1f40c5337 feat(hypervisor): generalize create_vm_from_cloud_init interface to support arbitrary NIC configs
- Replace fixed mgmt/capture dual-NIC parameters with generic NICConfigDict list
- Add optional disk_resize_gb parameter for post-clone disk expansion
- Update docstrings to reflect generic NIC approach (primary NIC concept)
- Add NICConfigDict TypedDict supporting access VLAN, trunk VLAN, and DHCP flags
2026-07-06 23:27:40 +02:00
christianmanivongandClaude Haiku 4.5 7f0dd789b0 feat(hypervisor): add VM provisioning interface stubs
Add three new methods to HypervisorDriver:
- create_vm_from_cloud_init(): provision VM from template with dual-NIC config
- destroy_vm(): stop and remove VM with optional disk cleanup
- get_vm_status(): poll runtime status, optionally wait for IP via guest-agent

New TypedDicts VMProvisionResultDict and VMStatusDict in models.py
document the provisioning API contract.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-06 21:45:52 +02:00
christianmanivongandClaude Sonnet 4.6 f51b1a4b6e docs: update AccessPointDriver MRO placement comment
The comment said AccessPointDriver sits BEFORE mixins, which was wrong after
the mixin refactor. NetworkDriver (parent) raises NotImplementedError for
standard NAPALM methods, so AccessPointDriver must come LAST in the MRO to
avoid shadowing mixin implementations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 14:09:31 +02:00
christianmanivongandClaude Sonnet 4.6 cc8bdc7b5e fix: remove get_wireless_clients/get_ssids/get_radio_status from AccessPointDriver
These three methods were defined with `raise NotImplementedError` in
AccessPointDriver. Because AccessPointDriver appears before the mixin
classes in the MRO of concrete drivers (e.g. OpenWrtDriver), this caused
the abstract body to be called instead of the mixin implementation.

Symptoms:
- get_radio_status() → NotImplementedError, silently caught in poll →
  radio_snapshot never updated after the initial snap
- get_ssids() / get_wireless_clients() → same silent failure

Fix: remove the method bodies from AccessPointDriver entirely. Python then
continues the MRO search and finds the correct mixin implementation.

The comment documents the invariant so it is not accidentally re-introduced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 00:11:34 +02:00
christianmanivongandClaude Sonnet 4.6 9e5e6a5d95 feat: ChannelScanEntryDict + get_channel_scan / push_radio_channel interface
Adds ChannelScanEntryDict TypedDict for iw-scan results (bssid, ssid,
frequency, channel, signal_dbm, channel_width, band).

AccessPointDriver gains two new interface methods:
- get_channel_scan(mode) → dict[iface, list[ChannelScanEntryDict]]
  Default returns {} so non-implementing drivers degrade gracefully.
- push_radio_channel(radio, channel) — abstract (raises NotImplementedError).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 23:25:49 +02:00
christianmanivongandClaude Sonnet 4.6 51e677492a feat: OUI_PREFIXES auf DeviceTypeDriver für MAC-basiertes Fingerprinting
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 15:41:45 +02:00
christianmanivongandClaude Sonnet 4.6 0f6734e6da feat: DeviceTypeDriver base class mit FingerprintRule und PortSpec
Neue Zwischenschicht zwischen NetworkDriver und den typ-spezifischen
Basisklassen (FirewallDriver, SwitchDriver, …). Definiert das
Fingerprinting-Interface für den Discovery-Subsystem:

- FingerprintRule (NamedTuple): pattern, weight, mandatory, negative
- PortSpec (NamedTuple): scheme, port, paths, weight, mandatory
- DeviceTypeDriver: VENDOR, DRIVER_NAME, PORT_SPECS, SNMP_OBJECT_ID_PREFIX,
  SNMP_FINGERPRINT, SSH_FINGERPRINT, HTTP_FINGERPRINT

Alle *Driver-Klassen erben jetzt von DeviceTypeDriver statt NetworkDriver.
Transitiv ist NetworkDriver weiterhin in der MRO (keine Breaking Change).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 14:29:41 +02:00
christianmanivongandClaude Sonnet 4.6 95f8771824 feat: add TYPE_LABEL class attribute to all base driver classes
Each abstract base class now carries a TYPE_LABEL: str attribute that
describes the device category in human-readable form:

  AccessPointDriver  → "Access Point"
  FirewallDriver     → "Firewall"
  HypervisorDriver   → "Hypervisor"
  OSDriver           → "OS"
  ResidentialGatewayDriver → "Gateway"
  StorageDriver      → "Storage"
  SwitchDriver       → "Switch"

Concrete drivers can override TYPE_LABEL to express a more specific
category (e.g. LinuxDriver sets "Linux"). The backend reads this
attribute to expose a type_label in the DriverInfo API response,
replacing the hardcoded DRIVER_TYPE map in the frontend.

23 tests covering presence, value, inheritance, and override.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 11:36:41 +02:00
christianmanivongandClaude Sonnet 4.6 be566ebba3 feat: document set_lag_members on SwitchDriver
Adds the abstract set_lag_members() method (with docstring) implemented
by the ProCurve, NetGear and TP-Link Jetstream drivers for managing
LAG/trunk port membership.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 14:48:54 +02:00
christianmanivongandClaude Sonnet 4.6 879419d5ba feat: add get_health_metrics() interface and UCD-MIB shared implementation
Defines the driver-level health metrics interface across all base classes.
OSDriver/FirewallDriver/HypervisorDriver/AccessPointDriver get a default
UCD-MIB + IF-MIB implementation via shared _ucd_metrics.py; SwitchDriver
raises NotImplementedError (vendor-proprietary OIDs). Adds HealthMetricsDict
and HealthMetricsIfaceDict TypedDicts to models.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 00:43:26 +02:00
christianmanivongandClaude Sonnet 4.6 197e0b4ab7 feat: add OSDriver base class with Docker and device action APIs
- Introduce OSDriver abstract base class (os.py) for general-purpose OS
  drivers (Linux, BSD, macOS) — registers package management, service
  management, users, processes, cron job and the two new OS-specific
  extension points
- Add get_docker_info() contract: returns DockerInfoDict covering
  containers, images, volumes, networks and outdated image detection
- Add run_device_action() contract: generic extensibility point for
  driver-specific one-off administrative actions
- Fix duplicate TypedDicts in models.py: remove early shadow definitions
  of UserDict, ProcessDict, CronJobDict, ApplyUpdatesResultDict from the
  Common section; keep the more complete definitions in the OS section
- Add Docker TypedDicts: DockerContainerDict, DockerImageDict,
  DockerVolumeDict, DockerNetworkDict, DockerInfoDict
- Add DeviceActionResultDict
- Export OSDriver from package __init__; bump version to 0.3.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 01:53:10 +02:00
christianmanivong b5f9c5301d feat: add service management and package update APIs to AccessPointDriver
- Add ServiceDict and UpdateDict TypedDicts to models
- Add get_services() / manage_service() abstract methods for init-system interaction
- Add get_available_updates() / apply_updates() for package upgrade workflows
- Add _filter_interfaces() helper to exclude lo and phy* interfaces from interface dicts
- Extend WirelessClientDict with optional ip, hostname, and lease_end fields
- Add optional description field to VPNTunnelDict
- Bump version 0.1.0 → 0.2.0
2026-05-29 08:38:05 +02:00
christianmanivong 03d014f57d Added abstract interface & vlan functions 2026-05-13 21:23:48 +02:00
christianmanivong b03e4355c9 Initial release (v0.1.0)
Add abstract device-type base classes for NAPALM drivers:
- AccessPointDriver  (wireless APs)
- SwitchDriver       (Ethernet switches)
- FirewallDriver     (firewalls / UTM)
- HypervisorDriver   (Proxmox VE, ESXi, KVM, Hyper-V)
- StorageDriver      (NAS/SAN appliances)

All return types modelled as TypedDicts in napalm_device_types.models.
2026-05-11 21:31:52 +02:00