def runTest(self): if not wlan: self.skipTest("skipping test no wlan") self.fip = lan.get_interface_ipaddr("eth1") self.rip = wlan.get_interface_ipaddr("wlan0") wlan.sendline('iwconfig') wlan.expect(prompt) super(iPerfBiDirTestLANtoWLAN, self).runTest(node1=wlan, node2=lan, firewall=False)
def runTest(self): if not wlan: self.skipTest("skipping test no wlan") wlan.sendline('iwconfig') wlan.expect(prompt) super(iPerfBiDirTestWLAN, self).runTest(node1=wlan, node2=wan)
def runTest(self): if not wlan: self.skipTest("skipping test no wlan") wlan.sendline('iwconfig') wlan.expect(prompt) super(iPerfReverseTestWLAN, self).runTest(client=wan, server=wlan)
def runTest(self): super(WlanAssociate, self).runTest() wlan_iface = wifi_interface(board) if wlan_iface is None: self.skipTest("No wifi interfaces detected, skipping..") if wlan is None: self.skipTest("No wlan VM, skipping test..") #Determine if we are using a beeliner x86 host. If not, default to usb drivers. #Would like to push this out to a library. wlan.sendline('lspci |grep -q Atheros; echo $?') wlan.expect('(\d+)\r\n') check_atheros = int(wlan.match.group(1)) if check_atheros is not 0: print("Creating realtek interface.") wlan.sendline('\napt-get install -qy firmware-realtek') wlan.expect('Reading package') wlan.expect(prompt) wlan.sendline('rmmod rtl8192cu 8812au') wlan.expect(prompt) wlan.sendline('modprobe rtl8192cu') wlan.expect(prompt) wlan.sendline('modprobe 8812au') wlan.expect(prompt) else: #Check if modules are alerady loaded. If not, load them. print("Found Atheros hardware, creating interface.") wlan.sendline('lsmod |grep -q ath_hal; echo $?') wlan.expect('(\d+)\r\n') check_loaded = int(wlan.match.group(1)) if check_loaded is not 0: #rc.wlan takes care of insmod, wlanconfig creates wlan0. Both should be in the path. wlan.sendline('rc.wlan up') wlan.expect(prompt) wlan.sendline('wlanconfig wlan0 create wlandev wifi0 wlanmode sta') wlan.expect(prompt) wlan.sendline('rfkill unblock all') wlan.expect(prompt) wlan.sendline('ifconfig wlan0') wlan.expect('HWaddr') wlan.expect(prompt) wlan.sendline('ifconfig wlan0 down') wlan.expect(prompt) wlan.sendline('ifconfig wlan0 up') wlan.expect(prompt) # wait until the wifi can see the SSID before even trying to join # not sure how long we should really give this, or who's fault it is for i in range(0, 20): try: wlan.sendline('iwlist wlan0 scan | grep ESSID:') wlan.expect(self.config.ssid) wlan.expect(prompt) except: lib.common.test_msg("can't see ssid %s, scanning again (%s tries)" % (self.config.ssid, i)) else: break time.sleep(10) for i in range(0, 2): try: wlan.sendline('iwconfig wlan0 essid %s' % self.config.ssid) wlan.expect(prompt) # give it some time to associate time.sleep(20) # make sure we assocaited wlan.sendline('iwconfig wlan0') wlan.expect('Access Point: ([0-9A-F]{2}[:-]){5}([0-9A-F]{2})') wlan.expect(prompt) except: lib.common.test_msg("Can't associate with ssid %s, trying again (%s tries) " % (self.config.ssid, i)) else: break # get ip on wlan wlan.sendline('killall dhclient') wlan.expect(prompt) time.sleep(10) wlan.sendline('dhclient wlan0') wlan.expect(prompt) # for reference wlan.sendline('ifconfig wlan0') wlan.expect(prompt) # make sure dhcp worked, and for reference of IP wlan_ip = wlan.get_interface_ipaddr("wlan0") # add route to wan wlan.sendline('ip route add 192.168.0.0/24 via 192.168.1.1') wlan.expect(prompt) wlan.sendline('ip route show') wlan.expect(prompt) wlan.sendline('ping 192.168.1.1 -c3') wlan.expect('3 packets transmitted') wlan.expect(prompt) wlan.sendline('curl 192.168.1.1 --connect-timeout 5 > /dev/null 2>&1; echo $?') wlan.expect('(\d+)\r\n') curl_success = int(wlan.match.group(1)) msg = "Attempt to curl router returns %s\n" % (curl_success) lib.common.test_msg(msg) assert (curl_success == 0)
def wlan_setup(self): wlan.sendline('\napt-get install -qy usbutils wireless-tools') wlan.expect('Reading package') wlan.expect(prompt) wlan.sendline('killall wpa_supplicant') wlan.expect(prompt)
def runTest(self): # Router board.sendline('uci set network.lan6=interface') board.expect(prompt) board.sendline('uci set network.lan6.proto=static') board.expect(prompt) board.sendline('uci set network.lan6.ip6addr=4aaa::1/64') board.expect(prompt) board.sendline('uci set network.lan6.ifname=@lan') board.expect(prompt) board.sendline('uci set network.wan6=interface') board.expect(prompt) board.sendline('uci set network.wan6.proto=static') board.expect(prompt) board.sendline('uci set network.wan6.ip6addr=5aaa::1/64') board.expect(prompt) board.sendline('uci set network.wan6.ifname=@wan') board.expect(prompt) board.sendline('uci commit network') board.expect(prompt) board.network_restart() # Lan-side Device lan.sendline('\nip -6 addr add 4aaa::6/64 dev eth1') lan.expect('ip -6') lan.expect(prompt) lan.sendline('ip -6 route add 4aaa::1 dev eth1') lan.expect(prompt) lan.sendline('ip -6 route add default via 4aaa::1 dev eth1') lan.expect(prompt) if 'No route to host' in lan.before: raise Exception('Error setting ivp6 routes') # Wan-side Device wan.sendline('\nip -6 addr add 5aaa::6/64 dev eth1') wan.expect('ip -6') wan.expect(prompt) wan.sendline('ip -6 route add 5aaa::1 dev eth1') wan.expect(prompt) wan.sendline('ip -6 route add default via 5aaa::1 dev eth1') wan.expect(prompt) if 'No route to host' in wan.before: raise Exception('Error setting ivp6 routes') # Wlan-side Device if wlan: wlan.sendline('\nip -6 addr add 4aaa::7/64 dev wlan0') wlan.expect('ip -6') wlan.expect(prompt) wlan.sendline('ip -6 route add 4aaa::1 dev eth1') wlan.expect(prompt) wlan.sendline('ip -6 route add default via 4aaa::1 dev wlan0') wlan.expect(prompt) # Give things time to get ready time.sleep(20) # Check addresses board.sendline('\nifconfig | grep -B2 addr:') board.expect('ifconfig ') board.expect(prompt) lan.sendline('\nifconfig | grep -B2 addr:') lan.expect('ifconfig ') lan.expect(prompt) wan.sendline('\nifconfig | grep -B2 addr:') wan.expect('ifconfig ') wan.expect(prompt)
def wlan_setup(self): wlan.sendline('\napt-get install -qy firmware-realtek usbutils wireless-tools wpasupplicant') wlan.expect('Reading package') wlan.expect(prompt)
def wlan_setup(self): wlan.sendline( '\napt-get install -qy firmware-realtek usbutils wireless-tools wpasupplicant' ) wlan.expect('Reading package') wlan.expect(prompt)