예제 #1
0
 def f_run_test(self):
     # start fire traffic
     self.pidHistDict = f_generate_traffic(self.net, self.topo,
                                           self.hostTraffic_dict_list[0],
                                           self.server_list,
                                           self.iperfPeriod,
                                           self.pidHistDict)
     self.dataCnt += 1
     ##        f_send_pox_inform(msg=MSG_TRAFFIC_FIRED) # sock.send(MSG_TRAFFIC_FIRED)
     #print self.pidHistDict
     raw_input("Press enter to continue")  #os.system("pause")
     self.bwmParserObj = BwmCsvParser(NETBW_FILE)
     #print self.bwmParserObj.pars_status , self.bwmParserObj.memDepth , self.bwmParserObj.start_intName
     print self.bwmParserObj.f_getMapOut(self.resMeasKeys)
     self.traffic_in = f_scaleTraffic(
         self.bwmParserObj.f_getMapOut(self.hostMeasKeys), J1TRAFFIC_SCALE *
         self.m_inTrafficScaleInv)  # D in solver, scale down 1e-7
     print self.traffic_in
     self.f_initSolver()
     self.f_getRatioDict(self.m_solver.o_ratioList)
     #print self.ratioDict
     #        f_send_pox_inform_mn(msg=str(TEM_ratio))
     f_send_pox_inform_mn(msg=str(self.ratioDict))
     #        raw_input("FMIN slover") #os.system("pause")
     #############################################
     time.sleep(0.81)
     self.bwmParserObj.f_readNew()
     rawMeasureData = f_scaleTraffic(
         self.bwmParserObj.f_getMapOut(self.resMeasKeys), J1TRAFFIC_SCALE *
         self.m_inTrafficScaleInv)  # D in solver, scale down 1e-7
     self.m_recorder.bwMeasure = [RECORD_ONCE, rawMeasureData]
     for t in range(3):
         time.sleep(0.8)
         self.bwmParserObj.f_readNew()
         rawMeasureData = f_scaleTraffic(
             self.bwmParserObj.f_getMapOut(self.resMeasKeys),
             J1TRAFFIC_SCALE *
             self.m_inTrafficScaleInv)  # D in solver, scale down 1e-7
         print rawMeasureData
         self.m_recorder.bwMeasure = [RECORD_MULTI, rawMeasureData]
     self.m_recorder.f_analyse()
     #############################################
     #print self.bwmParserObj.pars_status , self.bwmParserObj.memDepth , self.bwmParserObj.start_intName
     print self.bwmParserObj.f_getMapOut(self.resMeasKeys)
     print self.bwmParserObj.f_getMapOut(self.hostMeasKeys)
     raw_input("Finish recorder")  #os.system("pause")
     self.bwmParserObj.f_readNew()
     #print self.bwmParserObj.pars_status , self.bwmParserObj.memDepth , self.bwmParserObj.start_intName
     print self.bwmParserObj.f_getMapOut(self.resMeasKeys)
     print self.bwmParserObj.f_getMapOut(self.hostMeasKeys)
     self.pidHistDict = f_generate_traffic(self.net, self.topo,
                                           self.hostTraffic_dict_list[0],
                                           self.server_list,
                                           self.iperfPeriod,
                                           self.pidHistDict)
     #print self.pidHistDict.pars_status,
     raw_input("Press enter to continue")  #os.system("pause")
     CLI(self.net)
예제 #2
0
    def f_run_test(self):
        # start fire traffic
        self.pidHistDict = f_generate_traffic(self.net,self.topo,self.hostTraffic_dict_list[0],
                                              self.server_list,self.iperfPeriod,self.pidHistDict)
        self.dataCnt += 1
##        f_send_pox_inform(msg=MSG_TRAFFIC_FIRED) # sock.send(MSG_TRAFFIC_FIRED) 
        #print self.pidHistDict
        raw_input("Press enter to continue") #os.system("pause")
        self.bwmParserObj = BwmCsvParser(NETBW_FILE)
        #print self.bwmParserObj.pars_status , self.bwmParserObj.memDepth , self.bwmParserObj.start_intName
        print self.bwmParserObj.f_getMapOut(self.resMeasKeys)
        self.traffic_in = f_scaleTraffic(self.bwmParserObj.f_getMapOut(self.hostMeasKeys),
                                         J1TRAFFIC_SCALE*self.m_inTrafficScaleInv)  # D in solver, scale down 1e-7
        print self.traffic_in
        self.f_initSolver()
        self.f_getRatioDict(self.m_solver.o_ratioList)
        #print self.ratioDict
#        f_send_pox_inform_mn(msg=str(TEM_ratio)) 
        f_send_pox_inform_mn(msg=str(self.ratioDict)) 
#        raw_input("FMIN slover") #os.system("pause")
        #############################################
        time.sleep(0.81)
        self.bwmParserObj.f_readNew()
        rawMeasureData = f_scaleTraffic(self.bwmParserObj.f_getMapOut(self.resMeasKeys),
                                        J1TRAFFIC_SCALE*self.m_inTrafficScaleInv) # D in solver, scale down 1e-7
        self.m_recorder.bwMeasure = [RECORD_ONCE,rawMeasureData]
        for t in range(3):
            time.sleep(0.8)
            self.bwmParserObj.f_readNew()
            rawMeasureData = f_scaleTraffic(self.bwmParserObj.f_getMapOut(self.resMeasKeys),
                                        J1TRAFFIC_SCALE*self.m_inTrafficScaleInv) # D in solver, scale down 1e-7
            print rawMeasureData
            self.m_recorder.bwMeasure = [RECORD_MULTI,rawMeasureData]
        self.m_recorder.f_analyse()
        #############################################
        #print self.bwmParserObj.pars_status , self.bwmParserObj.memDepth , self.bwmParserObj.start_intName
        print self.bwmParserObj.f_getMapOut(self.resMeasKeys)
        print self.bwmParserObj.f_getMapOut(self.hostMeasKeys)
        raw_input("Finish recorder") #os.system("pause")
        self.bwmParserObj.f_readNew()
        #print self.bwmParserObj.pars_status , self.bwmParserObj.memDepth , self.bwmParserObj.start_intName
        print self.bwmParserObj.f_getMapOut(self.resMeasKeys)
        print self.bwmParserObj.f_getMapOut(self.hostMeasKeys)
        self.pidHistDict = f_generate_traffic(self.net,self.topo,self.hostTraffic_dict_list[0],
                                              self.server_list,self.iperfPeriod,self.pidHistDict)
        #print self.pidHistDict.pars_status, 
        raw_input("Press enter to continue") #os.system("pause")
        CLI( self.net )
예제 #3
0
 def f_postAveTrafficMeasure(self):
     for captureIdx in range(10):
         # read bwg-ng output
         self.bwmParserObj.f_readNew()
         # parse res bandwidth
         rawMeasureData = f_scaleTraffic(self.bwmParserObj.f_getMapOut(self.resMeasKeys),
                                         J1TRAFFIC_SCALE*self.m_inTrafficScaleInv) # D in solver, scale down 1e-7
         traffic_in = f_scaleTraffic(self.bwmParserObj.f_getMapOut(self.hostMeasKeys),
                                     J1TRAFFIC_SCALE*self.m_inTrafficScaleInv)
         print captureIdx
         #print rawMeasureData
         #print traffic_in
         if captureIdx == 0: # first time
             self.m_recorder.bwMeasure = [RECORD_ONCE,rawMeasureData]
         else:               # append results
             self.m_recorder.bwMeasure = [RECORD_MULTI,rawMeasureData]
         # wait for another results
         time.sleep(0.81)    
예제 #4
0
 def f_preTrafficCapture(self,trafficIdx):
     # initial bwg-ng parser
     if trafficIdx==0:
         self.bwmParserObj = BwmCsvParser(NETBW_FILE)
         self.f_read_multiInput()
     else:
         self.bwmParserObj.f_readNew()
         self.f_read_multiInput()
 #        raw_input("Press enter to continue")
     self.traffic_in = f_scaleTraffic(self.bwmParserObj.f_getMapOut(self.hostMeasKeys),
                                      J1TRAFFIC_SCALE*self.m_inTrafficScaleInv)  # D in solver, scale down 1e-7
예제 #5
0
 def f_postAveTrafficMeasure(self):
     for captureIdx in range(10):
         # read bwg-ng output
         self.bwmParserObj.f_readNew()
         # parse res bandwidth
         rawMeasureData = f_scaleTraffic(
             self.bwmParserObj.f_getMapOut(self.resMeasKeys),
             J1TRAFFIC_SCALE *
             self.m_inTrafficScaleInv)  # D in solver, scale down 1e-7
         traffic_in = f_scaleTraffic(
             self.bwmParserObj.f_getMapOut(self.hostMeasKeys),
             J1TRAFFIC_SCALE * self.m_inTrafficScaleInv)
         print captureIdx
         #print rawMeasureData
         #print traffic_in
         if captureIdx == 0:  # first time
             self.m_recorder.bwMeasure = [RECORD_ONCE, rawMeasureData]
         else:  # append results
             self.m_recorder.bwMeasure = [RECORD_MULTI, rawMeasureData]
         # wait for another results
         time.sleep(0.81)
예제 #6
0
    def f_preTrafficCapture(self, trafficIdx):
        # initial bwg-ng parser
        if trafficIdx == 0:
            self.bwmParserObj = BwmCsvParser(NETBW_FILE)
            self.f_read_multiInput()
        else:
            self.bwmParserObj.f_readNew()
            self.f_read_multiInput()

    #        raw_input("Press enter to continue")
        self.traffic_in = f_scaleTraffic(
            self.bwmParserObj.f_getMapOut(self.hostMeasKeys), J1TRAFFIC_SCALE *
            self.m_inTrafficScaleInv)  # D in solver, scale down 1e-7