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

show cdp neighbors for cisco_ios returns string instead of structured list #189

Closed
d3nisko opened this issue Apr 16, 2018 · 6 comments
Closed

Comments

@d3nisko
Copy link

d3nisko commented Apr 16, 2018

ISSUE TYPE
  • Bug Report
TEMPLATE USING
Value NEIGHBOR (\S+)
Value LOCAL_INTERFACE (\S+\s\S+)
Value CAPABILITY ([\w\s]+?)
Value PLATFORM (\S+\s\S+|\S+)
Value NEIGHBOR_INTERFACE (\S+\s\S+)

Start
  ^Device.*ID -> CDP

CDP
  ^${NEIGHBOR}\s+${LOCAL_INTERFACE}\s+\d+\s+${CAPABILITY}\s{2}\s+${PLATFORM}\s+${NEIGHBOR_INTERFACE} -> Record
SAMPLE COMMAND OUTPUT
sh cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, 
                  D - Remote, C - CVTA, M - Two-port Mac Relay 

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
hostname_1
                 Gig 1/1/2         133             R S I  C6807-XL  Gig 1/18
hostname_2
                 Gig 1/1/1         153             R S I  C6807-XL  Gig 1/17
hostname_3
                 Gig 1/1/3         155             R S I  C6807-XL  Gig 1/17
hostname_4
                 Gig 1/1/4         155             R S I  C6807-XL  Gig 1/18
hostname_5
                 Gig 1/0/6         175             T B I  AIR-CAP27 Gig 0

Total cdp entries displayed : 5
SUMMARY

Usage of net template doesn't return structured output for 'show cdp neighbors'.

STEPS TO REPRODUCE
from netmiko import Netmiko

execut python script: 

device = {
    'device_type': 'cisco_ios',
    'host': 'hostname',
    'username': 'username',
    'password': getpass(),
}

command = 'show cdp neighbors'
net_conn = Netmiko(**device)
   output = net_conn.send_command(command, use_textfsm=True)
net_conn.disconnect()

print(type(output))
EXPECTED RESULTS
<type 'list'>
ACTUAL RESULTS
<type 'unicode'>
@d3nisko d3nisko changed the title show cdp neighbors for cisco_ios doesn't returns string instead of structured list show cdp neighbors for cisco_ios returns string instead of structured list Apr 16, 2018
@jmcgill298
Copy link
Contributor

@d3nisko can you actually provide the results? Also, what leads you to believe this is an issue with the template, and not how Netmiko is behaving?

@jmcgill298
Copy link
Contributor

@d3nisko any updates you can provide us?

@d3nisko
Copy link
Author

d3nisko commented May 24, 2018 via email

@d3nisko
Copy link
Author

d3nisko commented May 24, 2018

@jmcgill298 this might sound very unprofessional, but I'm not able to reproduce the issue anymore. output is returned as expected even thought the code isn't changed and I don't recall upgrading neither netmiko nor templates.

@d3nisko
Copy link
Author

d3nisko commented May 24, 2018

Lets close the issue for now. I'll reopen if be able to reproduce.

@d3nisko d3nisko closed this as completed May 24, 2018
@jmcgill298
Copy link
Contributor

@d3nisko feel free to open another issue if you can reproduce.

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