netconf_lock

NETCONF lock.

Functions

netconf_lock(→ nornir.core.task.Result)

NETCONF locking operations for a specified datastore.

Module Contents

netconf_lock.netconf_lock(task: nornir.core.task.Task, datastore: str | None = 'candidate', manager: ncclient.manager.Manager | None = None, operation: str = 'lock') nornir.core.task.Result

NETCONF locking operations for a specified datastore.

Task name dynamically updated based on operation of lock or unlock.

Parameters:
  • datastore (str) – Target Datastore

  • manager (Manager) – Manager to use if operation==’unlock’ and the lock is carried.

  • operation (str) – Unlock or Lock

Examples

Simple example:

> nr.run(task=netconf_lock)

Lock candidate datestore:

> nr.run(task=netconf_lock,
>        operation="lock",
>        datastore="candidate")

Unlock candidate datestore:

> nr.run(task=netconf_lock,
>        operation="unlock",
>        datastore="candidate")

Unlock candidate datestore with a session:

> task.run(task=netconf_lock,
>    operation="unlock",
>    datastore="candidate",
>    manager=task.host["manager"])
Returns:

Result object with the following attributes set:

* result (RpcResult): Rpc and Manager