def getProtocolListByPort(self, port): """ Description For IxNetwork Classic Framework only: Get all enabled protocolss by the specified port. Parameter port: (chassisIp, cardNumber, portNumber) -> ('10.10.10.1', '2', '8') """ self.ixnObj.logInfo('\ngetProtocolListByPort...') chassis = str(port[0]) card = str(port[1]) port = str(port[2]) specifiedPort = (chassis, card, port) enabledProtocolList = [] response = self.ixnObj.get(self.ixnObj.sessionUrl+'/vport') vportList = ['%s/%s/%s' % (self.ixnObj.sessionUrl, 'vport', str(i["id"])) for i in response.json()] for vport in vportList: response = self.ixnObj.get(vport, 'assignedTo') # 10.219.117.101:1:5 assignedTo = response.json()['assignedTo'] currentChassisIp = str(assignedTo.split(':')[0]) currentCardNumber = str(assignedTo.split(':')[1]) currentPortNumber = str(assignedTo.split(':')[2]) currentPort = (currentChassisIp, currentCardNumber, currentPortNumber) if currentPort != specifiedPort: continue else: response = self.ixnObj.get(vport+'/protocols?links=true') if response.status_code == 200: #print 'json', response.json()['links'] for protocol in response.json()['links']: currentProtocol = protocol['href'] url = self.ixnObj.httpHeader+currentProtocol response = self.ixnObj.get(url) if 'enabled' in response.json() and response.json()['enabled'] == True: # Exclude ARP object if 'arp' not in currentProtocol: enabledProtocolList.append(str(currentProtocol)) return enabledProtocolList