Split topology discover into target, scan, and job modules.

Keep the discover facade stable for routers/tests while fixing the missing infer_device_type_vendor import on UME target resolution.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-02 17:50:10 +08:00
parent 083ff98574
commit 2068ce3d04
5 changed files with 782 additions and 736 deletions

View file

@ -183,8 +183,8 @@ class FabricTopologyTests(unittest.TestCase):
with (
patch.object(svc, "upsert_fabric_edge", side_effect=flaky_upsert),
patch("netx_api.topology_discover.upsert_fabric_edge", side_effect=flaky_upsert),
patch("netx_api.topology_discover._sleep_deadlock_backoff", return_value=None),
patch("netx_api.topology_discover_scan.upsert_fabric_edge", side_effect=flaky_upsert),
patch("netx_api.topology_discover_scan._sleep_deadlock_backoff", return_value=None),
):
out = svc._apply_discover_hits(
self.db,
@ -567,7 +567,7 @@ class FabricTopologyTests(unittest.TestCase):
"output": CISCO_LLDP_DETAIL,
"commands": ["show lldp neighbors detail"],
}
with patch("netx_api.topology_discover.execute_managed_ne_commands", return_value=fake_exec):
with patch("netx_api.topology_discover_scan.execute_managed_ne_commands", return_value=fake_exec):
job = svc.start_discover_job(
self.db,
FabricDiscoverRequest(scope="ne_ids", ne_ids=[ne_a.id], concurrency=1),
@ -742,7 +742,7 @@ Management Addresses:
"output": lldp_out,
"commands": ["show lldp neighbors detail"],
}
with patch("netx_api.topology_discover.execute_managed_ne_commands", return_value=fake_exec):
with patch("netx_api.topology_discover_scan.execute_managed_ne_commands", return_value=fake_exec):
job = svc.start_discover_job(
self.db,
FabricDiscoverRequest(