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['frequency'][0] = sta.get_freq(0) while True: 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] delay = sta.delay[0] latency = sta.latency[0] wirelessLink.tc(sta, 0, bw, loss, latency, delay) del sta.bw[0] del sta.loss[0] del sta.delay[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): currentTime = time() stations = mininet.stations while True: if len(stations) == 0: break time_ = time() - currentTime for sta in stations: if hasattr(sta, 'time'): if time_ >= sta.time[0]: wirelessLink.tc(sta, 0, sta.throughput[0], 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!")