neops.core.provider.interface_configure_from_jinja
InterfaceJinjaConfigureProvider
Provider to configure a device based on the passed interface selection to a jinja template
Interface Configure Parameters
Template
A Jinja Template which is processed before apply the result of this template to the device.
The following parameters are passed to the template processing:
input: all inputs from the task run argumentsdevice: the current device object serialized as dictionaryinterfaces: the current selected interface objects 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):
hostname {{ device.hostname }}
{% for interface in interfaces %}
interface {{ interface.name }}
description NEW-DESCRIPTION
{% endfor %}
Global Base Configure Parameters
Apply Method
The apply method descripbes how the configuration is written to the device.
cli: the configuration is applied directly in the configration modescp: the configuration is copied (with scp) as a file to the device and applied with an merge operationscp-startup: the configuration is copied (with scp) as a file to the device and written to the start up configuration
Slow Devices
With the slow_device parameter you can specify a delay factor to wait a longer time on responses from
slow devices
JSON Schema
Interface Configuration
Properties
-
apply(string): Method how to apply the configuration, over cli or copy with scp and merge. Must be one of:['scp', 'cli', 'scp-startup']. -
slow_device(integer): Add a factor for longer wait times for heavy loaded devices. Default:0. -
template(string): Jinja Template to generate the configuration.
Methods
run_on_device(self,task: nornir.core.task.Task,device_id: int,execute_on: List[int],execute_on_type: neops.core.provider.base.enum.RunOnEnum,**kwargs) -> nornir.core.task.Result