Passing options to napalm/netmiko

How can you pass specific arguments/options to napalm netmiko?

You can pass additional options via the inventory, some of the parameters will be well known, which means they go in the root of the object. For instance:

my_device:
    port: 22
    hostname: dev1.group_1
    username:
    password: a_password
    platform: eos

But others may be specific to the connection plugin (for instance napalm may take a bunch of options depending on the driver and same for netmiko; transport, secret, etc.), you can specify those in the path {$host, $group, $defaults}.connection_options.$driver_name.extras. For instance:

dev1.group_1:
    port: 22
    hostname: dev1.group_1
    username:
    password: a_password
    platform: eos
    connection_options:
        napalm:
            extras:
                optional_args:
                    transport: http

You can find more information here.

You can also see more information about accepted options for napalm and netmiko in their respective documentations.

2 Likes

Here is a Netmiko example that I was working on a couple of days ago (for my lab environment):

arista_console:
   platform: linux
   username: gituser
   connection_options:
     netmiko:
       extras:
         use_keys: True
         session_log: my_out.txt

The platform was Linux as I had to bounce through another machine to reach the Arista virtual device.

2 Likes

In case someone needs to change the default ssh connection to telnet.

SW52:
  hostname: 192.168.65.135
  username: cisco
  password: cisco
  port: 65102
  platform: ios
  connection_options:
    netmiko:
       extras:
         device_type: 'cisco_ios_telnet'
    napalm:
       extras:
         optional_args:
            transport: 'telnet'
2 Likes

how to add global_delay_factor = 2 for netmiko connection?

Replying to the global delay factor question

SW52:
  hostname: 192.168.65.135
  username: cisco
  password: cisco
  platform: ios
  connection_options:
    netmiko:
       extras:
         device_type: 'cisco_ios'
         global_delay_factor: 2