Skip to content

Commit 346ac79

Browse files
fix: improve device model matching flexibility for handlers
Update handler selection logic to support model prefix matching instead of exact matching, allowing handlers to support model variants (e.g., "ce6800" matches "ce" handler). Register AristaEOSHandler in factory and align test fixture model name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 614446c commit 346ac79

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

components/netdriver/server/handlers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,7 @@ def create_handler(process: SSHServerProcess,
7171
return PaloaltoPAHandler(process, conf_path)
7272
elif HuaweiCEHandler.is_selectable(vendor, model, version):
7373
return HuaweiCEHandler(process, conf_path)
74+
elif AristaEOSHandler.is_selectable(vendor, model, version):
75+
return AristaEOSHandler(process, conf_path)
7476
else:
7577
raise ValueError(f"Unsupported device: {vendor}:{model}:{version}")

components/netdriver/server/handlers/huawei/huawei_ce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class HuaweiCEHandler(CommandHandler):
2222
@classmethod
2323
def is_selectable(cls, vendor: str, model: str, version: str) -> bool:
2424
# only check vendor and model, check version in the future
25-
if cls.info.vendor == vendor and cls.info.model == model:
25+
if cls.info.vendor == vendor and model.startswith(cls.info.model):
2626
return True
2727

2828
def __init__(self, process: SSHServerProcess, conf_path: str = None):

tests/bases/netdriver/agent/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def arista_eos_dev(request: pytest.FixtureRequest) -> Generator[dict, None, None
405405
}
406406
else:
407407
port = 18039
408-
dev = MockSSHDevice.create_device(vendor="arista", model="eos-lab", version="4.31.2F", port=port)
408+
dev = MockSSHDevice.create_device(vendor="arista", model="eos", version="4.31.2F", port=port)
409409
runner = AsyncRunner(dev)
410410
thread = threading.Thread(target=runner)
411411
thread.daemon = True

0 commit comments

Comments
 (0)