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

Commit

Permalink
First working version
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop committed Mar 9, 2016
1 parent d7e1ce7 commit c8c48b5
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 9 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: python

python:
- 2.7

install:
- pip install -r requirements.txt
- pip install .

deploy:
provider: pypi
user: dbarroso
password:
secure: FWTA4L2e08mMpD8BbCNWTZN1XFCQKSlYUfPqT0aXDz/GgEK2KfZqbzj1V8Xwx4pXuBHSy8JunlpLGdc18dqtfMKpryz7elWbIsvyPNvcVFxYatG1RdDZB3qiN0MWTCVOCTUyOeglbOsaahKlV66RGBRbQpx107woZ/I+hg43jeNdi6fUer5Ip2DXLMFkR7yb5vbI+tc9KM1Z3/isSzmpkYWQm1MUGxnFonye46r6MoSOANTDpzNIAQKOKwUvGwdovZCAhdqn8JQp8EsKB9Tl0QK56k2//TWmOlglvwL3vVHOeP0V12fc8viKvYRGXKSCwzcz+bi5RSGo0Afurc7lVrmHgJbJIfXxilucE0OBOn58487wynn3k+30D39V9PnddYJ6iNU1ji7/qYpCbyE9ydSKFu4rFgwDbFTU1kJ+JlmNmoJYET/rZITQNUjtFC9grtjSdpouurzNS4eSg7CD8EfzVV6i3IS+1p9n4xosUxdCRl8/jhm9pNMW2OaM00r4GwW2Xt4kDP9J8OWDhlErDLE5lR4EjuGPCLmCYTWcl3DtvUlDCqBs5JZutHV+6raHBw7qFUcI2MxacjQys/3etjIUb9UilbBP1cnqec5Q/FfcTvD0QXCT56f1eM87eh4ysxmHFIDrW+ZwaDW/DicOExfeq264bYOge01poQEkdGM=
on:
tags: true
branch: master

script:
- cd test/unit
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_arp_table
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_bgp_neighbors
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_environment
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_facts
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_interfaces
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_interfaces_counters
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_interfaces_ip
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_lldp_neighbors
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_lldp_neighbors_detail
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_mac_address_table
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_ntp_peers
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_get_snmp_information
- nosetests -v TestIOSDriver:TestGetterIOSDriver.test_ios_only_bgp_time_conversion #IOS only test
- cd ../..
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include requirements.txt
include napalm_ios/templates/*.j2
15 changes: 15 additions & 0 deletions napalm_ios/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2016 Dravetech AB. All rights reserved.
#
# The contents of this file are licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

"""napalm_ios package."""
6 changes: 3 additions & 3 deletions napalm/ios.py → napalm_ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from datetime import datetime

from netmiko import ConnectHandler, FileTransfer
from napalm.base import NetworkDriver
from napalm.exceptions import ReplaceConfigException, MergeConfigException
from napalm_base.base import NetworkDriver
from napalm_base.exceptions import ReplaceConfigException, MergeConfigException

# Easier to store these as constants
HOUR_SECONDS = 3600
Expand Down Expand Up @@ -1321,4 +1321,4 @@ def get_snmp_information(self):
else:
raise ValueError("Unexpected Response from the device")

return snmp_dict
return snmp_dict
3 changes: 3 additions & 0 deletions napalm_ios/templates/delete_ntp_peers.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for peer in template_vars %}
no ntp server {{peer}}
{% endfor %}
1 change: 1 addition & 0 deletions napalm_ios/templates/set_hostname.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hostname {{hostname}}
3 changes: 3 additions & 0 deletions napalm_ios/templates/set_ntp_peers.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for peer in template_vars %}
ntp server {{peer}}
{% endfor %}
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
napalm-base
netmiko
29 changes: 29 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""setup.py file."""

import uuid

from setuptools import setup, find_packages
from pip.req import parse_requirements

__author__ = 'David Barroso <[email protected]>'

install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
reqs = [str(ir.req) for ir in install_reqs]

setup(
name="napalm-ios",
version="0.1.0",
packages=find_packages(),
author="David Barroso",
author_email="[email protected]",
description="Network Automation and Programmability Abstraction Layer with Multivendor support",
classifiers=[
'Topic :: Utilities',
'Programming Language :: Python',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
],
url="https://github.com/napalm-automation/napalm-ios",
include_package_data=True,
install_requires=reqs,
)
10 changes: 4 additions & 6 deletions test/unit/TestIOSDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""Tests for IOSDriver."""

import unittest
from napalm import get_network_driver
from base import TestConfigNetworkDriver, TestGettersNetworkDriver
from napalm_ios import ios
from napalm_base.test.base import TestConfigNetworkDriver, TestGettersNetworkDriver
import re


Expand Down Expand Up @@ -52,10 +52,9 @@ def setUpClass(cls):
username = 'vagrant'
password = 'vagrant'
cls.vendor = 'ios'
driver = get_network_driver(cls.vendor)
optional_args = {'port': 12204, 'dest_file_system': 'bootflash:'}

cls.device = driver(ip_addr, username, password, optional_args=optional_args)
cls.device = ios.IOSDriver(ip_addr, username, password, optional_args=optional_args)
cls.device.open()

# Setup initial state
Expand Down Expand Up @@ -134,11 +133,10 @@ def setUpClass(cls):
ip_addr = '192.168.0.234'
password = 'vagrant'
cls.vendor = 'ios'
driver = get_network_driver(cls.vendor)
optional_args = {}
optional_args['dest_file_system'] = 'flash:'

cls.device = driver(ip_addr, username, password, optional_args=optional_args)
cls.device = ios.IOSDriver(ip_addr, username, password, optional_args=optional_args)

if cls.mock:
cls.device.device = FakeIOSDevice()
Expand Down

0 comments on commit c8c48b5

Please sign in to comment.