ntc-templates
ntc-templates copied to clipboard
truncated time in cisco_nxos_show_ip_bgp_neighbors.textfsm
For values less than 1 day this regex is incorrect for cisco_nxos_show_ip_bgp_neighbors.textfsm:
Value UPTIME (\w+)
Value LAST_RESET (\w+)
Value LAST_PEER_RESET (\w+)
It is HH:MM:SS for values less than 1 day:
BGP state = Established, up for 20:03:51
I think this change is sufficient:
Value UPTIME ([\w:]+)
Value LAST_RESET ([\w:]+)
Value LAST_PEER_RESET ([\w:]+)
@ajw1980 @itdependsnetworks
I tinkered around with it starting out with \S+
first only to find that when a peer is in the idle BGP state then the template picks up an extra comma. Easily remedied by modifying the State Rule to make the comma optional, but there's a problem with that.
Edit:
Had I tested before initially commenting I would have caught the error in my logic. The comma still gets captured as part of the UPTIME
because it is optional at the end of that line. I'm going to vote [\w:]+
is going to be the pattern for UPTIME
.
Capture groups for LAST_RESET
and LAST_PEER_RESET
could be \S+
because the text surrounding them (trailing comma) is not optional.
- Are there any complaints to using two different regexes?
-
UPTIME
uses ajw's suggested pattern[\w:]+
-
LAST_RESET
andLAST_PEER_RESET
use another
-
no complaints, what are next steps?
@ryanmerolle I'd say it just comes down to somebody (I'll volunteer) pulling a PR together.
I had been chasing some of these and when there was no response I moved on to other priorities. :shrug: That's life. Thank you
@ryanmerolle @jvanderaa I have a PR ... it's #1719 to allow capturing BGP uptimes less than a day (the part that wasn't working) as well as beyond a full day
@jvanderaa can we please close this issue with PR is closed.