-
Notifications
You must be signed in to change notification settings - Fork 721
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
platform="cisco_ios", command="sh ip route summary" returning an empty array. #655
Comments
@delhipnr Can you provide the real format of the command? I'd like to compare it to the data we have in tests and then what error are you experiencing? |
show IP route summary R1#show ip route summary |
Yeah that is definitely odd as the template has Can you grab the actual output from the device and wrap it in triple backticks here? The formatting of what you provided doesn't match any other output we have as normally the Trying to help you out here, but definitely need more information. |
from ntc_templates.parse import parse_output indata = """ vlan_parsed = parse_output(platform="cisco_ios", command="show ip route summary", data=indata) na-EDGE1001SWG-VSS-242>show ip route summary RESTART: C:\Users\devuser\AppData\Local\Programs\Python\Python37-32\dictl.py |
The formatting still seems off with the indention to be honest. Does the output you're providing here match what you see on the device? I'd expect you could log into the device and then copy and paste it here wrapped in triple backticks and it would have the proper indentation.
I am curious as well that it is not parsing anything so maybe that is more of the smoking gun at this point. It appears the template was added 21 days ago. Did you pip install ntc-templates? Or are you getting the templates from git? |
|
Ok that is what I suspected. The template you're not getting any output for is not in the 1.4.0 package of ntc-templates as it was just added 22 days ago. I'll try and cut a new release soon to get you that. You can always Here is my script that I use: import sys
sys.path.append("/home/myohman/cloned-repos/ntc-templates/lib/ntc_templates")
from parse import parse_output
platform = "cisco_ios"
command = "show vlan"
with open("textfsm_data.cfg", "r") as f:
data = f.read()
parsed_output = parse_output(platform, command, data)
print(parsed_output) |
Thank You it is work.
|
I'll be releasing 1.4.1 tonight so you can pip install the newest version to use the same method you've been using although I would suggest the |
from ntc_templates.parse import parse_output
from pprint import pprint
showiproute = """
IP routing table name is default (0x0)
IP routing table maximum-paths is 32
Route Source Networks Subnets Replicates Overhead Memory (bytes)
connected 0 3 0 180 540
static 0 0 0 0 0
bgp 65000 0 0 0 0 0
External: 0 Internal: 0 Local: 0
internal 2 640
Total 2 3 0 180 1180
"""
vlan_parsed = parse_output(platform="cisco_ios", command="sh ip ro sum", data=showiproute)
pprint(vlan_parsed)
from ntc_templates.parse import parse_output
from pprint import pprint
showiproute = """
IP routing table name is default (0x0)
IP routing table maximum-paths is 32
Route Source Networks Subnets Replicates Overhead Memory (bytes)
connected 0 3 0 180 540
static 0 0 0 0 0
bgp 65000 0 0 0 0 0
External: 0 Internal: 0 Local: 0
internal 2 640
Total 2 3 0 180 1180
"""
vlan_parsed = parse_output(platform="cisco_ios", command="sh ip ro sum", data=showiproute)
pprint(vlan_parsed)
The text was updated successfully, but these errors were encountered: