def start_ap(self, profile, channel, security=None):
        """Starts an Access Point

        Args:
            profile: Profile name such as 'whirlwind'
            channel: Channel to operate on
        """
        self.log.info('Profile: %s, Channel: %d' % (profile, channel))
        setup_ap(access_point=self.ap,
                 profile_name=profile,
                 channel=channel,
                 ssid=self.ssid,
                 security=security)
示例#2
0
    def beacon_loss(self, channel):
        setup_ap(access_point=self.ap,
                 profile_name='whirlwind',
                 channel=channel,
                 ssid=self.ssid)
        time.sleep(self.wait_ap_startup_s)
        if channel > 14:
            self.in_use_interface = self.ap.wlan_5g
        else:
            self.in_use_interface = self.ap.wlan_2g

        # TODO(b/144505723): [ACTS] update BeaconLossTest.py to handle client
        # roaming, saved networks, etc.
        self.log.info("sending associate command for ssid %s", self.ssid)
        associate(client=self.wlan_device, ssid=self.ssid)

        asserts.assert_true(self.wlan_device.is_connected(),
                            'Failed to connect.')

        time.sleep(self.wait_client_connection_setup_s)

        for _ in range(0, self.num_of_iterations):
            # Turn off AP radio
            self.log.info("turning off radio")
            self.ap.iwconfig.ap_iwconfig(self.in_use_interface, "txpower off")
            time.sleep(self.wait_after_ap_txoff_s)

            # Did we disconnect from AP?
            asserts.assert_false(self.wlan_device.is_connected(),
                                 'Failed to disconnect.')

            # Turn on AP radio
            self.log.info("turning on radio")
            self.ap.iwconfig.ap_iwconfig(self.in_use_interface, "txpower on")
            time.sleep(self.wait_to_connect_after_ap_txon_s)

            # Tell the client to connect
            self.log.info("sending associate command for ssid %s" % self.ssid)
            associate(client=self.wlan_device, ssid=self.ssid)
            time.sleep(self.wait_client_connection_setup_s)

            # Did we connect back to WiFi?
            asserts.assert_true(self.wlan_device.is_connected(),
                                'Failed to connect back.')

        return True
 def test_rvr_11n_2g_20mhz_open_rx_ipv6(self):
     ssid = rand_ascii_str(20)
     setup_ap(access_point=self.access_point,
              profile_name='whirlwind',
              channel=hostapd_constants.AP_DEFAULT_CHANNEL_2G,
              ssid=ssid,
              setup_bridge=True)
     graph_data = self.run_rvr(ssid,
                               band='2g',
                               traffic_dir='rx',
                               ip_version=6)
     for rvr_graph in create_rvr_graph(
             self.test_name,
             context.get_current_context().get_full_output_path(),
             graph_data):
         self.rvr_graph_summary.append(rvr_graph)
     write_csv_rvr_data(
         self.test_name,
         context.get_current_context().get_full_output_path(), graph_data)
    def setup_ap(self, ssid, band, ipv4=True, ipv6=False):
        """Setup ap with basic config.

        Args:
            ssid: string, ssid to setup on ap
            band: string ('2g' or '5g') of band to setup.
            ipv4: True if using ipv4 (dhcp), else False.
            ipv6: True if using ipv6 (radvd), else False.
        """
        if band == BAND_2G:
            wlan_utils.setup_ap(access_point=self.access_point,
                                profile_name='whirlwind',
                                channel=11,
                                ssid=ssid)
        elif band == BAND_5G:
            wlan_utils.setup_ap(access_point=self.access_point,
                                profile_name='whirlwind',
                                channel=36,
                                ssid=ssid)

        if not ipv4:
            self.access_point.stop_dhcp()
        if ipv6:
            radvd_config = RadvdConfig(
                prefix='fd00::/64',
                adv_send_advert=radvd_constants.ADV_SEND_ADVERT_ON,
                adv_on_link=radvd_constants.ADV_ON_LINK_ON,
                adv_autonomous=radvd_constants.ADV_AUTONOMOUS_ON)

            if band == BAND_2G:
                self.router_adv_daemon = Radvd(self.access_point.ssh,
                                               self.access_point.wlan_2g)
            elif band == BAND_5G:
                self.router_adv_daemon = Radvd(self.access_point.ssh,
                                               self.access_point.wlan_5g)
            self.router_adv_daemon.start(radvd_config)

        self.log.info('Network (SSID: %s) is up.' % ssid)
 def test_rvr_11ac_5g_80mhz_wpa2_tx_ipv6(self):
     ssid = rand_ascii_str(20)
     password = rand_ascii_str(20)
     security_profile = Security(security_mode='wpa2', password=password)
     setup_ap(access_point=self.access_point,
              profile_name='whirlwind',
              channel=hostapd_constants.AP_DEFAULT_CHANNEL_5G,
              ssid=ssid,
              security=security_profile,
              setup_bridge=True)
     graph_data = self.run_rvr(ssid,
                               password=password,
                               band='5g',
                               traffic_dir='tx',
                               ip_version=6)
     for rvr_graph in create_rvr_graph(
             self.test_name,
             context.get_current_context().get_full_output_path(),
             graph_data):
         self.rvr_graph_summary.append(rvr_graph)
     write_csv_rvr_data(
         self.test_name,
         context.get_current_context().get_full_output_path(), graph_data)