I am trying to find the switch port that a network device (e.g. server) is plugged into (i.e. the hostname) and MAC address for the device (e.g. server). I can connect to the device just fine knowing the IP as follows:
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(self.TIMEOUT)
sock.connect_ex((ip_address, DEFAULT_PORT))
How do I get the MAC address and port name/number? The switches are Cisco but I don't want to rely on apriori knowledge about the network hardware.