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

Issue #384 cisco_asa_show_route - Fix uptime issue #401

Merged
merged 10 commits into from
Oct 22, 2019

Conversation

brandomando
Copy link
Contributor

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT

cisco_asa_show_route

SUMMARY

Uptime populating into nexthopif value because the uptime value was not placed into the template correctly.

Fixes #384

Before:

[{'protocol': 'S',
  'type': '',
  'network': 'Server1',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.64.65.82',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.100.67.246',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'Sever-2',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '192.168.14.95',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'Server_3',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.54.6.0',
  'mask': '255.255.255.0',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'SERVER',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '192.168.10.0',
  'mask': '255.255.255.64',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'server',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.14.128.0',
  'mask': '255.255.255.0',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.13.0.0',
  'mask': '255.255.0.0',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.3.18.16',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'C',
  'type': '',
  'network': '192.168.1.0',
  'mask': '255.255.255.0',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'L',
  'type': '',
  'network': '192.168.1.108',
  'mask': '255.255.255.255',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.2.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.3.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.1.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.4.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.4.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.1.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.2.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.3.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'E2',
  'network': '10.1.1.0',
  'mask': '255.255.255.0',
  'distance': '170',
  'metric': '3840',
  'nexthopip': '192.168.1.2',
  'nexthopif': '3:21:21',
  'uptime': ''},
 {'protocol': 'O',
  'type': 'E2',
  'network': '10.1.2.0',
  'mask': '255.255.255.0',
  'distance': '170',
  'metric': '3840',
  'nexthopip': '192.168.1.2',
  'nexthopif': '3:21:21',
  'uptime': ''},
 {'protocol': 'O',
  'type': 'E2',
  'network': '10.1.3.0',
  'mask': '255.255.255.0',
  'distance': '170',
  'metric': '3840',
  'nexthopip': '192.168.1.2',
  'nexthopif': '3:21:21',
  'uptime': ''},
 {'protocol': 'C',
  'type': '',
  'network': '192.168.1.0',
  'mask': '255.255.255.0',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'C',
  'type': '',
  'network': '192.168.2.0',
  'mask': '255.255.255.0',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'inside',
  'uptime': ''}]

After:

[{'protocol': 'S',
  'type': '',
  'network': 'Server1',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.64.65.82',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.100.67.246',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'Sever-2',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '192.168.14.95',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'Server_3',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.54.6.0',
  'mask': '255.255.255.0',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'SERVER',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '10.0.5.12',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '192.168.10.0',
  'mask': '255.255.255.64',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': 'server',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.14.128.0',
  'mask': '255.255.255.0',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.13.0.0',
  'mask': '255.255.0.0',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'S',
  'type': '',
  'network': '10.3.18.16',
  'mask': '255.255.255.255',
  'distance': '1',
  'metric': '0',
  'nexthopip': '172.52.64.1',
  'nexthopif': 'inside',
  'uptime': ''},
 {'protocol': 'C',
  'type': '',
  'network': '192.168.1.0',
  'mask': '255.255.255.0',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'L',
  'type': '',
  'network': '192.168.1.108',
  'mask': '255.255.255.255',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.2.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.3.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.1.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '172.16.4.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.2.2',
  'nexthopif': 'inside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.4.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.1.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.2.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'IA',
  'network': '10.0.3.254',
  'mask': '255.255.255.255',
  'distance': '110',
  'metric': '11',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'E2',
  'network': '10.1.1.0',
  'mask': '255.255.255.0',
  'distance': '170',
  'metric': '3840',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'E2',
  'network': '10.1.2.0',
  'mask': '255.255.255.0',
  'distance': '170',
  'metric': '3840',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'O',
  'type': 'E2',
  'network': '10.1.3.0',
  'mask': '255.255.255.0',
  'distance': '170',
  'metric': '3840',
  'nexthopip': '192.168.1.2',
  'nexthopif': 'outside',
  'uptime': '3:21:21'},
 {'protocol': 'C',
  'type': '',
  'network': '192.168.1.0',
  'mask': '255.255.255.0',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'outside',
  'uptime': ''},
 {'protocol': 'C',
  'type': '',
  'network': '192.168.2.0',
  'mask': '255.255.255.0',
  'distance': '',
  'metric': '',
  'nexthopip': '',
  'nexthopif': 'inside',
  'uptime': ''}]

@brandomando
Copy link
Contributor Author

Sorry for the sloppy commits. Please feel free to squash merge if you choose to merge. Let me know if there are any comments/fixes that need to be looked at with this, but the issue was fairly straightforward. The value UPTIME was missing in several places, and there was a space prior to \s+ in the load-balanced template.

Thanks,

Brandon

@brandomando
Copy link
Contributor Author

Also fixed, the uptime value only accounted for the hh:mm:ss format, but not the NwNd format. I added that to the UPTIME regex as well.

@FragmentedPacket FragmentedPacket added the changes_requested Waiting on user to address feedback label Jul 19, 2019
Copy link
Contributor

@FragmentedPacket FragmentedPacket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandomando Do you mind uploading a separate .raw and .parsed files for the tests rather than editing the existing one? After that change and tests passing, I will get this merged in.

@@ -6,7 +6,7 @@ Value DISTANCE (\d+)
Value METRIC (\d+)
Value NEXTHOPIP (\d+\.\d+\.\d+\.\d+)
Value NEXTHOPIF (\S+)
Value UPTIME (\d+:\d+:\d+)
Value UPTIME ((\d+:\d+:\d+)|(\d+w\d+d))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does \S+ work for UPTIME? I'm sure this converts to \d+y\d+d after a year.

@jmcgill298 jmcgill298 merged commit dccc8c7 into networktocode:master Oct 22, 2019
@brandomando brandomando deleted the asa_show_route branch August 8, 2020 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug changes_requested Waiting on user to address feedback waiting_response
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cisco ASA show route template error
3 participants