mirror of
https://github.com/hansjone/netx.git
synced 2026-10-11 10:33:23 +08:00
Include UME inventory NEs in LLDP all-inventory discovery.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a5d88f8a24
commit
90bd323115
5 changed files with 63 additions and 3 deletions
|
|
@ -137,7 +137,12 @@ def _resolve_scan_targets(
|
|||
default_profile = get_default_profile(db)
|
||||
targets: list[dict[str, str]] = []
|
||||
if scope == "all_inventory":
|
||||
# Managed inventory first; then UME NEs not already covered by the same management IP.
|
||||
managed_ips: set[str] = set()
|
||||
for ne in db.query(ManagedNE).all():
|
||||
ip = str(ne.ip_address or "").strip()
|
||||
if ip:
|
||||
managed_ips.add(ip)
|
||||
targets.append(
|
||||
{
|
||||
"ne_id": ne.id,
|
||||
|
|
@ -148,6 +153,16 @@ def _resolve_scan_targets(
|
|||
"device_type": ne.device_type or "",
|
||||
}
|
||||
)
|
||||
for ume in db.query(UmeInventoryNE).all():
|
||||
uid = str(ume.ne_id or "").strip()
|
||||
if not uid:
|
||||
continue
|
||||
ip = str(ume.ip_address or "").strip()
|
||||
if ip and ip in managed_ips:
|
||||
continue
|
||||
row = _ume_target_dict(db, uid, default_profile)
|
||||
if row is not None:
|
||||
targets.append(row)
|
||||
return targets
|
||||
|
||||
managed_ids = [str(x).strip() for x in (body.managed_ne_ids or []) if str(x).strip()]
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class FabricNeighborhoodOut(BaseModel):
|
|||
class FabricDiscoverRequest(BaseModel):
|
||||
"""Start LLDP discovery into fabric (no CDP)."""
|
||||
|
||||
scope: str = Field(default="ne_ids", description="all_inventory | ne_ids")
|
||||
scope: str = Field(default="ne_ids", description="all_inventory (managed+UME) | ne_ids")
|
||||
ne_ids: list[str] = Field(
|
||||
default_factory=list,
|
||||
description="Legacy mixed ids (managed first, then ume). Prefer managed_ne_ids/ume_ne_ids.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue