Skip to content
New issue

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

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

Already on GitHub? # to your account

Cisco IOS show bfd neighbors details failing when missing last #1863

Closed
gertzakis opened this issue Oct 9, 2024 · 0 comments · Fixed by #1864
Closed

Cisco IOS show bfd neighbors details failing when missing last #1863

gertzakis opened this issue Oct 9, 2024 · 0 comments · Fixed by #1864

Comments

@gertzakis
Copy link
Contributor

gertzakis commented Oct 9, 2024

ISSUE TYPE
  • Template Issue with error and raw data
TEMPLATE USING
Value OUR_ADDR (\S+)
Value NEIGHBOR_ADDR (\S+)
Value LOCAL_DISCRIM (\d+)
Value REMOTE_DISCRIM (\d+)
Value REMOTE_HEARD (\S+)
Value HOLDDOWN (\d+)
Value MULTIPLIER (\d{1,2})
Value STATE (\w+)
Value INTERFACE (\S+)
Value ECHO_FUNCTION ((?:\w+\s+)?\w+\s+echo\s+function)
Value ECHO_INTERVAL (\d+)
Value DIAGNOSTIC_BIT (\d)
Value DEMAND_BIT (\d)
Value POLL_BIT (\d)
Value MIN_TX_INTERVAL (\d+)
Value MIN_RX_INTERVAL (\d+)
Value RECEIVED_MIN_RX_INTERVAL (\d+)
Value RECEIVED_MULTIPLIER (\d{1,2})
Value HOLDDOWN_HITS (\d+)
Value HELLO_INTERVAL (\d+)
Value HELLO_HITS (\d+)
Value RX_COUNT (\d+)
Value RX_LAST (\d+)
Value TX_COUNT (\d+)
Value TX_LAST (\d+)
Value REGISTERED_PROTOCOLS (\S+(?:\s+\S+)*)
Value TEMPLATE (\S+)
Value UPTIME (\S+)
Value VERSION (\d+)

Start
  ^\s*IPv\d+\s+Sessions\s*$$
  ^\s*(?:\S+\s+)?NeighAddr.*$$ -> BFD
  #
  # Capture time-stamp if vty line has command time-stamping turned on
  ^Load\s+for\s+
  ^Time\s+source\s+is
  ^\s*$$
  ^. -> Error

BFD
  ^\s*${OUR_ADDR}\s*${NEIGHBOR_ADDR}\s+${LOCAL_DISCRIM}\/${REMOTE_DISCRIM}\s+${REMOTE_HEARD}\s+\d+\s+\(\s*\d+\s*\)\s+${STATE}\s+${INTERFACE}\s*$$
  #
  ^\s*${NEIGHBOR_ADDR}\s+${LOCAL_DISCRIM}\/${REMOTE_DISCRIM}\s+${REMOTE_HEARD}\s+${STATE}\s+${INTERFACE}\s*$$
  ^\s*OurAddr:\s+${OUR_ADDR}\s*$$
  #
  # common BFD details
  ^\s*Session\s+state\s+is\s+\S+\s+and\s+${ECHO_FUNCTION}(?:\s+with\s+${ECHO_INTERVAL}\s+)?.*$$
  ^\s*Local\s+Diag:\s+${DIAGNOSTIC_BIT},\s+Demand\s+mode:\s+${DEMAND_BIT},\s+Poll\s+bit:\s+${POLL_BIT}\s*$$
  ^\s*MinTxInt:\s+${MIN_TX_INTERVAL},\s+MinRxInt:\s+${MIN_RX_INTERVAL},\s+Multiplier:\s+${MULTIPLIER}\s*$$
  ^\s*Received\s+MinRxInt:\s+${RECEIVED_MIN_RX_INTERVAL},\s+Received Multiplier:\s+${RECEIVED_MULTIPLIER}\s*$$
  #
  # some legacy output spells holddown with one d
  ^\s*Holdd?own\s+\(hits\):\s+${HOLDDOWN}\(${HOLDDOWN_HITS}\),\s+Hello\s+\(hits\):\s+${HELLO_INTERVAL}\(${HELLO_HITS}\)\s*$$
  #
  ^\s*Rx\s+Count:\s+${RX_COUNT},(?:\s+\S+){6}\s+${RX_LAST}(?:\s+\S+){2}\s*$$
  ^\s*Tx\s+Count:\s+${TX_COUNT},(?:\s+\S+){6}\s+${TX_LAST}(?:\s+\S+){2}\s*$$
  ^\s*Registered\s+protocols:\s+${REGISTERED_PROTOCOLS}\s*$$
  ^\s*Template:\s+${TEMPLATE}\s*$$
  ^\s*Uptime:\s+${UPTIME}\s*$$
  ^\s*Last\s+packet:\s+Version:\s+${VERSION}\s+.*$$ -> Record
  #
  # lines of no interest for the time being
  #
  ^\s*Session\s+Host.*$$
  ^\s*Handle.*$$
  ^\s*Elapsed\s+time\s+watermarks.*$$
  ^\s+(?:\S+\s+){1,3}bit.*$$
  ^\s+Multiplier.*$$
  ^\s+My\s+Discr.*$$
  ^\s+Min\s+\S+\s+interval.*$$
  #
  ^\s*$$ -> Start
  ^. -> Error
SAMPLE COMMAND OUTPUT
IPv4 Sessions
NeighAddr                              LD/RD         RH/RS     State     Int
10.242.15.177                           3/874        Up        Up        Gi0/0/1
Session state is UP and not using echo function.
Session Host: Hardware
OurAddr: 10.242.15.178  
Handle: 4
Local Diag: 0, Demand mode: 0, Poll bit: 0
MinTxInt: 50000, MinRxInt: 50000, Multiplier: 3
Received MinRxInt: 50000, Received Multiplier: 3
Holddown (hits): 0(0), Hello (hits): 50(0)
Rx Count: 74964306, Rx Interval (ms) min/max/avg: 21/83/42
Tx Count: 72122352, Tx Interval (ms) min/max/avg: 33/56/44
Elapsed time watermarks: 0 0 (last: 0)
Registered protocols: BGP CEF 
Template: wan-access
Uptime: 5w1d
Last packet: Version: 1                  - Diagnostic: 0
             State bit: Up               - Demand bit: 0
             Poll bit: 0                 - Final bit: 0
             C bit: 1                                   
             Multiplier: 3               - Length: 24
             My Discr.: 874              - Your Discr.: 3
             Min tx interval: 50000      - Min rx interval: 50000
             Min Echo interval: 0       

SUMMARY

The problem is that the template is expecting the last: XX ms ago part. As an example from the above output:

Rx Count: 74964306, Rx Interval (ms) min/max/avg: 21/83/42

should be

Rx Count: 74964306, Rx Interval (ms) min/max/avg: 21/83/42 last: 316 ms ago

in order to work correctly.

STEPS TO REPRODUCE
EXPECTED RESULTS

Expected the output to be parsed successfully.

ACTUAL RESULTS

The parsing failed with the below error:

State Error raised. Rule Line: 75. Input Line: Rx Count: 74964306, Rx Interval (ms) min/max/avg: 21/83/42"
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant