def createVirtualIfaces(cls, nodes): "Creates virtual wifi interfaces" for node in nodes: if 'nvif' in node.params: nvif = node.params['nvif'] wlan = 0 for vif_ in range(0, nvif): vif = node.params['wlan'][wlan] + str(vif_ + 1) node.params['wlan'].append(vif) node.params['range'].append(node.params['range'][0]) cls.addParamsToNode(node) cls.addTxPowerParamToNode(node, isVirtualIface=True) cls.addChannelParamToNode(node, isVirtualIface=True) cls.addMacParamToNode(node, isVirtualIface=True, macID=(vif_ + 1)) cls.appendRSSI(node) cls.appendAssociatedTo(node) cls.addAntennaGainParamToNode(node, isVirtualIface=True) cls.addAntennaHeightParamToNode(node, isVirtualIface=True) cls.addModeParamToNode(node, isVirtualIface=True) node.cmd('iw dev %s interface add %s type station' % (node.params['wlan'][wlan], vif)) TCLinkWirelessStation(node, intfName1=vif) cls.configureMacAddr(node)
def configureWirelessLink(cls, stations, aps, cars): """ Configure Wireless Link :param stations: list of stations :param aps: list of access points :param cars: list of cars """ nodes = stations + cars for node in nodes: for wlan in range(0, len(node.params['wlan'])): TCLinkWirelessStation(node, intfName1=node.params['wlan'][wlan]) cls.configureMacAddr(node) stations, aps = cls.checkAPAdhoc(stations, aps) return stations, aps