Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
|
language: python
|
||||||
python:
|
python:
|
||||||
- 2.7
|
- 3.6
|
||||||
|
- 3.7
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements-dev.txt
|
- 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:
|
script:
|
||||||
- py.test --cov-report= test/
|
- pip install .
|
||||||
|
|
||||||
after_success:
|
|
||||||
- coveralls
|
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
# napalm-s350
|
# 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
|
## Supported devices
|
||||||
|
|
||||||
|
|||||||
+20
-7
@@ -36,7 +36,6 @@ from napalm.base.exceptions import (
|
|||||||
CommandErrorException,
|
CommandErrorException,
|
||||||
)
|
)
|
||||||
|
|
||||||
from napalm.base.utils import py23_compat
|
|
||||||
import napalm.base.helpers
|
import napalm.base.helpers
|
||||||
|
|
||||||
|
|
||||||
@@ -192,11 +191,11 @@ class S350Driver(NetworkDriver):
|
|||||||
serial_number, fqdn, os_version, hostname, domain_name = ('Unknown',) * 5
|
serial_number, fqdn, os_version, hostname, domain_name = ('Unknown',) * 5
|
||||||
|
|
||||||
# Submit commands to the device.
|
# 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_sys = self._send_command('show system')
|
||||||
show_inv = self._send_command('show inventory')
|
show_inv = self._send_command('show inventory')
|
||||||
show_hosts = self._send_command('show hosts | begin Default Domain Table')
|
show_hosts = self._send_command('show hosts')
|
||||||
show_int_st = self._send_command('show interface status | include gi')
|
show_int_st = self._send_command('show interface status')
|
||||||
|
|
||||||
# os_version
|
# os_version
|
||||||
for line in show_ver.splitlines():
|
for line in show_ver.splitlines():
|
||||||
@@ -210,9 +209,11 @@ class S350Driver(NetworkDriver):
|
|||||||
if line.startswith('System Name:'):
|
if line.startswith('System Name:'):
|
||||||
_, hostname = line.split('System Name:')
|
_, hostname = line.split('System Name:')
|
||||||
hostname = hostname.strip()
|
hostname = hostname.strip()
|
||||||
|
continue
|
||||||
elif line.startswith('System Description:'):
|
elif line.startswith('System Description:'):
|
||||||
_, model = line.split('System Description:')
|
_, model = line.split('System Description:')
|
||||||
model = model.strip()
|
model = model.strip()
|
||||||
|
continue
|
||||||
elif line.startswith('System Up Time (days,hour:min:sec):'):
|
elif line.startswith('System Up Time (days,hour:min:sec):'):
|
||||||
_, uptime_str = line.split('System Up Time (days,hour:min:sec):')
|
_, uptime_str = line.split('System Up Time (days,hour:min:sec):')
|
||||||
uptime = self._parse_uptime(uptime_str)
|
uptime = self._parse_uptime(uptime_str)
|
||||||
@@ -224,14 +225,26 @@ class S350Driver(NetworkDriver):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# fqdn
|
# fqdn
|
||||||
domain_line = show_hosts.splitlines()[4]
|
domainname = napalm.base.helpers.textfsm_extractor(self, 'hosts',
|
||||||
domainname = domain_line.split()[0]
|
show_hosts)[0]
|
||||||
|
domainname = domainname['domain_name']
|
||||||
|
if domainname == 'Domain':
|
||||||
|
domainname = ''
|
||||||
fqdn = '{0}.{1}'.format(hostname, domainname)
|
fqdn = '{0}.{1}'.format(hostname, domainname)
|
||||||
|
|
||||||
# interface_list
|
# interface_list
|
||||||
interfaces = []
|
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():
|
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(py23_compat.text_type(interface))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'fqdn': py23_compat.text_type(fqdn),
|
'fqdn': py23_compat.text_type(fqdn),
|
||||||
|
|||||||
@@ -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."""
|
"""setup.py file."""
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from pip.req import parse_requirements
|
|
||||||
|
|
||||||
__author__ = 'Jasper Lievisse Adriaanse <j@jasper.la>'
|
__author__ = 'Jasper Lievisse Adriaanse <j@jasper.la>'
|
||||||
|
|
||||||
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
|
with open("requirements.txt", "r") as fs:
|
||||||
reqs = [str(ir.req) for ir in install_reqs]
|
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(
|
setup(
|
||||||
name="napalm-s350",
|
name="napalm-s350",
|
||||||
version="0.1.0",
|
version="0.2.2",
|
||||||
packages=find_packages(),
|
packages=find_packages(exclude=("test*",)),
|
||||||
author="Jasper Lievisse Adriaanse",
|
author="Jasper Lievisse Adriaanse, Petr Klíma",
|
||||||
author_email="j@jasper.la",
|
author_email="j@jasper.la, qaxi@seznam.cz",
|
||||||
description="Network Automation and Programmability Abstraction Layer with Multivendor support",
|
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=[
|
classifiers=[
|
||||||
'Topic :: Utilities',
|
'Topic :: Utilities',
|
||||||
'Programming Language :: Python',
|
'License :: OSI Approved :: Apache Software License',
|
||||||
'Programming Language :: Python :: 2',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.6',
|
||||||
|
'Programming Language :: Python :: 3.7',
|
||||||
'Operating System :: POSIX :: Linux',
|
'Operating System :: POSIX :: Linux',
|
||||||
'Operating System :: MacOS',
|
'Operating System :: MacOS',
|
||||||
],
|
],
|
||||||
url="https://github.com/jasperla/napalm-s350",
|
url="https://github.com/napalm-automation-community/napalm-s350",
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=reqs,
|
install_requires=reqs,
|
||||||
)
|
)
|
||||||
|
|
||||||
Reference in new issue
Block a user