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
Metadata
Release files for astarmiko 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| astarmiko-0.1.0.tar.gz | 27.6 kB | Without provenance | Details for astarmiko-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| astarmiko-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for astarmiko-0.1.0-py3-none-any.whl |
Total release size: 55.8 kB
Release files / astarmiko-0.1.0.tar.gz
| Download URL | astarmiko-0.1.0.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1378f0f3f1fe9c399b660cac6d86cf443a753defb0f427c8346e19ec42ad320
|
|
BLAKE2b-256 checksum How to use checksums |
cd1eefc048e83a74493751888b5caeccc64cd43f3050e7887b476c1f29998d70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / astarmiko-0.1.0-py3-none-any.whl
| Download URL | astarmiko-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92d12b8becf911c9bd8c75c46e057511d0ac62c9ac6015eb4aa84c02c1b43569
|
|
BLAKE2b-256 checksum How to use checksums |
1d011acbce431063984f25777a453ae652efa1db33a83c93b56a38d6f7633b1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Security for astarmiko 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.