-
Notifications
You must be signed in to change notification settings - Fork 743
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
Update XR show bgp neighbors template #346
Update XR show bgp neighbors template #346
Conversation
Added tests/cisco_xr/show_bgp_neighbors1.raw Added tests/cisco_xr/show_bgp_neighbors1.parsed Updated templates/cisco_xr_show_bgp_neighbors.templates Value GR (.+?) Value List DEFAULT_ORIGINATE (.+) Value LAST_RESET_REASON (.*) START ^\s+Remote\s+AS\s+${REMOTE_AS}\,\s+local\s+AS\s+${LOCAL_AS}\,\s+(?:no\-prepend,\s+)?(?:replace\-as\,\s+)?${TYPE}\s+link ^\s+Administratively\s+shut\s+down ^\s+BFD\s+[Ee]nabled ^\s+Configured hold time\:\s+\d+\,\s+keepalive\: ^\s+Graceful\s+restart\s+is\s+${GR}\s*$$ ^\s+Restart\s+time\s+is ^\s+Stale\s+path\s+timeout\s+time\s+is ^\s+Graceful\s+Restart\s+\(GR\s+Awareness\)\: ^\s+Inbound\s+message\s+logging ^\s+Outbound\s+message\s+logging AFI ^\s+Default\s+information\s+originate\:\s+${DEFAULT_ORIGINATE} ^\s+AF-dependent capabilities ^\s+Graceful\s+Restart\s+capability ^\s+Local\s+restart\s+time\s+is ^\s+Maximum\s+stalepath\s+time\s+is ^\s+Remote\s+Restart\s+time\s+is ^\s+Private\s+AS\s+number\s+removed ^\s+Community\s+attribute ^\s+Advertise\s+VPNv[46]\s+routes\s+(is\s)?enabled\s+with ^\s+AS\s+[oO]verride\s+is ^\s+Send\s+Multicast\s+Attributes CONNECTION ^\s+Last\s+reset\s+${LAST_RESET}\,\s+due\s+to\s+${LAST_RESET_REASON} ^\s+Last\s+reset\s+${LAST_RESET} ^\s+External\s+BGP\s+neighbor\s+not\s+directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtishey when matching the rest of the line, you need to ensure that you account for a trailing space (it will eventually happen). The capture group will be either (.+?)
or (.*?)
and the regex will be ...${CAPTURE_GROUP}\s*$$
@@ -32,7 +34,7 @@ Value LOCAL_PORT (\d+) | |||
Value REMOTE_ADDRESS (.*) | |||
Value REMOTE_PORT (\d+) | |||
Value LAST_RESET (\S+) | |||
Value LAST_RESET_REASON (.+?) | |||
Value LAST_RESET_REASON (.*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this not working for your data? Follows for line 106
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Negative, it was matching the first letter. For example, "P" in:
Last reset 2w3d, due to Peer closing down the session
with:
^\s+Last\s+reset\s+${LAST_RESET}\,\s+due\s+to\s+${LAST_RESET_REASON}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without ending the line with \s*$$
that will happen, but my update included \s*$$
, so it will capture everything up to the end of the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmcgill298 I see what the issue was. Some routers output
^\s+Last\s+reset\s+${LAST_RESET}\,\s+due\s+to\s+${LAST_RESET_REASON}
and some just output
^\s+Last\s+reset\s+${LAST_RESET}
So there is a need to match either or (or just omit the values) . so the .+? failed with the first output scenario... I'll look into a more proper solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmcgill298 Can you check out the latest commit 60e6e56 and see if that makes sense?
Co-Authored-By: jtishey <[email protected]>
Co-Authored-By: jtishey <[email protected]>
ISSUE TYPE
COMPONENT
cisco_xr_show_bgp_neighbor
SUMMARY
Updates to PR #341 for Cisco XR show bgp neighbors and add an additional test
Added tests/cisco_xr/show_bgp_neighbors1.raw
Added tests/cisco_xr/show_bgp_neighbors1.parsed
Updated templates/cisco_xr_show_bgp_neighbors.templates
Value GR (.+?)
Value List DEFAULT_ORIGINATE (.+)
Value LAST_RESET_REASON (.*)
START
^\s+Remote\s+AS\s+${REMOTE_AS},\s+local\s+AS\s+${LOCAL_AS},\s+(?:no-prepend,\s+)?(?:replace-as,\s+)?${TYPE}\s+link
^\s+Administratively\s+shut\s+down
^\s+BFD\s+[Ee]nabled
^\s+Configured hold time:\s+\d+,\s+keepalive:
^\s+Graceful\s+restart\s+is\s+${GR}\s*$$
^\s+Restart\s+time\s+is
^\s+Stale\s+path\s+timeout\s+time\s+is
^\s+Graceful\s+Restart\s+(GR\s+Awareness):
^\s+Inbound\s+message\s+logging
^\s+Outbound\s+message\s+logging
AFI
^\s+Default\s+information\s+originate:\s+${DEFAULT_ORIGINATE}
^\s+AF-dependent capabilities
^\s+Graceful\s+Restart\s+capability
^\s+Local\s+restart\s+time\s+is
^\s+Maximum\s+stalepath\s+time\s+is
^\s+Remote\s+Restart\s+time\s+is
^\s+Private\s+AS\s+number\s+removed
^\s+Community\s+attribute
^\s+Advertise\s+VPNv[46]\s+routes\s+(is\s)?enabled\s+with
^\s+AS\s+[oO]verride\s+is
^\s+Send\s+Multicast\s+Attributes
CONNECTION
^\s+Last\s+reset\s+${LAST_RESET},\s+due\s+to\s+${LAST_RESET_REASON}
^\s+Last\s+reset\s+${LAST_RESET}
^\s+External\s+BGP\s+neighbor\s+not\s+directly