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 ASA show route template error #384

Closed
brandomando opened this issue Mar 7, 2019 · 0 comments · Fixed by #401
Closed

Cisco ASA show route template error #384

brandomando opened this issue Mar 7, 2019 · 0 comments · Fixed by #401

Comments

@brandomando
Copy link
Contributor

brandomando commented Mar 7, 2019

ISSUE TYPE
  • Bug Report
TEMPLATE USING
Value Filldown PROTOCOL (C|S|R|B|D|O|i|L)
Value Filldown TYPE (\w{0,2})
Value Required,Filldown NETWORK (\d+\.\d+\.\d+\.\d+|\S+)
Value Filldown MASK (\d+\.\d+\.\d+\.\d+)
Value DISTANCE (\d+)
Value METRIC (\d+)
Value NEXTHOPIP (\d+\.\d+\.\d+\.\d+)
Value NEXTHOPIF (\S+)
Value UPTIME (\d+:\d+:\d+)

Start
  ^Gateway -> ROUTES

ROUTES
  # Match regular routes with all data in same line
  ^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s+${MASK}\s\[${DISTANCE}\/${METRIC}\]\svia\s${NEXTHOPIP}(,\s${UPTIME}){0,1}(,\s${NEXTHOPIF}){0,1} -> Record
  #
  # Clear all non Filldown variables when line started with network that is variably subnetted
  ^\s+[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}${MASK} -> Clear
  ^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s\[${DISTANCE}\/${METRIC}\]\svia\s${NEXTHOPIP}(,\s${UPTIME}){0,1}(,\s${NEXTHOPIF}){0,1} -> Record
  #
  # Match load-balanced routes
  ^\s+\[${DISTANCE}\/${METRIC}\]\s+via\s+${NEXTHOPIP},\s+${NEXTHOPIF} -> Record
  #
  # Match directly connected routes
  ^${PROTOCOL}\s${TYPE}\s+${NETWORK}\sis\sdirectly\sconnected,\s${NEXTHOPIF} -> Record
  ^${PROTOCOL}(\*){0,1}\s${TYPE}\s+${NETWORK}\s+${MASK}\sis\sdirectly\sconnected,\s${NEXTHOPIF} -> Record
  #
  # Clear all variables on empty lines
  ^\s* -> Clearall
  #^${TYPE} -> Continue.Record
  #^${TYPE}\s+${NETWORK}\s+${MASK}\s+\[\d+\/\d+\]\s+via\s+${GATEWAY}\,\s+${INTFC}\s* -> Record
  #^\s+\[\d+\/\d+\]\s+via\s+${GATEWAY}\,\s+${INTFC} -> Record

EOF
SAMPLE COMMAND OUTPUT
Routing Table: BUSINESS
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, V - VPN
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, + - replicated route
Gateway of last resort is 10.200.0.2 to network 0.0.0.0

D EX     10.118.64.0 255.255.255.0 [170/3840] via 10.200.0.2, 2w2d, TRUST
                                 [170/3840] via 10.200.0.1, 2w2d, TRUST
SUMMARY

The UPTIME variable is not correctly placed in the template, and is causing uptime to populate into nexthopif, and uptime to be blank.

STEPS TO REPRODUCE
from netmiko import Netmiko

params = {
    'ip': 'testdevice',
    'device_type': 'cisco_asa',
    'username': 'testuser',
    'password': 'testpass',
    'secret': 'testpass'
}

device = Netmiko(**params)

routes = device.send_command('show route', use_textfsm=True)

print(routes)

EXPECTED RESULTS
{
            "protocol": "D",
            "type": "EX",
            "network": "10.118.64.0",
            "mask": "255.255.255.0",
            "distance": "170",
            "metric": "3840",
            "nexthopip": "10.200.0.1",
            "nexthopif": "TRUST",
            "uptime": "3w1d",
        }
ACTUAL RESULTS
{
            "protocol": "D",
            "type": "EX",
            "network": "10.118.64.0",
            "mask": "255.255.255.0",
            "distance": "170",
            "metric": "3840",
            "nexthopip": "10.200.0.1",
            "nexthopif": "3w1d",
            "uptime": "",
        }
brandomando added a commit to brandomando/ntc-templates that referenced this issue Apr 20, 2019
brandomando added a commit to brandomando/ntc-templates that referenced this issue Apr 20, 2019
brandomando added a commit to brandomando/ntc-templates that referenced this issue Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants