31 Commits
Author SHA1 Message Date
Petr Klíma c3dea8ec10 Update to napalm 4
Merge pull request #87 from napalm-automation-community/develop
2024-03-27 09:25:36 +01:00
Petr Klíma 6e6b38b224 Merge branch 'master' into develop 2024-03-27 09:21:17 +01:00
Petr Klima 3a63056fa8 Check syntax for Py3.12 2024-03-27 09:14:14 +01:00
Petr Klima 08d9a45e77 Shorten name of publish workflow 2024-03-27 09:09:40 +01:00
Petr Klima fc9e83c4bb Updata docs 2024-03-27 09:07:39 +01:00
Petr Klima 9025b0f434 CI renaname job 2024-03-26 17:20:36 +01:00
Petr Klima d6dd81ea81 CI rename legacy jobs 2024-03-26 17:19:12 +01:00
Petr Klima 7a8fbac693 CI FastTest for all other branches. 2024-03-26 17:18:31 +01:00
Petr Klima a4f0473fd2 CI ThoroughTest for branches develop and master 2024-03-26 17:17:47 +01:00
Petr Klima 62f6ab4cc3 Do not test on PyPy, local test with local Py version only 2024-03-26 17:07:14 +01:00
Petr Klima 7009fc9121 Remove Py13 - too early 2024-03-26 16:50:48 +01:00
Petr Klima cfd1169760 Full tox testing on "develop" and "master" branch. 2024-03-26 16:35:18 +01:00
Petr Klima f3d13a5e31 Napalm 4 compatibility, newer dependencies 2024-03-26 16:29:04 +01:00
Petr Klíma 5a9bff81b9 Update PublishToPIP.yml for manual run 2024-03-26 15:42:47 +01:00
Petr Klíma e939d9e73d Update pkg version in setup.py 2024-03-26 15:34:19 +01:00
Petr Klíma b4fd77df46 Merge pull request #86 from napalm-automation-community/develop
Add security changes for black CVE-2024-21503, update test tools
2024-03-26 14:43:07 +01:00
Petr Klima 7e1d345af6 Add scheduled check on develop branch 2024-03-26 14:30:07 +01:00
Petr Klima de857ba48a Update information about required versions to Py3.8+ and napalm 3 2024-03-26 14:22:01 +01:00
Petr Klíma d1b960a407 Merge pull request #85 from napalm-automation-community/dependabot/pip/black-24.3.0
Bump black from 20.8b1 to 24.3.0 to address CVE-2024-21503
2024-03-26 14:14:18 +01:00
Petr Klima 7929c6411c FIX force interface speed as a float 2024-03-26 14:08:17 +01:00
Petr Klima 751126a1f5 FIX add platform name to driver s350 2024-03-26 14:07:10 +01:00
Petr Klima 7a32595838 Allow testing on all supported Py versions 2024-03-26 14:05:20 +01:00
Petr Klima 5049dcdfd6 FIX minor formating fixes raised by pylama 2024-03-26 14:04:04 +01:00
Petr Klima 9787347098 FIX limit napalm and netmiko o version 3.*, soften version requirements 2024-03-26 14:01:31 +01:00
Petr Klima 7023c590e4 FIX minor formating fixes raised by pylama 2024-03-26 14:00:02 +01:00
Petr Klima 593f998376 remove demjson - blocking tests 2024-03-26 12:55:55 +01:00
dependabot[bot] 7206990ee1 Bump black from 20.8b1 to 24.3.0
Bumps [black](https://github.com/psf/black) from 20.8b1 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/commits/24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-20 15:48:51 +00:00
Petr Klíma 5da4d3d784 Merge pull request #84 from davama/develop
adding read_timeout_override and session_log optional_args for netmiko
2023-08-28 09:12:30 +02:00
Dave a0b28c9678 adding netmiko option session_log 2023-02-16 16:19:07 -05:00
Dave c74e972691 adding read_timeout_override netmiko option 2023-01-30 08:48:15 -05:00
Petr Klima f30528f14f Merge branch 'master' into develop 2021-03-09 09:48:09 +01:00
12 changed files with 128 additions and 82 deletions

No files matched your search

+40
View File
@@ -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
+2 -1
View File
@@ -1,11 +1,12 @@
# 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: Publish Python Package to PyPi.org
name: Publish To PyPi.org
on:
release:
types: [created]
workflow_dispatch:
jobs:
deploy:
-35
View File
@@ -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
+42
View File
@@ -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
+1 -1
View File
@@ -11,7 +11,7 @@ PyPi: [![Upload](https://github.com/napalm-automation-community/napalm-s350/work
## Requirements
Python 3.6+, napalm 3+
Python 3.8+, napalm 4
## Installation
+14 -18
View File
@@ -45,6 +45,8 @@ s350_base_interfaces = {
"te": "TengigabitEthernet",
}
from typing import List
class S350Driver(NetworkDriver):
"""Napalm driver for S350."""
@@ -77,6 +79,8 @@ class S350Driver(NetworkDriver):
"alt_key_file": "",
"ssh_config_file": None,
"allow_agent": False,
"session_log": None,
"read_timeout_override": None,
}
# Allow for passing additional Netmiko arguments
@@ -87,6 +91,7 @@ class S350Driver(NetworkDriver):
except KeyError:
pass
self.platform = "s350"
self.port = optional_args.get("port", 22)
self.device = None
self.force_no_enable = optional_args.get("force_no_enable", False)
@@ -118,16 +123,6 @@ class S350Driver(NetworkDriver):
"""Close the connection to the device."""
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):
"""Wrapper for self.device.send.command().
@@ -288,7 +283,8 @@ class S350Driver(NetworkDriver):
fqdn = "{0}.{1}".format(hostname, domainname)
# interface_list
interfaces = []
interfaces: List[str] = []
show_int_st = show_int_st.strip()
# remove the header information
show_int_st = re.sub(
@@ -309,7 +305,7 @@ class S350Driver(NetworkDriver):
"model": str(model),
"os_version": str(os_version),
"serial_number": str(serial_number),
"uptime": uptime,
"uptime": float(uptime),
"vendor": "Cisco",
}
@@ -364,7 +360,7 @@ class S350Driver(NetworkDriver):
return uptime_str
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
show_inventory = re.sub(r"\nPID", " PID", show_inventory, re.M)
# delete empty lines
@@ -471,7 +467,7 @@ class S350Driver(NetworkDriver):
entry = {
"is_up": is_up,
"is_enabled": is_enabled,
"speed": speed,
"speed": float(speed),
"mtu": mtu,
"last_flapped": -1.0,
"description": description,
@@ -523,7 +519,7 @@ class S350Driver(NetworkDriver):
return interfaces
def _get_ip_int_line_to_fields(self, line, fields_end):
""" dynamic fields lenghts """
"""dynamic fields lenghts"""
line_elems = {}
index = 0
f_start = 0
@@ -534,7 +530,7 @@ class S350Driver(NetworkDriver):
return line_elems
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_position.insert(0,0)
@@ -588,7 +584,7 @@ class S350Driver(NetworkDriver):
return neighbors
def _get_lldp_neighbors_line_to_fields(self, line, fields_end):
""" dynamic fields lenghts """
"""dynamic fields lenghts"""
line_elems = {}
index = 0
f_start = 0
@@ -599,7 +595,7 @@ class S350Driver(NetworkDriver):
return line_elems
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.append(len(dashline))
+16 -12
View File
@@ -1,12 +1,16 @@
black==20.8b1
coveralls==2.1.2
ddt==1.4.1
flake8-import-order==0.18.1
pytest==5.4.3
pytest-cov==2.10.1
pytest-json==0.4.0
pytest-pythonpath==0.7.3
pylama==7.7.1
mock==4.0.2
tox==3.20.1
demjson
napalm<=4.0.0
netmiko<=4.0.0
black<=24.3.0 # CVE-2024-21503
coveralls
ddt
flake8-import-order
# pytest==6.2.5
pytest
pytest-cov
pytest-json
pytest-pythonpath
pylama
# pyflakes==2.4.0 #prevent problems
pyflakes
mock
tox
+3 -3
View File
@@ -1,3 +1,3 @@
napalm>=3.0.0
netmiko>=3.1.0
netaddr
napalm<=4.0.0
netmiko<=4.0.0
netaddr<=1.2.1
+6 -3
View File
@@ -12,7 +12,7 @@ with open("README.md", "r") as fs:
setup(
name="napalm-s350",
version="0.3.1",
version="0.4.0",
packages=find_packages(exclude=("test*",)),
author="Jasper Lievisse Adriaanse, Petr Klíma, Daniel Bacher",
author_email="j@jasper.la, qaxi@seznam.cz, mail@phill93.de",
@@ -25,9 +25,12 @@ setup(
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"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 :: MacOS",
],
+1
View File
@@ -1,4 +1,5 @@
"""Test fixtures."""
from builtins import super
import pytest
+1
View File
@@ -1,4 +1,5 @@
"""Tests for getters."""
from napalm.base.test.getters import BaseTestGetters
import pytest
+2 -9
View File
@@ -1,6 +1,5 @@
[tox]
#envlist = py3{6,7,8},black,pylama,sphinx
envlist = py3{6,7,8},pylama,black
envlist = py,pylama,black
skip_missing_interpreters = true
[testenv]
@@ -14,15 +13,9 @@ commands =
[testenv:black]
commands =
black --check --target-version py36 --line-length 100 --color --diff .
black --check --target-version py312 --line-length 100 --color --diff .
[testenv:pylama]
commands =
pylama .
[testenv:sphinx]
commands =
make doctest
whitelist_externals =
make