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
This commit is contained in:
1 parent
6f9914f29e
commit
3e333d6bfd
3 files changed
+15
-18
No files matched your search
@@ -17,6 +17,9 @@ All notable changes to this driver. The format follows
|
|||||||
napalm-device-types' `ARP_AGE_UNKNOWN`) instead of `0.0`, which means "confirmed
|
napalm-device-types' `ARP_AGE_UNKNOWN`) instead of `0.0`, which means "confirmed
|
||||||
just now". The "Age (min)" column of `show arp` is not parsed until real switch
|
just now". The "Age (min)" column of `show arp` is not parsed until real switch
|
||||||
output confirms its format (NetOrk/netork#1327).
|
output confirms its format (NetOrk/netork#1327).
|
||||||
|
- A Netgear Plus switch is no longer offered as a ping-sweep source
|
||||||
|
(`supports_ping()` is `False`): its `ping` only raised, so every target of a sweep
|
||||||
|
came back as an error. `ping` still raises `NotImplementedError`, now NAPALM's own.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- **Breaking:** the Netgear Plus driver no longer has `set_vlan`, `delete_vlan` and
|
- **Breaking:** the Netgear Plus driver no longer has `set_vlan`, `delete_vlan` and
|
||||||
|
|||||||
@@ -548,23 +548,6 @@ class NetgearPlusDriver(FirmwareOfferMixin, SwitchDriver):
|
|||||||
def has_pending_commit(self) -> bool:
|
def has_pending_commit(self) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def ping(
|
|
||||||
self,
|
|
||||||
destination: str,
|
|
||||||
source: str = "",
|
|
||||||
ttl: int = 255,
|
|
||||||
timeout: int = 2,
|
|
||||||
size: int = 100,
|
|
||||||
count: int = 5,
|
|
||||||
vrf: str = "",
|
|
||||||
source_interface: str = "",
|
|
||||||
) -> dict[str, Any]:
|
|
||||||
"""Execute ping.
|
|
||||||
|
|
||||||
Not supported on Netgear Plus switches via HTTP.
|
|
||||||
"""
|
|
||||||
raise NotImplementedError("ping() is not supported for Netgear Plus switches.")
|
|
||||||
|
|
||||||
def traceroute(
|
def traceroute(
|
||||||
self,
|
self,
|
||||||
destination: str,
|
destination: str,
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
An application reads a capability from the method being there: netOrk offers
|
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
|
"Add VLAN" and the port VLAN editor when ``set_vlan`` / ``set_interface`` are
|
||||||
callable (#9). A method that only raises NotImplementedError
|
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.
|
made the HTTP-only Plus switches look able to do it.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -11,8 +12,18 @@ from __future__ import annotations
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from napalm_netgear.netgear_plus import NetgearPlusDriver
|
from napalm_netgear.netgear_plus import NetgearPlusDriver
|
||||||
|
from napalm_netgear.netgear_smart import NetgearSmartDriver
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("method", ["set_vlan", "delete_vlan", "set_interface"])
|
@pytest.mark.parametrize("method", ["set_vlan", "delete_vlan", "set_interface"])
|
||||||
def test_plus_has_no_vlan_or_port_writes(method):
|
def test_plus_has_no_vlan_or_port_writes(method):
|
||||||
assert not callable(getattr(NetgearPlusDriver, method, None))
|
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
|
||||||
Reference in new issue
Block a user