send_command
nornir_scrapli.tasks.send_command
send_command(task: Task, command: str, strip_prompt: bool = True, failed_when_contains: Optional[Union[str, List[str]]] = None, timeout_ops: Optional[float] = None) -> Result
¶
Send a single command to device using scrapli
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task |
Task
|
nornir task object |
required |
command |
str
|
string to send to device in privilege exec mode |
required |
strip_prompt |
bool
|
True/False strip prompt from returned output |
True
|
failed_when_contains |
Optional[Union[str, List[str]]]
|
string or list of strings indicating failure if found in response |
None
|
timeout_ops |
Optional[float]
|
timeout ops value for this operation; only sets the timeout_ops value for the duration of the operation, value is reset to initial value after operation is completed |
None
|
Returns:
Name | Type | Description |
---|---|---|
Result |
Result
|
scrapli nornir result object; almost identical to a "normal" nornir result object, but contains an additional attribute "scrapli_response" that contains the original response from scrapli |
Source code in tasks/core/send_command.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|