neops.core.provider.generic_jinja_check
GenericJinjaCheckProvider
This Provider is used to set check results from existing facts or checks.
JSON Schema
Generic Jinja Check
Properties
-
check_key
(string): Set the key where the check is saved. -
check_on
(string): Select on which entity you want save the Check. Must be one of:['GROUP', 'DEVICE', 'INTERFACE', 'CLIENT ON GROUP', 'CLIENT ON INTERFACE']
. -
template
(string): Jinja Template to set the check results. Default:{% do neops.set_result(True) %} {% do neops.set_reason("because") %}
.
Template
The Jinja template which is processed to map the values to the new facts.
The following parameters are passed to the template processing:
input
: all inputs from the task run arguments- entity objects based on
check_on
none
onGLOBAL
device_group
: onGROUP
, the current device group object serialized as dictionarydevice
: onDEVICE
, the current device object serialized as dictionaryinterface
: onINTERFACE
, the current interface object serialized as dictionaryclient
: onCLIENT ON GROUP
orCLIENT ON INTERFACE
, the current client object serialized as dictionary
neops
: the neops object brings methods to access to other elements over the neops.io search and to save the facts objectsneops.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 keyneops.set_result(result)
: sets the check result, if the check is successful (ok
ortrue
), not successful (nok
orfalse
) or if the check execution is failed (any other value)neops.set_metrics(metrics)
: set metrics values (dictionary) of a checkneops.set_reason(reason)
: set reason for the check result- set reference to related results for teardown
neops.add_related_device_group_facts(device_group_id, fact_key)
: set reference to device group facts by id and fact keyneops.add_related_device_facts(device_id, fact_key)
: set reference to device facts by id and fact keyneops.add_related_interface_facts(interface_id, fact_key)
: set reference to interface facts by id and fact keyneops.add_related_client_facts(client_id, fact_key)
: set reference to client facts by id and fact keyneops.add_related_device_group_check(device_group_id, check_key)
: set reference to device group check by id and check keyneops.add_related_device_check(device_id, check_key)
: set reference to device check by id and check keyneops.add_related_interface_check(interface_id, check_key)
: set reference to interface check by id and check keyneops.add_related_client_check(client_id, check_key)
: set reference to client check by id and check key
For more information on how to build a Jinja2 template, have a look at Appendix under Jinja2
Methods
run_on_client_of_interface(self,task: nornir.core.task.Task,client_id: int,check_on: str,template: str,**kwargs) -> Union[neops.core.provider.base.base_check.NeopsCheckResult, NoneType]
run_on_client_of_location(self,client_id: int,check_on: str,template: str,**kwargs) -> Union[neops.core.provider.base.base_check.NeopsCheckResult, NoneType]
run_on_device(self,task: nornir.core.task.Task,device_id: int,check_on: str,template: str,**kwargs) -> Union[neops.core.provider.base.base_check.NeopsCheckResult, NoneType]
run_on_device_group(self,device_group_id: int,check_on: str,template: str,**kwargs) -> Union[neops.core.provider.base.base_check.NeopsCheckResult, NoneType]
run_on_interface(self,task: nornir.core.task.Task,interface_id: int,check_on: str,template: str,**kwargs) -> Union[neops.core.provider.base.base_check.NeopsCheckResult, NoneType]