Skip to main content

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 class Activka for managing devices
  • astarmiko/async_exec.py – class ActivkaAsync for parallel SSH
  • astarmiko/log_config.py – flexible logging config (JSON, stdout)
  • scripts/fh.py – FindHost utility: locate host by IP or MAC
  • YAML/ – all inventory, command mapping and segment data
  • TEMPLATES/ – 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 templates
  • logging: enable/disable logging
  • add_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astarmiko-0.1.0.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

astarmiko-0.1.0-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

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

Hashes for astarmiko-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a1378f0f3f1fe9c399b660cac6d86cf443a753defb0f427c8346e19ec42ad320
MD5 3f17c69c31a6bcd50902b5ba3ab8c989
BLAKE2b-256 cd1eefc048e83a74493751888b5caeccc64cd43f3050e7887b476c1f29998d70

See more details on using hashes here.

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

Hashes for astarmiko-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92d12b8becf911c9bd8c75c46e057511d0ac62c9ac6015eb4aa84c02c1b43569
MD5 6315245d7c45253362cef6db72f36945
BLAKE2b-256 1d011acbce431063984f25777a453ae652efa1db33a83c93b56a38d6f7633b1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page