Skip to content

Commit

Permalink
Improve huawei vrp (#1579)
Browse files Browse the repository at this point in the history
Updates for Huawei VRP
  • Loading branch information
dainok authored Dec 26, 2023
1 parent 3df54dd commit 453687e
Show file tree
Hide file tree
Showing 31 changed files with 3,478 additions and 134 deletions.
4 changes: 2 additions & 2 deletions ntc_templates/templates/huawei_vrp_display_arp_all.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Value VPN_INSTANCE (\S+)

Start
^IP\s+ADDRESS\s+MAC\s+ADDRESS\s+EXPIRE\S+\s+TYPE\s+INTERFACE\s+VPN-INSTANCE
^\s+VLAN\/CEVLAN\s+PVC
^\s+VLAN\/CEVLAN
^-+
^${IP_ADDRESS}\s+${MAC_ADDRESS}\s+${EXPIRE}?\s+${TYPE}\s+${INTERFACE}(\s+)?${VPN_INSTANCE}?$$ -> Record
^\s+(\d+)\/(\S+)
^Total:(\d+)\s+Dynamic:(\d+)\s+Static:(\d+)\s+Interface:(\d+)\s+Remote:(\d+)
^Total:(\d+)\s+Dynamic:(\d+)\s+Static:(\d+)\s+Interface:(\d+)
^Redirect:(\d+)
^\s*$$
^. -> Error
21 changes: 20 additions & 1 deletion ntc_templates/templates/huawei_vrp_display_interface.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Value PROTOCOL_STATUS (\S*|\S*\s+\(\w+\))
Value INTERFACE_DESCRIPTION (.*)
Value PORT_TYPE (\S*)
Value PVID (\d+)
Value MTU (\d+)
Value INTERNET_ADDRESS (\S*)
Value INTERNET_PROTOCOL (disabled|enabled)
Value HARDWARE_ADDRESS (\S{4}-\S{4}-\S{4})
Expand All @@ -15,14 +16,18 @@ Value SPEED (\d*)
Value LOOPBACK (\S*)
Value DUPLEX (HALF|FULL)
Value NEGOTIATION (DISABLE|ENABLE)
Value List AGGREGATED_INTERFACES (\S+)

Start
^\S*\s+current\s+state\s+:.*$$ -> Continue.Record
^${INTERFACE}\s+current\s+state\s+:\s+${LINK_STATUS}\s*$$
^Line\s+protocol\s+current\s+state\s+:\s+${PROTOCOL_STATUS}\s*$$
^Last\sline\sprotocol\sup\stime\s*:\s+(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}|-)\s*$$
^Description:${INTERFACE_DESCRIPTION}\s*$$
^${PORT_TYPE}\s+Port(,\s+PVID\s+:\s*${PVID},)?.*$$
^${PORT_TYPE}\s+Port,\s*The\s+MTU\s+is\s+${MTU}
^${PORT_TYPE}\s+Port,\s*The\s+Maximum\s+Transmit\s+Unit\s+is\s+${MTU}
^${PORT_TYPE}\s+Port,(\s+PVID\s+:\s*${PVID},)?(\s*[^,]+,){1,}(\s+The\s+Maximum\s+(Frame\s+Length|Transmit\s+Unit)\s+is\s+${MTU})?
^PVID\s*:\s+${PVID},(\s*[^,]+,){0,}\s+The\s+Maximum\s+Frame\s+Length\s+is\s+${MTU}
^Internet\s+Address\s+is\s+negotiated,\s+${INTERNET_ADDRESS}\s*$$
^Internet\s+Address\s+is\s+${INTERNET_ADDRESS}\s*$$
^.*,\s+Hardware\s+address\s+is\s+${HARDWARE_ADDRESS}\s*$$
Expand Down Expand Up @@ -74,5 +79,19 @@ Start
^\s+OAM\sCells:\s+(\d|-)+,\s+ASM\sCells:\s+(\d|-)+\s*$$
^\s+Packet\sErrors:\s+(\d|-)+,\s+Packet\sDiscards:\s+(\d|-)+\s*$$
^\s+Cell\sErrors:\s+(\d|-)+\s*$$
^\s*Last\s+\d+\s+seconds
^\s*Input:\s+\d+\s+Packets,\s+\d+\s+Bytes
^\s*Output:\s+\d+\s+Packets,\s+\d+\s+Bytes
^\s*Mdi\s+:\s+
^-{6}
^PortName -> Trunk
^\s+
^. -> Error

Trunk
^-{6}
^${AGGREGATED_INTERFACES}\s+\S+\s+\d+\s*$$
^The\s+Number\s+of\s+Ports\s+in\s+Trunk\s*:\s*\d+\s*$$
^The\s+Number\s+of\s+UP\s+Ports\s+in\s+Trunk\s*:\s*\d+\s*$$
^\s*$$ -> Start
^. -> Error
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Value DESTINATION (\S+)
Value PREFIX_LENGTH (\d+)
Value PROTOCOL (Direct|Static|EBGP|IBGP||ISIS|OSPF|RIP|UNR)
Value PROTOCOL (Direct|Static|EBGP|IBGP||ISIS|OSPF|RIP|UNR|O_ASE)
Value PROCESS_ID (\d+)
Value LABEL (\S+)
Value QOS_INFO (\S+)
Expand Down
14 changes: 14 additions & 0 deletions ntc_templates/templates/huawei_vrp_display_ip_vpn-instance.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Value Required NAME (\S+)
Value RD (\d+:\d+)
Value ADDRESS_FAMILY (\S+)

Start
^\s*VPN-Instance Name -> VPNInstances
^\s*Total
^\s*$$
^. -> Error

VPNInstances
^\s*${NAME}\s+${RD}\s+${ADDRESS_FAMILY}\s* -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Value Required NAME (\S+)
Value Required ID (\d+)
Value List INTERFACE_LIST ([^,]+)

Start
^\s*Total
^\s*$$
^\s*VPN-Instance -> Continue.Record
^\s*VPN-Instance\s+Name\s+and\s+ID\s*:\s+${NAME}, ${ID}
^\s+Interface\s+Number
^\s+Interface\s+list\s*:\s+${INTERFACE_LIST},*
^\s{6,}${INTERFACE_LIST},*
^\s*Total
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Value VLAN_ID (\d+)
Value SERIAL (\S+)

Start
^${LOCAL_INTERFACE}\s+has\s+\d+\s+neighbors:$$
^${LOCAL_INTERFACE}\s+has\s+\d+\s+neighbor(s|\(s\)):$$
^\S+\s+has\s+\d+\s+neighbors
^Neighbor\s+index
^Chassis\s+type
Expand All @@ -25,14 +25,15 @@ Start
^System\s+capabilities\s+supported
^System\s+capabilities\s+enabled\s+:${CAPABILITIES}\s*$$
^Management\s+address\s+type
^Management\s+address\s*:\s*${MANAGEMENT_IP}
^Management\s+address\s*(value\s*)?:\s*${MANAGEMENT_IP}
^Expired\s+time
^Port\s+VLAN\s+ID\(PVID\)\s+:${VLAN_ID}
^VLAN\s+name\s+of\s+VLAN
^Protocol\s+identity
^Auto-negotiation
^OperMau
^Power
^OID
^PSE
^Port\s+power
^Link\s+aggregation
Expand Down
12 changes: 12 additions & 0 deletions ntc_templates/templates/huawei_vrp_display_mac-address.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Value DESTINATION_ADDRESS ([0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4})
Value DESTINATION_PORT ([^,\s]+)
Value TYPE (\S+)
Value VLAN_ID (\d+)

Start
^-+$$
^\s+$$
^MAC\s+Address
^${DESTINATION_ADDRESS}\s+${VLAN_ID}/([^/]+)/([^/]+)\s+${DESTINATION_PORT}\s+${TYPE} -> Record
^Total\s+items
^. -> Error
Loading

0 comments on commit 453687e

Please sign in to comment.