Connections¶
-
class
nornir.core.connections.
ConnectionPlugin
¶ Connection plugins have to inherit from this class and provide implementations for both the
open()
andclose()
methods.-
state
¶ Dictionary to hold any data that needs to be shared between the connection plugin and the plugin tasks using this connection.
-
close
() → None¶ Close the connection with the device
-
open
(hostname: Optional[str], username: Optional[str], password: Optional[str], port: Optional[int], platform: Optional[str], extras: Optional[Dict[str, Any]] = None, configuration: Optional[nornir.core.configuration.Config] = None) → None¶ Connect to the device and populate the attribute
connection
with the underlying connection
-
-
class
nornir.core.connections.
Connections
¶ -
available
= {}¶
-
classmethod
deregister
(name: str) → None¶ Deregisters a registered connection plugin by its name
Parameters: name – name of the connection plugin to deregister Raises: nornir.core.exceptions.ConnectionPluginNotRegistered
-
classmethod
deregister_all
() → None¶ Deregisters all registered connection plugins
-
classmethod
get_plugin
(name: str) → Type[nornir.core.connections.ConnectionPlugin]¶ Fetches the connection plugin by name if already registered
Parameters: name – name of the connection plugin Raises: nornir.core.exceptions.ConnectionPluginNotRegistered
-
classmethod
register
(name: str, plugin: Type[nornir.core.connections.ConnectionPlugin]) → None¶ Registers a connection plugin with a specified name
Parameters: - name – name of the connection plugin to register
- plugin – defined connection plugin class
Raises: :obj:`nornir.core.exceptions.ConnectionPluginAlreadyRegistered` if – another plugin with the specified name was already registered
-