Send command string to device using promptless (ps) approach. Can be used for any command, including commands that change device prompt. Multiple commands can be sent separated by ‘ ‘ newline.


Promptless mode allows to detect end of output from device without relying on timers or correct prompt matching (hence the name - promptless). This mode still uses pattern to decide if device finished emitting data, but that pattern is not dependent on device’s prompt regex matching.

Each reading cycle, data from device read as fast as possible until device either finishes or pose to prepare more data. Latter case detected and handled using read timeout timer and checking if new data received. To detect when device finishes producing output, algorithm sends two space character to device and checks in next read cycle if last line contains two additional spaces, concluding that end of output detected if so and continue cycling otherwise.

Overall its similar to how Humans interact with device prompt to verify that its still operational - try hitting space or type something in terminal to see if its appears on the screen.


netmiko_send_command_ps sample usage

Code to invoke netmiko_send_command_ps task:

from nornir import InitNornir
from nornir_salt import netmiko_send_command_ps

nr = InitNornir(config_file="config.yaml")

commands = '''
show ip int brief
conf t
interface loopback 100
ip address
show ip int brief

output =
    commands="show run",

output_multiline =

netmiko_send_command_ps returns

Returns Nornir results object with individual tasks names set equal to commands sent to device.

netmiko_send_command_ps reference

nornir_salt.plugins.tasks.netmiko_send_command_ps.netmiko_send_command_ps(task: nornir.core.task.Task, command_string: str, enable: bool = False, **kwargs: Any) nornir.core.task.Result

Patch netmiko connection object with send_command_ps method and execute it.

  • command_string – (str) Command to execute on the remote network device.

  • enable – (bool) Set to True to force Netmiko .enable() call.

  • kwargs – (dict) Additional arguments to pass to send_command_ps method.

Return result object

with result of the show command

nornir_salt.plugins.tasks.netmiko_send_command_ps.send_command_ps(self, command_string, read_timeout=30, timeout=120, inter_loop_sleep=0.1, initial_sleep=0.1, strip_prompt=True, strip_command=True, normalize=True, cutoff=0.6)
Execute command_string_ps on the SSH channel using promptless (ps) approach. Can be used

for any commands, including commands that change prompt. Multiple commands can be sent separated by ‘

‘ newline.
param command_string

The command(s) to be executed on the remote device.

type command_string


param read_timeout

Timeout in seconds to wait for data from devices, default 30s, if set to -1 will wait indefinitely

type read_timeout


param timeout

Timeout in seconds of overall wait, default 120s, if set to -1 will wait indefinitely

type timeout


param inter_loop_sleep

Interval in seconds to sleep between reading loops, default 0.1s

type inter_loop_sleep


param initial_sleep

time to sleep after sending command, defailt 0.1s

type initial_sleep


param strip_prompt

Remove the trailing router prompt from the output (default: True).

type strip_prompt


param strip_command

Remove the echo of the command from the output (default: True).

type strip_command


param normalize

Ensure the proper enter is sent at end of command (default: True).

type normalize