mirror of
https://github.com/hansjone/netx.git
synced 2026-10-11 06:50:49 +08:00
Switch CLI parsing to TextFSM and polish topology/workbench UX.
Use custom cli_templates plus community ntc-templates for LLDP and port traffic across ZTE/Huawei/Cisco/H3C/Juniper/Nokia, drop regex parsers, and surface Admin/Phy/Prot on port discover. Also batch-add topology NEs and tighten workbench branding. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
60186a12e3
commit
393fd0e0b4
41 changed files with 1771 additions and 1075 deletions
0
netx_api/cli_templates/huawei/.gitkeep
Normal file
0
netx_api/cli_templates/huawei/.gitkeep
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Value Filldown INTERFACE (\S+)
|
||||
Value Filldown ADMIN_OPER (UP|DOWN|Administratively\s+DOWN)
|
||||
Value Filldown DESCRIPTION (.*)
|
||||
Value Filldown RATE_PERIOD (\d+)
|
||||
Value Filldown INPUT_BPS ([\d.]+)
|
||||
Value Filldown OUTPUT_BPS ([\d.]+)
|
||||
Value Filldown IN_UTIL ([\d.]+)
|
||||
Value OUT_UTIL ([\d.]+)
|
||||
|
||||
Start
|
||||
^${INTERFACE}\s+current\s+state\s*:\s*${ADMIN_OPER}
|
||||
^Description:\s*${DESCRIPTION}\s*$$
|
||||
^\s*Last\s+${RATE_PERIOD}\s+seconds\s+input\s+rate:\s*${INPUT_BPS}\s*bits/sec
|
||||
^\s*Last\s+\d+\s+seconds\s+output\s+rate:\s*${OUTPUT_BPS}\s*bits/sec
|
||||
^\s*Last\s+\d+\s+seconds\s+input\s+utility\s+rate:\s*${IN_UTIL}\s*%
|
||||
^\s*Last\s+\d+\s+seconds\s+output\s+utility\s+rate:\s*${OUT_UTIL}\s*% -> Record
|
||||
^\s*$$
|
||||
^\s*<.*>\s*$$
|
||||
^.*#\s*$$
|
||||
^.* -> Start
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Value INTERFACE (\S+)
|
||||
Value PHY (down|[\*\^]down|up|up\(\w+\))
|
||||
Value PROTOCOL (down|[\*\^]down|up|up\(\w+\))
|
||||
Value INUTI (\d*\.?\d*%|\-\-)
|
||||
Value OUTUTI (\d*\.?\d*%|\-\-)
|
||||
Value INERRORS (\d+)
|
||||
Value OUTERRORS (\d+)
|
||||
|
||||
Start
|
||||
^\s*${INTERFACE}\s+${PHY}\s+${PROTOCOL}\s+${INUTI}\s+${OUTUTI}\s+${INERRORS}\s+${OUTERRORS}\s*$$ -> Record
|
||||
^\s*$$
|
||||
^\s*<.*>\s*$$
|
||||
^.*#\s*$$
|
||||
^.* -> Start
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
Value Filldown LOCAL_INTERFACE (\S+)
|
||||
Value CHASSIS_ID (\S+)
|
||||
Value NEIGHBOR_PORT_ID (\S+)
|
||||
Value NEIGHBOR_NAME (\S+)
|
||||
Value MGMT_ADDRESS (\S+)
|
||||
|
||||
Start
|
||||
^${LOCAL_INTERFACE}\s+has\s+\d+\s+neighbor -> Neighbor
|
||||
^\s*$$
|
||||
^.* -> Start
|
||||
|
||||
Neighbor
|
||||
^Chassis\s+ID\s*:\s*${CHASSIS_ID}
|
||||
^Port\s+ID\s*:\s*${NEIGHBOR_PORT_ID}
|
||||
^System\s+name\s*:\s*${NEIGHBOR_NAME}
|
||||
^Management\s+address\s*:\s*${MGMT_ADDRESS} -> Record
|
||||
^Local\s+Interface\s*:\s*${LOCAL_INTERFACE}
|
||||
^Neighbor\s+index\s*:
|
||||
^${LOCAL_INTERFACE}\s+has\s+\d+\s+neighbor -> Neighbor
|
||||
^\s*$$
|
||||
^\s*<.*>\s*$$
|
||||
^.*#\s*$$
|
||||
^.* -> Neighbor
|
||||
Loading…
Add table
Add a link
Reference in a new issue