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

hp_comware_display_interface.textfsm failing on multiline counters #1950

Open
juliencorsini opened this issue Dec 26, 2024 · 3 comments · May be fixed by #1963
Open

hp_comware_display_interface.textfsm failing on multiline counters #1950

juliencorsini opened this issue Dec 26, 2024 · 3 comments · May be fixed by #1963

Comments

@juliencorsini
Copy link

ISSUE TYPE
  • Template Issue with error and raw data
TEMPLATE USING
Value Required INTERFACE (\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 UNTAGGED_VLAN_ID (\d+)
Value VLAN_NATIVE (\d+)
Value List VLAN_PASSING ([^,]+)
Value List VLAN_PERMITTED ([^,]+)

Start
  #^\S+$$.Record
  ^\s*${INTERFACE}$$
  ^\s*Current\s+state:\s+${LINE_STATUS}
  ^\s*${INTERFACE}\s+current\s+state\s*:\s*${LINE_STATUS}
  ^\s*Line\s+protocol\s+state:\s+${PROTOCOL_STATUS}
  ^\s*Line\s+protocol\s+current\s+state:\s+${PROTOCOL_STATUS}
  ^\s*Description:\s+${DESCRIPTION}
  ^\s*Bandwidth:\s+${BANDWIDTH}
  ^\s*Maximum\s+[Tt]ransmi\S+\s+[Uu]nit:\s+${MTU}
  ^\s*The\sMaximum\s+Transmit\s+Unit\sis\s+${MTU}
  ^\s*Maximum\s+frame\s+length:\s+${L2MTU}
  ^\s*Forbid\s+jumbo\s+frames\s+to\s+pass
  ^\s*The\sMaximum\s+Frame\s+Length\sis\s+${L2MTU}
  ^\s*Internet\s+[Aa]ddress:\s+${IP_ADDRESS}\s+\([Pp]rimary\)
  ^\s*Internet\s+[Aa]ddress\sis\s+${IP_ADDRESS}\s+[Pp]rimary
  ^\s*Internet\s+[Aa]ddress:\s+${IP_ADDRESS}\s+\([Ss]ub\)
  ^\s*IP\s+[Pp]acket\s+[Ff]rame\s+[Tt]ype\s*:\s*[^,]+,\s+[Hh]ardware\s+[Aa]ddress:\s+${HW_ADDRESS}
  ^\s*IPv6\s+[Pp]acket\s+[Ff]rame\s+[Tt]ype\s*:\s*[^,]+,\s+[Hh]ardware\s+[Aa]ddress:\s+${HW_ADDRESS}
  ^\s*${SPEED}\s+mode,\s+${DUPLEX}\s+mode
  ^\s*${SPEED},\s+${DUPLEX},\s+link\s+type
  ^\s*PVID:\s+${VLAN_NATIVE}
  ^\s*Port\s+link-type:\s+${PORT_LINK_TYPE}
  ^\s*Un[Tt]agged\s+VLAN\s+ID\s*:\s*${UNTAGGED_VLAN_ID}
  # Trunk - Passing VLANs (parsing multiple times with Continue)
  ^\s+VLAN\s+[Pp]assing\s*:\s+${VLAN_PASSING},* -> Continue
  # Skip initial VLANs and read the Nth + 1
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){1}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){2}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){3}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){4}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){5}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){6}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){7}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){8}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){9}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){10}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){11}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){12}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){13}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){14}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){15}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){16}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){17}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){18}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\s+[^,]+,){19}\s+${VLAN_PASSING},* -> Continue
  ^\s+VLAN\s+[Pp]assing\s*:(?:\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+[Pp]assing\s*:
  ^\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*Encapsulation\s+is
  ^\s*Phy-mru
  ^\s*Last
  ^\s*Trunk\s+port
  ^\s*Loopback
  ^\s*Media
  ^\s*[Ff]low
  ^\s*Allow\s+jumbo
  ^\s*Broadcast
  ^\s*Multicast
  ^\s*Unicast
  ^\s*No\sconnector
  ^\s*M[Dd][Ii]\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+Un[tT]agged\s+VLAN
  ^\s*[Ii]nput
  ^\s*[Oo]utput
  ^\s*Physical
  ^\s*Internet\s+protocol
  ^\s*Port\s+hardware
  ^\s+\d+\s+unicasts
  ^\s+-\s+unicasts
  ^\s+\d+\s+[Cc][Rr][Cc]
  ^\s+\d+\s+aborts
  ^\s+\d+\s+packets,*\s*
  ^\s+\d+\s+errors,*\s*
  ^\s+\d+\s+lost
  ^\s+\d+\s+input\s+error
  ^\s+\d+\s+output\s+error
  ^\s+\d+\s+drops,*\s*
  ^\s+\d+\s+deferred,*\s*
  ^\s+\d+\s+broadcasts
  ^\s+\d+\s+ignored
  ^\s+\d+\s+dribbles
  ^\s*Tunnel\s
  ^\s*GRE
  ^\s*Checksumming\sof\sGRE
  ^\s+-\s+ignored
  ^\s+-\s+frame
  ^\s+-\s+aborts
  ^\s+-\s+lost\s+carrier
  ^\s*DCD:
  ^. -> Error
  ^\s*$$ ^. -> Error
SAMPLE COMMAND OUTPUT
 Input:  0 input errors, 0 runts, 0 giants, 0 throttles
	 0 CRC, 0 frame, - overruns, 0 aborts
	 - ignored, - parity errors

input:   0 input errors, 0 runts, - giants, - throttles, 0 CRC
         0 frame, 0 overruns, - aborts, - ignored, - parity errors
SUMMARY

On some interfaces of Comware nodes, counters may be displayed on 2 lines rather than one.
By excluding lines starting with frames, the parser succeeds.

Adding this line to the # Drop section helps:
^\s+\d+\s+frame

@mjbear
Copy link
Contributor

mjbear commented Dec 26, 2024

@juliencorsini
Are you able to provide the output for an entire interface in a code fence?

Additionally are you interested in submitting a pull request for template modifications?

(If yes, I'd be glad to review the changes in your PR.)

@juliencorsini juliencorsini linked a pull request Jan 7, 2025 that will close this issue
@juliencorsini
Copy link
Author

Hi @mjbear

I'll update the issue text once I will have tested that PR #1955 fixes or not this issue.

Thanks!

@jmcgill298
Copy link
Contributor

@juliencorsini 1955 has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants