Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Python scripts.

Hi all,

  Recently, I started some writing in python that I thought might be useful to some. These are still work in progress, but nevertheless. i was developing on Solaris 8 and Python 2.6.2. CiscoSwitch.py is a class which uses rshell to check things on a switch. findmap.py finds the port and switch of some MAC address. traverseall.py goes over your entire network and maps it.

  Enjoy.

-- Yaron.

4 REPLIES

Python scripts.

Very nice of you to share this.  :-)

Tried something like this years ago in perl. My idea was to discover a netwerk using CDP but without SNMP

Had some issues because the returned CDP info was formatated different on every IOS version  :-)

If you are still developing think about including sh ip arp and sh ip ro parsing to enhance the discovery

For loop avoidance I created a record of hostname+devicetype, hoping this to be unique for each device.

Must admit that your python source looks cleaner and more readable than what I did back then in perl. But that could very well be my fault.

Cheers,

Michel

New Member

Python scripts.

  The code is cleaner because it is in Python. I have been writing Perl for years and recently switched to Python and I can tell you that writing in Python is much easier. You think of the algorithm and simply writes it. I keep going to the Python docs for every other line and it is still much faster to write.

  I would probably add some more features to this class, but just wanted to share this, because it is already useful.

  As for ARP and routes, I am not sure I will add this because these only exists with L3 switches and the code is more into L2 switches.

Thanks for the feedback.

-- Yaron.

New Member

Re: Python scripts.

-- Yaron.

"michel.hegeraat" כתב:

>Michel Hegeraat created the discussion

>"Re: Python scripts."

>To view the discussion, visit: https://supportforums.cisco.com/message/3660517#3660517

New Member

Python scripts.

Hi,

Thanks for the share!

This will really come in handy when batching switches..

--

Regards Falk

5375
Views
0
Helpful
4
Replies
CreatePlease to create content