Author SHA1 Message Date
Petr Klíma e43b99aae9 move to version 0.5.0 2024-04-22 16:11:43 +02:00
Petr Klíma 8e73262261 move version to 5.0.0 2024-04-22 16:09:50 +02:00
d76fa4cd46 Make it napalm 5 compliant (#92)
* use netmiko_args

* Add changes for 4.1.0 (#89)

* Update requirements.txt

* Typpo in requirements

* _send_command has only two parameters

* Adapt to stricter Unit tests

---------

Co-authored-by: Anton Gridnev <anton@gridnev.pro>

* Remove s350_base_interfaces custom map - it is allready in napalm base

* Adapt Unit tests to canonical_interface_name()

* Add format parameter to get_config()

* Add badges

---------

Co-authored-by: Dave <davama@gmail.com>
Co-authored-by: Anton Gridnev <anton@gridnev.pro>
2024-04-22 16:08:58 +02:00
Petr Klíma 1efdaaf26b move version to 0.4.1.1 2024-04-05 08:00:16 +02:00
e320121d27 Adapt to napalm 4.1 tests (#90)
* use netmiko_args

* Add changes for 4.1.0 (#89)

* Update requirements.txt

* Typpo in requirements

* _send_command has only two parameters

* Adapt to stricter Unit tests

---------

Co-authored-by: Anton Gridnev <anton@gridnev.pro>

* Remove s350_base_interfaces custom map - it is allready in napalm base

* Adapt Unit tests to canonical_interface_name()

---------

Co-authored-by: Dave <davama@gmail.com>
Co-authored-by: Anton Gridnev <anton@gridnev.pro>
2024-03-29 17:23:46 +01:00
Petr Klima 9d6c4ea88b Lift version to 0.4.1 2024-03-29 17:17:20 +01:00
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
36 changed files with 230 additions and 210 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 # 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:
-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
+5 -4
View File
@@ -3,15 +3,16 @@
NAPALM driver for Cisco SMB switches (SF3xx, SF5xx, SG3xx, SG5xx, CBS35x). NAPALM driver for Cisco SMB switches (SF3xx, SF5xx, SG3xx, SG5xx, CBS35x).
## Status ## Status
Master: ![Build](https://github.com/napalm-automation-community/napalm-s350/workflows/Test%20before%20push/badge.svg?branch=master&event=push)
Develop: ![Build](https://github.com/napalm-automation-community/napalm-s350/workflows/Test%20before%20push/badge.svg?branch=develop&event=push) Master: [![Thorough Test](https://github.com/napalm-automation-community/napalm-s350/actions/workflows/ThoroughTest.yml/badge.svg?branch=master)](https://github.com/napalm-automation-community/napalm-s350/actions/workflows/ThoroughTest.yml)
PyPi: [![Upload](https://github.com/napalm-automation-community/napalm-s350/workflows/Upload%20Python%20Package%20to%20PyPi.org/badge.svg)](https://github.com/napalm-automation-community/napalm-s350/actions?query=workflow%3A%22Upload+Python+Package+to+PyPi.org%22) Develop: [![Thorough Test](https://github.com/napalm-automation-community/napalm-s350/actions/workflows/ThoroughTest.yml/badge.svg?branch=develop)](https://github.com/napalm-automation-community/napalm-s350/actions/workflows/ThoroughTest.yml)
PyPi.org: [![Publish To PyPi.org](https://github.com/napalm-automation-community/napalm-s350/actions/workflows/PublishToPIP.yml/badge.svg?branch=master)](https://github.com/napalm-automation-community/napalm-s350/actions/workflows/PublishToPIP.yml)
## Requirements ## Requirements
Python 3.6+, napalm 3+ Python 3.8+, napalm 4
## Installation ## Installation
+28 -57
View File
@@ -33,17 +33,12 @@ from napalm.base.exceptions import (
ConnectionClosedException, ConnectionClosedException,
) )
from napalm.base.helpers import canonical_interface_name from napalm.base.helpers import canonical_interface_name
from napalm.base.netmiko_helpers import netmiko_args
import napalm.base.constants as C import napalm.base.constants as C
import napalm.base.canonical_map import napalm.base.canonical_map
# make may own base_interfaces for s350 from typing import List
s350_base_interfaces = {
**napalm.base.canonical_map.base_interfaces,
"fa": "FastEthernet",
"gi": "GigabitEthernet",
"te": "TengigabitEthernet",
}
class S350Driver(NetworkDriver): class S350Driver(NetworkDriver):
@@ -63,30 +58,9 @@ class S350Driver(NetworkDriver):
self._dest_file_system = optional_args.get("dest_file_system", None) self._dest_file_system = optional_args.get("dest_file_system", None)
# Netmiko possible arguments # Netmiko possible arguments
netmiko_argument_map = { self.netmiko_optional_args = netmiko_args(optional_args)
"port": None,
"secret": "",
"verbose": False,
"keepalive": 30,
"global_delay_factor": 1,
"use_keys": False,
"key_file": None,
"ssh_strict": False,
"system_host_keys": False,
"alt_host_keys": False,
"alt_key_file": "",
"ssh_config_file": None,
"allow_agent": False,
}
# Allow for passing additional Netmiko arguments
self.netmiko_optional_args = {}
for k, v in netmiko_argument_map.items():
try:
self.netmiko_optional_args[k] = optional_args[k]
except KeyError:
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 +92,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().
@@ -180,7 +144,7 @@ class S350Driver(NetworkDriver):
else: else:
raise ValueError("Unexpected output: {}".format(line.split())) raise ValueError("Unexpected output: {}".format(line.split()))
interface = canonical_interface_name(interface, s350_base_interfaces) interface = canonical_interface_name(interface)
entry = { entry = {
"interface": interface, "interface": interface,
@@ -193,7 +157,13 @@ class S350Driver(NetworkDriver):
return arp_table return arp_table
def get_config(self, retrieve="all", full=False, sanitized=False): def get_config(
self,
retrieve="all",
full=False,
sanitized=False,
format: str = "text",
):
""" """
get_config for S350. Since this firmware doesn't support a candidate get_config for S350. Since this firmware doesn't support a candidate
configuration we leave it empty. configuration we leave it empty.
@@ -288,7 +258,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(
@@ -298,7 +269,7 @@ class S350Driver(NetworkDriver):
if not line: if not line:
continue continue
interface = line.split()[0] interface = line.split()[0]
interface = canonical_interface_name(interface, s350_base_interfaces) interface = canonical_interface_name(interface)
interfaces.append(str(interface)) interfaces.append(str(interface))
@@ -309,7 +280,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 +335,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,14 +442,14 @@ 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,
"mac_address": napalm.base.helpers.mac(mac), "mac_address": napalm.base.helpers.mac(mac),
} }
interface = canonical_interface_name(interface, s350_base_interfaces) interface = canonical_interface_name(interface)
interfaces[interface] = entry interfaces[interface] = entry
@@ -516,14 +487,14 @@ class S350Driver(NetworkDriver):
ip = netaddr.IPNetwork(cidr) ip = netaddr.IPNetwork(cidr)
family = "ipv{0}".format(ip.version) family = "ipv{0}".format(ip.version)
interface = canonical_interface_name(interface, s350_base_interfaces) interface = canonical_interface_name(interface)
interfaces[interface] = {family: {str(ip.ip): {"prefix_length": ip.prefixlen}}} interfaces[interface] = {family: {str(ip.ip): {"prefix_length": ip.prefixlen}}}
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 +505,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)
@@ -574,7 +545,7 @@ class S350Driver(NetworkDriver):
remote_port = line_elems[2] remote_port = line_elems[2]
remote_name = line_elems[3] remote_name = line_elems[3]
local_port = canonical_interface_name(local_port, s350_base_interfaces) local_port = canonical_interface_name(local_port)
neighbor = { neighbor = {
"hostname": remote_name, "hostname": remote_name,
@@ -588,7 +559,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 +570,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))
@@ -628,14 +599,14 @@ class S350Driver(NetworkDriver):
if interface: if interface:
if interface == local_port: if interface == local_port:
entry = self._get_lldp_neighbors_detail_parse(local_port) entry = self._get_lldp_neighbors_detail_parse(local_port)
local_port = canonical_interface_name(local_port, s350_base_interfaces) local_port = canonical_interface_name(local_port)
details[local_port] = [ details[local_port] = [
entry, entry,
] ]
else: else:
entry = self._get_lldp_neighbors_detail_parse(local_port) entry = self._get_lldp_neighbors_detail_parse(local_port)
local_port = canonical_interface_name(local_port, s350_base_interfaces) local_port = canonical_interface_name(local_port)
details[local_port] = [ details[local_port] = [
entry, entry,
] ]
@@ -670,7 +641,7 @@ class S350Driver(NetworkDriver):
elif line.startswith("Capabilities"): elif line.startswith("Capabilities"):
caps = self._get_lldp_neighbors_detail_capabilities_parse(line) caps = self._get_lldp_neighbors_detail_capabilities_parse(line)
remote_port_id = canonical_interface_name(remote_port_id, s350_base_interfaces) remote_port_id = canonical_interface_name(remote_port_id)
entry = { entry = {
"parent_interface": "N/A", "parent_interface": "N/A",
+14 -12
View File
@@ -1,12 +1,14 @@
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
pytest-pythonpath==0.7.3 pytest-cov
pylama==7.7.1 pytest-json
mock==4.0.2 pytest-pythonpath
tox==3.20.1 pylama
demjson pyflakes
mock
tox
+3 -3
View File
@@ -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
+6 -3
View File
@@ -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.5.0",
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
View File
@@ -1,4 +1,5 @@
"""Test fixtures.""" """Test fixtures."""
from builtins import super from builtins import super
import pytest import pytest
@@ -1,3 +1,3 @@
[ [
{"interface": "vlan 1", "mac": "9C:EB:E8:AA:BB:CC", "ip": "192.168.1.1", "age": 0.0} {"interface": "VLAN1", "mac": "9C:EB:E8:AA:BB:CC", "ip": "192.168.1.1", "age": 0.0}
] ]
@@ -1,12 +1,12 @@
[ [
{"interface": "TengigabitEthernet1/0/1", "mac": "00:00:0C:07:AC:01", "ip": "19.51.0.1", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "00:00:0C:07:AC:01", "ip": "19.51.0.1", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "E4:C7:22:FE:E0:43", "ip": "19.51.0.2", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "E4:C7:22:FE:E0:43", "ip": "19.51.0.2", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:15:AA", "ip": "19.51.0.5", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:15:AA", "ip": "19.51.0.5", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:14:6F", "ip": "19.51.0.3", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:14:6F", "ip": "19.51.0.3", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "5C:8A:38:2E:BD:C0", "ip": "19.51.0.1", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "5C:8A:38:2E:BD:C0", "ip": "19.51.0.1", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "5C:8A:38:2E:FD:E0", "ip": "19.51.0.8", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "5C:8A:38:2E:FD:E0", "ip": "19.51.0.8", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "00:50:56:93:19:B7", "ip": "19.51.1.4", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "00:50:56:93:19:B7", "ip": "19.51.1.4", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "00:50:56:92:2F:CB", "ip": "19.51.1.5", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "00:50:56:92:2F:CB", "ip": "19.51.1.5", "age": 0.0},
{"interface": "vlan 852", "mac": "00:50:56:9E:51:F3", "ip": "19.51.1.2", "age": 0.0}, {"interface": "VLAN852", "mac": "00:50:56:9E:51:F3", "ip": "19.51.1.2", "age": 0.0},
{"interface": "vlan 852", "mac": "A4:4C:C8:7D:37:03", "ip": "19.51.14.5", "age": 0.0} {"interface": "VLAN852", "mac": "A4:4C:C8:7D:37:03", "ip": "19.51.14.5", "age": 0.0}
] ]
@@ -1,4 +1,4 @@
[ [
{"interface": "vlan 202", "mac": "00:15:17:27:9C:4D", "ip": "10.0.3.1", "age": 0.0}, {"interface": "VLAN202", "mac": "00:15:17:27:9C:4D", "ip": "10.0.3.1", "age": 0.0},
{"interface": "vlan 202", "mac": "00:50:56:90:23:E8", "ip": "10.0.3.4", "age": 0.0} {"interface": "VLAN202", "mac": "00:50:56:90:23:E8", "ip": "10.0.3.4", "age": 0.0}
] ]
@@ -1,61 +1,61 @@
[ [
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.1", "ip" : "192.168.0.1",
"mac" : "AB:00:EF:12:34:56" "mac" : "AB:00:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.2", "ip" : "192.168.0.2",
"mac" : "AB:C7:EF:12:34:56" "mac" : "AB:C7:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.65", "ip" : "192.168.0.65",
"mac" : "AB:EA:EF:12:34:56" "mac" : "AB:EA:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.73", "ip" : "192.168.0.73",
"mac" : "AB:EA:EF:12:34:56" "mac" : "AB:EA:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.40", "ip" : "192.168.0.40",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.44", "ip" : "192.168.0.44",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "vlan 1", "interface" : "VLAN1",
"ip" : "192.168.0.4", "ip" : "192.168.0.4",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.49", "ip" : "192.168.0.49",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.2", "ip" : "192.168.0.2",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "vlan 1", "interface" : "VLAN1",
"ip" : "192.168.0.142", "ip" : "192.168.0.142",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
} }
@@ -1,3 +1,3 @@
[ [
{"interface": "vlan 1", "mac": "9C:EB:E8:AA:BB:CC", "ip": "192.168.1.1", "age": 0.0} {"interface": "VLAN1", "mac": "9C:EB:E8:AA:BB:CC", "ip": "192.168.1.1", "age": 0.0}
] ]
@@ -1,12 +1,12 @@
[ [
{"interface": "TengigabitEthernet1/0/1", "mac": "00:00:0C:07:AC:01", "ip": "19.51.0.1", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "00:00:0C:07:AC:01", "ip": "19.51.0.1", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "E4:C7:22:FE:E0:43", "ip": "19.51.0.2", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "E4:C7:22:FE:E0:43", "ip": "19.51.0.2", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:15:AA", "ip": "19.51.0.5", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:15:AA", "ip": "19.51.0.5", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:14:6F", "ip": "19.51.0.3", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "BC:EA:FA:B4:14:6F", "ip": "19.51.0.3", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "5C:8A:38:2E:BD:C0", "ip": "19.51.0.1", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "5C:8A:38:2E:BD:C0", "ip": "19.51.0.1", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "5C:8A:38:2E:FD:E0", "ip": "19.51.0.8", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "5C:8A:38:2E:FD:E0", "ip": "19.51.0.8", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "00:50:56:93:19:B7", "ip": "19.51.1.4", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "00:50:56:93:19:B7", "ip": "19.51.1.4", "age": 0.0},
{"interface": "TengigabitEthernet1/0/1", "mac": "00:50:56:92:2F:CB", "ip": "19.51.1.5", "age": 0.0}, {"interface": "TenGigabitEthernet1/0/1", "mac": "00:50:56:92:2F:CB", "ip": "19.51.1.5", "age": 0.0},
{"interface": "vlan 852", "mac": "00:50:56:9E:51:F3", "ip": "19.51.1.2", "age": 0.0}, {"interface": "VLAN852", "mac": "00:50:56:9E:51:F3", "ip": "19.51.1.2", "age": 0.0},
{"interface": "vlan 852", "mac": "A4:4C:C8:7D:37:03", "ip": "19.51.14.5", "age": 0.0} {"interface": "VLAN852", "mac": "A4:4C:C8:7D:37:03", "ip": "19.51.14.5", "age": 0.0}
] ]
@@ -1,4 +1,4 @@
[ [
{"interface": "vlan 202", "mac": "00:15:17:27:9C:4D", "ip": "10.0.3.1", "age": 0.0}, {"interface": "VLAN202", "mac": "00:15:17:27:9C:4D", "ip": "10.0.3.1", "age": 0.0},
{"interface": "vlan 202", "mac": "00:50:56:90:23:E8", "ip": "10.0.3.4", "age": 0.0} {"interface": "VLAN202", "mac": "00:50:56:90:23:E8", "ip": "10.0.3.4", "age": 0.0}
] ]
@@ -1,61 +1,61 @@
[ [
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.1", "ip" : "192.168.0.1",
"mac" : "AB:00:EF:12:34:56" "mac" : "AB:00:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.2", "ip" : "192.168.0.2",
"mac" : "AB:C7:EF:12:34:56" "mac" : "AB:C7:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.65", "ip" : "192.168.0.65",
"mac" : "AB:EA:EF:12:34:56" "mac" : "AB:EA:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.73", "ip" : "192.168.0.73",
"mac" : "AB:EA:EF:12:34:56" "mac" : "AB:EA:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.40", "ip" : "192.168.0.40",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.44", "ip" : "192.168.0.44",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "vlan 1", "interface" : "VLAN1",
"ip" : "192.168.0.4", "ip" : "192.168.0.4",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.49", "ip" : "192.168.0.49",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "TengigabitEthernet1/0/4", "interface" : "TenGigabitEthernet1/0/4",
"ip" : "192.168.0.2", "ip" : "192.168.0.2",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
}, },
{ {
"age" : 0.0, "age" : 0.0,
"interface" : "vlan 1", "interface" : "VLAN1",
"ip" : "192.168.0.142", "ip" : "192.168.0.142",
"mac" : "AB:50:EF:12:34:56" "mac" : "AB:50:EF:12:34:56"
} }
@@ -50,10 +50,10 @@
"GigabitEthernet1/0/46", "GigabitEthernet1/0/46",
"GigabitEthernet1/0/47", "GigabitEthernet1/0/47",
"GigabitEthernet1/0/48", "GigabitEthernet1/0/48",
"TengigabitEthernet1/0/1", "TenGigabitEthernet1/0/1",
"TengigabitEthernet1/0/2", "TenGigabitEthernet1/0/2",
"TengigabitEthernet1/0/3", "TenGigabitEthernet1/0/3",
"TengigabitEthernet1/0/4", "TenGigabitEthernet1/0/4",
"Port-channel1", "Port-channel1",
"Port-channel2", "Port-channel2",
"Port-channel3", "Port-channel3",
@@ -50,10 +50,10 @@
"GigabitEthernet1/0/46", "GigabitEthernet1/0/46",
"GigabitEthernet1/0/47", "GigabitEthernet1/0/47",
"GigabitEthernet1/0/48", "GigabitEthernet1/0/48",
"TengigabitEthernet1/0/1", "TenGigabitEthernet1/0/1",
"TengigabitEthernet1/0/2", "TenGigabitEthernet1/0/2",
"TengigabitEthernet1/0/3", "TenGigabitEthernet1/0/3",
"TengigabitEthernet1/0/4", "TenGigabitEthernet1/0/4",
"Port-channel1", "Port-channel1",
"Port-channel2", "Port-channel2",
"Port-channel3", "Port-channel3",
@@ -50,10 +50,10 @@
"GigabitEthernet1/0/46", "GigabitEthernet1/0/46",
"GigabitEthernet1/0/47", "GigabitEthernet1/0/47",
"GigabitEthernet1/0/48", "GigabitEthernet1/0/48",
"TengigabitEthernet1/0/1", "TenGigabitEthernet1/0/1",
"TengigabitEthernet1/0/2", "TenGigabitEthernet1/0/2",
"TengigabitEthernet1/0/3", "TenGigabitEthernet1/0/3",
"TengigabitEthernet1/0/4", "TenGigabitEthernet1/0/4",
"Port-channel1", "Port-channel1",
"Port-channel2", "Port-channel2",
"Port-channel3", "Port-channel3",
@@ -26,10 +26,10 @@
"GigabitEthernet1/0/22", "GigabitEthernet1/0/22",
"GigabitEthernet1/0/23", "GigabitEthernet1/0/23",
"GigabitEthernet1/0/24", "GigabitEthernet1/0/24",
"TengigabitEthernet1/0/1", "TenGigabitEthernet1/0/1",
"TengigabitEthernet1/0/2", "TenGigabitEthernet1/0/2",
"TengigabitEthernet1/0/3", "TenGigabitEthernet1/0/3",
"TengigabitEthernet1/0/4", "TenGigabitEthernet1/0/4",
"Port-channel1", "Port-channel1",
"Port-channel2", "Port-channel2",
"Port-channel3", "Port-channel3",
@@ -431,7 +431,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 0 "speed" : 0
}, },
"TengigabitEthernet1/0/1" : { "TenGigabitEthernet1/0/1" : {
"description" : "T1", "description" : "T1",
"is_enabled" : true, "is_enabled" : true,
"is_up" : true, "is_up" : true,
@@ -440,7 +440,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 1000 "speed" : 1000
}, },
"TengigabitEthernet1/0/2" : { "TenGigabitEthernet1/0/2" : {
"description" : "", "description" : "",
"is_enabled" : false, "is_enabled" : false,
"is_up" : false, "is_up" : false,
@@ -449,7 +449,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 0 "speed" : 0
}, },
"TengigabitEthernet1/0/3" : { "TenGigabitEthernet1/0/3" : {
"description" : "T2", "description" : "T2",
"is_enabled" : true, "is_enabled" : true,
"is_up" : true, "is_up" : true,
@@ -458,7 +458,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 1000 "speed" : 1000
}, },
"TengigabitEthernet1/0/4" : { "TenGigabitEthernet1/0/4" : {
"description" : "T3", "description" : "T3",
"is_enabled" : true, "is_enabled" : true,
"is_up" : true, "is_up" : true,
@@ -215,7 +215,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 0 "speed" : 0
}, },
"TengigabitEthernet1/0/1" : { "TenGigabitEthernet1/0/1" : {
"description" : "SW switch-c", "description" : "SW switch-c",
"is_enabled" : true, "is_enabled" : true,
"is_up" : true, "is_up" : true,
@@ -224,7 +224,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 1000 "speed" : 1000
}, },
"TengigabitEthernet1/0/2" : { "TenGigabitEthernet1/0/2" : {
"description" : "", "description" : "",
"is_enabled" : false, "is_enabled" : false,
"is_up" : false, "is_up" : false,
@@ -233,7 +233,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 0 "speed" : 0
}, },
"TengigabitEthernet1/0/3" : { "TenGigabitEthernet1/0/3" : {
"description" : "", "description" : "",
"is_enabled" : false, "is_enabled" : false,
"is_up" : false, "is_up" : false,
@@ -242,7 +242,7 @@
"mtu" : 9000, "mtu" : 9000,
"speed" : 0 "speed" : 0
}, },
"TengigabitEthernet1/0/4" : { "TenGigabitEthernet1/0/4" : {
"description" : "SW switch-c", "description" : "SW switch-c",
"is_enabled" : true, "is_enabled" : true,
"is_up" : true, "is_up" : true,
@@ -1,4 +1,4 @@
{ {
"vlan 10" : { "ipv4" : { "10.1.2.2" : { "prefix_length" : 24 } } }, "VLAN10" : { "ipv4" : { "10.1.2.2" : { "prefix_length" : 24 } } },
"vlan 80" : { "ipv4" : { "10.0.0.150" : { "prefix_length" : 24 } } } "VLAN80" : { "ipv4" : { "10.0.0.150" : { "prefix_length" : 24 } } }
} }
@@ -1 +1 @@
{ "vlan 1" : { "ipv4" : { "192.168.1.254" : { "prefix_length" : 24 } } } } { "VLAN1" : { "ipv4" : { "192.168.1.254" : { "prefix_length" : 24 } } } }
@@ -1,4 +1,4 @@
{ {
"vlan 1" : { "ipv4" : { "198.51.100.2" : { "prefix_length" : 24 } } }, "VLAN1" : { "ipv4" : { "198.51.100.2" : { "prefix_length" : 24 } } },
"vlan 852" : { "ipv4" : { "198.51.100.1" : { "prefix_length" : 16 } } } "VLAN852" : { "ipv4" : { "198.51.100.1" : { "prefix_length" : 16 } } }
} }
@@ -1 +1 @@
{"vlan 202": {"ipv4": {"10.0.3.5": {"prefix_length": 8}}}} {"VLAN202": {"ipv4": {"10.0.3.5": {"prefix_length": 8}}}}
@@ -1 +1 @@
{"vlan 1": {"ipv4": {"192.168.0.37": {"prefix_length": 17}}}} {"VLAN1": {"ipv4": {"192.168.0.37": {"prefix_length": 17}}}}
@@ -7,15 +7,15 @@
"hostname" : "", "hostname" : "",
"port" : "34:e6:aa:ff:53:a8" "port" : "34:e6:aa:ff:53:a8"
} ], } ],
"TengigabitEthernet1/0/1" : [ { "TenGigabitEthernet1/0/1" : [ {
"hostname" : "swzdsadas-vedc", "hostname" : "swzdsadas-vedc",
"port" : "Gi0/23" "port" : "Gi0/23"
} ], } ],
"TengigabitEthernet1/0/3" : [ { "TenGigabitEthernet1/0/3" : [ {
"hostname" : "sw1dsafdsfsdf.example.net", "hostname" : "sw1dsafdsfsdf.example.net",
"port" : "gi28" "port" : "gi28"
} ], } ],
"TengigabitEthernet1/0/4" : [ { "TenGigabitEthernet1/0/4" : [ {
"hostname" : "sw2dsdfssddfd", "hostname" : "sw2dsdfssddfd",
"port" : "te1/0/4" "port" : "te1/0/4"
} ] } ]
@@ -7,15 +7,15 @@
"hostname" : "", "hostname" : "",
"port" : "34:e6:aa:ff:53:a8" "port" : "34:e6:aa:ff:53:a8"
} ], } ],
"TengigabitEthernet1/0/1" : [ { "TenGigabitEthernet1/0/1" : [ {
"hostname" : "swzdsadas-vedc", "hostname" : "swzdsadas-vedc",
"port" : "Gi0/23" "port" : "Gi0/23"
} ], } ],
"TengigabitEthernet1/0/3" : [ { "TenGigabitEthernet1/0/3" : [ {
"hostname" : "sw1dsafdsfsdfsdd", "hostname" : "sw1dsafdsfsdfsdd",
"port" : "gi28" "port" : "gi28"
} ], } ],
"TengigabitEthernet1/0/4" : [ { "TenGigabitEthernet1/0/4" : [ {
"hostname" : "sw2dsdfssddfd", "hostname" : "sw2dsdfssddfd",
"port" : "te1/0/4" "port" : "te1/0/4"
} ] } ]
@@ -15,11 +15,11 @@
"hostname" : "ab:48:ef:12:34:56", "hostname" : "ab:48:ef:12:34:56",
"port" : "ab:48:ef:12:34:56" "port" : "ab:48:ef:12:34:56"
} ], } ],
"TengigabitEthernet1/0/1" : [ { "TenGigabitEthernet1/0/1" : [ {
"hostname" : "switch-c", "hostname" : "switch-c",
"port" : "gi1/0/1" "port" : "gi1/0/1"
} ], } ],
"TengigabitEthernet1/0/4" : [ { "TenGigabitEthernet1/0/4" : [ {
"hostname" : "switch-c.cb.madeta.cz", "hostname" : "switch-c.cb.madeta.cz",
"port" : "Gi1/0/26" "port" : "Gi1/0/26"
} ] } ]
@@ -1,4 +1,4 @@
{ "TengigabitEthernet1/0/4" : [ { { "TenGigabitEthernet1/0/4" : [ {
"parent_interface" : "N/A", "parent_interface" : "N/A",
"remote_chassis_id" : "ab:a5:ef:12:34:56", "remote_chassis_id" : "ab:a5:ef:12:34:56",
"remote_port" : "GigabitEthernet1/0/26", "remote_port" : "GigabitEthernet1/0/26",
+1
View File
@@ -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
+2 -9
View File
@@ -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