Wire BGP neighbor in/out discover to config BGP peer intent.

Filter peers by AFI (and VRF pairs for CE), support zip/pair bindings in discover UI, and tag FIB rows with address_families.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-21 20:19:29 +08:00
parent 3c3013dd73
commit dd8d46aebc
10 changed files with 490 additions and 110 deletions

View file

@ -38,6 +38,7 @@ def _map_fsm_rows(rows: list[dict[str, Any]], *, vrf: str) -> list[dict[str, Any
"pri": row_get(r, "PRI", "pri")[:16],
"metric": row_get(r, "METRIC", "metric")[:32],
"flags": row_get(r, "FLAGS", "flags")[:16],
"address_families": "ipv4",
}
)
return out
@ -67,6 +68,7 @@ def _hand_parse(*, raw_text: str, vrf: str = "", **_kw: Any) -> list[dict[str, A
"pri": m.group("pri")[:16],
"metric": m.group("metric")[:32],
"flags": (m.group("flags") or "").strip()[:16],
"address_families": "ipv4",
}
)
return out

View file

@ -37,6 +37,7 @@ def _map_fsm_rows(rows: list[dict[str, Any]], *, vrf: str) -> list[dict[str, Any
"pri": row_get(r, "PRI", "pri")[:16],
"metric": row_get(r, "METRIC", "metric")[:32],
"flags": row_get(r, "FLAGS", "flags")[:16],
"address_families": "ipv6",
}
if gw or iface:
cur["gateway"] = gw[:128]
@ -77,6 +78,7 @@ def _hand_parse(*, raw_text: str, vrf: str = "", **_kw: Any) -> list[dict[str, A
"pri": m.group("pri")[:16],
"metric": m.group("metric")[:32],
"flags": (m.group("flags") or "")[:16],
"address_families": "ipv6",
}
continue
m2 = _NH_RE.match(line)