Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Release 0.25.0 #303

Merged
merged 22 commits into from
Aug 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a961002
Validate string before evaluating (#274)
dbarrosop Jul 12, 2017
83d51ae
Bump version to 0.24.3 (#275)
dbarrosop Jul 12, 2017
4865720
Fix napalm validate so identical strings will work (#288)
ktbyers Aug 2, 2017
ef47e15
Correct link under "compliance_report" function (#289)
bdlamprecht Aug 2, 2017
42729d5
Convert napalm_base testing to tox (#284)
bewing Aug 8, 2017
fbe3347
Search parent modules in load_template
bewing Aug 4, 2017
896ebd4
load_template unit test fixes
bewing Aug 4, 2017
604bbda
Test search path building
bewing Aug 7, 2017
ee1b76d
If tox was merged I would've caught this
bewing Aug 7, 2017
37e58f4
PEP8
bewing Aug 7, 2017
2e1148a
Didn't use this subclass
bewing Aug 7, 2017
7868afc
pylama
bewing Aug 8, 2017
8959976
Rename template directory
bewing Aug 8, 2017
6d4e46a
Add requested value to the validate report (#291)
dbarrosop Aug 9, 2017
13ecc39
Clean up search_path creation
bewing Aug 9, 2017
cb9ecd4
__enter__ was swallowing the exception and returning False (#299)
dbarrosop Aug 10, 2017
a249e1b
Merge pull request #294 from bewing/lt_walk
bewing Aug 22, 2017
ae1bab0
Remove constraint on _rpc method for MockDriver that requires junos p…
nickethier Aug 22, 2017
0bc3eef
Implemented generic napalm tool with debugging capabilities (#292)
dbarrosop Aug 22, 2017
24cb28a
py3 requires you to cast keys and values into a list (#300)
dbarrosop Aug 25, 2017
cac3372
Version 0.25.0 (#302)
mirceaulinic Aug 25, 2017
e21f10f
Merge branch 'master' into develop
dbarrosop Aug 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ python:
- 2.7
- 3.4
- 3.5
- 3.6

install:
- pip install .
- pip install -r requirements-dev.txt
- pip install -r requirements.txt
- pip install -r test/unit/requirements.txt

- pip install tox-travis
- pip install coveralls
deploy:
provider: pypi
user: dbarroso
Expand All @@ -21,8 +19,7 @@ deploy:
branch: master

script:
- nosetests ./test/unit/TestGetNetworkDriver.py
- nosetests ./test/unit/TestHelpers.py
- nosetests ./test/unit/TestNapalmTestFramework.py
- py.test test/unit/validate
- pylama .
- tox
after_success:
- coveralls
- if [ $TRAVIS_TAG ]; then curl -X POST https://readthedocs.org/build/napalm; fi
66 changes: 34 additions & 32 deletions napalm_base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
from __future__ import print_function
from __future__ import unicode_literals

# std libs
import sys

# local modules
import napalm_base.exceptions
import napalm_base.helpers
Expand Down Expand Up @@ -47,17 +44,19 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
raise NotImplementedError

def __enter__(self):
try:
self.open()
except Exception: # noqa
exc_info = sys.exc_info()
return self.__raise_clean_exception(exc_info[0], exc_info[1], exc_info[2])
self.open()
return self

def __exit__(self, exc_type, exc_value, exc_traceback):
self.close()
if exc_type is not None:
return self.__raise_clean_exception(exc_type, exc_value, exc_traceback)
if exc_type is not None and (
exc_type.__name__ not in dir(napalm_base.exceptions) and
exc_type.__name__ not in __builtins__.keys()):
epilog = ("NAPALM didn't catch this exception. Please, fill a bugfix on "
"https://github.com/napalm-automation/napalm/issues\n"
"Don't forget to include this traceback.")
print(epilog)
return False

def __del__(self):
"""
Expand All @@ -71,27 +70,6 @@ def __del__(self):
except Exception:
pass

@staticmethod
def __raise_clean_exception(exc_type, exc_value, exc_traceback):
"""
This method is going to check if the exception exc_type is part of the builtins exceptions
or part of the napalm exceptions. If it is not, it will print a message on the screen
giving instructions to fill a bug.

Finally it will raise the original exception.

:param exc_type: Exception class.
:param exc_value: Exception object.
:param exc_traceback: Traceback.
"""
if (exc_type.__name__ not in dir(napalm_base.exceptions) and
exc_type.__name__ not in __builtins__.keys()):
epilog = ("NAPALM didn't catch this exception. Please, fill a bugfix on "
"https://github.com/napalm-automation/napalm/issues\n"
"Don't forget to include this traceback.")
print(epilog)
return False

def open(self):
"""
Opens a connection to the device.
Expand All @@ -114,6 +92,30 @@ def is_alive(self):
"""
raise NotImplementedError

def pre_connection_tests(self):
"""
This is a helper function used by the cli tool cl_napalm_show_tech. Drivers
can override this method to do some tests, show information, enable debugging, etc.
before a connection with the device is attempted.
"""
raise NotImplementedError

def connection_tests(self):
"""
This is a helper function used by the cli tool cl_napalm_show_tech. Drivers
can override this method to do some tests, show information, enable debugging, etc.
before a connection with the device has been successful.
"""
raise NotImplementedError

def post_connection_tests(self):
"""
This is a helper function used by the cli tool cl_napalm_show_tech. Drivers
can override this method to do some tests, show information, enable debugging, etc.
after a connection with the device has been closed successfully.
"""
raise NotImplementedError

def load_template(self, template_name, template_source=None,
template_path=None, **template_vars):
"""
Expand Down Expand Up @@ -1542,6 +1544,6 @@ def compliance_report(self, validation_file='validate.yml'):
Return a compliance report.

Verify that the device complies with the given validation file and writes a compliance
report file. See https://napalm.readthedocs.io/en/latest/validate.html.
report file. See https://napalm.readthedocs.io/en/latest/validate/index.html.
"""
return validate.compliance_report(self, validation_file=validation_file)
Loading