netmiko


Namenetmiko JSON
Version 4.2.0 PyPI version JSON
download
home_pagehttps://github.com/ktbyers/netmiko
SummaryMulti-vendor library to simplify legacy CLI connections to network devices
upload_time2023-05-05 16:36:08
maintainer
docs_urlNone
authorKirk Byers
requires_python>=3.7,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/netmiko.svg)](https://img.shields.io/pypi/pyversions/netmiko)
[![PyPI](https://img.shields.io/pypi/v/netmiko.svg)](https://pypi.python.org/pypi/netmiko)
[![Downloads](https://pepy.tech/badge/netmiko)](https://pepy.tech/project/netmiko)
[![GitHub contributors](https://img.shields.io/github/contributors/ktbyers/netmiko.svg)](https://GitHub.com/ktbyers/netmiko/graphs/contributors/)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

<img src="https://ktbyers.github.io/netmiko/images/netmiko_logo_gh.png" width="320">

Netmiko
=======

Multi-vendor library to simplify CLI connections to network devices

<br />

## 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).

<br />

## Getting Started
- [Getting Started](#getting-started-1)

<br />

## Examples
*You really should look here.*

- [Netmiko Examples](https://github.com/ktbyers/netmiko/blob/develop/EXAMPLES.md)

<br />


## Supported Platforms

[PLATFORMS](PLATFORMS.md)

<br />


## Installation

To install netmiko, simply us pip:

```
$ pip install netmiko
```

<br />

## API-Documentation

[API-Documentation](https://ktbyers.github.io/netmiko/docs/netmiko/index.html)

<br />

## Common Issues/FAQ

Answers to some [common questions](COMMON_ISSUES.md)

<br />

### Tutorials

- [Netmiko Overview](https://pynet.twb-tech.com/blog/automation/netmiko.html)
- [Secure Copy](https://pynet.twb-tech.com/blog/automation/netmiko-scp.html)
- [Netmiko through SSH Proxy](https://pynet.twb-tech.com/blog/automation/netmiko-proxy.html)
- [Netmiko and TextFSM](https://pynet.twb-tech.com/blog/automation/netmiko-textfsm.html)
- [Netmiko and what constitutes done](https://pynet.twb-tech.com/blog/automation/netmiko-what-is-done.html)

<br />

### Getting Started:

#### Create a dictionary representing the device.

Supported device_types can be found in [ssh_dispatcher.py](https://github.com/ktbyers/netmiko/blob/master/netmiko/ssh_dispatcher.py), see CLASS_MAPPER keys.
```py
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.

```py
net_connect = ConnectHandler(**cisco_881)
```

#### Execute show commands.

```py
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)

```py
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#
```

<br />

## API-Documentation

<a href="https://ktbyers.github.io/netmiko/docs/netmiko/index.html" title="Docs">API Documentation</a>

Below are some of the particularly handy Classes/functions for easy reference:
- [Base Connection Object](https://ktbyers.github.io/netmiko/docs/netmiko/base_connection.html)
- [SSH Autodetect](https://ktbyers.github.io/netmiko/docs/netmiko/index.html#netmiko.SSHDetect)
- [SSH Dispatcher](https://ktbyers.github.io/netmiko/docs/netmiko/index.html#netmiko.ssh_dispatcher)
- [Redispatch](https://ktbyers.github.io/netmiko/docs/netmiko/index.html#netmiko.redispatch)

<br />

## 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](VENDOR.md). 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](TESTING.md).

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

<br />

## 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](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](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/zt-km2k3upf-AkWHY4YEx3sI1R5irMmc7Q). Once you have entered the workspace, then you can join the #netmiko channel.


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


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ktbyers/netmiko",
    "name": "netmiko",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Kirk Byers",
    "author_email": "ktbyers@twb-tech.com",
    "download_url": "https://files.pythonhosted.org/packages/c9/26/74cb42b86b38069bcc4974fc5fccf670ca9b151cf6cfc5ecd97005cc01ae/netmiko-4.2.0.tar.gz",
    "platform": null,
    "description": "[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/netmiko.svg)](https://img.shields.io/pypi/pyversions/netmiko)\n[![PyPI](https://img.shields.io/pypi/v/netmiko.svg)](https://pypi.python.org/pypi/netmiko)\n[![Downloads](https://pepy.tech/badge/netmiko)](https://pepy.tech/project/netmiko)\n[![GitHub contributors](https://img.shields.io/github/contributors/ktbyers/netmiko.svg)](https://GitHub.com/ktbyers/netmiko/graphs/contributors/)\n[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n<img src=\"https://ktbyers.github.io/netmiko/images/netmiko_logo_gh.png\" width=\"320\">\n\nNetmiko\n=======\n\nMulti-vendor library to simplify CLI connections to network devices\n\n<br />\n\n## Why Netmiko?\nNetwork automation to screen-scraping devices is primarily concerned with gathering output from show commands and with making configuration changes.\n\nNetmiko 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).\n\n<br />\n\n## Getting Started\n- [Getting Started](#getting-started-1)\n\n<br />\n\n## Examples\n*You really should look here.*\n\n- [Netmiko Examples](https://github.com/ktbyers/netmiko/blob/develop/EXAMPLES.md)\n\n<br />\n\n\n## Supported Platforms\n\n[PLATFORMS](PLATFORMS.md)\n\n<br />\n\n\n## Installation\n\nTo install netmiko, simply us pip:\n\n```\n$ pip install netmiko\n```\n\n<br />\n\n## API-Documentation\n\n[API-Documentation](https://ktbyers.github.io/netmiko/docs/netmiko/index.html)\n\n<br />\n\n## Common Issues/FAQ\n\nAnswers to some [common questions](COMMON_ISSUES.md)\n\n<br />\n\n### Tutorials\n\n- [Netmiko Overview](https://pynet.twb-tech.com/blog/automation/netmiko.html)\n- [Secure Copy](https://pynet.twb-tech.com/blog/automation/netmiko-scp.html)\n- [Netmiko through SSH Proxy](https://pynet.twb-tech.com/blog/automation/netmiko-proxy.html)\n- [Netmiko and TextFSM](https://pynet.twb-tech.com/blog/automation/netmiko-textfsm.html)\n- [Netmiko and what constitutes done](https://pynet.twb-tech.com/blog/automation/netmiko-what-is-done.html)\n\n<br />\n\n### Getting Started:\n\n#### Create a dictionary representing the device.\n\nSupported device_types can be found in [ssh_dispatcher.py](https://github.com/ktbyers/netmiko/blob/master/netmiko/ssh_dispatcher.py), see CLASS_MAPPER keys.\n```py\nfrom netmiko import ConnectHandler\n\ncisco_881 = {\n    'device_type': 'cisco_ios',\n    'host':   '10.10.10.10',\n    'username': 'test',\n    'password': 'password',\n    'port' : 8022,          # optional, defaults to 22\n    'secret': 'secret',     # optional, defaults to ''\n}\n\n```\n\n#### Establish an SSH connection to the device by passing in the device dictionary.\n\n```py\nnet_connect = ConnectHandler(**cisco_881)\n```\n\n#### Execute show commands.\n\n```py\noutput = net_connect.send_command('show ip int brief')\nprint(output)\n```\n```\nInterface                  IP-Address      OK? Method Status                Protocol\nFastEthernet0              unassigned      YES unset  down                  down\nFastEthernet1              unassigned      YES unset  down                  down\nFastEthernet2              unassigned      YES unset  down                  down\nFastEthernet3              unassigned      YES unset  down                  down\nFastEthernet4              10.10.10.10     YES manual up                    up\nVlan1                      unassigned      YES unset  down                  down\n```\n\n#### Execute configuration change commands (will automatically enter into config mode)\n\n```py\nconfig_commands = [ 'logging buffered 20000',\n                    'logging buffered 20010',\n                    'no logging console' ]\noutput = net_connect.send_config_set(config_commands)\nprint(output)\n```\n```\npynet-rtr1#config term\nEnter configuration commands, one per line.  End with CNTL/Z.\npynet-rtr1(config)#logging buffered 20000\npynet-rtr1(config)#logging buffered 20010\npynet-rtr1(config)#no logging console\npynet-rtr1(config)#end\npynet-rtr1#\n```\n\n<br />\n\n## API-Documentation\n\n<a href=\"https://ktbyers.github.io/netmiko/docs/netmiko/index.html\" title=\"Docs\">API Documentation</a>\n\nBelow are some of the particularly handy Classes/functions for easy reference:\n- [Base Connection Object](https://ktbyers.github.io/netmiko/docs/netmiko/base_connection.html)\n- [SSH Autodetect](https://ktbyers.github.io/netmiko/docs/netmiko/index.html#netmiko.SSHDetect)\n- [SSH Dispatcher](https://ktbyers.github.io/netmiko/docs/netmiko/index.html#netmiko.ssh_dispatcher)\n- [Redispatch](https://ktbyers.github.io/netmiko/docs/netmiko/index.html#netmiko.redispatch)\n\n<br />\n\n## Contributing\n\nContributors are welcome.\n\nYou 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.\n\nBefore 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](VENDOR.md). 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](TESTING.md).\n\nFor all code contributions, please ensure that you have ran `black` against the code or your code will fail the Travis CI build.\n\n<br />\n\n## Questions/Discussion\n\nIf you find an issue with Netmiko, then you can open an issue on this projects issue page here: [https://github.com/ktbyers/netmiko/issues](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...\n\nIf you have questions or would like to discuss Netmiko, a #netmiko channel exists in [this Slack](https://pynet.slack.com) workspace. To join, use [this invitation](https://join.slack.com/t/pynet/shared_invite/zt-km2k3upf-AkWHY4YEx3sI1R5irMmc7Q). Once you have entered the workspace, then you can join the #netmiko channel.\n\n\n---\nKirk Byers  \nPython for Network Engineers  \nhttps://pynet.twb-tech.com  \n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Multi-vendor library to simplify legacy CLI connections to network devices",
    "version": "4.2.0",
    "project_urls": {
        "Homepage": "https://github.com/ktbyers/netmiko",
        "Repository": "https://github.com/ktbyers/netmiko"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41264801bb11234ee025b71d35289cdc62a0a4f2ad7a532ddff8cd7b4881249b",
                "md5": "16727362e3fb2532248d0e0e0f19a1a6",
                "sha256": "8dae36263edc0b5ca5373d3d9ec428f38efd050ecfddac9c0698d0e65082bb3b"
            },
            "downloads": -1,
            "filename": "netmiko-4.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "16727362e3fb2532248d0e0e0f19a1a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 213021,
            "upload_time": "2023-05-05T16:36:05",
            "upload_time_iso_8601": "2023-05-05T16:36:05.614197Z",
            "url": "https://files.pythonhosted.org/packages/41/26/4801bb11234ee025b71d35289cdc62a0a4f2ad7a532ddff8cd7b4881249b/netmiko-4.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c92674cb42b86b38069bcc4974fc5fccf670ca9b151cf6cfc5ecd97005cc01ae",
                "md5": "89fa6f94dcc1f3eeaf827e011567ae60",
                "sha256": "7adde6fe3ea63336228f49a863650c2d83fb0e680e0f0d158b5b0fb04c4100e1"
            },
            "downloads": -1,
            "filename": "netmiko-4.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "89fa6f94dcc1f3eeaf827e011567ae60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 137352,
            "upload_time": "2023-05-05T16:36:08",
            "upload_time_iso_8601": "2023-05-05T16:36:08.725363Z",
            "url": "https://files.pythonhosted.org/packages/c9/26/74cb42b86b38069bcc4974fc5fccf670ca9b151cf6cfc5ecd97005cc01ae/netmiko-4.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-05 16:36:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ktbyers",
    "github_project": "netmiko",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "netmiko"
}
        
Elapsed time: 0.07744s