Skip to content

Commit 1c83ba7

Browse files
authored
Modify disp interface for Comware5/7 variations (#2197)
1) Updated LINE_STATUS capture group to include 'STP DOWN' state 2) updated to account for optional 's' in 'forbid jumbo frames' 3) Updated to account for DHCP-Allocated address 4) Updated to account for Untagged Vlans 5) Other modification to account for lines that are in the output Signed-off-by: Cain,Marcus <[email protected]>
1 parent ed927aa commit 1c83ba7

14 files changed

+448
-18
lines changed

ntc_templates/templates/hp_comware_display_interface.textfsm

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Value Required INTERFACE (\S+)
2-
Value LINE_STATUS (UP|DOWN|Administratively DOWN)
2+
Value LINE_STATUS (UP|DOWN|Administratively DOWN|STP DOWN)
33
Value PROTOCOL_STATUS (UP(\(spoofing\))?|DOWN)
44
Value List IP_ADDRESS (\S+)
55
Value MTU (\d+)
@@ -27,17 +27,18 @@ Start
2727
^\s*Maximum\s+[Tt]ransmi\S+\s+[Uu]nit:\s+${MTU}
2828
^\s*The\sMaximum\s+Transmit\s+Unit\sis\s+${MTU}
2929
^\s*Maximum\s+frame\s+length:\s*${L2MTU}
30-
^\s*Forbid\s+jumbo\s+frames\s+to\s+pass
30+
^\s*Forbid\s+jumbo\s+frame(s?)\s+to\s+pass
3131
^\s*The\s+[Mm]aximum\s+[Ff]rame\s+[Ll]ength\s+is\s+${L2MTU}
32-
^\s*Internet\s+[Aa]ddress:\s+${IP_ADDRESS}\s+\(([Pp]rimary|[Ss]ub|[Cc]ellular-[Aa]llocated)\)
33-
^\s*Internet\s+[Aa]ddress\s+is\s+${IP_ADDRESS}\s+[Pp]rimary
32+
^\s*Internet\s+[Aa]ddress:\s+${IP_ADDRESS}\s+\(([Pp]rimary|[Ss]ub|[Cc]ellular-[Aa]llocated|DHCP-[Aa]llocated)\)
33+
^\s*Internet\s+[Aa]ddress\s+is\s+${IP_ADDRESS}\s+([Pp]rimary|[Ss]ub|[Cc]ellular-[Aa]llocated|DHCP-[Aa]llocated)
3434
^\s*IP\s+[Pp]acket\s+[Ff]rame\s+[Tt]ype\s*:\s*[^,]+,\s+[Hh]ardware\s+[Aa]ddress:\s+${HW_ADDRESS}
3535
^\s*IPv6\s+[Pp]acket\s+[Ff]rame\s+[Tt]ype\s*:\s*[^,]+,\s+[Hh]ardware\s+[Aa]ddress:\s+${HW_ADDRESS}
3636
^\s*${SPEED}\s+mode\s*,\s+${DUPLEX}\s+mode
3737
^\s*${SPEED},\s+${DUPLEX},\s+link\s+type
3838
^\s*PVID:\s+${VLAN_NATIVE}
3939
^\s*Port\s+link-type:\s+${PORT_LINK_TYPE}
4040
^\s*Un[Tt]agged\s+VLAN\s+ID\s*:\s*${UNTAGGED_VLAN_ID}
41+
^\s*Un[Tt]agged\s+(VLAN|Vlan)(s?):\s*${UNTAGGED_VLAN_ID}
4142
# Trunk - Passing VLANs (parsing multiple times with Continue)
4243
^\s+VLAN\s+[Pp]assing\s*:\s+${VLAN_PASSING},* -> Continue
4344
# Skip initial VLANs and read the Nth + 1
@@ -142,19 +143,22 @@ Start
142143
^\s*Trunk\s+port
143144
^\s*Loopback
144145
^\s*Media
146+
^\s*Ethernet\s+port\s+mode:
145147
^\s*[Ff]low
146148
^\s*Allow\s+jumbo
147149
^\s*Broadcast
148150
^\s*Multicast
149151
^\s*Unicast
152+
^\s*Known-unicast
150153
^\s*No\sconnector
151154
^\s*M[Dd][Ii]\s+type
155+
^\s*Port\s+up-mode
152156
^\s*Port\s+priority
153157
^\s*Current\s*system
154158
^\s*Peak
155159
^\s*IPv4\s+traffic
156160
^\s*IPv6\s+traffic
157-
^\s+Tagged\s+VLAN
161+
^\s+Tagged\s+(VLAN|Vlan)
158162
^\s+Un[tT]agged\s+VLAN
159163
^\s*[Ii]nput
160164
^\s*[Oo]utput
@@ -165,14 +169,14 @@ Start
165169
^\s+-\s+unicasts
166170
^\s+\d+\s+[Cc][Rr][Cc]
167171
^\s+\d+\s+aborts
168-
^\s+\d+\s+packets,*\s*
172+
^\s*\d+\s+packets,*\s*
169173
^\s+\d+\s+errors,*\s*
170174
^\s+\d+\s+lost
171175
^\s+\d+\s+input\s+error
172176
^\s+\d+\s+output\s+error
173177
^\s+\d+\s+drops,*\s*
174178
^\s+\d+\s+deferred,*\s*
175-
^\s+\d+\s+broadcasts
179+
^\s+(-|\d+)\s+broadcasts
176180
^\s+\d+\s+ignored
177181
^\s+\d+\s+dribbles
178182
^\s*Tunnel\s
@@ -187,4 +191,4 @@ Start
187191
^\s*Promiscuous\s+mode
188192
^\s*DCD:
189193
^. -> Error
190-
^\s*$$ ^. -> Error
194+
^\s*$$ ^. -> Error

tests/hp_comware/display_interface/hp_comware_display_interface.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ parsed_sample:
7777
port_link_type: "Access"
7878
protocol_status: "DOWN"
7979
speed: "Unknown-speed"
80-
untagged_vlan_id: ""
80+
untagged_vlan_id: "1"
8181
vlan_native: "1"
8282
vlan_passing: []
8383
vlan_permitted: []
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
HundredGigE3/0/23
2+
Current state: Administratively DOWN
3+
Line protocol state: DOWN
4+
IP packet frame type: Ethernet II, hardware address: dc68-0c3c-2388
5+
Description: SOME-DEVICE-DESC
6+
Bandwidth: 100000000 kbps
7+
Loopback is not set
8+
Media type is not sure, port is No connector
9+
Ethernet port mode: LAN
10+
Unknown-speed mode, unknown-duplex mode
11+
Link speed type is autonegotiation, link duplex type is autonegotiation
12+
Flow-control is not enabled
13+
Maximum frame length: 9416
14+
Allow jumbo frames to pass
15+
Broadcast max-ratio: 100%
16+
Multicast max-ratio: 100%
17+
Unicast max-ratio: 100%
18+
PVID: 1
19+
MDI type: Automdix
20+
Port link-type: Access
21+
Tagged VLANs: None
22+
Untagged VLANs: 1
23+
Port priority: 0
24+
Last link flapping: Never
25+
Last clearing of counters: 21:02:03 Sat 05/31/2025
26+
Current system time:2025-09-29 17:34:11 EST-05:00:00
27+
Last time when physical state changed to up:-
28+
Last time when physical state changed to down:2000-12-31 19:04:54 EST-05:00:00
29+
Peak input rate: 0 bytes/sec, at 2025-05-31 21:02:08
30+
Peak output rate: 0 bytes/sec, at 2025-05-31 21:02:08
31+
Last 300 seconds input: 0 packets/sec 0 bytes/sec -%
32+
Last 300 seconds output: 0 packets/sec 0 bytes/sec -%
33+
Input (total): 0 packets, 0 bytes
34+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
35+
Input (normal): 0 packets, - bytes
36+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
37+
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
38+
0 CRC, 0 frame, - overruns, 0 aborts
39+
- ignored, - parity errors
40+
Output (total): 0 packets, 0 bytes
41+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
42+
Output (normal): 0 packets, - bytes
43+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
44+
Output: 0 output errors, - underruns, 0 buffer failures
45+
0 aborts, 0 deferred, 0 collisions, 0 late collisions
46+
0 lost carrier, - no carrier
47+
IPv4 traffic statistics:
48+
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
49+
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
50+
Input: 0 packets, 0 bytes
51+
Output: 0 packets, 0 bytes
52+
IPv6 traffic statistics:
53+
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
54+
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
55+
Input: 0 packets, 0 bytes
56+
Output: 0 packets, 0 bytes
57+
58+
Ten-GigabitEthernet13/2/12
59+
Current state: UP
60+
Line protocol state: UP
61+
IP packet frame type: Ethernet II, hardware address: 40b9-3c3c-e9a0
62+
Description: SOME_DEVICE_DESCR
63+
Bandwidth: 1000000 kbps
64+
Loopback is not set
65+
Media type is twisted pair, port hardware type is 1000_BASE_T_AN_SFP
66+
1000Mbps-speed mode, full-duplex mode
67+
Link speed type is autonegotiation, link duplex type is autonegotiation
68+
Flow-control is not enabled
69+
Maximum frame length: 10000
70+
Allow jumbo frames to pass
71+
Broadcast max-ratio: 100%
72+
Multicast max-ratio: 100%
73+
Unicast max-ratio: 100%
74+
PVID: 1
75+
MDI type: Automdix
76+
Port up-mode is enabled
77+
Port link-type: Access
78+
Tagged VLANs: None
79+
Untagged VLANs: 1
80+
Port priority: 0
81+
Last link flapping: 299 weeks 3 days 18 hours 27 minutes
82+
Last clearing of counters: 23:10:42 Sun 03/07/2021
83+
Peak input rate: 0 bytes/sec, at 2025-03-06 17:03:07
84+
Peak output rate: 32 bytes/sec, at 2025-03-06 17:03:46
85+
Last 300 second input: 0 packets/sec 0 bytes/sec 0%
86+
Last 300 second output: 0 packets/sec 32 bytes/sec 0%
87+
Input (total): 0 packets, 0 bytes
88+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
89+
Input (normal): 0 packets, - bytes
90+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
91+
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
92+
0 CRC, 0 frame, - overruns, 0 aborts
93+
- ignored, - parity errors
94+
Output (total): 72002554 packets, 4608163456 bytes
95+
0 unicasts, 0 broadcasts, 72002554 multicasts, 0 pauses
96+
Output (normal): 72002554 packets, - bytes
97+
0 unicasts, 0 broadcasts, 72002554 multicasts, 0 pauses
98+
Output: 0 output errors, - underruns, - buffer failures
99+
0 aborts, 0 deferred, 0 collisions, 0 late collisions
100+
0 lost carrier, - no carrier
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
parsed_sample:
3+
- bandwidth: "100000000 kbps"
4+
description: "SOME-DEVICE-DESC"
5+
duplex: "unknown-duplex"
6+
hw_address:
7+
- "dc68-0c3c-2388"
8+
interface: "HundredGigE3/0/23"
9+
ip_address: []
10+
l2mtu: "9416"
11+
line_status: "Administratively DOWN"
12+
mtu: ""
13+
port_link_type: "Access"
14+
protocol_status: "DOWN"
15+
speed: "Unknown-speed"
16+
untagged_vlan_id: "1"
17+
vlan_native: "1"
18+
vlan_passing: []
19+
vlan_permitted: []
20+
- bandwidth: "1000000 kbps"
21+
description: "SOME_DEVICE_DESCR"
22+
duplex: "full-duplex"
23+
hw_address:
24+
- "40b9-3c3c-e9a0"
25+
interface: "Ten-GigabitEthernet13/2/12"
26+
ip_address: []
27+
l2mtu: "10000"
28+
line_status: "UP"
29+
mtu: ""
30+
port_link_type: "Access"
31+
protocol_status: "UP"
32+
speed: "1000Mbps-speed"
33+
untagged_vlan_id: "1"
34+
vlan_native: "1"
35+
vlan_passing: []
36+
vlan_permitted: []

tests/hp_comware/display_interface/hp_comware_display_interface2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ parsed_sample:
1313
port_link_type: "Access"
1414
protocol_status: "DOWN"
1515
speed: "Unknown-speed"
16-
untagged_vlan_id: ""
16+
untagged_vlan_id: "1"
1717
vlan_native: "1"
1818
vlan_passing: []
1919
vlan_permitted: []
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Vlan-interface123
2+
Current state: UP
3+
Line protocol state: UP
4+
Description: Vlan-interface123 Interface
5+
Bandwidth: 10000000 kbps
6+
Maximum transmission unit: 1500
7+
Internet address: 10.11.12.13/24 (DHCP-allocated)
8+
IP packet frame type: Ethernet II, hardware address: 5c8a-3849-a0c5
9+
IPv6 packet frame type: Ethernet II, hardware address: 5c8a-3849-a0c5
10+
Last clearing of counters: Never
11+
Last 300 seconds input rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec
12+
Last 300 seconds output rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec
13+
Input: 0 packets, 0 bytes, 0 drops
14+
Output: 0 packets, 0 bytes, 0 drops
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
parsed_sample:
3+
- bandwidth: "10000000 kbps"
4+
description: "Vlan-interface123 Interface"
5+
duplex: ""
6+
hw_address:
7+
- "5c8a-3849-a0c5"
8+
- "5c8a-3849-a0c5"
9+
interface: "Vlan-interface123"
10+
ip_address:
11+
- "10.11.12.13/24"
12+
l2mtu: ""
13+
line_status: "UP"
14+
mtu: "1500"
15+
port_link_type: ""
16+
protocol_status: "UP"
17+
speed: ""
18+
untagged_vlan_id: ""
19+
vlan_native: ""
20+
vlan_passing: []
21+
vlan_permitted: []
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
GigabitEthernet11/0/57
2+
Current state: DOWN
3+
Line protocol state: DOWN
4+
IP packet frame type: Ethernet II, hardware address: dc68-0c81-c28e
5+
Description: GigabitEthernet11/0/57 Interface
6+
Bandwidth: 1000000 kbps
7+
Loopback is not set
8+
Media type is not sure, port hardware type is No connector
9+
Unknown-speed mode, unknown-duplex mode
10+
Link speed type is autonegotiation, link duplex type is autonegotiation
11+
Flow-control is not enabled
12+
Maximum frame length: 9416
13+
Allow jumbo frames to pass
14+
Broadcast max-ratio: 100%
15+
Multicast max-ratio: 100%
16+
Unicast max-ratio: 100%
17+
Known-unicast max-ratio: 100%
18+
PVID: 1
19+
MDI type: Automdix
20+
Port link-type: Access
21+
Tagged VLANs: None
22+
Untagged VLANs: 1
23+
Port priority: 0
24+
Last link flapping: Never
25+
Last clearing of counters: Never
26+
Current system time:2025-09-29 16:22:53 EST-05:00:00
27+
Last time when physical state changed to up:-
28+
Last time when physical state changed to down:2001-01-01 00:05:34 EST-05:00:00
29+
Peak input rate: 0 bytes/sec, at 2000-12-31 19:06:09
30+
Peak output rate: 0 bytes/sec, at 2000-12-31 19:06:09
31+
Last 300 seconds input: 0 packets/sec 0 bytes/sec -%
32+
Last 300 seconds output: 0 packets/sec 0 bytes/sec -%
33+
Input (total): 0 packets, 0 bytes
34+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
35+
Input (normal): 0 packets, - bytes
36+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
37+
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
38+
0 CRC, 0 frame, - overruns, 0 aborts
39+
- ignored, - parity errors
40+
Output (total): 0 packets, 0 bytes
41+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
42+
Output (normal): 0 packets, - bytes
43+
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
44+
Output: 0 output errors, - underruns, 0 buffer failures
45+
0 aborts, 0 deferred, 0 collisions, 0 late collisions
46+
0 lost carrier, - no carrier
47+
IPv4 traffic statistics:
48+
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
49+
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
50+
Input: 0 packets, 0 bytes
51+
Output: 0 packets, 0 bytes
52+
IPv6 traffic statistics:
53+
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
54+
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
55+
Input: 0 packets, 0 bytes
56+
Output: 0 packets, 0 bytes
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
parsed_sample:
3+
- bandwidth: "1000000 kbps"
4+
description: "GigabitEthernet11/0/57 Interface"
5+
duplex: "unknown-duplex"
6+
hw_address:
7+
- "dc68-0c81-c28e"
8+
interface: "GigabitEthernet11/0/57"
9+
ip_address: []
10+
l2mtu: "9416"
11+
line_status: "DOWN"
12+
mtu: ""
13+
port_link_type: "Access"
14+
protocol_status: "DOWN"
15+
speed: "Unknown-speed"
16+
untagged_vlan_id: "1"
17+
vlan_native: "1"
18+
vlan_passing: []
19+
vlan_permitted: []

0 commit comments

Comments
 (0)