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

cisco_nxos_show_ip_route errors out on Route Not Found #869

Closed
seanblundy opened this issue Feb 27, 2021 · 3 comments
Closed

cisco_nxos_show_ip_route errors out on Route Not Found #869

seanblundy opened this issue Feb 27, 2021 · 3 comments

Comments

@seanblundy
Copy link

ISSUE TYPE
  • Bug Report
TEMPLATE USING
Value Filldown VRF (\S+)
Value PROTOCOL ([\w-]+)
Value TYPE ([\w-]+)
Value Filldown NETWORK (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
Value Filldown MASK (\d{1,2})
Value DISTANCE (\d+)
Value METRIC (\d+)
Value NEXTHOP_IP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
Value NEXTHOP_IF ([\w\./]+)
Value UPTIME ([\w:\.]+)
Value NEXTHOP_VRF (\S+)
Value TAG (\d+( \(\w+\))?)
Value SEGID (\d+)
Value TUNNELID (0x[a-f\d]+)
Value ENCAP (\w+)

Start
  ^IP\s+Route\s+Table\s+for\s+VRF\s+"${VRF}"\s*$$
  # Match the Network/Prefix Line
  ^\s*${NETWORK}\/${MASK}, ubest/mbest:
  #
  # Match VXLAN Route Entry
  ^\s+\*+via ${NEXTHOP_IP}(%${NEXTHOP_VRF})?, \[${DISTANCE}/${METRIC}\], ${UPTIME}, ${PROTOCOL}, ${TYPE}, tag ${TAG}\s+segid: ${SEGID}\s+tunnelid: ${TUNNELID}\s+encap: ${ENCAP} -> Record
  #
  # Match routes with no type, but with a tag (e.g. statics out SVIs with a tag)
  ^\s+\*+via ${NEXTHOP_IP}(%${NEXTHOP_VRF})?, ${NEXTHOP_IF}, \[${DISTANCE}\/${METRIC}\], ${UPTIME}, ${PROTOCOL}, tag ${TAG} -> Record
  #
  # Match standard dynamic route line (with or without tag)
  ^\s+\*+via ${NEXTHOP_IP}(%${NEXTHOP_VRF})?, ${NEXTHOP_IF}, \[${DISTANCE}/${METRIC}\], ${UPTIME}, ${PROTOCOL}, ${TYPE}(, tag ${TAG})? -> Record
  #
  # Match route without a type (e.g. direct, local)
  ^\s+\*+via ${NEXTHOP_IP}(%${NEXTHOP_VRF})?, ${NEXTHOP_IF}, \[${DISTANCE}\/${METRIC}\], ${UPTIME}, ${PROTOCOL} -> Record
  #
  # Match route without an outgoing interface (e.g. some statics) (with tag)
  ^\s+\*+via ${NEXTHOP_IP}(%${NEXTHOP_VRF})?, \[${DISTANCE}\/${METRIC}\], ${UPTIME}, ${PROTOCOL}, tag ${TAG} -> Record
  #
  # Match route without an outgoing interface (e.g. some statics) (without tag)
  ^\s+\*+via ${NEXTHOP_IP}(%${NEXTHOP_VRF})?, \[${DISTANCE}\/${METRIC}\], ${UPTIME}, ${PROTOCOL} -> Record
  #
  # Match route without a nexthop IP, only nexthop interface (e.g. null routes)
  ^\s+\*+via ${NEXTHOP_IF}, \[${DISTANCE}\/${METRIC}\], ${UPTIME}, ${PROTOCOL} -> Record
  ^'\S+'\s+denotes\s
  ^'%<string>'
  ^\s*$$
  ^. -> Error

EOF
SAMPLE COMMAND OUTPUT
nxos_device#show ip route vrf all 169.254.0.1
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>

Route not found

IP Route Table for VRF "DMZ"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>

0.0.0.0/0, ubest/mbest: 1/0
    *via 169.254.0.1, [20/0], 41w6d, bgp-64512, external, tag 64512

IP Route Table for VRF "Users"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>

0.0.0.0/0, ubest/mbest: 1/0
    *via 169.254.0.1%DMZ, [20/0], 41w6d, bgp-64512, external, tag 64512
SUMMARY

TextFSM errors out at the first Route not found block.

STEPS TO REPRODUCE

On a Cisco NX-OS device, create multiple vrfs.
In one VRF: Create a route toward a destination.
Perform show ip route vrf all toward that destination.

vrf context DMZ
  ip route 0.0.0.0/0 169.254.0.1
vrf context Users

EXPECTED RESULTS

A list of all the routes in all the vrfs.

ACTUAL RESULTS
textfsm.parser.TextFSMError: State Error raised. Rule Line: 45. Input Line: Route not found
Tested solution

Add ^Route not found above ^. -> Error in cisco_nxos_show_ip_route.textfsm

@diepes
Copy link
Contributor

diepes commented Mar 1, 2021

add pull request with additional test and the fix #870

@diepes
Copy link
Contributor

diepes commented Mar 10, 2021

@seanblundy PR merged.

@seanblundy
Copy link
Author

@diepes Thank you very much. :)

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

No branches or pull requests

2 participants