mirror of
https://github.com/hansjone/netx.git
synced 2026-10-18 01:40:51 +08:00
Decouple cutover HF from portrait and tighten ops UI.
Portrait stays on biz-monitor; cutover create/ensure owns purpose=cutover_hf slots with project collect override, multi-interval bindings, window pause, and industrial detail UX. Also expand ZTE collect/config parsers and TextFSM for route/BGP/L2VPN/VRRP coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a65c9fc420
commit
285c19e5a3
67 changed files with 9510 additions and 723 deletions
46
netx_api/biz_state/parsers/zte/config_common.py
Normal file
46
netx_api/biz_state/parsers/zte/config_common.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"""Helpers for ZTE MIM running-config section parsing."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
_MIM_OPEN = re.compile(r"^!<([^/>][^>]*)>\s*$")
|
||||
_MIM_CLOSE = re.compile(r"^!</([^>]+)>\s*$")
|
||||
|
||||
|
||||
def extract_mim_section(raw_text: str, section: str) -> str:
|
||||
"""Return body of ``!<section>`` … ``!</section>`` if present; else original text."""
|
||||
name = str(section or "").strip().lower()
|
||||
if not name:
|
||||
return str(raw_text or "")
|
||||
text = str(raw_text or "")
|
||||
lines = text.splitlines()
|
||||
start = -1
|
||||
for i, line in enumerate(lines):
|
||||
m = _MIM_OPEN.match(line.strip())
|
||||
if m and m.group(1).strip().lower() == name:
|
||||
start = i + 1
|
||||
break
|
||||
if start < 0:
|
||||
return text
|
||||
out: list[str] = []
|
||||
for line in lines[start:]:
|
||||
m = _MIM_CLOSE.match(line.strip())
|
||||
if m and m.group(1).strip().lower() == name:
|
||||
break
|
||||
out.append(line)
|
||||
return "\n".join(out)
|
||||
|
||||
|
||||
def is_secret_line(line: str) -> bool:
|
||||
low = str(line or "").lower()
|
||||
return any(
|
||||
k in low
|
||||
for k in (
|
||||
"password",
|
||||
"secret",
|
||||
"encrypted",
|
||||
"authentication-key",
|
||||
"pre-shared-key",
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue