Skip to main content

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

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)

Source distribution for astarmiko 0.1.0
File Size Uploaded
astarmiko-0.1.0.tar.gz 27.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for astarmiko 0.1.0
File Interpreter ABI Platform
astarmiko-0.1.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page