コード例 #1
0
def getStrideDeploymentPairs(nameToHostMap,maxPortcountInSwitch,testCaseName, loadFactor, testDuration,testStartDelay ):
    # foreach scrc-dest-pair
    #       login to src
    #       foreach of the flows
    #               build corresponding cmdString and deploy
    srcList, destList= l2StridePatternTestPairCreator(nameToHostMap,maxPortcountInSwitch)
    deploymentPairList= []

    if (len(srcList) != len(destList)):
        logger.error("Srclist and dest list is not equal in length. Printing them and exiting")
        logger.error(srcList)
        logger.error(destList)
        exit(1)
    else:
        i = 0
        j=0
        for i in range(0, len(srcList)):
            flowArrivalTimesByflowType = calculateFlowArrivalTimes(loadFactor, testDuration)
            for j in range (0, len(ConfigConst.FLOW_TYPE_IDENTIFIER_BY_FLOW_VOLUME_IN_KB)):
                flowsizeAsPacketCount = math.ceil(((ConfigConst.FLOW_TYPE_IDENTIFIER_BY_FLOW_VOLUME_IN_KB[j]*1024)/(ConfigConst.PACKET_SIZE)))
                for k in range (0, len(flowArrivalTimesByflowType[j])):
                    flowArraivalTime = flowArrivalTimesByflowType[j][k]
                    newDeploymentPair = tc.IPerfDeplymentPair(srcList[i], destList[i], srcList[i].getNextIPerf3ClientPort(),
                                                              destList[i].getNextIPerf3ServerPort(),testCaseName = testCaseName,
                                                              srcHostName=srcList[i].hostName, destHostName= destList[i].hostName,
                                                              startTime= flowArraivalTime+float(testStartDelay),flowSizeinPackets= flowsizeAsPacketCount)
                    deploymentPairList.append(newDeploymentPair)
                    # print(newDeploymentPair.getServerCommand())
    return deploymentPairList
コード例 #2
0
def buildOneDeploymentPair(nameToHostMap, srcName, dstName, testCaseName, testStartDelay, flowsizeInpacket, trafficClass, rateInKBPS):
    src = nameToHostMap.get(srcName)
    dst = nameToHostMap.get(dstName)
    newDeploymentPair = tc.IPerfDeplymentPair(src, dst, src.getNextIPerf3ClientPort(),
                                              dst.getNextIPerf3ServerPort(), testCaseName = testCaseName,
                                              srcHostName=src.hostName, destHostName= dst.hostName,
                                              startTime=float(testStartDelay), flowSizeinPackets= flowsizeInpacket,
                                              trafficClass = trafficClass, bitrate = rateInKBPS)
    return newDeploymentPair
コード例 #3
0
def getStrideDeploymentPairs(nameToHostMap,maxPortcountInSwitch,testCaseName, loadFactor, testDuration,testStartDelay ):
    # foreach scrc-dest-pair
    #       login to src
    #       foreach of the flows
    #               build corresponding cmdString and deploy
    srcList, destList= l2StridePatternTestPairCreator(nameToHostMap,maxPortcountInSwitch)
    # print("Srclist is ",srcList)
    # print("destList is ",destList)
    deploymentPairList= []

    if (len(srcList) != len(destList)):
        logger.error("Srclist and dest list is not equal in length. Printing them and exiting")
        logger.error(srcList)
        logger.error(destList)
        exit(1)
    else:
        flowArrivalTimesByflowType = calculateFlowArrivalTimes(loadFactor, testDuration)
        for i in range (0, len(ConfigConst.FLOW_TYPE_IDENTIFIER_BY_FLOW_VOLUME_IN_KB)):
            totalFlowForThisFlowType = len(flowArrivalTimesByflowType[i])
            flowsizeAsPacketCount = math.ceil(((ConfigConst.FLOW_TYPE_IDENTIFIER_BY_FLOW_VOLUME_IN_KB[i]*1024)/(ConfigConst.PACKET_SIZE)))
            for j in range (0,totalFlowForThisFlowType):
                k = j % len(srcList)
                newDeploymentPair = tc.IPerfDeplymentPair(srcList[k], destList[k], srcList[k].getNextIPerf3ClientPort(),
                                  destList[k].getNextIPerf3ServerPort(),testCaseName = testCaseName,
                                  srcHostName=srcList[k].hostName, destHostName= destList[k].hostName,
                                  startTime= flowArrivalTimesByflowType[i][j]+float(testStartDelay),flowSizeinPackets= flowsizeAsPacketCount,
                                  trafficClass = ConfigConst.FLOW_TYPE_TRAFFIC_CLASS[i], bitrate = ConfigConst.FLOW_TYPE_BITRATE[i])
                deploymentPairList.append(newDeploymentPair)
        testDurationScaled = loadFactor * 2 * testDuration
        qosDeploymentPair = getQoSTestDeploymentDeploymentPairs(nameToHostMap,testCaseName, testDuration=testDurationScaled,testStartDelay= testStartDelay)
        for k in qosDeploymentPair:
            deploymentPairList.append(k)
        # src = nameToHostMap.get("h0p0l0")
        # dst = nameToHostMap.get("h1p0l1")
        # flowSize = testDuration * ConfigConst.queueRateForSpineFacingPortsOfLeafSwitch
        # # print("Spoecial flow size is "+str(flowSize))
        # bitrate = ConfigConst.queueRateForSpineFacingPortsOfLeafSwitch * 1024
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                   dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                   srcHostName=src.hostName, destHostName= dst.hostName,
        #                   startTime= 10+float(testStartDelay),flowSizeinPackets= flowSize,
        #                   trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                                           dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                                           srcHostName=src.hostName, destHostName= dst.hostName,
        #                                           startTime= 10+float(testStartDelay+testDuration/3),flowSizeinPackets= flowSize,
        #                                           trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                                           dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                                           srcHostName=src.hostName, destHostName= dst.hostName,
        #                                           startTime= 10+float(testStartDelay+testDuration*2/3),flowSizeinPackets= flowSize,
        #                                           trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                                           dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                                           srcHostName=src.hostName, destHostName= dst.hostName,
        #                                           startTime= 10+float(testStartDelay+testDuration),flowSizeinPackets= flowSize,
        #                                           trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)
        # src = nameToHostMap.get("h0p0l2")
        # dst = nameToHostMap.get("h1p0l3")
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                   dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                   srcHostName=src.hostName, destHostName= dst.hostName,
        #                   startTime= 10+float(testStartDelay),flowSizeinPackets= flowSize,
        #                   trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                                           dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                                           srcHostName=src.hostName, destHostName= dst.hostName,
        #                                           startTime= 10+float(testStartDelay+testDuration/3),flowSizeinPackets= flowSize,
        #                                           trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                                           dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                                           srcHostName=src.hostName, destHostName= dst.hostName,
        #                                           startTime= 10+float(testStartDelay+testDuration*2/3),flowSizeinPackets= flowSize,
        #                                           trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)
        # newDeploymentPair = tc.IPerfDeplymentPair(src,dst, src.getNextIPerf3ClientPort(),
        #                                           dst.getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                                           srcHostName=src.hostName, destHostName= dst.hostName,
        #                                           startTime= 10+float(testStartDelay+testDuration),flowSizeinPackets= flowSize,
        #                                           trafficClass = ConfigConst.tunnelTrafficClass, bitrate = bitrate)
        # deploymentPairList.append(newDeploymentPair)

        # i = 0
        # j=0
        # for i in range(0, len(srcList)):
        #     flowArrivalTimesByflowType = calculateFlowArrivalTimes(loadFactor, testDuration)
        #     for j in range (0, len(ConfigConst.FLOW_TYPE_IDENTIFIER_BY_FLOW_VOLUME_IN_KB)):
        #         flowsizeAsPacketCount = math.ceil(((ConfigConst.FLOW_TYPE_IDENTIFIER_BY_FLOW_VOLUME_IN_KB[j]*1024)/(ConfigConst.PACKET_SIZE)))
        #         for k in range (0, len(flowArrivalTimesByflowType[j])):
        #             flowArraivalTime = flowArrivalTimesByflowType[j][k]
        #             newDeploymentPair = tc.IPerfDeplymentPair(srcList[i], destList[i], srcList[i].getNextIPerf3ClientPort(),
        #                                                       destList[i].getNextIPerf3ServerPort(),testCaseName = testCaseName,
        #                                                       srcHostName=srcList[i].hostName, destHostName= destList[i].hostName,
        #                                                       startTime= flowArraivalTime+float(testStartDelay),flowSizeinPackets= flowsizeAsPacketCount,
        #                                                       trafficClass = ConfigConst.FLOW_TYPE_TRAFFIC_CLASS[j], bitrate = ConfigConst.FLOW_TYPE_BITRATE[j])
        #             deploymentPairList.append(newDeploymentPair)
        #             # print(newDeploymentPair.getServerCommand())
    return deploymentPairList