Files
napalm-netgear/tests/unit/test_plus_capabilities.py
T
Christian Manivong 3e333d6bfd fix(plus): leave ping to NAPALM so sweeps skip Plus switches
The Plus driver overrode ping only to raise NotImplementedError. An
override is what napalm-device-types' driver_supports_ping looks for, so
the driver was offered as a ping-sweep source and every target came back
as an error. Without the override it inherits NAPALM's stub, which
raises the same way and reads as unsupported.

Closes #5
2026-11-01 21:54:31 +01:00

30 lines
1.0 KiB
Python

"""Netgear Plus only has the methods it can carry out.
An application reads a capability from the method being there: netOrk offers
"Add VLAN" and the port VLAN editor when ``set_vlan`` / ``set_interface`` are
callable (#9), and napalm-device-types takes a driver with a ``ping`` of its
own as a ping-sweep source (#5). A method that only raises NotImplementedError
made the HTTP-only Plus switches look able to do it.
"""
from __future__ import annotations
import pytest
from napalm_netgear.netgear_plus import NetgearPlusDriver
from napalm_netgear.netgear_smart import NetgearSmartDriver
@pytest.mark.parametrize("method", ["set_vlan", "delete_vlan", "set_interface"])
def test_plus_has_no_vlan_or_port_writes(method):
assert not callable(getattr(NetgearPlusDriver, method, None))
def test_plus_is_no_ping_sweep_source():
"""Its ping only raised, so every sweep target came back as an error (#5)."""
assert NetgearPlusDriver.supports_ping() is False
def test_smart_still_is_a_ping_sweep_source():
assert NetgearSmartDriver.supports_ping() is True