Async SSH automation for enterprise network equipment
Project description
astarmiko
Astarmiko is an advanced Python toolkit for managing and automating enterprise-grade network infrastructure over SSH. It provides both synchronous and asynchronous execution models, YAML-based inventory and configuration, and deep vendor-specific handling.
🚀 Features
- ✅ Unified interface for Cisco, Huawei, and others
- ⚡ Asynchronous SSH commands execution using
asyncio - 🔄 Automated configuration backups
- 🧠 Intelligent MAC/IP tracing and topology resolution (FindHost)
- 📁 Structured YAML configs for devices, commands, and segments
- 📊 Logging with stdout, JSON, rsyslog, Loki, Elastic support
📦 Installation
pip install -r requirements.txt
Requires Python 3.8+
📂 Project Structure
astarmiko/base.py– core classActivkafor managing devicesastarmiko/async_exec.py– classActivkaAsyncfor parallel SSHastarmiko/log_config.py– flexible logging config (JSON, stdout)scripts/fh.py– FindHost utility: locate host by IP or MACYAML/– all inventory, command mapping and segment dataTEMPLATES/– TextFSM templates for structured parsing
🚀 Recommended location for configuration files
All configuration files (YAML, TEMPLATES, example) are recommended to be stored in the user's home directory:
- Linux/macOS:
~/astarmiko/ - Windows:
C:\\Users\\username\\astarmiko\\
This will allow you to:
✅ Easily edit configuration files
✅ Avoid permission issues
✅ Use them on different operating systems without changes
Example:
mkdir -p ~/astarmiko
cp -r ./astarmiko/YAML ~/astarmiko/
cp -r ./astarmiko/TEMPLATES ~/astarmiko/
cp -r ./astarmiko/example ~/astarmiko/
---
## 🧑💻 Usage Examples
### Run show and config commands in parallel:
```python
from astarmiko.async_exec import ActivkaAsync, setup_config
setup_config("astarmiko.yaml")
a = ActivkaAsync("activka_byname.yaml")
await a.execute_on_devices(["R1", "R2"], ["show version"])
await a.setconfig_on_devices(["R1"], ["interface lo1", "description test"])
Run FindHost (fh.py)
python fh.py 192.168.1.23
📘 YAML Config Files
activka_byname.yaml
Defines all devices, their types, IPs, segment and role:
Router1:
device_type: cisco_ios
ip: 10.1.1.1
LEVEL:
Router1: R
SEGMENT:
Router1: SEG A
astarmiko.yaml
Global configuration for templates, logging, credentials, etc.
templpath: path to FSM templateslogging: enable/disable loggingadd_account: fallback credentials list
commands.yaml
Maps vendor-agnostic command names to real CLI syntax:
commands:
arp_table:
cisco_ios: "show ip arp"
huawei: "display arp"
Also defines MAC formatting rules for each platform.
📚 Documentation
See full documentation in /DOCUMENTATION folder:
base_ru.md,async_exec_en.md,log_config_ru.md, etc.
🙌 Contributing
Please read CONTRIBUTING.md to get started.
🛡 License
MIT License — see LICENSE file.
Made with ❤️ by astaraiki
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astarmiko-0.1.0.tar.gz.
File metadata
- Download URL: astarmiko-0.1.0.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1378f0f3f1fe9c399b660cac6d86cf443a753defb0f427c8346e19ec42ad320
|
|
| MD5 |
3f17c69c31a6bcd50902b5ba3ab8c989
|
|
| BLAKE2b-256 |
cd1eefc048e83a74493751888b5caeccc64cd43f3050e7887b476c1f29998d70
|
File details
Details for the file astarmiko-0.1.0-py3-none-any.whl.
File metadata
- Download URL: astarmiko-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92d12b8becf911c9bd8c75c46e057511d0ac62c9ac6015eb4aa84c02c1b43569
|
|
| MD5 |
6315245d7c45253362cef6db72f36945
|
|
| BLAKE2b-256 |
1d011acbce431063984f25777a453ae652efa1db33a83c93b56a38d6f7633b1e
|