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_xr_show_ip_route uptime format and protocol sub-type support #185

Closed
mekisiel opened this issue Apr 4, 2018 · 0 comments · Fixed by #266
Closed

cisco_xr_show_ip_route uptime format and protocol sub-type support #185

mekisiel opened this issue Apr 4, 2018 · 0 comments · Fixed by #266

Comments

@mekisiel
Copy link
Contributor

mekisiel commented Apr 4, 2018

ISSUE TYPE
  • Bug Report
TEMPLATE USING

cisco_xr_show_ip_route.template

SAMPLE COMMAND OUTPUT
Wed Apr  4 19:27:36.016 UTC

Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path
       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, E - EGP
       i - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, su - IS-IS summary null, * - candidate default
       U - per-user static route, o - ODR, L - local, G  - DAGR, l - LISP
       A - access/subscriber, a - Application route
       M - mobile route, r - RPL, (!) - FRR Backup path

Gateway of last resort is 10.0.0.1 to network 0.0.0.0

D EX 10.0.10.4/30 [170/76800] via 10.0.20.2, 14:56:35, TenGigE0/0/0/5.1
B    192.168.70.4/30 [200/0] via 10.0.20.2, 1y03w
SUMMARY

cisco_xr_show_ip_route.template currently does not account for non-hh:mm:ss uptime formats, such as '1y03w'
cisco_xr_show_ip_route.template currently does not account for protocol sub-type support, such as 'D EX'
I have a working template if you prefer I submit a pull request for this.

STEPS TO REPRODUCE

Use the above show ip route output as 'sh_ip_route.txt'.
Use the following script as 'check.py':

import textfsm

with open('sh_ip_route.txt', 'r') as input_file:
    iproute_raw = input_file.read()

with open('./templates/cisco_xr_show_ip_route.template', 'r') as template_file:
    re_table = textfsm.TextFSM(template_file)
    fsm_results = re_table.ParseText(iproute_raw)

print(fsm_results)

Run python check.py

EXPECTED RESULTS

Receive a list of 2 lists corresponding to the 2 routes in the show ip route output.

ACTUAL RESULTS
Traceback (most recent call last):
  File "check.py", line 8, in <module>
    fsm_results = re_table.ParseText(iproute_raw)
  File "/home/user/Projects/registrar/lib64/python3.4/site-packages/textfsm.py", line 855, in ParseText
    self._CheckLine(line)
  File "/home/user/Projects/registrar/lib64/python3.4/site-packages/textfsm.py", line 878, in _CheckLine
    if self._Operations(rule):
  File "/home/user/Projects/registrar/lib64/python3.4/site-packages/textfsm.py", line 954, in _Operations
    % (rule.new_state, rule.line_num))
textfsm.TextFSMError: Error: "LINE NOT FOUND". Line: 29.
mekisiel added a commit to mekisiel/ntc-templates that referenced this issue Apr 6, 2018
networktocode#185

Signed-off-by: mekisiel <20518298+mekisiel@users.noreply.github.com>
jmcgill298 pushed a commit to jmcgill298/ntc-templates that referenced this issue Oct 14, 2018
networktocode#185

Signed-off-by: mekisiel <20518298+mekisiel@users.noreply.github.com>
jmcgill298 pushed a commit that referenced this issue Oct 14, 2018
#185

Signed-off-by: mekisiel <20518298+mekisiel@users.noreply.github.com>
jvanderaa pushed a commit that referenced this issue Nov 10, 2021
#185

Signed-off-by: mekisiel <20518298+mekisiel@users.noreply.github.com>
# 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