send_configs_from_file
nornir_scrapli.tasks.send_configs_from_file
send_configs_from_file(task: Task, file: str, dry_run: Optional[bool] = None, strip_prompt: bool = True, failed_when_contains: Optional[Union[str, List[str]]] = None, stop_on_failed: bool = False, privilege_level: str = '', eager: bool = False, timeout_ops: Optional[float] = None) -> Result
¶
Send configs from a file to device using scrapli
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task |
Task
|
nornir task object |
required |
file |
str
|
string path to file |
required |
dry_run |
Optional[bool]
|
Whether to apply changes or not; if dry run, will ensure that it is possible to enter config mode, but will NOT send any configs |
None
|
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
|
stop_on_failed |
bool
|
True/False stop executing commands if a command fails, returns results as of current execution |
False
|
privilege_level |
str
|
name of configuration privilege level/type to acquire; this is platform dependent, so check the device driver for specifics. Examples of privilege_name would be "configuration_exclusive" for IOSXRDriver, or "configuration_private" for JunosDriver. You can also pass in a name of a configuration session such as "my-config-session" if you have registered a session using the "register_config_session" method of the EOSDriver or NXOSDriver. |
''
|
eager |
bool
|
if eager is True we do not read until prompt is seen at each command sent to the channel. Do not use this unless you know what you are doing as it is possible that it can make scrapli less reliable! |
False
|
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. Note that this is the timeout value PER CONFIG sent, not for the total of the configs being sent! |
None
|
Returns:
Name | Type | Description |
---|---|---|
Result |
Result
|
nornir result object with Result.result value set to returned scrapli Response object |
Raises:
Type | Description |
---|---|
NornirScrapliNoConfigModeGenericDriver
|
If attempting to use this task function against a host that is using the "generic" platform type |
Source code in tasks/core/send_configs_from_file.py
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|