def behavior(self): seconds = 5 info('Replaying process starting in %s seconds\n' % seconds) sleep(seconds) info('Replaying process has been started\n') currentTime = time() stations = self.net.stations for sta in stations: sta.wintfs[0].freq = sta.wintfs[0].get_freq() while self.thread_._keep_alive: if len(stations) == 0: break time_ = time() - currentTime for sta in stations: if hasattr(sta, 'time'): if time_ >= sta.time[0]: if sta.wintfs[0].associatedTo: bw = sta.bw[0] loss = sta.loss[0] latency = sta.latency[0] wirelessLink.config_tc(sta.wintfs[0], bw, loss, latency) del sta.bw[0] del sta.loss[0] del sta.latency[0] del sta.time[0] if len(sta.time) == 0: stations.remove(sta) sleep(0.001) info('Replaying process has finished!')
def behavior(cls, Mininet_wifi): seconds = 5 info('Replaying process starting in %s seconds\n' % seconds) sleep(seconds) info('Replaying process has been started\n') currentTime = time() stations = Mininet_wifi.stations for sta in stations: sta.params['freq'][0] = sta.get_freq(0) while mobility.thread_._keep_alive: if len(stations) == 0: break time_ = time() - currentTime for sta in stations: if hasattr(sta, 'time'): if time_ >= sta.time[0]: if sta.params['associatedTo'][0] != '': bw = sta.bw[0] loss = sta.loss[0] latency = sta.latency[0] wirelessLink.config_tc(sta, 0, bw, loss, latency) del sta.bw[0] del sta.loss[0] del sta.latency[0] del sta.time[0] if len(sta.time) == 0: stations.remove(sta) sleep(0.001) info('Replaying process has finished!')
def throughput(cls, Mininet_wifi): currentTime = time() stations = Mininet_wifi.stations while mobility.thread_._keep_alive: if len(stations) == 0: break time_ = time() - currentTime for sta in stations: if hasattr(sta, 'time'): if time_ >= sta.time[0]: wirelessLink.config_tc(sta, 0, sta.throughput[0], 0, 0) # pos = '%d, %d, %d' % (sta.throughput[0], sta.throughput[0], 0) # self.moveStationTo(sta, pos) del sta.throughput[0] del sta.time[0] #info('%s\n' % sta.time[0]) if len(sta.time) == 1: stations.remove(sta) # time.sleep(0.001) info("\nReplaying Process Finished!")