Skip to content

Commit

Permalink
Merge pull request #19 from napalm-automation/develop
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
dbarrosop authored Oct 25, 2016
2 parents db99faf + 794b906 commit ad1a10f
Show file tree
Hide file tree
Showing 13 changed files with 497 additions and 14 deletions.
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
###Description of Issue/Question


### Did you follow the steps from https://github.com/napalm-automation/napalm#faq
- [ ] Yes
- [ ] No


### Setup

### napalm-fortios version
(Paste verbatim output from `pip freeze | grep napalm-fortios` between quotes below)

```

```

### FortiOS version
(Paste verbatim output from `get sys status` between quotes below)

```

```

### Steps to Reproduce the Issue

### Error Traceback
(Paste the complete traceback of the exception between quotes below)

```

```
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Make sure you have read http://napalm.readthedocs.io/en/latest/contributing/index.html --!>
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python:
install:
- pip install -r requirements.txt
- pip install .
- pip install coveralls
deploy:
provider: pypi
user: dbarroso
Expand All @@ -14,9 +15,12 @@ deploy:
branch: master
script:
- cd test/unit
- nosetests -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_bgp_neighbors
- nosetests -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_environment
- nosetests -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_facts
- nosetests -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_interfaces
- nosetests -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_interfaces_counters
- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_bgp_neighbors
- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_environment
- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_facts
- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_interfaces
- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_interfaces_counters
- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_config
- cd ../..
- coverage combine test/unit/.coverage
after_success: coveralls
1 change: 1 addition & 0 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please, read http://napalm.readthedocs.io/en/latest/contributing/index.html
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![PyPI](https://img.shields.io/pypi/v/napalm-fortios.svg)](https://pypi.python.org/pypi/napalm-fortios)
[![PyPI](https://img.shields.io/pypi/dm/napalm-fortios.svg)](https://pypi.python.org/pypi/napalm-fortios)
[![Build Status](https://travis-ci.org/napalm-automation/napalm-fortios.svg?branch=master)](https://travis-ci.org/napalm-automation/napalm-fortios)
[![Coverage Status](https://coveralls.io/repos/github/napalm-automation/napalm-fortios/badge.svg?branch=master)](https://coveralls.io/github/napalm-automation/napalm-fortios)


# napalm-fortios
13 changes: 12 additions & 1 deletion napalm_fortios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@
# the License.

"""napalm_fortios package."""
from fortios import FortiOSDriver
# Import stdlib
import pkg_resources

# Import local modules
from napalm_fortios.fortios import FortiOSDriver

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

__all__ = ('FortiOSDriver',)
23 changes: 23 additions & 0 deletions napalm_fortios/fortios.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,29 @@ def rollback(self):
self.device.candidate_config['vpn certificate local']['Fortinet_SSLProxy'].del_param('certificate')
self.device.commit()

def get_config(self, retrieve="all"):
"""get_config implementation for FortiOS."""
get_startup = retrieve == "all" or retrieve == "startup"
get_running = retrieve == "all" or retrieve == "running"
get_candidate = retrieve == "all" or retrieve == "candidate"

if retrieve == "all" or get_running:
result = self.execute_command_with_vdom('show')
text_result = '\n'.join(result)

return {
'startup': "",
'running': text_result,
'candidate': "",
}

elif get_startup or get_candidate:
return {
'startup': "",
'running': "",
'candidate': "",
}

def get_facts(self):
system_status = self.get_command_with_vdom('get system status', vdom='global')
performance_status = self.get_command_with_vdom('get system performance status', vdom='global')
Expand Down
6 changes: 0 additions & 6 deletions pylama.ini

This file was deleted.

7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pytest
pytest-cov
pytest-json
pytest-pythonpath
pylama
flake8-import-order
-r requirements.txt
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
napalm_base
napalm-base==0.17.0
pyFG
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[pylama]
linters = mccabe,pep8,pyflakes
ignore = D203,C901

[pylama:pep8]
max_line_length = 100
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name="napalm-fortios",
version="0.1.1",
version="0.2.0",
packages=find_packages(),
author="David Barroso",
author_email="dbarrosop@dravetech.com",
Expand Down
Loading

0 comments on commit ad1a10f

Please sign in to comment.