Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hpe templates #1246

Merged
merged 25 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions ntc_templates/templates/hp_comware_display_interface.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
Value Required INTF (\S+)
Value LINE_STATUS (UP|DOWN|Administratively DOWN)
Value PROTOCOL_STATUS (UP(\(spoofing\))?|DOWN)
Value List IP_ADDRESS (\S+)
Value MTU (\d+)
Value L2MTU (\d+)
Value List HW_ADDRESS ([a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+)
Value DESCRIPTION (.*)
Value BANDWIDTH (.*)
Value DUPLEX (\S+)
Value SPEED (\S+)
Value PORT_LINK_TYPE (\S+)
Value VLAN_NATIVE (\d+)
Value List VLAN_PASSING ([^,]+)
Value List VLAN_PERMITTED ([^,]+)

Start
#^\S+$$.Record
^${INTF}$$
^Current\s+state:\s+${LINE_STATUS}
^Line\s+protocol\s+state:\s+${PROTOCOL_STATUS}
^Description:\s+${DESCRIPTION}
^Bandwidth:\s+${BANDWIDTH}
^Maximum\s+transmission\s+unit:\s+${MTU}
^Maximum\s+frame\s+length:\s+${L2MTU}
^Internet\s+address:\s+${IP_ADDRESS}\s+\(Primary\)
^Internet\s+address:\s+${IP_ADDRESS}\s+\(Sub\)
^IP\s+packet\s+frame\s+type:\s+Ethernet\s+II,\s+hardware\s+address:\s+${HW_ADDRESS}
^IPv6\s+packet\s+frame\s+type:\s+Ethernet\s+II,\s+hardware\s+address:\s+${HW_ADDRESS}
^${SPEED}\s+mode,\s+${DUPLEX}\s+mode
^PVID:\s+${VLAN_NATIVE}
^Port\s+link-type:\s+${PORT_LINK_TYPE}
# Trunk - Passing VLANs (parsing multiple times with Continue)
^\s+VLAN\s+Passing:\s+${VLAN_PASSING},* -> Continue
# Skip initial VLANs and read the Nth + 1
^\s+VLAN\s+Passing:(?:\s+[^,]+,){1}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){2}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){3}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){4}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){5}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){6}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){7}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){8}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){9}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){10}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){11}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){12}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){13}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){14}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){15}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){16}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){17}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){18}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){19}\s+${VLAN_PASSING},* -> Continue
^\s+VLAN\s+Passing:(?:\s+[^,]+,){20}\s+${VLAN_PASSING},* -> Continue
^\s{14,}${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){1}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){2}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){3}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){4}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){5}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){6}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){7}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){8}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){9}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){10}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){11}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){12}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){13}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){14}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){15}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){16}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){17}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){18}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){19}\s+${VLAN_PASSING},* -> Continue
^\s{14,}(?:\s+[^,]+,){20}\s+${VLAN_PASSING},* -> Continue
# End od VLAN Passing
^\s+VLAN\s+Passing:
^\s{14,}
# Trunk - Permitted VLANs (parsing multiple times with Continue)
^\s+VLAN\s+permitted:\s+${VLAN_PERMITTED},* -> Continue
# Skip initial VLANs and read the Nth + 1
^\s+VLAN\s+permitted:(?:\s+[^,]+,){1}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){2}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){3}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){4}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){5}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){6}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){7}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){8}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){9}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){10}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){11}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){12}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){13}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){14}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){15}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){16}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){17}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){18}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){19}\s+${VLAN_PERMITTED},* -> Continue
^\s+VLAN\s+permitted:(?:\s+[^,]+,){20}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){1}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){2}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){3}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){4}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){5}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){6}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){7}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){8}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){9}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){10}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){11}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){12}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){13}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){14}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){15}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){16}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){17}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){18}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){19}\s+${VLAN_PERMITTED},* -> Continue
^\s{14,}(?:\s+[^,]+,){20}\s+${VLAN_PERMITTED},* -> Continue
# End od VLAN Passing
^\s+VLAN\s+permitted:
^\s{14,}
# Next
^$$ -> Next.Record
# Drop
^\s*Link
^\s*Last
^\s*Trunk\s+port
^\s*Loopback
^\s*Media
^\s*Flow
^\s*Allow\s+jumbo
^\s*Broadcast
^\s*Multicast
^\s*Unicast
^\s*MDI\s+type
^\s*Port\s+priority
^\s*Current\s*system
^\s*Peak
^\s*IPv4\s+traffic
^\s*IPv6\s+traffic
^\s+Tagged\s+VLAN
^\s+UnTagged\s+VLAN
^\s*Input
^\s*Output
^\s{6,}\d+\s+unicasts
^\s{6,}\d+\s+CRC
^\s{6,}\d+\s+aborts
^\s{6,}\d+\s+lost
^\s{6,}.*ignored
^. -> Error
^\s*$$ ^. -> Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Value Required NAME (\S+)
Value RD (\d+:\d+)

Start
^\s*VPN-Instance Name -> VPNInstances

VPNInstances
^\s*${NAME}\s+${RD}\s+.* -> Record
^\s*${NAME}\s+.* -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Value Required INTERFACE (\S+)
Value CREATION_MODE (.+)
Value AGGREGATION_MODE (.+)
Value LOADSHARING (.+)
Value List LOCAL_INTERFACES (\S+)
Value List REMOTE_INTERFACES (\S+)

Start
^Aggregat\S+\s+Interface:\s+${INTERFACE}
^Creation\s+Mode:\s+${CREATION_MODE}
^Aggregation\s+Mode:\s+${AGGREGATION_MODE}
^Loadsharing\s+Type:\s+${LOADSHARING}
^Local: -> LocalPorts
dainok marked this conversation as resolved.
Show resolved Hide resolved
^\s*$$ ^. -> Error

LocalPorts
^\s+Port
^\s*---
^\s+${LOCAL_INTERFACES}\s+.*
# Start of remote block port
^Remote: -> RemotePorts
^. -> Error
^\s*$$ ^. -> Error

RemotePorts
^\s+Actor
^\s*---
^\s+${REMOTE_INTERFACES}\s+.*
# New item, restart from the beginning
^Aggregat -> Continue.Record
^Aggregat\S+\s+Interface:\s+${INTERFACE} -> Start
^. -> Error
^\s*$$ ^. -> Error
3 changes: 3 additions & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,14 @@ fortinet_get_system_arp.textfsm, .*, fortinet, g[[et]] sy[[stem]] arp

hp_comware_display_lldp_neighbor-information_verbose.textfsm, .*, hp_comware, di[[splay]] ll[[dp]] n[[eighbor-information]] v[[erbose]]
hp_comware_display_counters_bound_interface.textfsm, .*, hp_comware, di[[splay]] cou[[nters]] (\S+) i[[nterface]]
hp_comware_display_link-aggregation_verbose.textfsm, .*, hp_comware, di[[splay]] link[[-aggregation]] v[[erbose]]
hp_comware_display_ip_routing-table.textfsm, .*, hp_comware, di[[splay]] ip r[[outing-table]]
hp_comware_display_device_manuinfo.textfsm, .*, hp_comware, di[[splay]] dev[[ice]] m[[anuinfo]]
hp_comware_display_ip_vpn-instance.textfsm, .*, hp_comware, di[[splay]] ip vpn[[-instance]]
hp_comware_display_ip_interface.textfsm, .*, hp_comware, dis[[play]] ip i[[nterface]]
hp_comware_display_mac-address.textfsm, .*, hp_comware, di[[splay]] mac-ad[[dress]]
hp_comware_display_vlan_brief.textfsm, .*, hp_comware, di[[splay]] v[[lan]] b[[rief]]
hp_comware_display_interface.textfsm, .*, hp_comware, dis[[play]] int[[erface]]
hp_comware_display_clock.textfsm, .*, hp_comware, di[[splay]] clo[[ck]]
hp_comware_display_arp.textfsm, .*, hp_comware, di[[splay]] a[[rp]]

Expand Down
145 changes: 145 additions & 0 deletions tests/hp_comware/display_interface/hp_comware_display_interface.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
Vlan-interface2000
Current state: UP
Line protocol state: UP
Description: Servers-VLAN
Bandwidth: 10000000 kbps
Maximum transmission unit: 1500
Internet address: 10.1.200.1/24 (Primary)
IP packet frame type: Ethernet II, hardware address: abab-cdcd-6486
IPv6 packet frame type: Ethernet II, hardware address: abab-cdcd-6486
Last clearing of counters: Never
Last 300 seconds input rate: 7 bytes/sec, 56 bits/sec, 0 packets/sec
Last 300 seconds output rate: 16 bytes/sec, 128 bits/sec, 0 packets/sec
Input: 9103 packets, 611444 bytes, 0 drops
Output: 18587 packets, 1143610 bytes, 0 drops

Bridge-Aggregation20
Current state: UP
Line protocol state: UP
IP packet frame type: Ethernet II, hardware address: abab-cdcd-6485
Description: TO_DIST_02_3rd_FLOOR
Bandwidth: 40000000 kbps
40Gbps-speed mode, full-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
PVID: 1
Port link-type: Trunk
VLAN Passing: 1(default vlan), 4001-4002
VLAN permitted: 1(default vlan), 2001-2020, 2190, 4001-4002
Trunk port encapsulation: IEEE 802.1q
Last clearing of counters: Never
Last 300 seconds input: 3143 packets/sec 929430 bytes/sec 0%
Last 300 seconds output: 5674 packets/sec 5945156 bytes/sec 0%
Input (total): 80274398 packets, 24384580165 bytes
80218843 unicasts, 12 broadcasts, 55543 multicasts, 0 pauses
Input (normal): 80274398 packets, - bytes
80218843 unicasts, 12 broadcasts, 55543 multicasts, 0 pauses
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
0 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 110103849 packets, 90115617821 bytes
109953707 unicasts, 9 broadcasts, 150133 multicasts, 0 pauses
Output (normal): 110103849 packets, - bytes
109953707 unicasts, 9 broadcasts, 150133 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier

GigabitEthernet1/1/0/31
Current state: DOWN
Line protocol state: DOWN
IP packet frame type: Ethernet II, hardware address: abab-cdcd-6485
Description: Aruba-WLC
Bandwidth: 1000000 kbps
Loopback is not set
Media type is twisted pair, port hardware type is 1000_BASE_T
Unknown-speed mode, unknown-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
Flow-control is not enabled
Maximum frame length: 9216
Allow jumbo frames to pass
Broadcast max-ratio: 100%
Multicast max-ratio: 100%
Unicast max-ratio: 100%
PVID: 2190
MDI type: Automdix
Port link-type: Trunk
VLAN Passing: 2000, 3230, 4001-4005, 4049-4052
VLAN permitted: 2-4094
Trunk port encapsulation: IEEE 802.1q
Port priority: 0
Last link flapping: Never
Last clearing of counters: Never
Current system time:2022-12-04 09:59:42 SAR+03:00:00
Last time when physical state changed to up:-
Last time when physical state changed to down:2022-12-03 14:48:11 SAR+03:00:00
Peak input rate: 0 bytes/sec, at 2022-12-03 14:48:40
Peak output rate: 0 bytes/sec, at 2022-12-03 14:48:40
Last 300 seconds input: 0 packets/sec 0 bytes/sec -%
Last 300 seconds output: 0 packets/sec 0 bytes/sec -%
Input (total): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Input (normal): 0 packets, - bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
0 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Output (normal): 0 packets, - bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier
IPv4 traffic statistics:
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
Input: 0 packets, 0 bytes
Output: 0 packets, 0 bytes
IPv6 traffic statistics:
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
Input: 0 packets, 0 bytes
Output: 0 packets, 0 bytes

Ten-GigabitEthernet1/0/1
Current state: DOWN
Line protocol state: DOWN
IP packet frame type: Ethernet II, hardware address: 000c-2963-b767
Description: Ten-GigabitEthernet1/0/1 Interface
Bandwidth: 100000 kbps
Loopback is not set
Media type is twisted pair, port hardware type is 1000_BASE_T_AN_SFP
Unknown-speed mode, unknown-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
Flow-control is not enabled
Maximum frame length: 9216
Allow jumbo frame to pass
Broadcast max-ratio: 100%
Multicast max-ratio: 100%
Unicast max-ratio: 100%
PVID: 1
MDI type: Automdix
Port link-type: Access
 Tagged VLANs: None
 UnTagged VLANs: 1
Port priority: 2
Last link flapping: 6 hours 39 minutes 25 seconds
Last clearing of counters: 14:34:09 Tue 11/01/2011
Peak input rate: 0 bytes/sec, at 2013-07-17 22:06:19
Peak output rate: 0 bytes/sec, at 2013-07-17 22:06:19
Last 300 second input: 0 packets/sec 0 bytes/sec -%
Last 300 second output: 0 packets/sec 0 bytes/sec -%
Input (total): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Input (normal): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
0 CRC, 0 frame, 0 overruns, 0 aborts
0 ignored, 0 parity errors
Output (total): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Output (normal): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Output: 0 output errors, 0 underruns, 0 buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, 0 no carrier
Loading