Connection Plugins

Connection plugins help to connect with devices. Reference documentation for more information.

NcclientPlugin

Ncclient library connection plugin to interact with devices over NETCONF.

NcclientPlugin reference

nornir_salt.plugins.connections.NcclientPlugin.NcclientPlugin()

Full list of inventory extras see Ncclient Docs for manager.connect method.

Example on how to configure a device to use netconfig without using an ssh agent and without verifying the keys:

host-1:
  hostname: 192.168.16.20
  username: admin
  password: admin
  port: 2022
  connection_options:
    ncclient:
      extras:
        allow_agent: False
        hostkey_verify: False

Anything under inventory extras section passed on to Ncclient manager.connect call.

HTTPPlugin

HTTP Connection plugin to interact with devices over HTTP/HTTPS.

HTTPPlugin reference

nornir_salt.plugins.connections.HTTPPlugin.HTTPPlugin()

This plugin connects to the device via HTTP using Python requests library.

Connection reference name is http

Full list of inventory extras see here

Sample Nornir inventory:

hosts:
  ceos1:
    hostname: 10.0.1.4
    platform: arista_eos
    groups: [lab, connection_params]

  ceos2:
    hostname: 10.0.1.5
    platform: arista_eos
    groups: [lab, connection_params]

groups:
  lab:
    username: nornir
    password: nornir
  connection_params:
    connection_options:
      http:
        port: 80
        extras:
          transport: http
          verify: False
          base_url: "http://device1.lab/api/v1/"
          headers:
            Content-Type: "application/yang-data+json"
            Accept: "application/yang-data+json"

Anything under inventory extras section passed on to requests.request(method, url, **kwargs) call in a form of **kwargs except for transport and base_url. Inventory parameters can be overridden on task call.

transport and base_url - used to form URL to send request to if no absolute URL provided on task call.

PyGNMIPlugin

PyGNMI library connection plugin to interact with devices over gNMI protocol.

This plugin maintains long running gNMI connection to devices, if this behavior not desirable, consider using Nornir host’s close_connection method to close gNMI connection.

PyGNMIPlugin reference

nornir_salt.plugins.connections.PyGNMIPlugin.PyGNMIPlugin()

Full list of inventory extras see PyGNMI Docs for gNMIclient class.

Sample inventory:

host-1:
  hostname: 192.168.16.20
  username: admin
  password: admin
  port: 2022
  connection_options:
    pygnmi:
      extras:
        insecure: True
        gnmi_timeout: 10

Anything under inventory extras section passed on to PyGNMI gNMIclient class object instantiation.