Esempio n. 1
0
 def test_mode_n_on_both_bands(self):
     """Test that band is maintained when setting a mode N spec."""
     spec = ap_spec.APSpec(band=ap_spec.BAND_5GHZ, mode=ap_spec.MODE_N)
     self.assertEquals(spec.band, ap_spec.BAND_5GHZ)
     self.assertEquals(spec.mode, ap_spec.MODE_N)
     spec = ap_spec.APSpec(band=ap_spec.BAND_2GHZ, mode=ap_spec.MODE_N)
     self.assertEquals(spec.band, ap_spec.BAND_2GHZ)
     self.assertEquals(spec.mode, ap_spec.MODE_N)
    def testGetAPConfigurators_WithModeAPSpec(self):
        """Test with a mode only specified AP Spec"""
        self._build_ap_test_inventory()

        spec = ap_spec.APSpec(mode=ap_spec.DEFAULT_2GHZ_MODE)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap1, self.mock_ap2].sort(), actual.sort())

        spec = ap_spec.APSpec(mode=ap_spec.DEFAULT_5GHZ_MODE)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap2], actual)
    def testGetApConfigurators_WithBandAPSpec(self):
        """Test with a band only specified AP Spec"""
        self._build_ap_test_inventory()

        spec = ap_spec.APSpec(band=ap_spec.BAND_2GHZ)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap1, self.mock_ap2].sort(), actual.sort())

        spec = ap_spec.APSpec(band=ap_spec.BAND_5GHZ)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap2], actual)
    def testGetAPConfigurators_WithVisibilityAPSpec(self):
        """Test with a visibility specified AP Spec."""
        self._build_ap_test_inventory()

        spec = ap_spec.APSpec(visible=True)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap1, self.mock_ap2].sort(), actual.sort())

        spec = ap_spec.APSpec(band=ap_spec.BAND_5GHZ, visible=False)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap2], actual)
    def testGetAPConfigurators_ByHostName(self):
        """Test obtaining a list of APs by hostname."""
        self._build_ap_test_inventory()

        spec = ap_spec.APSpec(hostnames=['chromeos3-row2-rack1-host1'])
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap1], actual)

        spec = ap_spec.APSpec(hostnames=[
            'chromeos3-row2-rack1-host1', 'chromeos3-row2-rack1-host2'
        ])
        actual = self.factory.get_ap_configurators_by_spec(spec=spec)
        self.assertEquals([self.mock_ap1, self.mock_ap2].sort(), actual.sort())
    def testGetAPConfigurators_ByType(self):
        """Test obtaining configurators by type."""
        self._build_ap_test_inventory()

        spec = ap_spec.APSpec(configurator_type=ap_spec.CONFIGURATOR_STATIC)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec,
                                                           pre_configure=True)
        self.assertEquals([self.mock_ap1], actual)
Esempio n. 7
0
 def test_set_security_psk_default(self):
     """Test setting security to WPAPSK."""
     spec = ap_spec.APSpec(security=ap_spec.SECURITY_TYPE_WPAPSK)
     self.assertEquals(spec.visible, True)
     self.assertEquals(spec.security, ap_spec.SECURITY_TYPE_WPAPSK)
     self.assertEquals(spec.band, ap_spec.DEFAULT_BAND)
     self.assertEquals(spec.mode, ap_spec.DEFAULT_2GHZ_MODE)
     self.assertEquals(spec.channel, ap_spec.DEFAULT_2GHZ_CHANNEL)
    def testGetAPConfigurators_ByLab(self):
        """Test obtaining configurators by location relative to the lab."""
        self._build_ap_test_inventory()

        spec = ap_spec.APSpec(lab_ap=False)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec,
                                                           pre_configure=True)
        self.assertEquals([self.mock_ap3], actual)
Esempio n. 9
0
 def test_default_creation(self):
     """Test building a default ap_spec object."""
     spec = ap_spec.APSpec()
     self.assertEquals(spec.visible, True)
     self.assertEquals(spec.security, ap_spec.DEFAULT_SECURITY_TYPE)
     self.assertEquals(spec.band, ap_spec.DEFAULT_BAND)
     self.assertEquals(spec.mode, ap_spec.DEFAULT_2GHZ_MODE)
     self.assertEquals(spec.channel, ap_spec.DEFAULT_2GHZ_CHANNEL)
     self.assertIsNone(spec.password)
Esempio n. 10
0
 def test_set_security_and_visibility(self):
     """Test setting visibility to hidden and security to WPAPSK."""
     spec = ap_spec.APSpec(visible=False,
                           security=ap_spec.SECURITY_TYPE_WPAPSK)
     self.assertEquals(spec.visible, False)
     self.assertEquals(spec.security, ap_spec.SECURITY_TYPE_WPAPSK)
     self.assertEquals(spec.band, ap_spec.DEFAULT_BAND)
     self.assertEquals(spec.mode, ap_spec.DEFAULT_2GHZ_MODE)
     self.assertEquals(spec.channel, ap_spec.DEFAULT_2GHZ_CHANNEL)
     self.assertIsNotNone(spec.password)
    def testGetAndPreConfigureAPConfigurators(self):
        """Test preconfiguring APs."""
        self._build_ap_test_inventory()

        # Pick something that is not the default channel.
        channel = ap_spec.VALID_5GHZ_CHANNELS[-1]
        spec = ap_spec.APSpec(channel=channel)
        actual = self.factory.get_ap_configurators_by_spec(spec=spec,
                                                           pre_configure=True)
        self.assertEquals([self.mock_ap2], actual)
        self.assertEquals(actual[0].get_channel(), channel)
Esempio n. 12
0
 def test_only_set_band_5ghz(self):
     """Test setting only the band to 5GHz."""
     spec = ap_spec.APSpec(band=ap_spec.BAND_5GHZ)
     self.assertEquals(spec.channel, ap_spec.DEFAULT_5GHZ_CHANNEL)
     self.assertEquals(spec.mode, ap_spec.DEFAULT_5GHZ_MODE)
Esempio n. 13
0
 def test_only_set_mode_5ghz(self):
     """Test setting only a 5GHz mode."""
     spec = ap_spec.APSpec(mode=ap_spec.MODE_A)
     self.assertEquals(spec.band, ap_spec.BAND_5GHZ)
     self.assertEquals(spec.channel, ap_spec.DEFAULT_5GHZ_CHANNEL)
Esempio n. 14
0
 def test_only_set_mode_n(self):
     """Test setting the mode to N."""
     spec = ap_spec.APSpec(mode=ap_spec.MODE_N)
     self.assertEquals(spec.band, ap_spec.DEFAULT_BAND)
     self.assertEquals(spec.channel, ap_spec.DEFAULT_2GHZ_CHANNEL)
 def testGetAPConfigurators_WithSecurityAPSpec(self):
     """Test with a security only specified AP Spec"""
     self._build_ap_test_inventory()
     spec = ap_spec.APSpec(security=ap_spec.SECURITY_TYPE_WPAPSK)
     actual = self.factory.get_ap_configurators_by_spec(spec=spec)
     self.assertEquals([self.mock_ap1], actual)
Esempio n. 16
0
 def test_only_set_channel_5ghz(self):
     """Test setting only a 5GHz channel."""
     spec = ap_spec.APSpec(channel=ap_spec.DEFAULT_5GHZ_CHANNEL)
     self.assertEquals(spec.band, ap_spec.BAND_5GHZ)
     self.assertEquals(spec.mode, ap_spec.DEFAULT_5GHZ_MODE)
Esempio n. 17
0
 def test_set_band_and_mode_5ghz(self):
     """Test setting the band and mode to valid 5GHz values."""
     spec = ap_spec.APSpec(band=ap_spec.BAND_5GHZ, mode=ap_spec.MODE_A)
     self.assertEquals(spec.channel, ap_spec.DEFAULT_5GHZ_CHANNEL)
Esempio n. 18
0
 def test_set_band_mode_and_channel_5ghz(self):
     """Test setting the band and channel to valid 5GHz value."""
     spec = ap_spec.APSpec(band=ap_spec.BAND_5GHZ,
                           mode=ap_spec.MODE_N,
                           channel=ap_spec.DEFAULT_5GHZ_CHANNEL)
     self.assertNotEquals(spec.mode, ap_spec.DEFAULT_2GHZ_MODE)