tasks

nornir_napalm.plugins.tasks.napalm_cli(task: Task, commands: List[str], **kwargs: Any) Result

Run commands on remote devices using napalm

Parameters:
  • commands – commands to execute

  • **kwargs – placeholder for user added arguments

Returns:

  • result (dict): result of the commands execution

Return type:

Result object with the following attributes set

nornir_napalm.plugins.tasks.napalm_configure(task: Task, dry_run: bool | None = None, filename: str | None = None, configuration: str | None = None, replace: bool = False, commit_message: str | None = None, revert_in: int | None = None) Result

Loads configuration into a network devices using napalm

Parameters:
  • dry_run – Whether to apply changes or not

  • filename – filename containing the configuration to load into the device

  • configuration – configuration to load into the device

  • replace – whether to replace or merge the configuration

  • revert_in – amount of time in seconds after which to revert the commit, None to disable

Returns:

  • changed (bool): whether the task is changing the system or not

  • diff (string): change in the system

Return type:

Result object with the following attributes set

nornir_napalm.plugins.tasks.napalm_confirm_commit(task: Task, dry_run: bool | None = None) Result

Confirm a commit that has a “pending” commit via the revert_in argument to napalm_config.

Parameters:

dry_run – whether to confirm_commit or not

nornir_napalm.plugins.tasks.napalm_get(task: Task, getters: List[str], getters_options: Dict[str, Dict[str, Any]] | None = None, **kwargs: Any) Result

Gather information from network devices using napalm

Parameters:
  • getters – getters to use

  • getters_options (dict of dicts) – When passing multiple getters you pass a dictionary where the outer key is the getter name and the included dictionary represents the options to pass to the getter

  • **kwargs – will be passed as they are to the getters

Returns:

  • result (dict): dictionary with the result of the getter

Return type:

Result object with the following attributes set

nornir_napalm.plugins.tasks.napalm_ping(task: Task, dest: str, source: str | None = '', ttl: int | None = 255, timeout: int | None = 2, size: int | None = 100, count: int | None = 5, vrf: str | None = None) Result

Executes ping on the device and returns a dictionary with the result.

Parameters:
  • dest (str) –

  • source (str, optional) –

  • ttl (int, optional) –

  • timeout (int, optional) –

  • size (int, optional) –

  • count (int, optional) –

  • vrf (str, optional) –

Returns:

  • result (dict): list of dictionary with the result of the ping response. Output dictionary has one of following keys “success or error”

Return type:

Result object with the following attributes set

nornir_napalm.plugins.tasks.napalm_rollback(task: Task, dry_run: bool | None = None) Result

Rollback device configuration using napalm :param dry_run: whether to rollback the configuration or not

nornir_napalm.plugins.tasks.napalm_validate(task: Task, src: str | None = None, validation_source: Dict[str, Dict[str, Any]] | None = None) Result

Gather information with napalm and validate it:

Parameters:
  • src – file to use as validation source

  • validation_source (list) – data to validate device’s state

Returns:

  • result (dict): dictionary with the result of the validation

  • complies (bool): Whether the device complies or not

Return type:

Result object with the following attributes set