Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nokia/moler/llms.txt

Use this file to discover all available pages before exploring further.

Moler is a Python library that gives you ready-made building blocks for automating tests against real systems. It handles SSH connections, shell command execution, output parsing, state machine transitions, and parallel execution — so you can focus on writing tests instead of infrastructure.

Quick Start

Run your first automated command in under 5 minutes

Installation

Install Moler via pip and set up your environment

Core Concepts

Understand commands, events, devices, and connections

API Reference

Explore the full public API surface

What Moler provides

100+ built-in Unix commands

Pre-built parsers for ping, ls, ps, ssh, ifconfig, iperf3, and many more — each returning structured Python dicts.

Command as Future

Every command object is both callable (blocking) and a Future (non-blocking). Start in background, await when ready.

Device state machines

Devices track their connection state automatically. Just call goto_state("UNIX_REMOTE") and Moler handles the transition.

Event observers

Watch connections for asynchronous events — alarms, reboots, prompts — without polling.

Parallel execution

Run commands on multiple devices simultaneously using background start and await patterns.

Automatic logging

Moler logs all device activity automatically — main log plus per-device logs — with configurable rotation.

Get started in 3 steps

1

Install Moler

pip install moler
2

Define your devices

Create a my_devices.yml configuration file describing your test environment:
DEVICES:
  MyMachine:
    DEVICE_CLASS: moler.device.unixlocal.UnixLocal
3

Run your first command

from moler.config import load_config
from moler.device import DeviceFactory

load_config(config='my_devices.yml')
my_unix = DeviceFactory.get_device(name='MyMachine')
ps_cmd = my_unix.get_cmd(cmd_name="ps", cmd_params={"options": "-ef"})
processes = ps_cmd()
print(processes)
Moler supports Python 3.8 through 3.14 and runs on POSIX/Unix systems. See Installation for full requirements.