mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10:46 +08:00
Add BGP as <local_as> binding for multi-process ZTE collects.
Stamp local_as on peer/route/evpn results and discover (local_as, neighbor/vrf) pairs from config_bgp_peer so each router bgp process is collected separately. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b453c6871e
commit
262082ef08
10 changed files with 690 additions and 318 deletions
|
|
@ -223,7 +223,13 @@ def expand_from_bindings(
|
|||
val = params.get(ph.name) or params.get(ph.schema_field) or ""
|
||||
if ph.required and not val:
|
||||
raise ValueError(f"missing placeholder {ph.name} for {profile.profile_id}")
|
||||
rendered = rendered.replace(f"<{ph.name}>", val)
|
||||
if not val:
|
||||
# Optional empty: drop `` as <local_as>`` (or bare `` <name>``) so
|
||||
# legacy single-AS binds still render a valid show command.
|
||||
rendered = rendered.replace(f" as <{ph.name}>", "")
|
||||
rendered = rendered.replace(f"<{ph.name}>", "")
|
||||
else:
|
||||
rendered = rendered.replace(f"<{ph.name}>", val)
|
||||
concrete = normalize_command(rendered)
|
||||
if re.search(r"<[^>]+>", concrete):
|
||||
raise ValueError(f"unresolved placeholders in: {concrete}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue