def getPortsByProtocol(self, protocolName): """ Description Based on the specified protocol, return all ports associated with the protocol. Parameters protocolName options: bfd, bgp, cfm, eigrp, elmi, igmp, isis, lacp, ldp, linkOam, lisp, mld, mplsOam, mplsTp, openFlow, ospf, ospfV3, pimsm, ping, rip, ripng, rsvp, static, stp Returns: [chassisIp, cardNumber, portNumber] Example: [['192.168.70.11', '1', '1'], ['192.168.70.11', '1', '2']] Returns [] if no port is configured with the specified protocolName """ portList = [] response = self.ixnObj.get(self.ixnObj.sessionUrl+'/vport') # ['http://{apiServerIp:port}/api/v1/sessions/1/ixnetwork/vport/1'] vportList = ['%s/%s/%s' % (self.ixnObj.sessionUrl, 'vport', str(i["id"])) for i in response.json()] # Go through each port that has the protocol enabled. for vport in vportList: # http://{apiServerIp:port}/api/v1/sessions/1/ixnetwork/vport/1/protocols/ospf currentProtocol = vport+'/protocols/'+protocolName response = self.ixnObj.get(currentProtocol) if response.json()['enabled'] == True: # 192.168.70.11:1:5 response = self.ixnObj.get(vport) assignedTo = response.json()['assignedTo'] currentChassisIp = str(assignedTo.split(':')[0]) currentCardNumber = str(assignedTo.split(':')[1]) currentPortNumber = str(assignedTo.split(':')[2]) currentPort = [currentChassisIp, currentCardNumber, currentPortNumber] portList.append(currentPort) return portList