Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)