> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# Netmiko integration

> Overview of the Netmiko execution engine in Itential Gateway for SSH-based network device interactions.

Netmiko is a multi-vendor library to simplify Paramiko SSH connections primarily to network devices. It is maintained by [Kirk Byers](https://ktbyers.github.io/netmiko/docs/netmiko/index.html) and built on top of the [Paramiko](http://www.paramiko.org/) 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](https://pypi.org/project/netmiko/) or [Netmiko docs](https://ktbyers.github.io/netmiko/docs/netmiko/index.html) pages.

Itential Gateway contains a Netmiko execution engine that supports pulling or pushing of arbitrary commands or configurations via the `send_command` and `send_config` endpoints.

> **Note**
>
> Netmiko version 3.0 is the minimum version supported by Gateway.

## 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 Gateway UI or by a separate application via the Gateway API. Functions are executed on the node on which the AG server is running.

### Endpoint arguments

For external inventory, Netmiko endpoints in Gateway 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 Gateway is running on.

Example:

```js
host="192.168.0.1"
host="CSR-MIAMI-01"
host="CSR-MIAMI-01.domain.com"
```

#### 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:

```js
connection_options = {
  "device_type": "cisco_ios",
  "host": "192.168.0.1",
  "port": 22,
  "username": "admin",
  "password": "VerySecurePassword",
  # ...
}
```

#### 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:

* [Platform support](https://github.com/ktbyers/netmiko/blob/master/PLATFORMS.md)
* [SSH dispatcher](https://github.com/ktbyers/netmiko/blob/master/netmiko/ssh_dispatcher.py)

Example:

```js
Alcatel|Nokia SROS: "nokia_sros",
Arista EOS: "arista_eos",
Cisco IOS: "cisco_ios",
Cisco IOSXR: "cisco_xr",
Cisco NXOS: "cisco_nxos",
Juniper Junos: "juniper_junos"
```

## 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 Gateway UI or by a separate application via the Gateway API. Functions are executed on the node on which the AG server is running.

### Endpoint arguments

For native inventory, Netmiko endpoints in Gateway 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:

```js
host="cisco_device"
```

#### Command string

The `command_string` is executed on the remote device.

Example:

```js
"command_string": "show version"
"command_string": "show interfaces"
```

#### Config commands

Multiple configuration commands are sent to the device.

Example:

```js
"config_commands": [
"hostname ROUTER1",
"interface Ethernet 1/1",
"description ROUTER1 Uplink"
]
```

> **Note**
>
> 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:

```js
{
  "cmd_verify": true,
  "command_string": "show version",
  "delay_factor": 0,
  "expect_string": "string",
  "host": "cisco_device",
  "max_loops": 0,
  "normalize": true,
  "strip_command": true,
  "strip_prompt": true,
  "textfsm_template": "string",
  "ttp_template": "string",
  "use_genie": true,
  "use_textfsm": true,
  "use_ttp": true
}
```

## 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](./script-execution-engine) guide for a better alternative for large command and configuration sets or prebuilt scripts).

Example:

```js
commands = [
  "show version",
  "show interfaces"
]

config = [
  "enable",
  "terminal length 0",
  "interface Ethernet1/1",
  "  no switchport",
  "  ip address 192.168.1.1/24",
  "  mtu 9216",
  "  end",
  "copy running-configuration startup-configuration"
]
```