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_nxos_show_cdp_neighbors_detail 'str' object has no attribute 'seek'. #936

Closed
rtrunk opened this issue May 28, 2021 · 2 comments
Closed

Comments

@rtrunk
Copy link

rtrunk commented May 28, 2021

ISSUE TYPE
  • Bug Report
TEMPLATE USING
Value Required DEST_HOST (.*)
Value SYSNAME (.*)
Value MGMT_IP (.*)
Value PLATFORM (.*)
Value REMOTE_PORT (.*)
Value LOCAL_PORT (.*)
Value VERSION (.*)
Value INTERFACE_IP (.*)
Value CAPABILITIES (.*[^\s])

Start
  ^Device ID:${DEST_HOST}
  ^System Name: ${SYSNAME}
  ^Interface address\(es\): -> GetInterfaceIP
  ^Mgmt address\(es\): -> GetIP
  ^Platform: ${PLATFORM}, Capabilities: ${CAPABILITIES}\s*$$
  ^Interface: ${LOCAL_PORT}, Port ID \(outgoing port\): ${REMOTE_PORT}
  ^Version: -> GetVersion
  ^----- -> Record

GetIP
  ^.*IP.+Address: ${MGMT_IP} -> Start

GetInterfaceIP
  ^.*IP.+Address: ${INTERFACE_IP} -> Start

GetVersion
  ^${VERSION} -> Start

SAMPLE COMMAND OUTPUT
umbcdcdist-2# show cdp nei det
----------------------------------------
Device ID:c3750umbcMGT.courts.state.md.us
VTP Management Domain Name: null

Interface address(es):
    IPv4 Address: 10.76.160.253
Platform: cisco WS-C3750X-48, Capabilities: Switch IGMP Filtering 
Interface: mgmt0, Port ID (outgoing port): GigabitEthernet1/0/24
Holdtime: 127 sec

Version:
Cisco IOS Software, C3750E Software (C3750E-UNIVERSALK9-M), Version 12.2(53)SE2, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2010 by Cisco Systems, Inc.
Compiled Wed 21-Apr-10 05:11 by prod_rel_team

Advertisement Version: 2

Native VLAN: 160
Duplex: full
Mgmt address(es):
    IPv4 Address: 10.76.160.253
----------------------------------------
Device ID:umbcaccess-a2.courts.state.md.us(FDO2303222A)
System Name: umbcaccess-a2

Interface address(es):
    IPv4 Address: 10.76.160.65
Platform: N9K-C93180YC-EX, Capabilities: Router Switch Supports-STP-Dispute
Interface: Ethernet1/1, Port ID (outgoing port): Ethernet1/49
Holdtime: 166 sec

Version:
Cisco Nexus Operating System (NX-OS) Software, Version 9.2(3)

Advertisement Version: 2

Native VLAN: 1
Duplex: full

MTU: 9216
Physical Location: UMBC Data Center
Mgmt address(es):
    IPv4 Address: 10.76.160.65
----------------------------------------
Device ID:umbcaccess-a1.courts.state.md.us(FDO2303223K)
System Name: umbcaccess-a1

Interface address(es):
    IPv4 Address: 10.76.160.64
Platform: N9K-C93180YC-EX, Capabilities: Router Switch IGMP Filtering Supports-STP-Dispute
Interface: Ethernet1/2, Port ID (outgoing port): Ethernet1/50
Holdtime: 133 sec

Version:
Cisco Nexus Operating System (NX-OS) Software, Version 9.2(3)

Advertisement Version: 2

Native VLAN: 1
Duplex: full

MTU: 9216
Physical Location: UMBC Data Center
Mgmt address(es):
    IPv4 Address: 10.76.160.64
SUMMARY
STEPS TO REPRODUCE
>>> print(textfsm.__version__)
1.1.0
>>> type="nxos"
>>> template = os.environ['NET_TEXTFSM'] + "\cisco_" + type + "_show_cdp_neighbors_detail.textfsm"
>>> print("Using: " + template)
Using: C:\repos\ntc-templates\templates\cisco_nxos_show_cdp_neighbors_detail.textfsm
>>> try:
...     mylist=textfsm.TextFSM(template)
... except Exception as e:
...     print(e)
...
'str' object has no attribute 'seek'
>>>
>>>

EXPECTED RESULTS

No error

ACTUAL RESULTS

'str' object has no attribute 'seek'

>>> print(textfsm.__version__)
1.1.0
>>> type="nxos"
>>> template = os.environ['NET_TEXTFSM'] + "\cisco_" + type + "_show_cdp_neighbors_detail.textfsm"
>>> print("Using: " + template)
Using: C:\repos\ntc-templates\templates\cisco_nxos_show_cdp_neighbors_detail.textfsm
>>> try:
...     mylist=textfsm.TextFSM(template)
... except Exception as e:
...     print(e)
...
'str' object has no attribute 'seek'
>>>
>>>


@jmcgill298
Copy link
Contributor

This project consists mostly of TextFSM templates and a testing methodology to ensure new commits provide the expected output. There is another small section to assist with using CliTable to parse command output into TextTable and convert the TextTable into a list of dictionaries. Using this is documented in the README.md file

Whereas you have documented the code you are using, I am still not sure what you are actually trying to do. The code raises the error above is from TextFSM; if your use case is outside of what is supported by this project, then you will need to raise an issue with the appropriate group.

@rtrunk
Copy link
Author

rtrunk commented May 28, 2021

I will move to TextFSM

@rtrunk rtrunk closed this as completed May 28, 2021
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