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>
This commit is contained in:
@@ -38,6 +38,7 @@ Requires Python ≥ 3.9 and NAPALM ≥ 4.0.
|
||||
| `SwitchDriver` | Ethernet switches | Cisco IOS, Arista EOS, Juniper EX |
|
||||
| `FirewallDriver` | Firewalls & UTM appliances | pfSense, Fortinet FortiOS, Cisco ASA |
|
||||
| `HypervisorDriver` | Hypervisors & virtualisation platforms | Proxmox VE, VMware ESXi, KVM/libvirt |
|
||||
| `OSDriver` | General-purpose operating systems | Linux, BSD, macOS |
|
||||
| `StorageDriver` | Storage appliances & NAS/SAN | TrueNAS, Synology DSM, QNAP QTS |
|
||||
|
||||
## Usage
|
||||
@@ -105,6 +106,34 @@ class ProxmoxDriver(HypervisorDriver):
|
||||
...
|
||||
```
|
||||
|
||||
### OS / Linux
|
||||
|
||||
```python
|
||||
from napalm_device_types import OSDriver
|
||||
|
||||
class LinuxDriver(OSDriver):
|
||||
|
||||
def get_packages(self):
|
||||
# return List[PackageDict]
|
||||
...
|
||||
|
||||
def get_services(self):
|
||||
# return List[ServiceDict]
|
||||
...
|
||||
|
||||
def get_users(self):
|
||||
# return List[UserDict]
|
||||
...
|
||||
|
||||
def get_processes(self):
|
||||
# return List[ProcessDict]
|
||||
...
|
||||
|
||||
def get_cron_jobs(self):
|
||||
# return List[CronJobDict]
|
||||
...
|
||||
```
|
||||
|
||||
### Storage / NAS
|
||||
|
||||
```python
|
||||
|
||||
Reference in New Issue
Block a user