def GetVportMapping( port ): # Search all vport for the port number. # Port format = 1/1. Not 1/1/1. vportList = ixNet.getList(ixNet.getRoot(), 'vport') for vport in vportList: # ::ixNet::OBJ-/availableHardware/chassis:"10.219.117.101"/card:1/port:5 connectedTo = ixNet.getAttribute(vport, '-connectedTo') card = connectedTo.split('/')[3].split(':')[-1] portNum = connectedTo.split('/')[4].split(':')[-1] portNumber = card +'/' + portNum if portNumber == port: return vport