Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae33f4cc40 | ||
|
|
2d471af056 | ||
|
|
34ac2e5d4c | ||
|
|
1ff7c2a090 | ||
|
|
9d0995b3aa | ||
|
|
9ffa4b058c | ||
|
|
55a7d13531 | ||
|
|
bf489713a1 | ||
|
|
289b3bb184 | ||
|
|
dce581347c | ||
|
|
30490d89f5 | ||
|
|
906d22da3d | ||
|
|
04ad218156 | ||
|
|
e462abcc99 | ||
|
|
92634bfc16 | ||
|
|
b641ca5359 | ||
|
|
d905e3d042 | ||
|
|
ce70d202e8 | ||
|
|
89d8e813f8 | ||
|
|
c402398855 | ||
|
|
379a0d021e | ||
|
|
c979aa1ed6 | ||
|
|
aa2095de51 | ||
|
|
626acd4326 | ||
|
|
616a1b8429 | ||
|
|
7685f34b82 | ||
|
|
fb7310570e | ||
|
|
2948d69e8c | ||
|
|
de9352ef4f | ||
|
|
4d02acedc5 | ||
|
|
68739a4a42 | ||
|
|
24131751aa | ||
|
|
cf168a60ab | ||
|
|
da258ffd99 |
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# This workflows will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||
|
||||
name: Testing Upload Python Package to TEST.PyPi.org
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
- name: Build
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel
|
||||
- name: Check
|
||||
run: |
|
||||
twine check dist/*
|
||||
- name: Publish
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.TWINE_TEST_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.TWINE_TEST_PASSWORD }}
|
||||
TWINE_REPOSITORY: ${{ secrets.TWINE_TEST_REPOSITORY }}
|
||||
run: |
|
||||
twine upload --verbose --non-interactive --disable-progress-bar --skip-existing dist/*
|
||||
@@ -0,0 +1,37 @@
|
||||
# This workflows will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||
|
||||
name: Upload Python Package to PyPi.org
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
- name: Build
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel
|
||||
- name: Check
|
||||
run: |
|
||||
twine check dist/*
|
||||
- name: Publish
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
||||
TWINE_REPOSITORY: ${{ secrets.TWINE_REPOSITORY }}
|
||||
run: |
|
||||
twine upload --verbose --non-interactive --disable-progress-bar dist/*
|
||||
+3
-18
@@ -1,23 +1,8 @@
|
||||
language: python
|
||||
python:
|
||||
- 2.7
|
||||
- 3.6
|
||||
- 3.7
|
||||
install:
|
||||
- pip install -r requirements-dev.txt
|
||||
- pip install .
|
||||
- pip install -e git+https://github.com/napalm-automation/napalm-base.git@develop#egg=napalm-base
|
||||
- pip install coveralls
|
||||
|
||||
deploy:
|
||||
provider: pypi
|
||||
user: dbarroso
|
||||
password:
|
||||
secure: IIifRr9K771snku+qI7yz8T/cJC4ZO/fUYUNILhMB5eQtF2/MAEU7W1owGfcIqE9SW7fhPAXqVrnb7AcdFyjjbkZn6uoYYlh5LrQaCXgbfol5Yg+OSsRKFwhEOBcKFrtqz3W6UPunN6CX4v2gn2UCmWSyQ3XERgqKxobBVSOMb1G9PTy/Zk0ZUvGJc05bxWj3xuVQKg904VpnhQJ6q1h4d9SV+dQClP4eDRbEwe+ICKX3S2JPa/PiJfWrIsCL12yT+iZ/aiDwfSBjh+o3HMdt98cB3FkHAibEZnvpLOpUCmjX1rMyqyJEqVgDM1mQ4vyoYO5DNFv94ZufGJnJP+TIbkkSaFy9ZpeC2V+7K03TM+g1rZD3BKK50u3kL86KsHao14SZHV58l7/b3023IUr4MwrQgoLlHMhw9IFFC8bYmP/6aylae5fR/+5inGloSByzWLAKKQ0FLPPkCoeukmldyphjZ8HnGdhEu566kO9R5gxJ4edsbeimsRAO3oZ/EByQcgOytJjVKjMpn7fhiSblJO8KB4+M5d5fXUn5RZ31P3g8RFfG1Jqx2l9eOd4i8u9l3NkRd9WO8q5wyF/hvC/u4RcIMnRYl5hPWMBNY6uGGj7aq7o+XETTLVFirCwHBKre6OLdaVpW1ZciJP07Xb9qhyPLCeP3E9VM/OAz9rs5KI=
|
||||
on:
|
||||
tags: true
|
||||
branch: master
|
||||
|
||||
script:
|
||||
- py.test --cov-report= test/
|
||||
|
||||
after_success:
|
||||
- coveralls
|
||||
- pip install .
|
||||
@@ -1,6 +1,10 @@
|
||||
# napalm-s350
|
||||
|
||||
Napalm driver targeting Cisco SG350 devices.
|
||||
NAPALM driver for Cisco SMB switches (SF3xx, SF5xx, SG3xx, SG5xx).
|
||||
|
||||
## Status
|
||||
Main: [](https://travis-ci.com/napalm-automation-community/napalm-s350)
|
||||
Develop: [](https://travis-ci.com/napalm-automation-community/napalm-s350)
|
||||
|
||||
## Supported devices
|
||||
|
||||
|
||||
+25
-12
@@ -36,7 +36,6 @@ from napalm.base.exceptions import (
|
||||
CommandErrorException,
|
||||
)
|
||||
|
||||
from napalm.base.utils import py23_compat
|
||||
import napalm.base.helpers
|
||||
|
||||
|
||||
@@ -192,11 +191,11 @@ class S350Driver(NetworkDriver):
|
||||
serial_number, fqdn, os_version, hostname, domain_name = ('Unknown',) * 5
|
||||
|
||||
# Submit commands to the device.
|
||||
show_ver = self._send_command('show version | include Version')
|
||||
show_ver = self._send_command('show version')
|
||||
show_sys = self._send_command('show system')
|
||||
show_inv = self._send_command('show inventory')
|
||||
show_hosts = self._send_command('show hosts | begin Default Domain Table')
|
||||
show_int_st = self._send_command('show interface status | include gi')
|
||||
show_hosts = self._send_command('show hosts')
|
||||
show_int_st = self._send_command('show interface status')
|
||||
|
||||
# os_version
|
||||
for line in show_ver.splitlines():
|
||||
@@ -210,9 +209,11 @@ class S350Driver(NetworkDriver):
|
||||
if line.startswith('System Name:'):
|
||||
_, hostname = line.split('System Name:')
|
||||
hostname = hostname.strip()
|
||||
continue
|
||||
elif line.startswith('System Description:'):
|
||||
_, model = line.split('System Description:')
|
||||
model = model.strip()
|
||||
continue
|
||||
elif line.startswith('System Up Time (days,hour:min:sec):'):
|
||||
_, uptime_str = line.split('System Up Time (days,hour:min:sec):')
|
||||
uptime = self._parse_uptime(uptime_str)
|
||||
@@ -224,22 +225,34 @@ class S350Driver(NetworkDriver):
|
||||
break
|
||||
|
||||
# fqdn
|
||||
domain_line = show_hosts.splitlines()[4]
|
||||
domainname = domain_line.split()[0]
|
||||
domainname = napalm.base.helpers.textfsm_extractor(self, 'hosts',
|
||||
show_hosts)[0]
|
||||
domainname = domainname['domain_name']
|
||||
if domainname == 'Domain':
|
||||
domainname = ''
|
||||
fqdn = '{0}.{1}'.format(hostname, domainname)
|
||||
|
||||
# interface_list
|
||||
interfaces = []
|
||||
show_int_st = show_int_st.strip()
|
||||
# remove the header information
|
||||
show_int_st = re.sub(
|
||||
r"(^-.*$|^Port .*$|^Ch .*$)|^\s.*$|^.*Flow.*$", "", show_int_st,
|
||||
flags=re.M
|
||||
)
|
||||
for line in show_int_st.splitlines():
|
||||
interfaces.append(py23_compat.text_type(line.split()[0]))
|
||||
if not line:
|
||||
continue
|
||||
interface = line.split()[0]
|
||||
interfaces.append(str(interface))
|
||||
|
||||
return {
|
||||
'fqdn': py23_compat.text_type(fqdn),
|
||||
'hostname': py23_compat.text_type(hostname),
|
||||
'fqdn':str(fqdn),
|
||||
'hostname': str(hostname),
|
||||
'interface_list': interfaces,
|
||||
'model': py23_compat.text_type(model),
|
||||
'os_version': py23_compat.text_type(os_version),
|
||||
'serial_number': py23_compat.text_type(serial_number),
|
||||
'model': str(model),
|
||||
'os_version': str(os_version),
|
||||
'serial_number': str(serial_number),
|
||||
'uptime': uptime,
|
||||
'vendor': u'Cisco',
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Value DOMAIN_NAME ([\w+.]+)
|
||||
|
||||
Start
|
||||
^\s+Domain\s+Source\s+Interface\s+Preference -> Domains
|
||||
^\s+Source\s+Interface\s+Preference\s+Domain -> Domains
|
||||
|
||||
Domains
|
||||
^${DOMAIN_NAME} -> Record End
|
||||
@@ -1,31 +1,37 @@
|
||||
"""setup.py file."""
|
||||
|
||||
import uuid
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from pip.req import parse_requirements
|
||||
|
||||
__author__ = 'Jasper Lievisse Adriaanse <j@jasper.la>'
|
||||
|
||||
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
|
||||
reqs = [str(ir.req) for ir in install_reqs]
|
||||
with open("requirements.txt", "r") as fs:
|
||||
reqs = [r for r in fs.read().splitlines() if (len(r) > 0 and not r.startswith("#"))]
|
||||
|
||||
with open("README.md", "r") as fs:
|
||||
long_description = fs.read()
|
||||
|
||||
setup(
|
||||
name="napalm-s350",
|
||||
version="0.1.0",
|
||||
packages=find_packages(),
|
||||
author="Jasper Lievisse Adriaanse",
|
||||
author_email="j@jasper.la",
|
||||
description="Network Automation and Programmability Abstraction Layer with Multivendor support",
|
||||
version="0.2.3",
|
||||
packages=find_packages(exclude=("test*",)),
|
||||
author="Jasper Lievisse Adriaanse, Petr Klíma",
|
||||
author_email="j@jasper.la, qaxi@seznam.cz",
|
||||
description="NAPALM driver for Cisco SMB switches (SF3xx, SF5xx, SG3xx, SG5xx)",
|
||||
license="Apache 2.0",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
classifiers=[
|
||||
'Topic :: Utilities',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Operating System :: MacOS',
|
||||
],
|
||||
url="https://github.com/jasperla/napalm-s350",
|
||||
url="https://github.com/napalm-automation-community/napalm-s350",
|
||||
include_package_data=True,
|
||||
install_requires=reqs,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user