def autoAssociation(cls, stations, aps):
        """
        This is useful to make the users' life easier
        
        :param stations: list of stations
        :param aps: list of access points
        """
        from mininet.node import Car

        nodes = stations + aps
        for node in nodes:
            for wlan in range(0, len(node.params['wlan'])):
                if isinstance(node, Car) and wlan == 1:
                    node = node.params['carsta']
                    wlan = 0
        ap = []
        for node in aps:
            if 'link' in node.params:
                ap.append(node)

        nodes = stations + ap

        if cls.nroads == 0:
            for node in nodes:
                if 'position' in node.params and 'link' not in node.params:
                    mobility.aps = aps
                    mobility.parameters_(node)

            for sta in stations:
                for wlan in range(0, len(sta.params['wlan'])):
                    for ap in aps:
                        if 'position' in sta.params and 'position' in ap.params:
                            dist = sta.get_distance_to(ap)
                            if dist <= ap.params['range'][0]:
                                mobility.handover(sta, ap, wlan, ap_wlan=0)
Exemple #2
0
    def autoAssociation(cls, stations, aps):
        """
        This is useful to make the users' life easier
        
        :param stations: list of stations
        :param aps: list of access points
        """
        nodes = stations + aps
        for node in nodes:
            for wlan in range(0, len(node.params['wlan'])):
                if node.type == 'vehicle' and wlan == 1:
                    node = node.params['carsta']
                    wlan = 0
        ap = []
        for node in aps:
            if 'link' in node.params:
                ap.append(node)

        nodes = stations + ap

        if cls.nroads == 0:
            for node in nodes:
                if 'position' in node.params and 'link' not in node.params:
                    mobility.aps = aps
                    mobility.parameters_(node)

            for sta in stations:
                for wlan in range(0, len(sta.params['wlan'])):
                    for ap in aps:
                        if 'position' in sta.params and 'position' in ap.params:
                            dist = wirelessLink.getDistance(sta, ap)
                            if dist <= ap.params['range'][0]:
                                mobility.handover(sta, ap, wlan)
Exemple #3
0
    def autoAssociation(self, stations, accessPoints):
        """
        This is useful to make the users' life easier
        
        :param stations: list of stations
        :param accessPoints: list of access points
        """
        nodes = stations + accessPoints
        for node in nodes:
            for wlan in range(0, len(node.params['wlan'])):
                if node.type == 'vehicle' and wlan == 1:
                    node = node.params['carsta']
                    wlan = 0
                node.setTxPower_(node.params['wlan'][wlan],
                                 node.params['txpower'][wlan])
                node.setAntennaGain_(node.params['wlan'][wlan],
                                     node.params['antennaGain'][wlan])
                #node.setAntennaHeight_(node.params['wlan'][wlan], node.params['antennaHeight'][wlan])

        ap = []
        for node in accessPoints:
            if 'link' in node.params:
                ap.append(node)

        nodes = stations + ap

        if self.nroads == 0:
            for node in stations:
                for wlan in range(0, len(node.params['wlan'])):
                    if node.func[wlan] == 'mesh':
                        mobility.meshNodes.append(node)
                    elif node.func[wlan] == 'adhoc':
                        mobility.adhocNodes.append(node)
            for node in nodes:
                if 'position' in node.params and 'link' not in node.params:
                    mobility.accessPoints = accessPoints
                    mobility.parameters_(node)

            for sta in stations:
                for wlan in range(0, len(sta.params['wlan'])):
                    for ap in accessPoints:
                        if 'position' in sta.params and 'position' in ap.params:
                            dist = link.getDistance(sta, ap)
                            if dist <= ap.params['range']:
                                mobility.handover(sta, ap, wlan)
Exemple #4
0
    def autoAssociation(self, stations, accessPoints):
        """
        This is useful to make the users' life easier
        
        :param stations: list of stations
        :param accessPoints: list of access points
        """
        nodes = stations + accessPoints
        for node in nodes:
            for wlan in range(0, len(node.params['wlan'])):
                node.setTxPower_(node.params['wlan'][wlan],
                                 node.params['txpower'][wlan])

        ap = []
        for node in accessPoints:
            if 'link' in node.params:
                ap.append(node)

        nodes = stations + ap

        if not self.isVanet:
            for node in stations:
                for wlan in range(0, len(node.params['wlan'])):
                    if node.func[wlan] == 'mesh':
                        mobility.meshNodes.append(node)
                    elif node.func[wlan] == 'adhoc':
                        mobility.adhocNodes.append(node)
            for node in nodes:
                if 'position' in node.params and 'link' not in node.params:
                    mobility.accessPoints = accessPoints
                    mobility.parameters_(node)

            for sta in stations:
                for wlan in range(0, len(node.params['wlan'])):
                    for ap in accessPoints:
                        if 'position' in sta.params and 'position' in ap.params:
                            dist = link.getDistance(sta, ap)
                            if dist <= ap.params['range']:
                                mobility.handover(sta, ap, wlan, dist)