Having ssh access only, determine if the device is router or a switch (Cisco and Juniper)

view story

http://serverfault.com – 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! (HowTos)