示例#1
0
 def parameters(self):
     while self.continue_:
         listNodes.ssid_ID = 0
         for node in self.staList:
             for wlan in range(0, len(node.params['wlan'])):
                 if node.func[wlan] != 'mesh' and node.func[wlan] != 'adhoc':
                     self.nodeParameter(node, wlan)
                 elif node.func[wlan] == 'mesh' :
                     dist = listNodes.pairingNodes(node, wlan, self.staList)
                     if dist != 0:
                         channelParameters(node, None, wlan, dist, self.staList, 0)
                 else:
                     if dist != 0:
                         channelParameters(node, None, wlan, dist, self.staList, 0)
         if meshRouting.routing == 'custom':
             for node in mobility.staList:
                 for wlan in range(0, len(node.params['wlan'])):
                     if node.func[wlan] == 'mesh':
                         """Mesh Routing"""
                         try:
                             meshRouting.customMeshRouting(node, wlan, self.staList)
                         except:
                             pass
             listNodes.clearList()
         # have to verify this
         time.sleep(0.01)
示例#2
0
 def parameters(self):
     while self.continue_:
         listNodes.ssid_ID = 0
         for node in self.staList:
             for wlan in range(0, len(node.params['wlan'])):
                 if node.func[wlan] != 'mesh' and node.func[wlan] != 'adhoc':
                     self.nodeParameter(node, wlan)
                 elif node.func[wlan] == 'mesh':
                     dist = listNodes.pairingNodes(node, wlan, self.staList)
                     if dist != 0:
                         channelParameters(node, None, wlan, dist,
                                           self.staList, 0)
                 else:
                     if dist != 0:
                         channelParameters(node, None, wlan, dist,
                                           self.staList, 0)
         if meshRouting.routing == 'custom':
             for node in mobility.staList:
                 for wlan in range(0, len(node.params['wlan'])):
                     if node.func[wlan] == 'mesh':
                         """Mesh Routing"""
                         try:
                             meshRouting.customMeshRouting(
                                 node, wlan, self.staList)
                         except:
                             pass
             listNodes.clearList()
示例#3
0
 def parameters(self):
     while self.continue_:
         try:
             for node in self.staList:
                 for wlan in range(0, node.nWlans):
                     if node.func[wlan] == 'mesh' or node.func[
                             wlan] == 'adhoc':
                         dist = listNodes.pairingNodes(
                             node, wlan, self.staList)
                         if dist != 0:
                             channelParameters(node, None, wlan, dist,
                                               self.staList,
                                               abs(node.params['speed']))
                     else:
                         self.nodeParameter(node, wlan)
             if meshRouting.routing == 'custom':
                 for node in mobility.staList:
                     for wlan in range(0, node.nWlans):
                         if node.func[wlan] == 'mesh':
                             """Mesh Routing"""
                             meshRouting.customMeshRouting(
                                 node, wlan, self.staList)
                 listNodes.clearList()
         except:
             pass
示例#4
0
 def setChannelParameters(self, sta, ap, dist, wlan):
     """ Wifi Parameters """
     associated = True
     time = abs(sta.speed)
     staList = emulationEnvironment.staList
     
     if ap == sta.associatedAp[wlan]:
         if dist > ap.range + sta.range:  
             sta.pexec('iw dev %s-wlan%s disconnect' % (sta, wlan))
             sta.associatedAp[wlan] = 'NoAssociated'
             sta.rssi[wlan] = 0
             sta.snr[wlan] = 0
             emulationEnvironment.numberOfAssociatedStations(ap)
         else:
             #if emulationEnvironment.continue_:
             channelParameters(sta, ap, wlan, dist, staList, time)
     else:   
         if dist < ap.range + sta.range:            
             aps = 0
             for n in range(0,len(sta.associatedAp)):
                 if str(sta.associatedAp[n]) != 'NoAssociated':
                     aps+=1
             if len(sta.associatedAp) == aps:
                 associated = True
             else:
                 associated = False
         else:
             associated = False
     if ap == sta.associatedAp[wlan] or dist < (ap.range + sta.range):
         #Only if it is a mobility environment
         changeAP = False
         association_Control = dict ()
         
         """Association Control: mechanisms that optimize the use of the APs"""
         if emulationEnvironment.associationControlMethod != False:
             ac = emulationEnvironment.associationControlMethod              
             value = associationControl(sta, ap, wlan, ac)
             changeAP = value.changeAP
             association_Control.setdefault( 'ac', ac )                
             
         #Go to handover    
         if associated == False or changeAP == True:
             self.handover(sta, ap, wlan, dist, changeAP, **association_Control)
             channelParameters(sta, ap, wlan, dist, staList, time)
示例#5
0
 def setChannelParameters(self, sta, ap, dist, wlan):
     """ Wifi Parameters """
     associated = True
     time = abs(sta.params['speed'])
     staList = self.staList
     
     if ap == sta.associatedAp[wlan]:
         if dist > ap.range + sta.range:  
             debug( '\niw dev %s disconnect' % sta.params['wlan'][wlan] )
             sta.pexec('iw dev %s disconnect' % sta.params['wlan'][wlan])
             sta.associatedAp[wlan] = 'NoAssociated'
             sta.params['rssi'][wlan] = 0
             sta.params['snr'][wlan] = 0
             self.numberOfAssociatedStations(ap)
         else:
             channelParameters(sta, ap, wlan, dist, staList, time)
     else:   
         if dist < ap.range + sta.range:            
             aps = 0
             for n in range(0,len(sta.associatedAp)):
                 if str(sta.associatedAp[n]) != 'NoAssociated':
                     aps+=1
             if len(sta.associatedAp) == aps:
                 associated = True
             else:
                 associated = False
         else:
             associated = False
     if ap == sta.associatedAp[wlan] or dist < (ap.range + sta.range):
         #Only if it is a mobility environment
         changeAP = False
         association_Control = dict ()
         
         """Association Control: mechanisms that optimize the use of the APs"""
         if self.associationControlMethod != False:
             ac = self.associationControlMethod              
             value = associationControl(sta, ap, wlan, ac)
             changeAP = value.changeAP
             association_Control.setdefault( 'ac', ac )                
             
         #Go to handover    
         if associated == False or changeAP == True:
             self.handover(sta, ap, wlan, dist, changeAP, **association_Control)
             channelParameters(sta, ap, wlan, dist, staList, time)
示例#6
0
 def parameters(self):
     while emulationEnvironment.continue_:
         try:
             for node in emulationEnvironment.staList: 
                 for wlan in range(0, node.nWlans):
                     if node.func[wlan] == 'mesh' or node.func[wlan] == 'adhoc':
                         dist = listNodes.pairingNodes(node, wlan, emulationEnvironment.staList)
                         channelParameters(node, None, wlan, dist, emulationEnvironment.staList, abs(node.speed))
                     else:
                         self.nodeParameter(node, wlan)
             if emulationEnvironment.meshRouting == 'custom':
                 for node in emulationEnvironment.staList:       
                     for wlan in range(0, node.nWlans):
                         if node.func[wlan] == 'mesh':
                             """Mesh Routing"""                    
                             meshRouting.customMeshRouting(node, wlan, emulationEnvironment.staList)    
                 listNodes.clearList()
         except:
             pass
示例#7
0
 def parameters(self):
     while self.continue_:
         try:
             for node in self.staList: 
                 for wlan in range(0, node.nWlans):
                     if node.func[wlan] == 'mesh' or node.func[wlan] == 'adhoc':
                         dist = listNodes.pairingNodes(node, wlan, self.staList)
                         if dist!=0:
                             channelParameters(node, None, wlan, dist, self.staList, abs(node.speed))
                     else:
                         self.nodeParameter(node, wlan)
             if meshRouting.routing == 'custom':
                 for node in mobility.staList:       
                     for wlan in range(0, node.nWlans):
                         if node.func[wlan] == 'mesh':
                             """Mesh Routing"""                    
                             meshRouting.customMeshRouting(node, wlan, self.staList)    
                 listNodes.clearList()
         except:
             pass
示例#8
0
 def setChannelParameters(self, sta, ap, dist, wlan):
     """ Wifi Parameters """
     associated = True
     #time = abs(sta.params['speed'])
     staList = self.staList
     
     if ap == sta.params['associatedTo'][wlan]:            
         if dist > ap.range:  
             debug('\niw dev %s disconnect' % sta.params['wlan'][wlan])
             sta.pexec('iw dev %s disconnect' % sta.params['wlan'][wlan])
             sta.params['associatedTo'][wlan] = ''
             sta.params['rssi'][wlan] = 0
             sta.params['snr'][wlan] = 0
             ap.associatedStations.remove(sta)
         else:
             channelParameters(sta, ap, wlan, dist, staList, 0)
     else:  
         if dist < ap.range:  
             if sta.params['associatedTo'][wlan] == '':
                 associated = False
         else:
             associated = False
     if ap == sta.params['associatedTo'][wlan] or dist < ap.range:
         changeAP = False
         ac = None
         sta.params['frequency'][wlan] = channelParameters.frequency(ap, 0)
         sta.params['channel'][wlan] = ap.params['channel'][0]
         
         """Association Control: mechanisms that optimize the use of the APs"""
         if self.associationControlMethod != False:
             ac = self.associationControlMethod              
             value = associationControl(sta, ap, wlan, ac)
             changeAP = value.changeAP
             
         #Go to handover    
         if associated == False or changeAP == True:
             self.handover(sta, ap, wlan, dist, changeAP, ac)
             channelParameters(sta, ap, wlan, dist, staList, 0)
     else:
         #have to verify this
         time.sleep(0.01)
 def setChannelParameters(self, sta, ap, dist, wlan):
     """ Wifi Parameters """
     associated = True
     #time = abs(sta.params['speed'])
     staList = self.staList
     
     if ap == sta.params['associatedTo'][wlan]:            
         if dist > ap.params['range']:  
             debug('\niw dev %s disconnect' % sta.params['wlan'][wlan])
             sta.pexec('iw dev %s disconnect' % sta.params['wlan'][wlan])
             sta.params['associatedTo'][wlan] = ''
             sta.params['rssi'][wlan] = 0
             sta.params['snr'][wlan] = 0
             ap.associatedStations.remove(sta)
         else:
             channelParameters(sta, ap, wlan, dist, staList, 0)
     else:  
         if dist < ap.params['range']:  
             if sta.params['associatedTo'][wlan] == '':
                 associated = False
         else:
             associated = False
     if ap == sta.params['associatedTo'][wlan] or dist < ap.params['range']:
         changeAP = False
         ac = None
         sta.params['frequency'][wlan] = channelParameters.frequency(ap, 0)
         sta.params['channel'][wlan] = ap.params['channel'][0]
         
         """Association Control: mechanisms that optimize the use of the APs"""
         if self.associationControlMethod != False:
             ac = self.associationControlMethod              
             value = associationControl(sta, ap, wlan, ac)
             changeAP = value.changeAP
             
         #Go to handover    
         if associated == False or changeAP == True:
             self.handover(sta, ap, wlan, dist, changeAP, ac)
             channelParameters(sta, ap, wlan, dist, staList, 0)
     else:
         #have to verify this
         time.sleep(0.01)