Esempio n. 1
0
 def pairingNodes_(self, sta, wlan, stationList, **params):
     """Pairing nodes"""
     i = 1
     ref_distance = 0
     self.dist = 0
     self.ssid_ID += 1
     for ref_sta in stationList:
         if ref_sta != sta:
             dist = channelParameters.getDistance(sta, ref_sta)
             if dist != 0.0:
                 totalRange = sta.range + ref_sta.range
                 if dist < totalRange:
                     ref_distance = ref_distance + dist
                     listNodes.nodesX.append(sta)
                     listNodes.nodesY.append(ref_sta)
                     ssid = sta.params['associatedTo'][wlan]
                     ref_ssid = ref_sta.params['associatedTo'][wlan]
                     if ssid != ref_ssid or ssid == sta.ssid[
                             wlan] or ssid == '' or ref_ssid == '':
                         sta.params['associatedTo'][
                             wlan] = sta.ssid[wlan] + str(self.ssid_ID)
                         ref_sta.params['associatedTo'][
                             wlan] = sta.ssid[wlan] + str(self.ssid_ID)
                     i += 1
     self.dist = ref_distance / i
     return self.dist
Esempio n. 2
0
 def customMeshRouting(self, sta, wlan, stationList, **params):
     """Custom Mesh Routing"""
     associate = False
     controlMeshMac = []
     command = ''
     for ref_sta in stationList:
         for ref_wlan in range(len(ref_sta.params['wlan'])):
             if ref_sta != sta and ref_sta.func[ref_wlan] == 'mesh':
                 dist = channelParameters.getDistance(sta, ref_sta)
                 totalRange = int(sta.params['range']) + int(
                     ref_sta.params['range'])
                 if dist < totalRange:
                     if ref_sta.func[ref_wlan] == 'mesh':
                         if sta.params['associatedTo'][
                                 wlan] == ref_sta.params['associatedTo'][
                                     ref_wlan]:
                             associate = True
     """Adding all reached target paths"""
     if associate:
         exist = []
         sta_ref = []
         sta_ref.append(sta)
         j = 0
         exist.append(sta)
         while j < len(stationList):
             j += 1
             if sta_ref == []:
                 break
             else:
                 newsta = sta_ref[0]
             for x, y in zip(listNodes.nodesX, listNodes.nodesY):
                 if x == sta and y not in exist:
                     command = 'iw dev %s mpath new %s next_hop %s' % (sta.params['wlan'][wlan], \
                                                                       y.meshMac[wlan], y.meshMac[wlan])
                     sta.pexec(command)
                     exist.append(y)
                     controlMeshMac.append(y.meshMac[wlan])
                     sta_ref.append(y)
                 elif x == newsta and y not in exist:
                     command = 'iw dev %s mpath new %s next_hop %s' % (sta.params['wlan'][wlan], \
                                                                       y.meshMac[wlan], x.meshMac[wlan])
                     sta.pexec(command)
                     exist.append(y)
                     controlMeshMac.append(y.meshMac[wlan])
                     sta_ref.append(y)
             if newsta in sta_ref:
                 sta_ref.remove(newsta)
     """delete all unknown paths"""
     if associate:
         for ref_sta in stationList:
             for ref_wlan in range(len(ref_sta.params['wlan'])):
                 if ref_sta != sta and ref_sta.func[ref_wlan] == 'mesh':
                     if ref_sta.meshMac[ref_wlan] not in controlMeshMac:
                         sta.pexec('iw dev %s mpath del %s' %
                                   (sta.params['wlan'][wlan],
                                    ref_sta.meshMac[ref_wlan]))
     """mesh leave"""
     if associate == False:
         sta.pexec('iw dev %s mesh leave' % sta.params['wlan'][wlan])
         sta.params['associatedTo'][wlan] = ''
Esempio n. 3
0
    def pairing(self, sta, wlan, stationList):
        """Pairing nodes"""
        i=1
        ref_distance = 0
        self.dist = 0       
   
        alreadyConn = []
 
        for ref_sta in stationList:
            if ref_sta != sta:
                dist = channelParameters.getDistance(sta, ref_sta)
                if dist != 0.0:
                    totalRange = int(sta.params['range']) + int(ref_sta.params['range'])
                    if dist < totalRange:
                        ref_distance = ref_distance + dist
                        ssid = sta.params['associatedTo'][wlan]
                        ref_ssid = ref_sta.params['associatedTo'][wlan]
                        i+=1
                        sta.params['frequency'][wlan] = channelParameters.frequency(sta, wlan)
                        if sta.ssid[wlan] == ref_sta.ssid[wlan]:
                            if sta.params['cell'][wlan] == '':
                                alreadyConn.append(sta)
                                sta.params['associatedTo'][wlan] = sta.ssid[wlan]
                                sta.params['cell'][wlan] = ('02:CA:FF:EE:BA:0%s' % self.ssid_ID)
                                iface = sta.params['wlan'][wlan]
                                print "associating %s to %s..." % (iface, sta.ssid[wlan])
                                sta.pexec('iwconfig %s essid %s ap 02:CA:FF:EE:BA:0%s' % (sta.params['wlan'][wlan], sta.params['associatedTo'][wlan], self.ssid_ID))
                                #sta.pexec('iw dev %s ibss join %s 2412' % (sta.params['wlan'][wlan], \
                                #                                           sta.params['associatedTo'][wlan]))   
                                sta.params['frequency'][wlan] = channelParameters.frequency(sta, wlan)
                            if sta.params['cell'][wlan] != ref_sta.params['cell'][wlan]:
                                if ref_sta.params['associatedTo'][wlan] == sta.ssid[wlan]: 
                                    if ref_sta.params['cell'][wlan] == '' and sta in alreadyConn:
                                        alreadyConn.append(ref_sta)
                                        iface = ref_sta.params['wlan'][wlan]
                                        ref_sta.params['associatedTo'][wlan] = sta.ssid[wlan]
                                        ref_sta.params['cell'][wlan] = ('02:CA:FF:EE:BA:0%s' % self.ssid_ID)
                                        print "associating %s to %s..." % (iface, sta.ssid[wlan])
                                        ref_sta.pexec('iwconfig %s essid %s ap 02:CA:FF:EE:BA:0%s' % (ref_sta.params['wlan'][wlan], ref_sta.params['associatedTo'][wlan], self.ssid_ID))
                                        #ref_sta.pexec('iw dev %s ibss join %s 2412' % (ref_sta.params['wlan'][wlan], \
                                        #                                               ref_sta.params['associatedTo'][wlan]))
                                        ref_sta.params['frequency'][wlan] = channelParameters.frequency(ref_sta, wlan)
        if alreadyConn != [] and len(alreadyConn) != 1: 
            for ref_sta in stationList:
                if ref_sta not in alreadyConn:
                    if ref_sta.params['cell'][wlan] == sta.params['cell'][wlan]:
                        ref_sta.params['cell'][wlan] = ''
        self.ssid_ID+=1
         
        self.dist = ref_distance / i
        return self.dist
     
    #def confirmAdhocAssociation(self, sta, iface, wlan):
    #    associated = ''
    #    while(associated == '' or len(associated) == 0):
    #        sta.sendCmd("iw dev %s scan ssid | grep %s" % (iface, sta.ssid[wlan]))
    #        associated = sta.waitOutput()
    #    sta.params['frequency'][wlan] = channelParameters.frequency(sta, wlan)
Esempio n. 4
0
 def getAPsInRange(self, sta):
     for ap in mobility.apList:
         dist = channelParameters.getDistance(sta, ap)
         if dist < ap.params['range']:
             if ap not in sta.params['apsInRange']:
                 sta.params['apsInRange'].append(ap)
         else:
             if ap in sta.params['apsInRange']:
                 sta.params['apsInRange'].remove(ap)
Esempio n. 5
0
    def pairingNodes(self, sta, wlan, stationList, **params):
        """Pairing nodes"""
        i = 1
        ref_distance = 0
        self.dist = 0
        self.ssid_ID += 1

        par = []
        alreadyConn = []
        cont = True

        list = []
        list.append(sta)
        currentSta = sta

        while cont:
            if len(par) != 0:
                sta = par[0]
                par.pop(0)
            for ref_sta in stationList:
                if ref_sta != sta and ref_sta.func[wlan] == 'mesh' :
                    dist = channelParameters.getDistance(sta, ref_sta)
                    if dist != 0.0:
                        totalRange = int(sta.params['range']) + int(ref_sta.params['range'])
                        if dist < totalRange:
                            cont = True
                            ref_distance = ref_distance + dist
                            if currentSta == sta:
                                listNodes.nodesX.append(sta)
                                listNodes.nodesY.append(ref_sta)
                            ssid = sta.params['associatedTo'][wlan]
                            ref_ssid = ref_sta.params['associatedTo'][wlan]
                            if ssid != ref_ssid or ssid == sta.ssid[wlan] or ssid == '' or ref_ssid == '':
                                if ref_sta.params['associatedTo'][wlan] != '' and \
                                        ref_sta.params['associatedTo'][wlan] != ssid and sta not in alreadyConn:
                                    alreadyConn.append(sta)
                                    sta.params['associatedTo'][wlan] = ref_sta.params['associatedTo'][wlan]
                                    sta.pexec('iw dev %s mesh join %s' % (sta.params['wlan'][wlan], sta.params['associatedTo'][wlan]))
                                else:
                                    if sta.params['associatedTo'][wlan] != sta.ssid[wlan] + str(self.ssid_ID) and \
                                                                                                sta not in alreadyConn:
                                        alreadyConn.append(sta)
                                        sta.params['associatedTo'][wlan] = sta.ssid[wlan] + str(self.ssid_ID)
                                        sta.pexec('iw dev %s mesh join %s' % (sta.params['wlan'][wlan], sta.params['associatedTo'][wlan]))
                                if ref_sta not in alreadyConn:
                                    alreadyConn.append(ref_sta)
                                    ref_sta.params['associatedTo'][wlan] = sta.ssid[wlan] + str(self.ssid_ID)
                                    ref_sta.pexec('iw dev %s mesh join %s' % (ref_sta.params['wlan'][wlan], ref_sta.params['associatedTo'][wlan]))
                            if ref_sta not in list:
                                par.append(ref_sta)
                                list.append(ref_sta)
                            i += 1
            if len(par) == 0:
                cont = False
                self.ssid_ID += 1
        self.dist = ref_distance / i
        return self.dist
Esempio n. 6
0
 def getAPsInRange(self, sta):
     for ap in mobility.apList:
         dist = channelParameters.getDistance(sta, ap)
         if dist < ap.params['range']:
             if ap not in sta.params['apsInRange']:
                 sta.params['apsInRange'].append(ap)
         else:
             if ap in sta.params['apsInRange']:
                 sta.params['apsInRange'].remove(ap)
Esempio n. 7
0
 def start(self, node, d):
     dd = -1
     while self.dist <= d: 
         ap = node.params['associatedTo'][0]
         if ap != '':
             self.dist = channelParameters.getDistance(node, ap)
             if dd != self.dist:
                 os.system("echo %.3f %d >> data.text" % (self.dist, node.params['rssi'][0]))
                 dd = self.dist
Esempio n. 8
0
 def getAPsInRange(self, sta):
     for ap in mobility.apList:
         dist = channelParameters.getDistance(sta, ap)
         if dist < ap.range + sta.range:
             if ap not in sta.inRangeAPs:
                 sta.inRangeAPs.append(ap)
         else:
             if ap in sta.inRangeAPs:
                 sta.inRangeAPs.remove(ap)
Esempio n. 9
0
 def getAPsInRange(self, sta):
     for ap in emulationEnvironment.apList:
         dist = channelParameters.getDistance(sta, ap)
         if dist < ap.range + sta.range:
             if ap not in sta.inRangeAPs:
                 sta.inRangeAPs.append(ap)
         else:
             if ap in sta.inRangeAPs:
                 sta.inRangeAPs.remove(ap)
    def customMeshRouting(self, sta, wlan, stationList, **params):
        """Custom Mesh Routing"""
        associate = False
        controlMeshMac = []
        command = ''
        for ref_sta in stationList:
            if ref_sta != sta and ref_sta.func[wlan] == 'mesh' :
                dist = channelParameters.getDistance(sta, ref_sta)
                totalRange = int(sta.params['range']) + int(ref_sta.params['range'])
                if dist < totalRange:
                    for w in range(len(ref_sta.params['wlan'])):
                        if ref_sta.func[w] == 'mesh':
                            if sta.params['associatedTo'][wlan] == ref_sta.params['associatedTo'][w]:
                                associate = True

        """Adding all reached target paths"""
        if associate:
            exist = []
            sta_ref = []
            sta_ref.append(sta)
            j = 0
            exist.append(sta)
            while j < len(stationList):
                j += 1
                if sta_ref == []:
                    break
                else:
                    newsta = sta_ref[0]
                for x, y in zip(listNodes.nodesX, listNodes.nodesY):
                    if x == sta and y not in exist:
                        command = 'iw dev %s mpath new %s next_hop %s' % (sta.params['wlan'][wlan], y.meshMac[wlan], y.meshMac[wlan])
                        sta.pexec(command)
                        exist.append(y)
                        controlMeshMac.append(y.meshMac[wlan])
                        sta_ref.append(y)
                    elif x == newsta and y not in exist:
                        command = 'iw dev %s mpath new %s next_hop %s' % (sta.params['wlan'][wlan], y.meshMac[wlan], x.meshMac[wlan])
                        sta.pexec(command)
                        exist.append(y)
                        controlMeshMac.append(y.meshMac[wlan])
                        sta_ref.append(y)
                if newsta in sta_ref:
                    sta_ref.remove(newsta)

        """delete all unknown paths"""
        if associate:
            for ref_sta in stationList:
                for w in range(len(ref_sta.params['wlan'])):
                    if ref_sta != sta and ref_sta.func[w] == 'mesh' :
                        if ref_sta.meshMac[w] not in controlMeshMac:
                            sta.pexec('iw dev %s mpath del %s' % (sta.params['wlan'][wlan], ref_sta.meshMac[w]))

        """mesh leave"""
        if associate == False:
            sta.pexec('iw dev %s mesh leave' % sta.params['wlan'][wlan])
            sta.params['associatedTo'][wlan] = ''
Esempio n. 11
0
    def pairingNodes(self, sta, wlan, stationList, **params):
        i = 1
        ref_distance = 0
        self.dist = 0

        for ref_sta in stationList:
            if ref_sta != sta:
                dist = channelParameters.getDistance(sta, ref_sta)
                totalRange = sta.range + ref_sta.range
                if dist < totalRange:
                    ref_distance = ref_distance + dist
                    if sta.ssid[wlan] == ref_sta.ssid[wlan]:
                        listNodes.nodesX.append(sta)
                        listNodes.nodesY.append(ref_sta)
                    i += 1
        self.dist = ref_distance / i
        return self.dist
Esempio n. 12
0
 def pairingNodes(self, sta, wlan, stationList, **params):
     i=1
     ref_distance = 0
     self.dist = 0
     
     for ref_sta in stationList:
         if ref_sta != sta:
             dist = channelParameters.getDistance(sta, ref_sta)
             totalRange = sta.range + ref_sta.range
             if dist < totalRange:
                 ref_distance = ref_distance + dist
                 if sta.ssid[wlan] == ref_sta.ssid[wlan]:
                     listNodes.nodesX.append(sta)
                     listNodes.nodesY.append(ref_sta)                                 
                 i+=1
     self.dist = ref_distance / i
     return self.dist
Esempio n. 13
0
 def customAssociationControl(self, node1, node2, wlan, ac):
     """Mechanisms that optimize the use of the APs"""
     if ac == "llf":  #useful for llf (Least-loaded-first)
         apref = node1.associatedAp[wlan]
         if apref != 'NoAssociated':
             ref_llf = apref.nAssociatedStations
             if node2.nAssociatedStations + 2 < ref_llf:
                 self.changeAP = True
         else:
             self.changeAP = True
     elif ac == "ssf":  #useful for ssf (Strongest-signal-first)
         if propagationModel_.model == '':
             propagationModel_.model = 'friisPropagationLossModel'
         refDistance = channelParameters.getDistance(node1, node2)
         refValue = propagationModel_(node1, node2, refDistance, wlan)
         if refValue.rssi > float(node1.params['rssi'][wlan] + 0.1):
             self.changeAP = True
     return self.changeAP
 def customAssociationControl(self, sta, ap, wlan, ac):
     """Mechanisms that optimize the use of the APs"""        
     if ac == "llf": #useful for llf (Least-loaded-first)
         apref = sta.params['associatedTo'][wlan]
         if apref != 'NoAssociated':
             ref_llf = len(apref.associatedStations)
             if len(ap.associatedStations)+2 < ref_llf:
                 self.changeAP = True
         else:
             self.changeAP = True
     elif ac == "ssf": #useful for ssf (Strongest-signal-first)
         if propagationModel_.model == '':
             propagationModel_.model = 'friisPropagationLossModel'
         refDistance = channelParameters.getDistance(sta, ap)
         refValue = propagationModel_(sta, ap, refDistance, wlan)
         if refValue.rssi > float(sta.params['rssi'][wlan] + 1):
             self.changeAP = True
     return self.changeAP  
Esempio n. 15
0
 def customAssociationControl(self, sta, ap, wlan, ac):
     """Mechanisms that optimize the use of the APs"""
     if ac == "llf":  #useful for llf (Least-loaded-first)
         apref = sta.params['associatedTo'][wlan]
         if apref != 'NoAssociated':
             ref_llf = len(apref.associatedStations)
             if len(ap.associatedStations) + 2 < ref_llf:
                 self.changeAP = True
         else:
             self.changeAP = True
     elif ac == "ssf":  #useful for ssf (Strongest-signal-first)
         if propagationModel_.model == '':
             propagationModel_.model = 'friisPropagationLossModel'
         refDistance = channelParameters.getDistance(sta, ap)
         refValue = propagationModel_(sta, ap, refDistance, wlan)
         if refValue.rssi > float(sta.params['rssi'][wlan] + 1):
             self.changeAP = True
     return self.changeAP
 def customAssociationControl(self, node1, node2, wlan, ac):
     """Mechanisms that optimize the use of the APs"""        
     if ac == "llf": #useful for llf (Least-loaded-first)
         apref = node1.associatedAp[wlan]
         if apref != 'NoAssociated':
             #accessPoint.numberOfAssociatedStations(apref)
             ref_llf = apref.nAssociatedStations
             if node2.nAssociatedStations+2 < ref_llf:
                 self.changeAP = True
         else:
             self.changeAP = True
     elif ac == "ssf": #useful for ssf (Strongest-signal-first)
         if emulationEnvironment.propagation_Model == '':
             emulationEnvironment.propagation_Model = 'friisPropagationLossModel'
         refDistance = channelParameters.getDistance(node1, node2)
         refValue = propagationModel(node1, node2, refDistance, wlan, emulationEnvironment.propagation_Model, self.systemLoss)
         if refValue.rssi > float(node1.rssi[wlan] + 0.1):
             self.changeAP = True
     return self.changeAP  
Esempio n. 17
0
 def pairingNodes_(self, sta, wlan, stationList, **params):
     """Pairing nodes"""
     i=1
     ref_distance = 0
     self.dist = 0
     self.ssid_ID+=1
     for ref_sta in stationList:
         if ref_sta != sta:
             dist = channelParameters.getDistance(sta, ref_sta)
             if dist != 0.0:
                 totalRange = sta.range + ref_sta.range
                 if dist < totalRange:
                     ref_distance = ref_distance + dist
                     listNodes.nodesX.append(sta)
                     listNodes.nodesY.append(ref_sta)  
                     ssid = sta.params['associatedTo'][wlan]
                     ref_ssid = ref_sta.params['associatedTo'][wlan]
                     if ssid != ref_ssid or ssid == sta.ssid[wlan] or ssid == '' or ref_ssid == '':
                         sta.params['associatedTo'][wlan] = sta.ssid[wlan] + str(self.ssid_ID)
                         ref_sta.params['associatedTo'][wlan] = sta.ssid[wlan] + str(self.ssid_ID)  
                     i+=1
     self.dist = ref_distance / i
     return self.dist
Esempio n. 18
0
 def start(self, node, d):  
     while self.dist <= d:   
         ap = node.associatedAp[0]
         self.dist = channelParameters.getDistance(node, ap)
         os.system("echo %d %d >> data.text" % (self.dist, node.rssi[0]))
Esempio n. 19
0
 def start(self, node, d):
     while self.dist <= d:
         ap = node.associatedAp[0]
         self.dist = channelParameters.getDistance(node, ap)
         os.system("echo %d %d >> data.text" %
                   (self.dist, node.params['rssi'][0]))
Esempio n. 20
0
 def nodeParameter(self, sta, wlan):
     for ap in emulationEnvironment.apList:
         if 'wlan' not in ap.params:
             dist = channelParameters.getDistance(sta, ap)
             self.getAPsInRange(sta)
             self.setChannelParameters(sta, ap, dist, wlan)  
Esempio n. 21
0
 def customMeshRouting(self, node, wlan, stationList, **params):
    
     sta = node        
     
     if wlan < sta.nWlans:
         associate = False
         controlMeshMac = []
         command = ''
         iface = 'mp'
        
         for ref_sta in stationList:
             if ref_sta != sta:
                 dist = channelParameters.getDistance(sta, ref_sta)
                         
                 totalRange = sta.range + ref_sta.range
                 if dist < totalRange:
                     for w in range(ref_sta.nWlans):
                         if ref_sta.func[w] == 'mesh':
                             if sta.ssid[wlan] == ref_sta.ssid[w]:                                
                                 associate = True
         
         """Mesh Join""" 
         if associate == True and sta.isAssociated[wlan] == False:                
             sta.pexec('ifconfig %s-%s%s up' % (sta, iface, wlan))
             sta.pexec('iw dev %s-%s%s mesh join %s' % (sta, iface, wlan, sta.ssid[wlan]))   
             sta.isAssociated[wlan] = True
         
         """Adding all reached target paths"""
         if associate:
             sta.pexec('ifconfig %s-%s%s up' % (sta, iface, wlan))
         
             sta.isAssociated[wlan] = True
             exist = []
             sta_ref = []
             sta_ref.append(sta)
             j = 0
             exist.append(sta)
             while j < len(stationList):
                 j+=1         
                 if sta_ref == []:
                     break       
                 else:
                     newsta = sta_ref[0]
                 
                 for x, y in zip(listNodes.nodesX, listNodes.nodesY):
                     if x == sta and y not in exist:
                         command = 'iw dev %s-%s%s mpath new %s next_hop %s' % (sta, iface, wlan, y.meshMac[wlan], y.meshMac[wlan])
                         sta.pexec(command)
                         exist.append(y)
                         controlMeshMac.append(y.meshMac[wlan])
                         sta_ref.append(y)
                     elif x == newsta and y not in exist:
                         command = 'iw dev %s-%s%s mpath new %s next_hop %s' % (sta, iface, wlan, y.meshMac[wlan], x.meshMac[wlan])
                         sta.pexec(command)
                         exist.append(y)
                         controlMeshMac.append(y.meshMac[wlan])
                         sta_ref.append(y)
                 if newsta in sta_ref:
                     sta_ref.remove(newsta)
         
         """delete all unknown paths"""
         if associate:
             for y in stationList:
                 for w in range(y.nWlans):
                     if y.meshMac[w] not in controlMeshMac:
                         sta.pexec('iw dev %s-%s%s mpath del %s' % (sta, iface, wlan, y.meshMac[w]))
         
             sta.isAssociated[wlan] = True
             
         """mesh leave"""
         if associate == False:
             sta.pexec('iw dev %s-%s%s mesh leave' % (sta, iface, wlan))
             
             sta.pexec('ifconfig %s-mp0 down' % sta)
             sta.isAssociated[wlan] = False
Esempio n. 22
0
 def nodeParameter(self, sta, wlan):
     for ap in mobility.apList:
         if 'wlan' not in ap.params:
             dist = channelParameters.getDistance(sta, ap)
             self.getAPsInRange(sta)
             self.setChannelParameters(sta, ap, dist, wlan)  
Esempio n. 23
0
 def nodeParameter(self, sta, wlan):
     for ap in mobility.apList:
         dist = channelParameters.getDistance(sta, ap)
         self.getAPsInRange(sta)
         self.setChannelParameters(sta, ap, dist, wlan)
Esempio n. 24
0
    def customMeshRouting(self, node, wlan, stationList, **params):
       
        sta = node        
        if wlan < sta.nWlans:
            associate = False
            controlMeshMac = []
            command = ''
            iface = 'mp'
	    #listNodes.pairingNodes(node, wlan, stationList, **params)
           
            for ref_sta in stationList:
                if ref_sta != sta:
                    dist = channelParameters.getDistance(sta, ref_sta)
                            
                    totalRange = sta.range + ref_sta.range
                    if dist < totalRange:
                        for w in range(ref_sta.nWlans):
                            if ref_sta.func[w] == 'mesh':
                                if sta.ssid[wlan] == ref_sta.ssid[w]:                                
                                    associate = True
            
            """Mesh Join""" 
            if associate == True and sta.isAssociated[wlan] == False:                
                sta.pexec('ifconfig %s-%s%s up' % (sta, iface, wlan))
                sta.pexec('iw dev %s-%s%s mesh join %s' % (sta, iface, wlan, sta.ssid[wlan]))   
                sta.isAssociated[wlan] = True
            
            """Adding all reached target paths"""
            if associate:
                sta.pexec('ifconfig %s-%s%s up' % (sta, iface, wlan))
            
                sta.isAssociated[wlan] = True
                exist = []
                sta_ref = []
                sta_ref.append(sta)
                j = 0
                exist.append(sta)
                while j < len(stationList):
                    j+=1         
                    if sta_ref == []:
                        break       
                    else:
                        newsta = sta_ref[0]
		    #import pdb; pdb.set_trace()
                    
                    for x, y in zip(listNodes.nodesX, listNodes.nodesY):
                        if x == sta and y not in exist:
                            command = 'iw dev %s-%s%s mpath new %s next_hop %s' % (sta, iface, wlan, y.meshMac[wlan], y.meshMac[wlan])
                            sta.pexec(command)
                            exist.append(y)
                            controlMeshMac.append(y.meshMac[wlan])
                            sta_ref.append(y)
                        elif x == newsta and y not in exist:
                            command = 'iw dev %s-%s%s mpath new %s next_hop %s' % (sta, iface, wlan, y.meshMac[wlan], x.meshMac[wlan])
                            sta.pexec(command)
                            exist.append(y)
                            controlMeshMac.append(y.meshMac[wlan])
                            sta_ref.append(y)
                    if newsta in sta_ref:
                        sta_ref.remove(newsta)
            
            """delete all unknown paths"""
            if associate:
                for y in stationList:
                    for w in range(y.nWlans):
                        if y.meshMac[w] not in controlMeshMac:
                            sta.pexec('iw dev %s-%s%s mpath del %s' % (sta, iface, wlan, y.meshMac[w]))
            
                sta.isAssociated[wlan] = True
                
            """mesh leave"""
            if associate == False:
                sta.pexec('iw dev %s-%s%s mesh leave' % (sta, iface, wlan))
                
                sta.pexec('ifconfig %s-mp0 down' % sta)
                sta.isAssociated[wlan] = False