Skip to content

Commit 36fa64f

Browse files
committed
feat: add new 'paramiko' driver for Linux management
1 parent 4780447 commit 36fa64f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3710
-32
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ docs-local/
3131
tests/
3232
site*
3333

34+
# Paramiko driver examples config
35+
examples/paramiko-driver/common.py
36+
3437

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
3+
## [0.2.0] - 2025-11-09
4+
5+
### Added
6+
7+
- **Paramiko 驱动**: 新增 Paramiko 驱动,支持 Linux 服务器管理
8+
- 支持多种认证方式(密码、密钥文件、密钥内容)
9+
- 支持 SFTP 文件传输(上传/下载/断点续传)
10+
- 支持 SSH 代理/跳板机连接
11+
- 支持 sudo 权限执行和 PTY 模式
12+
13+
## [0.1.0] - 2025-7-04
14+
15+
### Added
16+
17+
- 初始版本发布
18+
- 支持 Netmiko、NAPALM、PyEAPI 驱动
19+
- 支持长连接技术、分布式架构、插件系统
20+
- 支持模板引擎(Jinja2、TextFSM、TTP)和 Webhook 通知
21+

README-zh.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ NetPulse 提供了强大的插件系统,支持多种功能扩展:
3232
* **设备驱动**:
3333
- 支持 Netmiko (Cisco/Huawei/Juniper等)
3434
- 支持 NAPALM (配置管理/状态检查)
35+
- 支持 PyEAPI (Arista EOS)
36+
- 支持 Paramiko (Linux服务器)
3537
- 支持自定义协议扩展
3638

3739
* **模板引擎**:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ NetPulse offers a powerful plugin system supporting various functional extension
3232
* **Device Drivers**:
3333
- Netmiko support (Cisco/Huawei/Juniper etc.)
3434
- NAPALM support (Configuration management/State verification)
35+
- PyEAPI support (Arista EOS)
36+
- Paramiko support (Linux servers)
3537
- Custom protocol extension support
3638

3739
* **Template Engine**:

docs/en/api/api-overview.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Device Operation API provides device query, configuration, and connection testin
8383
- Netmiko (SSH) - Universal SSH connection
8484
- NAPALM (multi-vendor) - Standardized interface
8585
- PyEAPI (Arista-specific) - HTTP/HTTPS API
86+
- Paramiko (SSH) - Linux server management
8687

8788
For detailed information, see: [Device Operation API](./device-api.md)
8889

@@ -129,6 +130,11 @@ For detailed information, see: [Job Management API](./job-api.md)
129130
- **Connection Method**: HTTP/HTTPS API
130131
- **Features**: Native API support, excellent performance
131132

133+
### Paramiko (Linux Servers)
134+
- **Device Types**: Linux servers (Ubuntu, CentOS, Debian, etc.)
135+
- **Connection Method**: SSH
136+
- **Features**: Native SSH, supports file transfer, proxy connections, sudo, etc.
137+
132138
## Queue Strategies
133139

134140
NetPulse supports two queue strategies, and the system will automatically select the appropriate strategy based on driver type:
@@ -140,12 +146,12 @@ NetPulse supports two queue strategies, and the system will automatically select
140146
- **Use Cases**: Frequent operations on the same device, need to maintain connection state
141147

142148
### FIFO Queue (fifo)
143-
- **Applicable Drivers**: PyEAPI (HTTP/HTTPS stateless connections)
149+
- **Applicable Drivers**: PyEAPI (HTTP/HTTPS stateless connections), Paramiko (Linux servers)
144150
- **Features**: First-in-first-out, new connection each time
145151
- **Advantages**: Simple and efficient, suitable for stateless operations
146-
- **Use Cases**: HTTP API calls, no need to maintain connection state
152+
- **Use Cases**: HTTP API calls, long-running tasks, no need to maintain connection state
147153

148-
> **Tip**: If `queue_strategy` is not specified, the system will automatically select based on driver type (Netmiko/NAPALM → `pinned`, PyEAPI → `fifo`)
154+
> **Tip**: If `queue_strategy` is not specified, the system will automatically select based on driver type (Netmiko/NAPALM → `pinned`, PyEAPI/Paramiko`fifo`)
149155
150156
## Core Parameters Quick Reference
151157

docs/en/api/device-api.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Driver-specific parameters, vary by driver type and operation type. **Most scena
293293
}
294294
```
295295

296-
> **Detailed Parameter Description**: Please refer to driver-specific documentation ([Netmiko](../drivers/netmiko.md), [NAPALM](../drivers/napalm.md), [PyEAPI](../drivers/pyeapi.md))
296+
> **Detailed Parameter Description**: Please refer to driver-specific documentation ([Netmiko](../drivers/netmiko.md), [NAPALM](../drivers/napalm.md), [PyEAPI](../drivers/pyeapi.md), [Paramiko](../drivers/paramiko.md))
297297
298298
### options
299299

@@ -615,6 +615,36 @@ response = requests.post(
615615
}
616616
```
617617

618+
#### Paramiko (Linux Servers)
619+
620+
**Basic Connection Test**:
621+
```json
622+
{
623+
"driver": "paramiko",
624+
"connection_args": {
625+
"host": "192.168.1.100",
626+
"username": "admin",
627+
"password": "your_password",
628+
"port": 22,
629+
"timeout": 30.0
630+
}
631+
}
632+
```
633+
634+
**Key Authentication Example**:
635+
```json
636+
{
637+
"driver": "paramiko",
638+
"connection_args": {
639+
"host": "192.168.1.100",
640+
"username": "admin",
641+
"key_filename": "/path/to/private_key",
642+
"passphrase": "your_key_passphrase",
643+
"port": 22
644+
}
645+
}
646+
```
647+
618648
### Connection Parameter Description
619649

620650
**Netmiko Parameters**:
@@ -689,7 +719,7 @@ response = requests.post(
689719
690720
### Quick Tips
691721

692-
- **Driver Selection**: Netmiko (universal SSH), NAPALM (multi-vendor), PyEAPI (Arista-specific)
722+
- **Driver Selection**: Netmiko (universal SSH), NAPALM (multi-vendor), PyEAPI (Arista-specific), Paramiko (Linux servers)
693723
- **Queue Strategy**: Usually no need to specify, system will automatically select based on driver
694724
- **Error Handling**: Implement retry mechanism, record detailed error information
695725
- **Task Tracking**: Use `/job` interface to query task status, or use webhook callbacks

docs/en/architecture/architecture-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ NetPulse improves system performance, availability, and scalability through the
289289
**Design Philosophy**: Extend functionality through plugin mechanism, drivers are one type of plugin.
290290

291291
**Supported Extensions**:
292-
- **Device Drivers**: Can add new device drivers (currently supports Netmiko, NAPALM, pyeAPI, etc.)
292+
- **Device Drivers**: Can add new device drivers (currently supports Netmiko, NAPALM, PyEAPI, Paramiko, etc.)
293293
- **Template Engines**: Can add new template formats (currently supports Jinja2, TextFSM, TTP, etc.)
294294
- **Scheduling Algorithms**: Can add new scheduling strategies (currently supports greedy, minimum load, etc.)
295295
- **Notification Mechanisms**: Can add new Webhook implementations

docs/en/architecture/driver-system.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Device Driver System
22

3-
NetPulse provides extensible driver support through its plugin system. Users can use the three built-in supported drivers, or develop custom drivers as needed.
3+
NetPulse provides extensible driver support through its plugin system. Users can use the four built-in supported drivers, or develop custom drivers as needed.
44

55
## Core Drivers
66

77
| Driver | Protocol | Vendor Support | Key Features | Dependencies |
88
|----------|---------------|-----------------------------|-------------------------------------------|-------------------|
99
| Netmiko | SSH/Telnet | 30+ vendors | CLI command execution, **SSH keepalive** | netmiko~=4.5.0 |
1010
| NAPALM | API/SSH | Multi-vendor (Cisco/Juniper/Arista) | Configuration management, state collection | napalm~=5.0.0 |
11-
| pyeAPI | HTTP/HTTPS | Arista EOS only | Native EOS API access, HTTP-based eAPI | pyeapi~=1.0.4 |
11+
| PyEAPI | HTTP/HTTPS | Arista EOS only | Native EOS API access, HTTP-based eAPI | pyeapi~=1.0.4 |
12+
| Paramiko | SSH | Linux servers | Native SSH, file transfer, proxy connections, sudo | paramiko~=3.0.0 |
1213

1314
## Specify Device Driver
1415

@@ -60,6 +61,12 @@ When using [Pinned Worker](./architecture-overview.md) with Netmiko driver, the
6061

6162
Users can configure SSH keepalive time through the `keepalive` parameter. When SSH keepalive fails, Pinned Worker will automatically exit. When tasks are sent again, a new Pinned Worker will be created to connect to the device.
6263

64+
## Paramiko
65+
66+
Paramiko driver is used to manage Linux servers in NetPulse, implemented based on native SSH protocol. Paramiko driver supports command execution, file transfer, proxy connections, sudo, and other advanced features, suitable for system monitoring, configuration management, software deployment, and other scenarios.
67+
68+
Paramiko driver defaults to FIFO queue strategy (short connection), suitable for long-running tasks and file transfer scenarios. Unlike Netmiko driver, Paramiko driver does not implement long connection reuse, and will disconnect after each task execution.
69+
6370
## Long Connection Technology
6471

6572
### Technology Overview

docs/en/architecture/plugin-system.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ graph TB
2323
Driver --> Netmiko[Netmiko Driver]
2424
Driver --> NAPALM[NAPALM Driver]
2525
Driver --> PyEAPI[PyEAPI Driver]
26+
Driver --> Paramiko[Paramiko Driver]
2627
Driver --> Custom[Custom Driver...]
2728
2829
style Plugin fill:#E6F4EA,stroke:#4B8B3B,stroke-width:3px
@@ -80,7 +81,7 @@ graph TD
8081
| **Name Attribute** | `driver_name` |
8182
| **Directory** | `netpulse/plugins/drivers/` |
8283
| **Global Variable** | `drivers` |
83-
| **Built-in Implementation** | Netmiko, NAPALM, pyeAPI |
84+
| **Built-in Implementation** | Netmiko, NAPALM, PyEAPI, Paramiko |
8485

8586
**Core Methods**:
8687
- `connect()`: Establish device connection

docs/en/drivers/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ NetPulse adopts a plugin-based driver architecture, supporting rapid extension o
99
| **Netmiko** | SSH/Telnet | **Most scenarios (recommended)** | Supports a wide range of device types, long connection reuse improves performance |
1010
| **NAPALM** | SSH/HTTP/HTTPS | Need configuration merge/rollback | Supports configuration merge, replace, rollback |
1111
| **PyEAPI** | HTTP/HTTPS | Arista EOS devices | Native API, excellent performance, JSON structured data |
12+
| **Paramiko** | SSH | Linux servers | Native SSH, supports file transfer, proxy connections, sudo, etc. |
1213

1314
## Driver Description
1415

@@ -66,17 +67,40 @@ NetPulse is based on a plugin-based driver architecture that can quickly extend
6667

6768
📖 [View PyEAPI Detailed Documentation](./pyeapi.md)
6869

70+
### Paramiko
71+
72+
**Recommended choice when managing Linux servers**. Based on native SSH protocol, supports file transfer, proxy connections, sudo, and other advanced features.
73+
74+
- Supported Devices: Linux servers (Ubuntu, CentOS, Debian, etc.)
75+
- Recommended Queue Strategy: FIFO (short connection)
76+
- Use Cases: System monitoring, configuration management, file transfer, batch server operations
77+
78+
**Key Parameters**:
79+
- `connection_args.host` (required)`: Server address
80+
- `connection_args.username` (required)`: SSH username
81+
- `connection_args.password`: Password authentication
82+
- `connection_args.key_filename`: Private key file path
83+
- `connection_args.pkey`: Private key content (PEM format string)
84+
- `connection_args.proxy_host`: SSH proxy/jump host address
85+
- `driver_args.timeout`: Command execution timeout
86+
- `driver_args.get_pty`: Whether to use pseudo-terminal (PTY)
87+
- `driver_args.file_transfer`: File transfer operation (upload/download)
88+
89+
📖 [View Paramiko Detailed Documentation](./paramiko.md)
90+
6991
## Selection Recommendations
7092

7193
| Scenario | Recommended Driver |
7294
|----------|-------------------|
95+
| Linux servers | **Paramiko (preferred)** |
7396
| Arista devices | **PyEAPI (preferred)** |
7497
| Cisco/Juniper/Other SSH devices | **Netmiko (recommended)** |
7598
| Need configuration merge/rollback | NAPALM |
7699

77100
## Quick Decision
78101

79102
```
103+
Linux server? → Paramiko
80104
Arista device? → PyEAPI
81105
Need configuration merge/rollback? → NAPALM
82106
Other scenarios → Netmiko (recommended)

0 commit comments

Comments
 (0)