Netmiko integration
Netmiko is a multi-vendor library to simplify Paramiko SSH connections primarily to network devices. It is maintained by Kirk Byers and built on top of the Paramiko library. Network engineers and developers can use Netmiko to interact with a wide range of devices over SSH. Most audits, commands, or configurations can be pushed or retrieved with nothing but connection and authentication details. However, should a more advanced connectivity configuration be required (custom timeouts, retries, etc), Netmiko also supports additional parameters based upon its underlying Paramiko library.
For more information on Netmiko, visit the Netmiko PyPI or Netmiko docs pages.
Itential Automation Gateway (IAG) contains a Netmiko execution engine that supports pulling or pushing of arbitrary commands or configurations via the send_command and send_config endpoints.
Netmiko version 3.0 is the minimum version supported by IAG.
External inventory
Netmiko does not have any explicit notion of inventory systems or files. Instead, it accepts a set of connection options which it uses to connect at runtime (host, port, authentication details, etc).
Execution
Netmiko functions are executed by issuing a POST request to the appropriate endpoint, e.g. /api/v2.0/netmiko/send_{command|config}. Executing a function can be done using the IAG UI or by a separate application via the IAG API. Functions are executed on the node on which the AG server is running.
Endpoint arguments
For external inventory, Netmiko endpoints in IAG require three distinct arguments to interact with remote devices: a host, connection options, and router commands/configs.
Host
The host is either an IP address or a hostname which can be resolved via DNS on the server that IAG is running on.
Example:
Connection options
The connection_options is a dictionary which can map directly to Netmiko’s ConnectHandler arguments, both in required parameters and parameter types such as port=int(). Because host is a top-level argument, it is excluded in this dictionary and will be overwritten if included.
Example:
Common device types
The device_type is supplied via the device_type parameter in connection_options.
See the following links for details on Netmiko support of vendor platforms and device types:
Example:
Native inventory
Execute native inventory by providing a host and command string.
Execution
Netmiko functions are executed by issuing a POST request to the appropriate endpoint, e.g. /api/v2.0/netmiko/send_{command|config_set}/execute. Executing a function can be done using the IAG UI or by a separate application via the IAG API. Functions are executed on the node on which the AG server is running.
Endpoint arguments
For native inventory, Netmiko endpoints in IAG require at least two distinct arguments to interact with native devices: a host and router commands/configs.
Host
The host is the native Netmiko device name.
Example:
Command string
The command_string is executed on the remote device.
Example:
Config commands
Multiple configuration commands are sent to the device.
Example:
The minimum requirements to connect to native Netmiko devices are host, command_string, and config_commands. For other variables, refer to the Netmiko documentation.
Example:
Router commands and config
Any environment-specific commands or configurations can be supplied transactionally (one command/config line per API call) or in a batch (performance may vary; see the Script execution engine guide for a better alternative for large command and configuration sets or prebuilt scripts).
Example: