def getPortNum(portSearchName): devices = base_ONOS.readDevices(ctrl) for dev in devices: devNum = str(devices[dev][0]) ports = base_ONOS.readPorts(devNum, ctrl) for port in ports: portNum = str(ports[port][1]) portName = str(ports[port][3]["portName"]) if portName == portSearchName: print(portNum)
linkTO = str(edge_data[edge]['to']) for node in node_data: nodeID = str(node_data[node]['id']) nodeNAME = str(node_data[node]['label']) if nodeID == linkTO: try: linkSPEED = str(edge_data[edge]['label']) edgesInfo[linkID].update({ 'to': nodeNAME, 'speed': linkSPEED }) except KeyError: pass link_id = {} devices = base_ONOS.readDevices(ctrl) for dev in devices: devNum = str(devices[dev][0]) ports = base_ONOS.readPorts(devNum, ctrl) for port in ports: portNum = str(ports[port][1]) portName = str(ports[port][3]["portName"]) if portNum != 'local' and len(portName) > 7: # print(portName[len(portName)-1]) # if int(portName[len(portName)-1]) > 1: for edge in edgesInfo: try: edgePortFWD = 'c.' + edgesInfo[edge][ 'from'] + '-' + edgesInfo[edge]['to'] portSpeed = edgesInfo[edge]['speed']