def run_once(self):
     """Test body."""
     ap_config = hostap_config.HostapConfig(channel=1, hide_ssid=True)
     # Set up the router and associate the client with it.
     self.context.configure(ap_config)
     self.context.capture_host.start_capture(
         ap_config.frequency,
         ht_type=ap_config.ht_packet_capture_mode,
         snaplen=packet_capturer.SNAPLEN_WIFI_PROBE_REQUEST)
     test_ssid = self.context.router.get_ssid()
     assoc_params = xmlrpc_datatypes.AssociationParameters(ssid=test_ssid,
                                                           is_hidden=True)
     self.context.assert_connect_wifi(assoc_params)
     results = self.context.capture_host.stop_capture()
     if len(results) != 1:
         raise error.TestError('Expected to generate one packet '
                               'capture but got %d instead.' % len(results))
     probe_ssids = tcpdump_analyzer.get_probe_ssids(
         results[0].local_pcap_path,
         probe_sender=self.context.client.wifi_mac)
     if len(probe_ssids) != 2:
         raise error.TestError('Expected exactly two SSIDs, but got %s' %
                               probe_ssids)
     if probe_ssids - {self.BROADCAST_SSID, test_ssid}:
         raise error.TestError('Unexpected probe SSIDs: %s' % probe_ssids)
Beispiel #2
0
 def run_once(self):
     """Test body."""
     ap_config = hostap_config.HostapConfig(channel=1)
     # Set up the router and associate the client with it.
     self.context.configure(ap_config)
     self.context.router.start_capture(
         ap_config.frequency,
         ht_type=ap_config.ht_packet_capture_mode,
         snaplen=packet_capturer.SNAPLEN_WIFI_PROBE_REQUEST)
     assoc_params = xmlrpc_datatypes.AssociationParameters(
         ssid=self.context.router.get_ssid())
     self.context.assert_connect_wifi(assoc_params)
     results = self.context.router.stop_capture()
     if len(results) != 1:
         raise error.TestError('Expected to generate one packet '
                               'capture but got %d instead.' % len(results))
     probe_ssids = tcpdump_analyzer.get_probe_ssids(
         results[0].local_pcap_path,
         probe_sender=self.context.client.wifi_mac)
     expected_ssids = frozenset([self.BROADCAST_SSID])
     permitted_ssids = (expected_ssids
                        | frozenset([self.context.router.get_ssid()]))
     # Verify expected ssids are contained in the probe result
     if expected_ssids - probe_ssids:
         raise error.TestError('Expected SSIDs %s, but got %s' %
                               (expected_ssids, probe_ssids))
     # Verify probe result does not contain any unpermitted ssids
     if probe_ssids - permitted_ssids:
         raise error.TestError('Permitted SSIDs %s, but got %s' %
                               (permitted_ssids, probe_ssids))
Beispiel #3
0
    def run_once(self):
        """Test body."""
        ap_config = hostap_config.HostapConfig(channel=1)

        # Start capture before starting anything else.
        self.context.capture_host.start_capture(
            ap_config.frequency,
            ht_type=ap_config.ht_packet_capture_mode,
            snaplen=packet_capturer.SNAPLEN_WIFI_PROBE_REQUEST)

        # We're looking for the MAC address, so disable randomization.
        with self.context.client.mac_address_randomization(False):
            # Set up the router and associate the client with it.
            self.context.configure(ap_config)
            assoc_params = xmlrpc_datatypes.AssociationParameters(
                ssid=self.context.router.get_ssid())

            self.context.assert_connect_wifi(assoc_params)
            results = self.context.capture_host.stop_capture()

        if len(results) != 1:
            raise error.TestError('Expected to generate one packet '
                                  'capture but got %d instead.' % len(results))
        probe_ssids = tcpdump_analyzer.get_probe_ssids(
            results[0].local_pcap_path,
            probe_sender=self.context.client.wifi_mac)
        # We expect a broadcast probe, but it's not guaranteed.
        expected_ssids = frozenset([self.BROADCAST_SSID])
        permitted_ssids = (expected_ssids
                           | frozenset([self.context.router.get_ssid()]))
        # Verify probe result does not contain any unpermitted ssids
        if probe_ssids - permitted_ssids:
            raise error.TestError('Permitted SSIDs %s, but got %s' %
                                  (permitted_ssids, probe_ssids))