예제 #1
0
    def wifi_scan(self):
        from boardfarm.lib.installers import install_iw
        install_iw(self)

        self.sudo_sendline('iw %s scan | grep SSID:' % self.iface_wifi)
        self.expect(self.prompt)
        return self.before
예제 #2
0
    def wifi_scan(self):
        """Scanning the SSID associated with the wifi interface

        :return: List of SSID
        :rtype: string
        """
        from boardfarm.lib.installers import install_iw
        install_iw(self)

        self.sudo_sendline('iw %s scan | grep SSID:' % self.iface_wifi)
        self.expect(self.prompt)
        return self.before
예제 #3
0
    def wifi_check_ssid(self, ssid_name):
        from boardfarm.lib.installers import install_iw
        install_iw(self)

        self.sudo_sendline('iw %s scan | grep "SSID: %s"' %
                           (self.iface_wifi, ssid_name))
        self.expect(self.prompt)
        match = re.search("%s\"\s+.*(%s)" % (ssid_name, ssid_name),
                          self.before)
        if match:
            return True
        else:
            return False
예제 #4
0
    def iwlist_supported_channels(self, wifi_band):
        """list of wifi client support channel.

        :param wifi_mode: wifi frequency ['2' or '5']
        :type wifi_mode: string
        :return: list of channel in wifi mode
        :rtype: list
        """
        install_iw(self)

        self.sudo_sendline(f"iwlist {self.iface_wifi} channel")
        self.expect(self.prompt)
        channel_list = []
        for line in self.before.split("\r\n"):
            match = re.search(r"Channel\ \d+\ \:\ %s.\d+\ GHz" % (wifi_band), line)
            if match:
                channel_list.append(match.group().split(" ")[1])
        return channel_list
예제 #5
0
    def wifi_check_ssid(self, ssid_name):
        """Check the SSID provided is present in the scan list

        :param ssid_name: SSID name to be verified
        :type ssid_name: string
        :return: True or False
        :rtype: boolean
        """
        from boardfarm.lib.installers import install_iw
        install_iw(self)

        self.sudo_sendline('iw %s scan | grep "SSID: %s"' %
                           (self.iface_wifi, ssid_name))
        self.expect(self.prompt)
        match = re.search(r"%s\"\s+.*(%s)" % (ssid_name, ssid_name),
                          self.before)
        if match:
            return True
        else:
            return False
예제 #6
0
    def set_wlan_scan_channel(self, channel):
        """Change wifi client scan channel."""
        install_iw(self)

        self.sudo_sendline(f"iwconfig {self.iface_wifi} channel {channel}")
        self.expect(self.prompt)