Moler can be configured via a YAML file or an inline Python dictionary. The configuration file defines the devices available to your test code, the connections used to reach them, and logging settings.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.
Loading configuration
Useload_config from moler.config to apply your configuration before accessing any devices.
- YAML file
- Inline dict
- Environment variable
load_config accepts either config or from_env_var, but not both. Passing both causes config to take precedence.
Full configuration structure
A complete YAML configuration file has three top-level sections:DEVICES section
Each key underDEVICES becomes the name used to retrieve a device via DeviceFactory.get_device(name=...). The only required field per device is DEVICE_CLASS.
DEVICE_CLASS
Fully qualified Python class path for the device implementation.| Class | Description |
|---|---|
moler.device.unixlocal.UnixLocal | Local Unix shell (opens a terminal) |
moler.device.unixremote.UnixRemote | Remote Unix shell reached via SSH hops |
CONNECTION_HOPS
CONNECTION_HOPS describes the state machine transitions that move a device between states. Each entry maps FROM_STATE → TO_STATE → command + params.
device.goto_state(state="UNIX_REMOTE").
DEFAULT_CONNECTION
Sets the connection type and variant used for all devices that do not specify their ownCONNECTION_DESC. If omitted, the default is terminal/threaded.
Optional device fields
INITIAL_STATE
INITIAL_STATE
Sets the state the device enters after creation. If not specified the device starts in its class default initial state.
LAZY_CMDS_EVENTS
LAZY_CMDS_EVENTS
When
True, commands and events are loaded on first use rather than at device creation time. Useful for large test suites to reduce startup overhead.CLONED_FROM
CLONED_FROM
Creates a device that is a copy of another already-defined device. The cloned device shares the same class and connection hops.
LOGICAL_TOPOLOGY
LOGICAL_TOPOLOGY
Defines which devices are neighbours of each other. Moler uses this to route multi-hop state transitions automatically.
CREATE_AT_STARTUP
CREATE_AT_STARTUP
When
True, all defined devices are instantiated and connected immediately when load_config is called, rather than lazily on first access.Using devices after loading config
load_config API
- Calling
load_configmore than once with the same config is a no-op unless devices were deleted in between. - Calling it with a new config adds devices from the new config on top of the existing ones.
- Calling
moler.config.clear()resets all loaded configuration.