Skip to content

Commit

Permalink
first beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop committed Oct 29, 2017
1 parent 3407edb commit 0b05c2a
Show file tree
Hide file tree
Showing 346 changed files with 4,955 additions and 957 deletions.
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Django stuff:
*.log
*.pot

# Sphinx documentation
docs/_build/

.idea
.DS_Store

env
*.swp

test/unit/test_devices.py

report.json
tags
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: python

python:
- 2.7
- 3.4
- 3.5
- 3.6

install:
- pip install tox-travis
- pip install coveralls
deploy:
provider: pypi
user: dbarroso
password:
secure: kt2RgomUtrf5zXo3CyF8B7SkolvKgALAO0s72WuMd0wTGmgOvoBlt10Vfc+G+wuVAYvW/JKdsYRceancAFyWLFgjLtNxbV4cJF2RXN956sYFSJ2VrtUiB19WuKZjX6024gMs780hC/3bdK1SDg/NAAHSR7u2cma3QgRcW6O+UG4=
on:
tags: true
branch: master

script:
- tox

after_success:
- coveralls
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include requirements/*
include napalm/*/templates/*.j2
include napalm/*/utils/textfsm_templates/*.tpl
include napalm/junos/utils/*.yml
170 changes: 170 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
[![PyPI](https://img.shields.io/pypi/v/napalm.svg)](https://pypi.python.org/pypi/napalm)
[![Build Status](https://travis-ci.org/napalm-automation/napalm.svg?branch=master)](https://travis-ci.org/napalm-automation/napalm)


NAPALM
======
NAPALM (Network Automation and Programmability Abstraction Layer with Multivendor support) is a Python library that implements a set of functions to interact with different router vendor devices using a unified API.

![NAPALM logo](static/logo.png?raw=true "NAPALM logo")

NAPALM supports several methods to connect to the devices, to manipulate configurations or to retrieve data.

Supported Network Operating Systems
-----------------------------------

Please check the following [link](https://napalm.readthedocs.io/en/latest/support/index.html) to see which devices are supported. Make sure you understand the [caveats](https://napalm.readthedocs.io/en/latest/support/index.html#caveats).

Documentation
=============

Before using the library, please read the documentation at: [Read the Docs](https://napalm.readthedocs.io)

You can also watch a [live demo](https://youtu.be/93q-dHC0u0I) of NAPALM to see what it is and what it can do for you.

Install
=======

Full installation
-----------------

If you want to fully install NAPALM you can do it by executing:

```
pip install napalm
```

That will install all the drivers currently available.


Partial Installation
--------------------

If you want to install just a subset of the available modules you can just pick them as follows:

```
pip install --install-option="ios" napalm
```

To install multiple drivers:
```
pip install --install-option="eos" --install-option="junos" napalm
```

To add drivers to an existing instalation:
```
pip install --install-option="eos" --install-option="junos" --force-reinstall -U napalm
```

Check the ['Supported Network Operating Systems'](#supported-network-operating-systems) section for more information about supported modules.


Upgrading
=========

We plan to upgrade napalm as fast as possible. Adding new methods and bugfixes. To upgrade napalm it's a simple as repeating the steps you performed while installing but adding the `-U` flag. For example:

```
pip install napalm -U
```

or:

```
pip install --install-option="eos" --install-option="junos" napalm -U
```


We will be posting news on our slack channel and on Twitter.


Automation Frameworks
======================

Due to its flexibility, NAPALM can be integrated in widely used automation frameworks.


Ansible
-------

Please check [napalm-ansible](https://github.com/napalm-automation/napalm-ansible) for existing Ansible modules leveraging the NAPALM API. Make sure you read the documentation and you understand how it works before trying to use it.


SaltStack
---------

Beginning with release code named `Carbon` (2016.11), [NAPALM is fully integrated](https://mirceaulinic.net/2016-11-30-salt-carbon-released/) in SaltStack - no additional modules required. For setup recommendations, please see [napalm-salt](https://github.com/napalm-automation/napalm-salt). For documentation and usage examples, you can check the modules documentation, starting from the [release notes](https://docs.saltstack.com/en/develop/topics/releases/2016.11.0.html#network-automation-napalm) and [this blog post](https://mirceaulinic.net/2016-11-17-network-orchestration-with-salt-and-napalm/).


Contact
=======

Slack
-----

Slack is probably the easiest way to get help with NAPALM. You can find us in the channel `napalm` on the [network.toCode()](https://networktocode.herokuapp.com/) team.

FAQ
---

If you have any issues using NAPALM or encounter any errors, before submitting any questions (directly by email or on Slack), please go through the following checklist:

- Make sure you have the latest release installed. We release very often, so upgrading to the latest version might help in many cases.
- Double check you are able to access the device using the credentials provided.
- Does your device meet the minimum [requirements](http://napalm.readthedocs.io/en/latest/support/index.html#general-support-matrix)?
- Some operating systems have some specific [constraints](http://napalm.readthedocs.io/en/latest/support/index.html#caveats). (e.g. have you enabled the XML agent on IOS-XR, or the NXAPI feature on NXOS?)
- Are you able to connect to the device using NAPALM? Check using the CLI test tool:

```bash
$ cl_napalm_test --vendor VENDOR --user USERNAME --password PASSWORD --optional_args OPTIONAL_ARGS HOSTNAME
```

Where vendor, username, password and hostname are mandatory. [Optional arguments](http://napalm.readthedocs.io/en/latest/support/index.html#optional-arguments) are specified as comma separated values.

Example:

```bash
$ cl_napalm_test --vendor junos --user napalm --password dbejmujz --optional_args 'port=12202, config_lock=False' edge01.bjm01
```

In case you have any errors, please review the steps above - this looks like a problem with your environment setup.

In order to get help faster, when submitting a bug/error make sure to include all the details requested.

News
====

Blog Posts
----------

* [NAPALM, Ansible, and Cisco IOS](https://pynet.twb-tech.com/blog/automation/napalm-ios.html) by Kirk Byers
* [Adding Cisco IOS support to NAPALM (Network Automation and Programmability Abstraction Layer with Multivendor support)](https://projectme10.wordpress.com/2015/12/07/adding-cisco-ios-support-to-napalm-network-automation-and-programmability-abstraction-layer-with-multivendor-support/) by Gabriele Gerbino
* [Network orchestration with Salt and NAPALM](https://mirceaulinic.net/2016-11-17-network-orchestration-with-salt-and-napalm/) by Mircea Ulinic

Presentations
-------------

* [NANOG 64 Presentation & Demo](https://youtu.be/93q-dHC0u0I) by David Barroso and Elisa Jasinska
* [Netnod Autumn Meeting 2015 Presentation](https://www.netnod.se/sites/default/files/NAPALM-david_barroso-Netnodautumnmeeting2015.pdf) by David Barroso
* [Automating IXP Device Configurations with Ansible at the Euro-IX Forum](https://www.euro-ix.net/m/uploads/2015/10/26/euroix-berlin-v2.pdf) by Elisa Jasinska
* [Network Automation with Salt and NAPALM at NANOG 68](https://www.nanog.org/sites/default/files/NANOG68%20Network%20Automation%20with%20Salt%20and%20NAPALM%20Mircea%20Ulinic%20Cloudflare%20(1).pdf); [video](https://www.youtube.com/watch?v=gV2918bH5_c); [recorded demo](https://www.youtube.com/watch?v=AqBk5fM7qZ0) by Mircea Ulinic

Podcasts
--------

* [NAPALM: Integrating Ansible with Network Devices on Software Gone Wild](http://blog.ipspace.net/2015/06/napalm-integrating-ansible-with-network.html) with David Barroso and Elisa Jasinska

Authors
=======
* David Barroso ([[email protected]](mailto:[email protected]))
* Elisa Jasinska ([[email protected]](mailto:[email protected]))
* Many others, check the [contributors](https://github.com/napalm-automation/napalm/graphs/contributors) page for details.


Thanks
======

This project was founded by David Barroso as part of [Spotify][spotify] and Elisa Jasinska as part of [BigWave IT][bigwave]. Originally it was hosted by the [Spotify][spotify] organization but due to the many contributions received by third parties we agreed creating a dedicated organization for NAPALM and give a big thanks to [Spotify][spotify] for the support.

[spotify]: http://www.spotify.com
[bigwave]: http://bigwaveit.org/
8 changes: 8 additions & 0 deletions napalm/_SUPPORTED_DRIVERS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SUPPORTED_DRIVERS = [
"eos",
"ios",
"iosxr",
"junos",
"nxos",
"nxos_ssh",
]
19 changes: 19 additions & 0 deletions napalm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pkg_resources
import sys
from napalm.base import get_network_driver
from napalm._SUPPORTED_DRIVERS import SUPPORTED_DRIVERS

# Verify Python Version that is running
try:
if not(sys.version_info.major == 2 and sys.version_info.minor == 7) and \
not(sys.version_info.major == 3):
raise RuntimeError('NAPALM requires Python 2.7 or Python3')
except AttributeError:
raise RuntimeError('NAPALM requires Python 2.7 or Python3')

try:
__version__ = pkg_resources.get_distribution('napalm').version
except pkg_resources.DistributionNotFound:
__version__ = "Not installed"

__all__ = ('get_network_driver', 'SUPPORTED_DRIVERS')
41 changes: 13 additions & 28 deletions napalm/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,22 @@
# License for the specific language governing permissions and limitations under
# the License.

"""napalm_base package."""
"""napalm.base package."""

# Python3 support
from __future__ import print_function
from __future__ import unicode_literals

# Python std lib
import sys
import inspect
import importlib
import pkg_resources

# Verify Python Version that is running
try:
if not(sys.version_info.major == 2 and sys.version_info.minor == 7) and \
not(sys.version_info.major == 3):
raise RuntimeError('NAPALM requires Python 2.7 or Python3')
except AttributeError:
raise RuntimeError('NAPALM requires Python 2.7 or Python3')

# NAPALM base
from napalm_base.base import NetworkDriver
from napalm_base.exceptions import ModuleImportError
from napalm_base.mock import MockDriver
from napalm_base.utils import py23_compat

try:
__version__ = pkg_resources.get_distribution('napalm-base').version
except pkg_resources.DistributionNotFound:
__version__ = "Not installed"

from napalm.base.base import NetworkDriver
from napalm.base.exceptions import ModuleImportError
from napalm.base.mock import MockDriver
from napalm.base.utils import py23_compat

__all__ = [
'get_network_driver', # export the function
Expand Down Expand Up @@ -73,13 +58,13 @@ def get_network_driver(module_name, prepend=True):
.. code-block:: python
>>> get_network_driver('junos')
<class 'napalm_junos.junos.JunOSDriver'>
<class 'napalm.junos.junos.JunOSDriver'>
>>> get_network_driver('IOS-XR')
<class 'napalm_iosxr.iosxr.IOSXRDriver'>
>>> get_network_driver('napalm_eos')
<class 'napalm_eos.eos.EOSDriver'>
<class 'napalm.iosxr.iosxr.IOSXRDriver'>
>>> get_network_driver('napalm.eos')
<class 'napalm.eos.eos.EOSDriver'>
>>> get_network_driver('wrong')
napalm_base.exceptions.ModuleImportError: Cannot import "napalm_wrong". Is the library \
napalm.base.exceptions.ModuleImportError: Cannot import "napalm_wrong". Is the library \
installed?
"""
if module_name == "mock":
Expand All @@ -94,8 +79,8 @@ def get_network_driver(module_name, prepend=True):
# Try to not raise error when users requests IOS-XR for e.g.
module_install_name = module_name.replace('-', '')
# Can also request using napalm_[SOMETHING]
if 'napalm_' not in module_install_name and prepend is True:
module_install_name = 'napalm_{name}'.format(name=module_install_name)
if 'napalm' not in module_install_name and prepend is True:
module_install_name = 'napalm.{name}'.format(name=module_install_name)
module = importlib.import_module(module_install_name)
except ImportError:
raise ModuleImportError(
Expand All @@ -110,5 +95,5 @@ def get_network_driver(module_name, prepend=True):

# looks like you don't have any Driver class in your module...
raise ModuleImportError(
'No class inheriting "napalm_base.base.NetworkDriver" found in "{install_name}".'
'No class inheriting "napalm.base.base.NetworkDriver" found in "{install_name}".'
.format(install_name=module_install_name))
Loading

0 comments on commit 0b05c2a

Please sign in to comment.