mirror of
https://github.com/hansjone/netx.git
synced 2026-10-18 15:00:45 +08:00
Add TextFSM rule tables as dual input to biz-state parsers.
Collectors apply RULE_KEYS (or index stems) into fsm_tables before normalize; parsers prefer FSM or hand-parse. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
24a1a853af
commit
02b8a7073b
25 changed files with 714 additions and 69 deletions
|
|
@ -6,10 +6,13 @@ from typing import Any
|
|||
|
||||
from ....lldp_shared import NeighborHit, parse_neighbor_output
|
||||
|
||||
RULE_KEYS: tuple[str, ...] = ()
|
||||
|
||||
|
||||
def normalize_lldp_neighbors(
|
||||
*,
|
||||
raw_text: str,
|
||||
fsm_tables=None,
|
||||
vendor: str = "",
|
||||
device_type: str = "",
|
||||
command: str = "",
|
||||
|
|
@ -21,7 +24,7 @@ def normalize_lldp_neighbors(
|
|||
device_type=device_type,
|
||||
command=command,
|
||||
)
|
||||
_ = params
|
||||
_ = (params, fsm_tables)
|
||||
rows: list[dict[str, Any]] = []
|
||||
for h in hits:
|
||||
rows.append(
|
||||
|
|
@ -34,3 +37,5 @@ def normalize_lldp_neighbors(
|
|||
}
|
||||
)
|
||||
return rows
|
||||
|
||||
normalize_lldp_neighbors.RULE_KEYS = RULE_KEYS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue