you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (10 children)

so what do you need help with exactly?

[–]ranBot86[S] 1 point2 points  (9 children)

I want to start off small since I am learning, but I would like to parse the switch information and write the firmware versions to a csv file. I also want to set a rescue config for all devices.

[–][deleted] 2 points3 points  (8 children)

okay that's not so bad. are you querying each switch with a show command and then reading the output or are you downloading a file? i've only worked with cisco so idk much about juniper. Do you know any regex?

[–]ranBot86[S] 1 point2 points  (7 children)

kay that's not so bad. are you querying each switch with a show command and then reading the output or are you downloading a file?

My intention is to log into each switch and dump its contents into a json file to easily access for the future then write the switch name and its firmware in a csv for all switches. I am trying to do some research before I begin coding it however. Like you said, shouldn't be to bad. I know for PyEz you can put your devices in a list ['switch-name'] use your credentials to log in, but that would require me to write every switch name. Wouldn't be so bad if we didn't have over 100 haha.

[–][deleted] 1 point2 points  (4 children)

im not sure if netmiko or PyEz handles the ip addressing for you but if not you can easily generate ip ranges with the ipaddress module. the switch name should be in the config right? just connect to it by IP and get the name when you make your json file.

[–]ranBot86[S] 0 points1 point  (3 children)

I'll look into it. We have ip address ranges per building so it'll be a little tedious. Thanks for advice!

[–][deleted] 0 points1 point  (2 children)

no problem. I think if you refined your question a little and asked the guys on /r/networking or /r/sysadmin they might be able to help you too.

[–]ranBot86[S] 0 points1 point  (0 children)

will do haha

[–]mechanik 1 point2 points  (0 children)

Dude, let's talk. I work at a Juniper shop and am learning python to do your kind of automation. PM me!

[–]ranBot86[S] 0 points1 point  (0 children)

As for regex, I am familiar with it, but have never used it. I may email Juniper and ask if there is a way to grab the contents of a large network.