- @staticmethod
- def get_port_mac(sshclient, port):
- cmd = "ifconfig |grep HWaddr |grep %s |awk '{print $5}' " % port
- LOG.debug("Executing command: %s", cmd)
- status, stdout, stderr = sshclient.execute(cmd)
-
- if status:
- raise RuntimeError(stderr)
- else:
- return stdout.rstrip()
-
- @staticmethod
- def get_port_ip(sshclient, port):
- cmd = "ifconfig %s |grep 'inet addr' |awk '{print $2}' \
- |cut -d ':' -f2 " % port
- LOG.debug("Executing command: %s", cmd)
- status, stdout, stderr = sshclient.execute(cmd)
-
- if status:
- raise RuntimeError(stderr)
- else:
- return stdout.rstrip()
-