From f3d13a5e3111a1e209b242527b335bf5d17746ee Mon Sep 17 00:00:00 2001 From: Petr Klima Date: Tue, 26 Mar 2024 16:29:04 +0100 Subject: [PATCH] Napalm 4 compatibility, newer dependencies --- napalm_s350/s350.py | 17 +++++------------ requirements-dev.txt | 12 +++++++----- requirements.txt | 6 +++--- setup.py | 9 ++++++--- tox.ini | 9 +-------- 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/napalm_s350/s350.py b/napalm_s350/s350.py index f6c77d7..eb3a9b8 100644 --- a/napalm_s350/s350.py +++ b/napalm_s350/s350.py @@ -45,6 +45,8 @@ s350_base_interfaces = { "te": "TengigabitEthernet", } +from typing import List + class S350Driver(NetworkDriver): """Napalm driver for S350.""" @@ -121,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(). @@ -291,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( @@ -312,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", } diff --git a/requirements-dev.txt b/requirements-dev.txt index 69b67af..a8b9916 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,14 +1,16 @@ -napalm>=3.0.0, <4.0.0 -netmiko>=3.1.0, <4.0.0 -black +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==6.2.5 +pytest pytest-cov pytest-json pytest-pythonpath pylama -pyflakes==2.4.0 #prevent problems +# pyflakes==2.4.0 #prevent problems +pyflakes mock tox diff --git a/requirements.txt b/requirements.txt index 405545b..be9a920 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -napalm>=3.0.0, <4.0.0 -netmiko>=3.1.0, <4.0.0 -netaddr +napalm<=4.0.0 +netmiko<=4.0.0 +netaddr<=1.2.1 diff --git a/setup.py b/setup.py index 01362eb..66ede45 100644 --- a/setup.py +++ b/setup.py @@ -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", ], diff --git a/tox.ini b/tox.ini index d6c5f93..c938707 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] -#envlist = py3{6,7,8},black,pylama,sphinx -envlist = py3{8,9,10,11,12},pylama,black +envlist = py3{8,9,10,11,12,13},pylama,black skip_missing_interpreters = true [testenv] @@ -20,9 +19,3 @@ commands = commands = pylama . -[testenv:sphinx] -commands = - make doctest - -whitelist_externals = - make