• Stars
    star
    3,508
  • Rank 12,678 (Top 0.3 %)
  • Language
    Python
  • License
    MIT License
  • Created about 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Multi-vendor library to simplify Paramiko SSH connections to network devices

PyPI - Python Version PyPI Downloads GitHub contributors Code Style

Netmiko

Multi-vendor library to simplify CLI connections to network devices


Why Netmiko?

Network automation to screen-scraping devices is primarily concerned with gathering output from show commands and with making configuration changes.

Netmiko aims to accomplish both of these operations and to do it across a very broad set of platforms. It seeks to do this while abstracting away low-level state control (i.e. eliminate low-level regex pattern matching to the extent practical).


Getting Started


Examples

You really should look here.


Supported Platforms

PLATFORMS


Installation

To install netmiko, simply us pip:

$ pip install netmiko

API-Documentation

API-Documentation


Common Issues/FAQ

Answers to some common questions


Tutorials


Getting Started:

Create a dictionary representing the device.

Supported device_types can be found in ssh_dispatcher.py, see CLASS_MAPPER keys.

from netmiko import ConnectHandler

cisco_881 = {
    'device_type': 'cisco_ios',
    'host':   '10.10.10.10',
    'username': 'test',
    'password': 'password',
    'port' : 8022,          # optional, defaults to 22
    'secret': 'secret',     # optional, defaults to ''
}

Establish an SSH connection to the device by passing in the device dictionary.

net_connect = ConnectHandler(**cisco_881)

Execute show commands.

output = net_connect.send_command('show ip int brief')
print(output)
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0              unassigned      YES unset  down                  down
FastEthernet1              unassigned      YES unset  down                  down
FastEthernet2              unassigned      YES unset  down                  down
FastEthernet3              unassigned      YES unset  down                  down
FastEthernet4              10.10.10.10     YES manual up                    up
Vlan1                      unassigned      YES unset  down                  down

Execute configuration change commands (will automatically enter into config mode)

config_commands = [ 'logging buffered 20000',
                    'logging buffered 20010',
                    'no logging console' ]
output = net_connect.send_config_set(config_commands)
print(output)
pynet-rtr1#config term
Enter configuration commands, one per line.  End with CNTL/Z.
pynet-rtr1(config)#logging buffered 20000
pynet-rtr1(config)#logging buffered 20010
pynet-rtr1(config)#no logging console
pynet-rtr1(config)#end
pynet-rtr1#

API-Documentation

API Documentation

Below are some of the particularly handy Classes/functions for easy reference:


Contributing

Contributors are welcome.

You can contribute to Netmiko in a variety of ways: answering questions on Slack (see below in Questions/Discussions), responding to issues, adding to the common issues, reporting/fixing bugs, or even adding your own device type.

Before contributing a new vendor/platform device type, remember that any code added needs to be supported in some fashion. To add a vendor/platform you can follow the outline here. Once you've worked on your first pass of your driver and have it functional, you'll need to include test data in order for it to be merged into develop, you can see the general flow of how to do that here.

For all code contributions, please ensure that you have ran black against the code or your code will fail the Travis CI build.


Questions/Discussion

If you find an issue with Netmiko, then you can open an issue on this projects issue page here: https://github.com/ktbyers/netmiko/issues. Please make sure you've read through the common issues and examples prior to opening an issue. Please only open issues for bugs, feature requests, or other topics related to development of Netmiko. If you simply have a question, join us on Slack...

If you have questions or would like to discuss Netmiko, a #netmiko channel exists in this Slack workspace. To join, use this invitation. Once you have entered the workspace, then you can join the #netmiko channel.


Kirk Byers
Python for Network Engineers
https://pynet.twb-tech.com

More Repositories

1

pynet

Python for Network Engineers
Python
581
star
2

netmiko_tools

Command line tools built on Netmiko to simplify information gathering
Python
94
star
3

ansible_course

Ansible for Network Engineers
Python
85
star
4

nornir_netmiko

Netmiko Plugins for Nornir
Python
80
star
5

pyplus_course

Python Network Automation Course
Python
55
star
6

ansible_helpers

Ansible plugins and modules to make network automation easier.
Python
41
star
7

python_course

Python Network Automation Course
Python
26
star
8

scp_sidecar

Ansible modules using SCP and SSH to transfer files to network devices
Python
25
star
9

netmiko-ansible

Ansible modules that use Netmiko
Python
11
star
10

nxapi-plumbing

A low-level library for managing Cisco devices through NX-API using JSON-RPC and XML
Python
9
star
11

ansible-techniques

Experimenting with different Ansible techniques (with networking bent)
Python
5
star
12

net_upgrade

Automate OS Upgrade Process
4
star
13

pynet-ons-jul17

Python
4
star
14

nornir_test

Nornir Examples and Testing Repository
Python
4
star
15

napalm_custom_test

Custom Tests Against Real Devices
Python
3
star
16

incendio

POC for new napalm with config only
Python
3
star
17

pynet_ons

Testing only
Python
2
star
18

pynet_testm

Test repository
Python
2
star
19

ansible-eos-old

Arista EOS modules for performing network resource automation using Ansible
2
star
20

pyneta

Test PyNet Repository
Python
2
star
21

pynet-foo

Git Testing
Python
1
star
22

pynet-ons-feb19

Onsite February 2019
Python
1
star
23

napalm-merged

Merging napalm libs into a single repo
Python
1
star
24

pynet-ons-jan17

Python
1
star
25

ansible-svcug

SVCUG Ansible Workshop
Python
1
star
26

pynet_ons_oct16

Python
1
star
27

pynetb

Python
1
star
28

iop_2020

Interop 2020 source code (Netmiko, NAPALM, Nornir)
1
star
29

pynet_articles

Code associated with articles on the Python for Network Engineers Website
1
star
30

pynet-test-old

Test repository
Python
1
star
31

ascii_card_game1

Zack and Kirks Card Game
1
star
32

gh_actions_test1

Python
1
star