neops.core.provider.device_exec_from_jinja
DeviceJinjaExecProvider
Provider to execute commands in exec mode
Device Configure Parameters
Template
A Jinja Template which is processed before apply the result of this template.
The following parameters are passed to the template processing:
input
: all inputs from the task run argumentsdevice
: the current device object serialized as dictionaryneops
: the neops object brings methods to access to other elements over the neops.io searchneops.search_devices(query)
: returns a list of devices found by the search queryneops.search_interfaces(query)
: returns a list of interfaces found by the search queryneops.search_device_groups(query)
: returns a list of groups found by the search queryneops.search_client(query)
: returns a list of clients found by the search queryneops.get_common_facts(key)
: returns the common/global fact of the given key
For more information on how to build a Jinja2 template, have a look at Appendix under Jinja2
Example of device and neops usage (only to show usage, config change doesn't make sense):
Expecting User FeedbackNormally a prompt is expected after executing commands on a device.
But as you can see in the template above, there could be commands whichone are asking for user feedback.
To handle user feedbacks you can pass an other value than the prompt to be expected by passing :expect [expect value]
.
JSON Schema
Device Exec
Properties
template
(string): Jinja Template to generate the configuration.
Methods
run_on_device
is called by the run cycle.
It processes the template and executes the commands on the device