示例#1
0
文件: sim.py 项目: leihnwong/lazyctrl
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()