There are some Cisco and Juniper devices on our network that I need to make a python script to determine what they are: switches or routers.
I have ssh access, so I can show version
and parse 'JUNOS' or 'Cisco' to find out the vendor. But I don't know how to find out if the device is a router, switch or something else.
Thanks for you help!
Best Answer
It can be quite hard to tell because a lot of models marketed as a switch will have routing functions included, and you could also have cases where routers are being used like switches - i.e. they aren't routing traffic. So even if you can figure out the capability of a device, you really want to know its function in your network.
You might have a lot of devices, but you probably don't have that many different models, so manually parsing the output of
show version
may be enough to figure out what your devices can do.Unless you are just trying to populate an asset database, you are going to have to look at the configurations and figure out what each device is actually configured to do.