def f_test_topo(topo_fname,mat_fname,traffic_in,weight_raw_in=[],cli_mode=False): tp = f_getTopoFile(topo_fname) print tp if not tp: raise Exception( 'Unable to find topology file: %s' ) %tp mat_f = f_getTopoFile(mat_fname,file_appendix='.mat') print 'mat file: ', mat_f topo = customTopo(tp) PARAS.MININET_PARAS[TOPO] = topo #print topo.hostPortIpDict switch_list,host_list,server_list = read_topo.f_parse_item_set(topo.topo_data) # add global mininet parameters PARAS.MININET_PARAS[SWITCH_LIST] = switch_list PARAS.MININET_PARAS[HOST_LIST] = host_list PARAS.MININET_PARAS[SERVER_LIST] = server_list #print host_list, switch_list, server_list ''' net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink) ''' ''' net = Mininet(topo=topo, switch=UserSwitch, host=CPULimitedHost, link=TCLink) ''' ''' net = Mininet(topo=topo, switch=UserSwitch, host=CPULimitedHost, controller=RemoteController, link=TCLink) ''' #''' net = Mininet(topo=topo, host=CPULimitedHost, controller=RemoteController, link=TCLink) #''' net.start() PARAS.MININET_PARAS[NET] = net ''' setup host,server and switch''' f_setup_nodes(net,topo,switch_list,host_list,server_list) if not cli_mode: mn_st_machine = MnServer(topo_fname,net,topo,server_list,switch_list,traffic_in,weight_raw_in) mn_st_machine.io_mat_f = mat_f final = mn_st_machine.run() # status = f_init_server_socket() # # if status: # # f_generate_traffic(net,topo,{'h1':'8m'},server_list,period=1000) # # diable_items = ','.join(switch_list)+','+SYS_ENTITY # #print diable_items # f_logNetBw(NETBW_FILE,diable_items) CLI( net ) net.stop()
def __init__ (self,topfile_in): tf = f_getTopoFile(topfile_in) if tf: self.infor_obj = rt.TopoInfor(tf) else: self.infor_obj = rt.TopoInfor(TOPO_FILE) self.switches ={} # get dpid for all switches self.target_switch = self.infor_obj.dpidSwitchDict.keys() self.switchDpidDict = self.infor_obj.switchDpidDict self.switchNameList = self.infor_obj.switch_list #print self.switchNameList # get bwm-ng unwanted interface self.diable_items = ','.join(self.switchNameList)+','+SYS_ENTITY self.switchAllOn = False self.pox_st_machine = None self.pox_st_machine_on = False # Listen to dependencies #def startup (): # core.openflow.addListeners(self, priority=0) #core.call_when_ready(startup, ('openflow')) core.openflow.addListeners(self) ''' event related ''' self.initEventRaised = False
def init_topRes(self): ''' ''' tf = f_getTopoFile(self.topoFileName) if tf: infor_obj = TopoInfor(tf) else: infor_obj = TopoInfor(TOPO_FILE) self.host_list = infor_obj.host_list self.switch_list = infor_obj.switch_list self.server_list = infor_obj.server_list self.link_list = infor_obj.link_list self.sortedResList = infor_obj.sortedResList self.traffic_in = None self.m_solver = None ''' RES related''' self.resCapacity = infor_obj.resCapacity # C self.resPmax = infor_obj.resPmax # PMAX self.resBeta = infor_obj.resBeta # Beta self.resServer_num = infor_obj.resServer_num # I self.resMux_num = infor_obj.resMux_num # H self.resLink_num = infor_obj.resLink_num # L self.userRouteMat = infor_obj.userRouteMat # EM matrix for user/route mapping self.reRouteMat = infor_obj.reRouteMat # RM matrix for res/route mapping self.resUtilRatio = infor_obj.resUtilRatio # RES_ratio self.resDelay = infor_obj.resDelay self.resMeasKeys = infor_obj.resMeasKeys self.hostMeasKeys = infor_obj.hostMeasKeys self.hostSwitch = [keys.split('-')[0] for keys in self.hostMeasKeys] self.ratioDict = {} self.init_matPara() '''
def __init__(self, topfile_in): tf = f_getTopoFile(topfile_in) if tf: self.infor_obj = rt.TopoInfor(tf) else: self.infor_obj = rt.TopoInfor(TOPO_FILE) self.switches = {} # get dpid for all switches self.target_switch = self.infor_obj.dpidSwitchDict.keys() self.switchDpidDict = self.infor_obj.switchDpidDict self.switchNameList = self.infor_obj.switch_list #print self.switchNameList # get bwm-ng unwanted interface self.diable_items = ','.join(self.switchNameList) + ',' + SYS_ENTITY self.switchAllOn = False self.pox_st_machine = None self.pox_st_machine_on = False # Listen to dependencies #def startup (): # core.openflow.addListeners(self, priority=0) #core.call_when_ready(startup, ('openflow')) core.openflow.addListeners(self) ''' event related ''' self.initEventRaised = False