Exemplo n.º 1
0
def testAuto(num_sw=16, num_port=48, num_group=4, num_tries=10000, control_threshold=0.9):
    """Run an automatic test with given parameters.
    Generate group randomly, and send traffic randomly with control_threshold
    @param num_sw: Number of switches in the datacenter
    @param num_port: Number of ports of each switch
    @param num_group: Number of groups in the datacenter
    @param num_tries: Number of random tests
    @param control_threshold: How many percent flows are cross-group
    """
    dc = DC(Flat(num_sw=num_sw, num_port=num_port))
    dc.genGroupRandom(num_group=num_group)
    dc.testShuffleTraffic(num_tries, control_threshold)
    dc.showInfo()
    dc.showStat()
Exemplo n.º 2
0
def testManu(host_file='host_sw_map.txt', sw_file='metis_input.txt.part.10', trace_file='flow_anon_2008-01-01.agg.txt'):
    """Read host,sw,trace from out files, and run the test.
    @param host_file: File that stores the host-sw mapping information.
        every line with format: host_id sw_id
    @param sw_file: File that stores the sw-group mapping information
    @param trace_file: File that stores the trace record information
    """
    if not (os.path.isfile(host_file) and os.path.isfile(sw_file)):
        print "[ERROR] Invalid file name, host_sw_map=%s, sw_group_map=%s." %(host_file,sw_file)
        return
    dc = DC()
    print "readin sw-group mapping information."
    dc.readinEdgeSWInfo(sw_file)
    print "readin host-sw mapping information."
    dc.readinVMInfo(host_file)
    #dc.showInfo()
    print "readin trace file."
    if os.path.isfile(trace_file):
        dc.testTraffic(trace_file)
    else:
        print "%s, No traffic file is given for testing." %trace_file
    dc.showInfo()
    dc.showStat()