Пример #1
0
 def behavior(self, mininet):
     seconds = 5
     info('Replaying process starting in %s seconds\n' % seconds)
     time.sleep(seconds)
     info('Replaying process has been started\n')
     currentTime = time.time()
     stations = mininet.stations
     for sta in stations:
         sta.params['frequency'][0] = wirelessLink.frequency(sta, 0)
     while True:
         if len(stations) == 0:
             break
         time_ = 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)
         time.sleep(0.001)
     info('Replaying process has finished!')
Пример #2
0
 def throughput(self, mininet):
     currentTime = time.time()
     stations = mininet.stations
     while True:
         if len(stations) == 0:
             break
         time_ = 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!")