Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa2095de51 | ||
|
|
626acd4326 | ||
|
|
616a1b8429 | ||
|
|
7685f34b82 | ||
|
|
fb7310570e | ||
|
|
2948d69e8c | ||
|
|
de9352ef4f | ||
|
|
4d02acedc5 | ||
|
|
68739a4a42 | ||
|
|
24131751aa | ||
|
|
cf168a60ab | ||
|
|
da258ffd99 |
No files matched your search
+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
|
|
||||||
+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
|
||||||
@@ -3,16 +3,15 @@
|
|||||||
import uuid
|
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("#"))]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="napalm-s350",
|
name="napalm-s350",
|
||||||
version="0.1.0",
|
version="0.1.2",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
author="Jasper Lievisse Adriaanse",
|
author="Jasper Lievisse Adriaanse",
|
||||||
author_email="j@jasper.la",
|
author_email="j@jasper.la",
|
||||||
@@ -20,8 +19,9 @@ setup(
|
|||||||
classifiers=[
|
classifiers=[
|
||||||
'Topic :: Utilities',
|
'Topic :: Utilities',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 2',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 3.6',
|
||||||
|
'Programming Language :: Python :: 3.7',
|
||||||
'Operating System :: POSIX :: Linux',
|
'Operating System :: POSIX :: Linux',
|
||||||
'Operating System :: MacOS',
|
'Operating System :: MacOS',
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user