def configureWifiNodes(self, stations, accessPoints, cars, switches, \ nextIP, ipBaseNum, prefixLen, useWmediumd): """ Configure WiFi Nodes :param stations: list of stations :param accessPoints: list of access points :param cars: list of cars :param switches: list of switches :param wifiRadios: number of wireless radios :param wmediumd: loads wmediumd """ self.useWmediumd = useWmediumd params = {} if self.ifb: link.ifb = True params['ifb'] = self.ifb params['useWmediumd'] = useWmediumd nodes = stations + accessPoints + cars module.start(nodes, self.wifiRadios, self.alternativeModule, **params) self.configureWirelessLink(stations, accessPoints, cars, switches) self.createVirtualIfaces(stations) self.configureAPs(accessPoints) self.isWiFi = True # useful if there no link between sta and any other device params = { 'nextIP': nextIP, 'ipBaseNum': ipBaseNum, 'prefixLen': prefixLen, 'ssid': 'mesh-ssid' } for car in cars: self.addMesh(car.params['carsta'], **params) stations.remove(car.params['carsta']) stations.append(car) car.lastpos = [0, 0, 0] car.params['wlan'].append(0) car.params['rssi'].append(0) car.params['snr'].append(0) car.params['channel'].append(0) car.params['txpower'].append(0) car.params['antennaGain'].append(0) car.params['antennaHeight'].append(0) car.params['associatedTo'].append('') car.params['frequency'].append(0) return stations, accessPoints
def configureWifiNodes(cls, mininet): """ Configure WiFi Nodes :param stations: list of stations :param aps: list of access points :param cars: list of cars :param wifiRadios: number of wireless radios :param wmediumd: loads wmediumd """ from mininet.node import Car cls.enable_wmediumd = mininet.enable_wmediumd params = {} if cls.ifb: wirelessLink.ifb = True params['ifb'] = cls.ifb nodes = mininet.stations + mininet.aps + mininet.cars module.start(nodes, cls.wifiRadios, cls.alternativeModule, **params) cls.configureWirelessLink(mininet.stations, mininet.aps, mininet.cars) cls.createVirtualIfaces(mininet.stations) cls.configureAPs(mininet.aps, mininet.driver) cls.isWiFi = True for car in mininet.cars: # useful if there no link between sta and any other device params = { 'nextIP': mininet.nextIP, 'ipBaseNum': mininet.ipBaseNum, 'prefixLen': mininet.prefixLen, 'ssid': car.params['ssid'] } if 'func' in car.params and car.params['func'] == 'adhoc': cls.addHoc(car.params['carsta'], **params) else: cls.addMesh(car.params['carsta'], **params) mininet.stations.remove(car.params['carsta']) mininet.stations.append(car) if 'position' in car.params: if car.params['position'] == (0, 0, 0): car.lastpos = [0, 0, 0] else: car.params['carsta'].params['position'] = car.params[ 'position'] car.lastpos = car.params['position'] else: car.lastpos = [0, 0, 0] car.params['wlan'].append(0) if not cls.enable_interference: car.params['rssi'].append(0) car.params['channel'].append(0) car.params['mode'].append(0) car.params['txpower'].append(0) car.params['antennaGain'].append(0) car.params['antennaHeight'].append(0) car.params['associatedTo'].append('') car.params['frequency'].append(0) 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 if int(node.params['range'][wlan]) == 0: if isinstance(node, Car) and wlan == 1: node = node.params['carsta'] wlan = 0 intf = node.params['wlan'][wlan] node.params['range'][wlan] = node.getRange(intf=intf) else: if node.params['txpower'][wlan] == 14: node.autoTxPower = True node.params['txpower'][wlan] = \ node.getTxPower_prop_model(wlan) setParam = True if isinstance(node, Car): setParam = False node.setTxPower(node.params['txpower'][wlan], intf=node.params['wlan'][wlan], setParam=setParam) if cls.enable_wmediumd: if not mininet.configureWiFiDirect and not mininet.configure4addr and \ not mininet.enable_error_prob: cls.configureWmediumd(mininet) cls.wmediumdConnect() if cls.enable_interference and not cls.isVanet: for node in nodes: for wlan in range(0, len(node.params['wlan'])): node.setTxPower(node.params['txpower'][wlan], intf=node.params['wlan'][wlan], setParam=False) node.setAntennaGain( node.params['antennaGain'][wlan], intf=node.params['wlan'][wlan], setParam=False) return mininet.stations, mininet.aps
def configureWifiNodes(self, stations, accessPoints, cars, switches, \ nextIP, ipBaseNum, prefixLen, useWmediumd, driver): """ Configure WiFi Nodes :param stations: list of stations :param accessPoints: list of access points :param cars: list of cars :param switches: list of switches :param wifiRadios: number of wireless radios :param wmediumd: loads wmediumd """ self.useWmediumd = useWmediumd params = {} if self.ifb: link.ifb = True params['ifb'] = self.ifb params['useWmediumd'] = useWmediumd nodes = stations + accessPoints + cars module.start(nodes, self.wifiRadios, self.alternativeModule, **params) self.configureWirelessLink(stations, accessPoints, cars, switches) self.createVirtualIfaces(stations) self.configureAPs(accessPoints, driver) self.isWiFi = True for car in cars: # useful if there no link between sta and any other device params = { 'nextIP': nextIP, 'ipBaseNum':ipBaseNum, \ 'prefixLen':prefixLen, 'ssid':car.params['ssid']} if 'func' in car.params and car.params['func'] == 'adhoc': self.addHoc(car.params['carsta'], **params) else: self.addMesh(car.params['carsta'], **params) stations.remove(car.params['carsta']) stations.append(car) if 'position' in car.params: if car.params['position'] == (0, 0, 0): car.lastpos = [0, 0, 0] else: car.params['carsta'].params['position'] = car.params[ 'position'] car.lastpos = car.params['position'] else: car.lastpos = [0, 0, 0] car.params['wlan'].append(0) if not self.enable_interference: car.params['rssi'].append(0) car.params['snr'].append(0) car.params['channel'].append(0) car.params['txpower'].append(0) car.params['antennaGain'].append(0) car.params['antennaHeight'].append(0) car.params['associatedTo'].append('') car.params['frequency'].append(0) if self.useWmediumd: if not self.configureWiFiDirect and not self.configure4addr: self.configureWmediumd(stations, accessPoints) self.wmediumdConnect() for node in nodes: for wlan in range(0, len(node.params['channel'])): if node.params['range'] == 33 or node.params['range'] == 18: value = distanceByPropagationModel(node, wlan) node.params['range'] = int(value.dist) return stations, accessPoints