Example #1
0
def usage():
    print 'Usage: exp-rt-score.py [-options]'
    print '\t\tto run the experiment.\n'
    print 'where options include:'
    print '-h, --help\tdisplay this message'
    print '--short\tdo a short run of the regTests'

    print '\nFor all tests:'
    print '--sneeql-root=<dir> \n\tdefault: ' + optSneeqlRoot
    print '--num-epochs=<sec> \n\tdefault: ' + str(optNumEpochs)
    print '--ouput-root=<dir> \n\tdefault: ' + str(optOutputRoot)
    print '--timestamp-output \n\tdefault: ' + str(optTimeStampOutput)
    print '--do-tossim \n\tdefault: ' + str(optDoTossim)
    print '--do-avrora \n\tdefault: ' + str(optDoAvrora)
    print '--num-avrora-runs \n\tdefault: ' + str(optNumAvroraRuns)
    print '--tossim-sync-time \n\tdefault: ' + str(optTossimSyncTime)
    print '--do-avrora-individual-queries \n\tdefault: ' + str(
        optDoAvroraIndividualQueries)
    print '--do-tossim-individual-queries \n\tdefault: ' + str(
        optDoTossimIndividualQueries)

    print '--generate-random-network=[True|False] \n\tdefault: ' + str(
        optGenerateRandomNet)
    print '\nIf a pre-existing network is to be used:'
    print '--sneeql-network-file=<file> \n\tdefault: ' + str(optSneeqlNetFile)
    print '--avrora-network-file=<file> \n\tdefault: ' + str(
        optAvroraNetFile
    ) + '\n\tif not provided freespace radio model won\'t be used by Avrora'
    print '\nIf a network is to be generated	:'
    print '--net-num-nodes=<n> \n\tdefault: ' + str(optNetNumNodes)
    print '--net-x-dim=<n> \n\tdefault: ' + str(optNetXDim)
    print '--net-y-dim=<n> \n\tdefault: ' + str(optNetYDim)

    print '\nPhysical schema options:'
    print '--generate-random-schemas=[True|False] \n\tdefault: ' + str(
        optGenerateRandomSchemas)
    print '--num-schemas=<num> \n\tdefault: ' + str(
        optNumSchemas) + "\n\tonly applies if generate-random-schemas=True"
    print '--schema-file=<file> \n\tdefault: ' + str(
        optSchemaFile) + "\n\tonly applies if generate-random-schemas=False"

    print '\nScenarios to be tested:'
    print '--query-set=[Q1,Q2,..Qn] \n\tdefault: ' + str(optQuerySet)
    print '--sinks=[N1,N2,..Nn] \n\tdefault: ' + str(optSinks)
    print '--acq-rates=[a1,..,an] \n\t default: ' + str(optAcqRates)
    print '--max-buffering-factors=[b1..bn] \n\t default: ' + str(
        optMaxBufferingFactors)
    print '--max-delivery-time=[D1..Dn] \n\t default: ' + str(
        optMaxDeliveryTime)

    SneeqlLib.usage()
    TossimLib.usage()
    AvroraLib.usage()
    RandomSeeder.usage()
Example #2
0
def usage():
	print 'Usage: regTests.py [-options]'
	print '\t\tto run the experiment.\n'
	print 'where options include:'
	print '-h, --help\tdisplay this message'
	print '--short\tdo a short run of the regTests'
	
	print '\nFor all tests:'
	print '--sneeql-root=<dir> \n\tdefault: '+ optSneeqlRoot
	print '--num-agenda-evals=<n> \n\tdefault: ' + str(optNumAgendaEvals)
	print '--query-duration=<secs>' + str(optQueryDuration)
	print '--ouput-root=<dir> \n\tdefault: ' + str(optOutputRoot)
	print '--timestamp-output \n\tdefault: ' + str(optTimeStampOutput)
	print '--do-tossim \n\tdefault: ' + str(optDoTossim)
	print '--do-avrora \n\tdefault: ' + str(optDoAvrora)
	print '--num-avrora-runs \n\tdefault: ' + str(optNumAvroraRuns)
	print '--tossim-sync-time \n\tdefault: ' + str(optTossimSyncTime)
	print '--do-avrora-candidates \n\tdefault: ' + str(optDoAvroraCandidates)
	print '--do-tossim-candidates \n\tdefault: ' + str(optDoTossimCandidates)
	print '--do-model: ' + str(optDoModel)

	print '--generate-random-network=[True|False] \n\tdefault: '+str(optGenerateRandomNet)
	print '\nIf a pre-existing network is to be used:'
	print '--sneeql-network-file=<file> \n\tdefault: '+ str(optSneeqlNetFile)
	print '--avrora-network-file=<file> \n\tdefault: '+ str(optAvroraNetFile) + '\n\tif not provided freespace radio model won\'t be used by Avrora'
	print '\nIf a network is to be generated	:'
	print '--net-num-nodes=<n> \n\tdefault: ' + str(optNetNumNodes)
	print '--net-x-dim=<n> \n\tdefault: ' + str(optNetXDim)
	print '--net-y-dim=<n> \n\tdefault: ' + str(optNetYDim)
	
	print '\nPhysical schema options:'
	print '--generate-random-schemas=[True|False] \n\tdefault: '+ str(optGenerateRandomSchemas)
	print '--num-schemas=<num> \n\tdefault: ' + str(optNumSchemas) + "\n\tonly applies if generate-random-schemas=True"
	print '--schema-file=<file> \n\tdefault: ' + str(optSchemaFile) + "\n\tonly applies if generate-random-schemas=False"
	
	print '\nScenarios to be tested:'
	print '--queries=[Q1..Qn] \n\tdefault: '+ str(optQueries)
	print '--acq-rates=[a1,..,an] \n\t default: ' + str(optAcqRates)
	print '--max-buffering-factors=[b1..bn] \n\t default: ' + str(optMaxBufferingFactors)

	print '--qos-aware-routing=[True|False] \n\tdefault:' + str(optQoSAwareRouting) #Move to sneeqlLib
	print '--routing-trees-to-generate=<n> \n\tdefault: ' + str(optRoutingTreesToGenerate) #Move to sneeqlLib
	print '--routing-trees-to-keep=<n> \n\tdefault: ' + str(optRoutingTreesToKeep) #Move to sneeqlLib
	print '--qos-aware-where-scheduling=[True|False] \n\tdefault:' + str(optQoSAwareWhereScheduling) #Move to sneeqlLib
	print '--qos-aware-when-scheduling=[True|False] \n\tdefault:' + str(optQoSAwareWhenScheduling) #Move to sneeqlLib

	SneeqlLib.usage()
	TossimLib.usage()
	AvroraLib.usage()
	RandomSeeder.usage()
Example #3
0
def parseArgs(args):
    global optSneeqlRoot, optNumEpochs, optOutputRoot, optTimeStampOutput, optDoTossim, optDoAvrora, optNumAvroraRuns, optTossimSyncTime, optDoAvroraCandidates, optDoTossimCandidates, optGenerateRandomNet, optSneeqlNetFile, optAvroraNetFile, optNetNumNodes, optNetXDim, optNetYDim, optGenerateRandomSchemas, optNumSchemas, optSchemaFile, optQueries, optAcqRates, optMaxBufferingFactors

    try:
        optNames = [
            "help", "short", "sneeql-root=", "num-epochs=", "output-root=",
            "timestamp-output=", "do-tossim=", "do-avrora=",
            "num-avrora-runs=", "tossim-sync-time=", "do-avrora-candidates=",
            "do-tossim-candidates="
        ]
        optNames += [
            "generate-random-network=", "sneeql-network-file=",
            "avrora-network-file=", "net-num-nodes=", "net-x-dim=",
            "net-y-dim="
        ]
        optNames += [
            "generate-random-schemas=", "num-schemas=", "schema-file="
        ]
        optNames += ["queries=", "acq-rates=", "max-buffering-factors="]

        #append the result of getOpNames to all the libraries
        optNames += SneeqlLib.getOptNames()
        optNames += TossimLib.getOptNames()
        optNames += AvroraLib.getOptNames()
        optNames += RandomSeeder.getOptNames()

        optNames = UtilLib.removeDuplicates(optNames)

        opts, args = getopt.getopt(args, "h", optNames)
    except getopt.GetoptError, err:
        print str(err)
        usage()
        sys.exit(2)
Example #4
0
def testTossimCandidate(nescDir, traceFilePath, query, numNodes, duration, outputPath, schemaPath, aqRate):

	#compile the nesc
	exitVal = TossimLib.compileNesCCode(nescDir)
	if (exitVal != 0):
		return;		

	#run tossim simulation		
	exitVal = TossimLib.runSimulation(nescDir, traceFilePath, query, numNodes, simulationDuration = (duration + optTossimSyncTime))
	if (exitVal != 0):
		return;

	#check all tuples present in Tossim simulation
	queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (outputPath, query)
	actualBFactor = SneeqlLib.getBufferingFactor(queryPlanSummaryFile)
	checkTupleCount.checkResults(query, traceFilePath, schemaPath, aqRate, actualBFactor, duration)
Example #5
0
def usage():
	print 'Usage: regTests.py [-options]'
	print '\t\tto run the experiment.\n'
	print 'where options include:'
	print '-h, --help\tdisplay this message'
	print '--short\tdo a short run of the regTests'
	
	print '\nFor all tests:'
	print '--sneeql-root=<dir> \n\tdefault: '+ optSneeqlRoot
	print '--num-epochs=<sec> \n\tdefault: ' + str(optNumEpochs)
	print '--ouput-root=<dir> \n\tdefault: ' + str(optOutputRoot)
	print '--timestamp-output \n\tdefault: ' + str(optTimeStampOutput)
	print '--targets={avrora1,avrora2,tossim1,tossim2,insense} \n\tdefault: ' + str(optTargets)
	print '--num-avrora-runs \n\tdefault: ' + str(optNumAvroraRuns)
	print '--tossim-sync-time \n\tdefault: ' + str(optTossimSyncTime)
	print '--do-avrora-candidates \n\tdefault: ' + str(optDoAvroraCandidates)
	print '--do-tossim-candidates \n\tdefault: ' + str(optDoTossimCandidates)

	print '--generate-random-network=[True|False] \n\tdefault: '+str(optGenerateRandomNet)
	print '\nIf a pre-existing network is to be used:'
	print '--sneeql-network-file=<file> \n\tdefault: '+ str(optSneeqlNetFile)
	print '--avrora-network-file=<file> \n\tdefault: '+ str(optAvroraNetFile) + '\n\tif not provided freespace radio model won\'t be used by Avrora'
	print '\nIf a network is to be generated	:'
	print '--net-num-nodes=<n> \n\tdefault: ' + str(optNetNumNodes)
	print '--net-x-dim=<n> \n\tdefault: ' + str(optNetXDim)
	print '--net-y-dim=<n> \n\tdefault: ' + str(optNetYDim)
	
	print '\nPhysical schema options:'
	print '--generate-random-schemas=[True|False] \n\tdefault: '+ str(optGenerateRandomSchemas)
	print '--num-schemas=<num> \n\tdefault: ' + str(optNumSchemas) + "\n\tonly applies if generate-random-schemas=True"
	print '--schema-file=<file> \n\tdefault: ' + str(optSchemaFile) + "\n\tonly applies if generate-random-schemas=False"
	
	print '\nScenarios to be tested:'
	print '--queries=[Q1..Qn] \n\tdefault: '+ str(optQueries)
	print '--acq-rates=[a1,..,an] \n\t default: ' + str(optAcqRates)
	print '--max-buffering-factors=[b1..bn] \n\t default: ' + str(optMaxBufferingFactors)
	print '--test-all=[True|False] \n\tdefault: '+ str(optTestAll)

	print '\nExperiment Parameters:'
	print '--led-debug\n\tdefault: ' + str(optLedDebug)
	
	SneeqlLib.usage()
	TossimLib.usage()
	AvroraLib.usage()
	RandomSeeder.usage()
	checkTupleCount.usage()
Example #6
0
def testTossimCandidate(nescDir, traceFilePath, query, numNodes, duration,
                        outputPath, schemaPath, aqRate):

    #compile the nesc
    exitVal = TossimLib.compileNesCCode(nescDir)
    if (exitVal != 0):
        return

    #run tossim simulation
    exitVal = TossimLib.runSimulation(nescDir,
                                      traceFilePath,
                                      query,
                                      numNodes,
                                      simulationDuration=(duration +
                                                          optTossimSyncTime))
    if (exitVal != 0):
        return
Example #7
0
def usage():
    print 'Usage: regTests.py [-options]'
    print '\t\tto run the experiment.\n'
    print 'where options include:'
    print '-h, --help\tdisplay this message'
    print '--short\tdo a short run of the regTests'

    print '\nFor all tests:'
    print '--sneeql-root=<dir> \n\tdefault: ' + optSneeqlRoot
    print '--sim-duration=<sec> \n\tdefault: ' + str(optSimDuration)
    print '--ouput-root=<dir> \n\tdefault: ' + str(optOutputRoot)
    print '--timestamp-output \n\tdefault: ' + str(optTimeStampOutput)
    print '--do-tossim \n\tdefault: ' + str(optDoTossim)
    print '--do-avrora \n\tdefault: ' + str(optDoAvrora)
    print '--num-avrora-runs \n\tdefault: ' + str(optNumAvroraRuns)
    print '--tossim-sync-time \n\tdefault: ' + str(optTossimSyncTime)
    print '--do-avrora-candidates \n\tdefault: ' + str(optDoAvroraCandidates)
    print '--do-tossim-candidates \n\tdefault: ' + str(optDoTossimCandidates)

    print '--sneeql-network-file=<file> \n\tdefault: ' + str(optSneeqlNetFile)
    print '--net-num-nodes=<n> \n\tdefault: ' + str(optNetNumNodes)

    print '\nPhysical schema options:'
    print '--schema-file=<file> \n\tdefault: ' + str(
        optSchemaFile) + "\n\tonly applies if generate-random-schemas=False"

    print '\nScenarios to be tested:'
    print '--queries=[Q1..Qn] \n\tdefault: ' + str(optQueries)
    print '--acq-rates=[a1,..,an] \n\t default: ' + str(optAcqRates)
    print '--max-buffering-factors=[b1..bn] \n\t default: ' + str(
        optMaxBufferingFactors)
    print '--delivery-times=[D1..Dn] \n\t default: ' + str(optDeliveryTimes)
    print '--test-all=[True|False] \n\tdefault: ' + str(optTestAll)

    print '\nExperiment Parameters:'
    print '--x-val-type=[acq|del|bf]' + str(optXValType)
    print '--led-debug\n\tdefault: ' + str(optLedDebug)

    SneeqlLib.usage()
    TossimLib.usage()
    AvroraLib.usage()
    RandomSeeder.usage()
    checkTupleCount.usage()
Example #8
0
def testTossimCandidate(nescDir, traceFilePath, query, numNodes, duration, outputPath, schemaPath, aqRate):

	#compile the nesc
	exitVal = TossimLib.compileNesCCode(nescDir)
	if (exitVal != 0):
		return;		

	#run tossim simulation		
	exitVal = TossimLib.runSimulation(nescDir, traceFilePath, query, numNodes, simulationDuration = (duration + optTossimSyncTime))
	if (exitVal != 0):
		return;

	#check all tuples present in Tossim simulation
	queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.csv" % (outputPath, query)
	
	candidateInfo = getCandidateSummaryInformation(nescDir, query, outputPath)
	alpha = int(candidateInfo['alpha-ms'])
	bufferingFactor = int(candidateInfo['beta'])
	checkTupleCount.checkResults(query, traceFilePath, schemaPath, alpha, bufferingFactor, duration)
Example #9
0
def startLogger(timeStamp):
    global logger

    logger = logging.getLogger('test')

    #create the directory if required
    if not os.path.isdir(optOutputRoot):
        os.makedirs(optOutputRoot)

    hdlr = logging.FileHandler('%s/test%s.log' % (optOutputRoot, timeStamp))
    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr)
    logger.setLevel(logging.INFO)
    logger.info('Starting Regression Test')

    #Register the logger with the libraries this module uses
    SneeqlLib.registerLogger(logger)
    TossimLib.registerLogger(logger)
    AvroraLib.registerLogger(logger)
    checkTupleCount.registerLogger(logger)
    RandomSeeder.registerLogger(logger)
Example #10
0
def parseArgs(args):
    global optSneeqlRoot, optSimDuration, optOutputRoot
    global optTimeStampOutput, optDoTossim, optDoAvrora
    global optTossimSyncTime, optDoAvroraCandidates, optDoTossimCandidates
    global optSneeqlNetFile
    global optNetNumNodes
    global optSchemaFile
    global optQueries, optAcqRates, optMaxBufferingFactors, optDeliveryTimes
    global optTestAll, optLedDebug, optXValType

    try:
        optNames = [
            "help", "short", "sneeql-root=", "sim-duration=", "output-root="
        ]
        optNames += [
            "timestamp-output=", "compile-sneeql=", "do-tossim=", "do-avrora="
        ]
        optNames += [
            "tossim-sync-time=", "do-avrora-candidates=",
            "do-tossim-candidates="
        ]
        optNames += [
            "generate-random-network=", "sneeql-network-file=",
            "net-num-nodes="
        ]
        optNames += ["schema-file="]
        optNames += [
            "queries=", "acq-rates=", "max-buffering-factors=",
            "delivery-times=", "test-all=", "x-val-type="
        ]

        #append the result of getOpNames to all the libraries
        optNames += SneeqlLib.getOptNames()
        optNames += TossimLib.getOptNames()
        optNames += AvroraLib.getOptNames()
        optNames += RandomSeeder.getOptNames()
        optNames += checkTupleCount.getOptNames()

        optNames = UtilLib.removeDuplicates(optNames)

        opts, args = getopt.getopt(args, "h", optNames)
    except getopt.GetoptError, err:
        print str(err)
        usage()
        sys.exit(2)
Example #11
0
def parseArgs(args):
	global optSneeqlRoot, optNumAgendaEvals, optQueryDuration, optOutputRoot, optLabel, optTimeStampOutput, optDoTossim, optDoAvrora, optNumAvroraRuns, optTossimSyncTime, optDoAvroraCandidates, optDoTossimCandidates, optDoModel, optGenerateRandomNet, optSneeqlNetFile, optAvroraNetFile, optNetNumNodes, optNetXDim, optNetYDim, optGenerateRandomSchemas, optNumSchemas, optSchemaFile, optQueries, optAcqRates, optMaxBufferingFactors, optQoS, optQoSAwareRouting, optRoutingTreesToGenerate, optRoutingTreesToKeep, optQoSAwareWhereScheduling, optQoSAwareWhenScheduling, optBufferingFactor
	
	try:
		optNames = ["help", "sneeql-root=", "num-agenda-evals=", "query-duration=", "output-root=", "label=", "timestamp-output=", "do-tossim=", "do-avrora=", "num-avrora-runs=", "tossim-sync-time=", "do-avrora-candidates=", "do-tossim-candidates=", "do-model="]
		optNames += ["generate-random-network=", "sneeql-network-file=", "avrora-network-file=", "net-num-nodes=", "net-x-dim=", "net-y-dim="]
		optNames += ["generate-random-schemas=", "num-schemas=", "schema-file="]
		optNames += ["queries=", "acq-rates=", "max-buffering-factors="]
		optNames += ["qos-aware-routing=", "routing-trees-to-generate=", "routing-trees-to-keep=", "qos-aware-where-scheduling=", "qos-aware-when-scheduling=","buffering-factor="]
	
		#append the result of getOpNames to all the libraries 
		optNames += SneeqlLib.getOptNames();
		optNames += TossimLib.getOptNames();
		optNames += AvroraLib.getOptNames();
		optNames += RandomSeeder.getOptNames();

		optNames = UtilLib.removeDuplicates(optNames)
		
		opts, args = getopt.getopt(args, "h",optNames)
	except getopt.GetoptError, err:
		print str(err)
		usage()
		sys.exit(2)
Example #12
0
        if (o == "--max-buffering-factors"):
            optMaxBufferingFactors = a.split(",")
            optMaxBufferingFactors = [int(x) for x in optMaxBufferingFactors]
            continue

        if (o == "--short"):
            optQueries = ["Q0"]
            optNumSchemas = 1
            optAcqRates = [5000]
            optMaxBufferingFactors = [3]
            optDoTossimCandidates = False
            optDoAvroraCandidates = False
            continue

    SneeqlLib.setOpts(opts)
    TossimLib.setOpts(opts)
    AvroraLib.setOpts(opts)
    RandomSeeder.setOpts(opts)


#Ouput info message to screen and logger if applicable
def report(message):
    if (logger != None):
        logger.info(message)
    print message


#Ouput warning message to screen and logger if applicable
def reportWarning(message):
    if (logger != None):
        logger.warning(message)