Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d6c4ea88b | ||
|
|
c3dea8ec10 | ||
|
|
6e6b38b224 | ||
|
|
3a63056fa8 | ||
|
|
08d9a45e77 | ||
|
|
fc9e83c4bb | ||
|
|
9025b0f434 | ||
|
|
d6dd81ea81 | ||
|
|
7a8fbac693 | ||
|
|
a4f0473fd2 | ||
|
|
62f6ab4cc3 | ||
|
|
7009fc9121 | ||
|
|
cfd1169760 | ||
|
|
f3d13a5e31 | ||
|
|
5a9bff81b9 | ||
|
|
e939d9e73d | ||
|
|
b4fd77df46 | ||
|
|
7e1d345af6 | ||
|
|
de857ba48a | ||
|
|
d1b960a407 | ||
|
|
7929c6411c | ||
|
|
751126a1f5 | ||
|
|
7a32595838 | ||
|
|
5049dcdfd6 | ||
|
|
9787347098 | ||
|
|
7023c590e4 | ||
|
|
593f998376 | ||
|
|
7206990ee1 | ||
|
|
5da4d3d784 | ||
|
|
a0b28c9678 | ||
|
|
c74e972691 |
No files matched your search
@@ -0,0 +1,40 @@
|
|||||||
|
# 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: Fast Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches-ignore:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
tox_test:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [ "3.11" ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||||||
|
|
||||||
|
- name: Test with tox
|
||||||
|
run: |
|
||||||
|
tox
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
# This workflows will upload a Python Package using Twine when a release is created
|
# 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
|
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||||
|
|
||||||
name: Publish Python Package to PyPi.org
|
name: Publish To PyPi.org
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
# 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: Test before push
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set up Python 3.x
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -r requirements.txt
|
|
||||||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
|
||||||
- name: Test with tox
|
|
||||||
run: |
|
|
||||||
tox
|
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# 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: Thorough Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
# check every 14 days
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 5,20 * *'
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
tox_test:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||||||
|
|
||||||
|
- name: Test with tox
|
||||||
|
run: |
|
||||||
|
tox
|
||||||
@@ -11,7 +11,7 @@ PyPi: [:
|
class S350Driver(NetworkDriver):
|
||||||
"""Napalm driver for S350."""
|
"""Napalm driver for S350."""
|
||||||
@@ -77,6 +79,8 @@ class S350Driver(NetworkDriver):
|
|||||||
"alt_key_file": "",
|
"alt_key_file": "",
|
||||||
"ssh_config_file": None,
|
"ssh_config_file": None,
|
||||||
"allow_agent": False,
|
"allow_agent": False,
|
||||||
|
"session_log": None,
|
||||||
|
"read_timeout_override": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow for passing additional Netmiko arguments
|
# Allow for passing additional Netmiko arguments
|
||||||
@@ -87,6 +91,7 @@ class S350Driver(NetworkDriver):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self.platform = "s350"
|
||||||
self.port = optional_args.get("port", 22)
|
self.port = optional_args.get("port", 22)
|
||||||
self.device = None
|
self.device = None
|
||||||
self.force_no_enable = optional_args.get("force_no_enable", False)
|
self.force_no_enable = optional_args.get("force_no_enable", False)
|
||||||
@@ -118,16 +123,6 @@ class S350Driver(NetworkDriver):
|
|||||||
"""Close the connection to the device."""
|
"""Close the connection to the device."""
|
||||||
self.device.disconnect()
|
self.device.disconnect()
|
||||||
|
|
||||||
def cli(self, commands):
|
|
||||||
output = {}
|
|
||||||
try:
|
|
||||||
for cmd in commands:
|
|
||||||
output[cmd] = self.device.send_command(cmd)
|
|
||||||
|
|
||||||
return output
|
|
||||||
except (socket.error, EOFError) as e:
|
|
||||||
raise ConnectionClosedException(str(e))
|
|
||||||
|
|
||||||
def _send_command(self, command):
|
def _send_command(self, command):
|
||||||
"""Wrapper for self.device.send.command().
|
"""Wrapper for self.device.send.command().
|
||||||
|
|
||||||
@@ -288,7 +283,8 @@ class S350Driver(NetworkDriver):
|
|||||||
fqdn = "{0}.{1}".format(hostname, domainname)
|
fqdn = "{0}.{1}".format(hostname, domainname)
|
||||||
|
|
||||||
# interface_list
|
# interface_list
|
||||||
interfaces = []
|
|
||||||
|
interfaces: List[str] = []
|
||||||
show_int_st = show_int_st.strip()
|
show_int_st = show_int_st.strip()
|
||||||
# remove the header information
|
# remove the header information
|
||||||
show_int_st = re.sub(
|
show_int_st = re.sub(
|
||||||
@@ -309,7 +305,7 @@ class S350Driver(NetworkDriver):
|
|||||||
"model": str(model),
|
"model": str(model),
|
||||||
"os_version": str(os_version),
|
"os_version": str(os_version),
|
||||||
"serial_number": str(serial_number),
|
"serial_number": str(serial_number),
|
||||||
"uptime": uptime,
|
"uptime": float(uptime),
|
||||||
"vendor": "Cisco",
|
"vendor": "Cisco",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +360,7 @@ class S350Driver(NetworkDriver):
|
|||||||
return uptime_str
|
return uptime_str
|
||||||
|
|
||||||
def _get_facts_parse_inventory(self, show_inventory):
|
def _get_facts_parse_inventory(self, show_inventory):
|
||||||
""" inventory can list more modules/devices """
|
"""inventory can list more modules/devices"""
|
||||||
# make 1 module 1 line
|
# make 1 module 1 line
|
||||||
show_inventory = re.sub(r"\nPID", " PID", show_inventory, re.M)
|
show_inventory = re.sub(r"\nPID", " PID", show_inventory, re.M)
|
||||||
# delete empty lines
|
# delete empty lines
|
||||||
@@ -471,7 +467,7 @@ class S350Driver(NetworkDriver):
|
|||||||
entry = {
|
entry = {
|
||||||
"is_up": is_up,
|
"is_up": is_up,
|
||||||
"is_enabled": is_enabled,
|
"is_enabled": is_enabled,
|
||||||
"speed": speed,
|
"speed": float(speed),
|
||||||
"mtu": mtu,
|
"mtu": mtu,
|
||||||
"last_flapped": -1.0,
|
"last_flapped": -1.0,
|
||||||
"description": description,
|
"description": description,
|
||||||
@@ -523,7 +519,7 @@ class S350Driver(NetworkDriver):
|
|||||||
return interfaces
|
return interfaces
|
||||||
|
|
||||||
def _get_ip_int_line_to_fields(self, line, fields_end):
|
def _get_ip_int_line_to_fields(self, line, fields_end):
|
||||||
""" dynamic fields lenghts """
|
"""dynamic fields lenghts"""
|
||||||
line_elems = {}
|
line_elems = {}
|
||||||
index = 0
|
index = 0
|
||||||
f_start = 0
|
f_start = 0
|
||||||
@@ -534,7 +530,7 @@ class S350Driver(NetworkDriver):
|
|||||||
return line_elems
|
return line_elems
|
||||||
|
|
||||||
def _get_ip_int_fields_end(self, dashline):
|
def _get_ip_int_fields_end(self, dashline):
|
||||||
""" fields length are diferent device to device, detect them on horizontal lin """
|
"""fields length are diferent device to device, detect them on horizontal line"""
|
||||||
|
|
||||||
fields_end = [m.start() for m in re.finditer(" ", dashline.strip())]
|
fields_end = [m.start() for m in re.finditer(" ", dashline.strip())]
|
||||||
# fields_position.insert(0,0)
|
# fields_position.insert(0,0)
|
||||||
@@ -588,7 +584,7 @@ class S350Driver(NetworkDriver):
|
|||||||
return neighbors
|
return neighbors
|
||||||
|
|
||||||
def _get_lldp_neighbors_line_to_fields(self, line, fields_end):
|
def _get_lldp_neighbors_line_to_fields(self, line, fields_end):
|
||||||
""" dynamic fields lenghts """
|
"""dynamic fields lenghts"""
|
||||||
line_elems = {}
|
line_elems = {}
|
||||||
index = 0
|
index = 0
|
||||||
f_start = 0
|
f_start = 0
|
||||||
@@ -599,7 +595,7 @@ class S350Driver(NetworkDriver):
|
|||||||
return line_elems
|
return line_elems
|
||||||
|
|
||||||
def _get_lldp_neighbors_fields_end(self, dashline):
|
def _get_lldp_neighbors_fields_end(self, dashline):
|
||||||
""" fields length are diferent device to device, detect them on horizontal lin """
|
"""fields length are diferent device to device, detect them on horizontal line"""
|
||||||
|
|
||||||
fields_end = [m.start() for m in re.finditer(" ", dashline)]
|
fields_end = [m.start() for m in re.finditer(" ", dashline)]
|
||||||
fields_end.append(len(dashline))
|
fields_end.append(len(dashline))
|
||||||
|
|||||||
+16
-12
@@ -1,12 +1,16 @@
|
|||||||
black==20.8b1
|
napalm<=4.0.0
|
||||||
coveralls==2.1.2
|
netmiko<=4.0.0
|
||||||
ddt==1.4.1
|
black<=24.3.0 # CVE-2024-21503
|
||||||
flake8-import-order==0.18.1
|
coveralls
|
||||||
pytest==5.4.3
|
ddt
|
||||||
pytest-cov==2.10.1
|
flake8-import-order
|
||||||
pytest-json==0.4.0
|
# pytest==6.2.5
|
||||||
pytest-pythonpath==0.7.3
|
pytest
|
||||||
pylama==7.7.1
|
pytest-cov
|
||||||
mock==4.0.2
|
pytest-json
|
||||||
tox==3.20.1
|
pytest-pythonpath
|
||||||
demjson
|
pylama
|
||||||
|
# pyflakes==2.4.0 #prevent problems
|
||||||
|
pyflakes
|
||||||
|
mock
|
||||||
|
tox
|
||||||
+3
-3
@@ -1,3 +1,3 @@
|
|||||||
napalm>=3.0.0
|
napalm<=4.0.0
|
||||||
netmiko>=3.1.0
|
netmiko<=4.0.0
|
||||||
netaddr
|
netaddr<=1.2.1
|
||||||
@@ -12,7 +12,7 @@ with open("README.md", "r") as fs:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="napalm-s350",
|
name="napalm-s350",
|
||||||
version="0.3.1",
|
version="0.4.1",
|
||||||
packages=find_packages(exclude=("test*",)),
|
packages=find_packages(exclude=("test*",)),
|
||||||
author="Jasper Lievisse Adriaanse, Petr Klíma, Daniel Bacher",
|
author="Jasper Lievisse Adriaanse, Petr Klíma, Daniel Bacher",
|
||||||
author_email="j@jasper.la, qaxi@seznam.cz, mail@phill93.de",
|
author_email="j@jasper.la, qaxi@seznam.cz, mail@phill93.de",
|
||||||
@@ -25,9 +25,12 @@ setup(
|
|||||||
"License :: OSI Approved :: Apache Software License",
|
"License :: OSI Approved :: Apache Software License",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.6",
|
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
"Operating System :: MacOS",
|
"Operating System :: MacOS",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Test fixtures."""
|
"""Test fixtures."""
|
||||||
|
|
||||||
from builtins import super
|
from builtins import super
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Tests for getters."""
|
"""Tests for getters."""
|
||||||
|
|
||||||
from napalm.base.test.getters import BaseTestGetters
|
from napalm.base.test.getters import BaseTestGetters
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
#envlist = py3{6,7,8},black,pylama,sphinx
|
envlist = py,pylama,black
|
||||||
envlist = py3{6,7,8},pylama,black
|
|
||||||
skip_missing_interpreters = true
|
skip_missing_interpreters = true
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
@@ -14,15 +13,9 @@ commands =
|
|||||||
|
|
||||||
[testenv:black]
|
[testenv:black]
|
||||||
commands =
|
commands =
|
||||||
black --check --target-version py36 --line-length 100 --color --diff .
|
black --check --target-version py312 --line-length 100 --color --diff .
|
||||||
|
|
||||||
[testenv:pylama]
|
[testenv:pylama]
|
||||||
commands =
|
commands =
|
||||||
pylama .
|
pylama .
|
||||||
|
|
||||||
[testenv:sphinx]
|
|
||||||
commands =
|
|
||||||
make doctest
|
|
||||||
|
|
||||||
whitelist_externals =
|
|
||||||
make
|
|
||||||
Reference in new issue
Block a user