예제 #1
0
    def check_mfp_connection(self, wd, device, ssid, throws_exception):
        ordered_networks = device.get_ordered_networks()
        ordered_network = None

        for o_n in ordered_networks:
            if o_n.name == ssid:
                ordered_network = o_n
                break

        self.assertEqual(ordered_network.name, ssid)

        condition = 'not obj.connected'
        wd.wait_for_object_condition(ordered_network.network_object, condition)

        if throws_exception:
            with self.assertRaises(iwd.NotSupportedEx):
                ordered_network.network_object.connect()
            return
        else:
            ordered_network.network_object.connect()

        condition = 'obj.connected'
        wd.wait_for_object_condition(ordered_network.network_object, condition)

        device.disconnect()

        condition = 'not obj.connected'
        wd.wait_for_object_condition(ordered_network.network_object, condition)

        IWD.clear_storage()
예제 #2
0
    def test_connection_with_no_agent(self):

        wd = IWD()

        with self.assertRaises(iwd.NoAgentEx):
            self.check_connection(wd, 'ssid1')

        IWD.clear_storage()
예제 #3
0
    def test_connection_with_own_agent(self):

        wd = IWD()

        psk_agent = PSKAgent("secret_ssid1")
        wd.register_psk_agent(psk_agent)

        self.check_connection(wd, 'ssid1')

        wd.unregister_psk_agent(psk_agent)

        IWD.clear_storage()
예제 #4
0
    def test_connection_with_other_agent(self):
        wd = IWD()

        iwctl = subprocess.Popen(['iwctl', '-P', 'secret_ssid2'])
        # Let iwctl to start and register its agent.
        wd.wait(2)

        self.check_connection(wd, 'ssid2')

        iwctl.terminate()
        iwctl.communicate()

        IWD.clear_storage()
예제 #5
0
    def test_8021x(self):
        tca = TestConnectAutoConnect()
        tca.validate('ssidEAP-TLS', True, iwd.NotConfiguredEx)

        IWD.copy_to_storage('ssidEAP-TLS.8021x')

        tca.validate('ssidEAP-TLS', True)

        IWD.clear_storage()
        IWD.copy_to_storage('ssidEAP-Other.8021x')

        tca.validate('ssidEAP-Other', False, iwd.NotSupportedEx)

        IWD.clear_storage()
예제 #6
0
    def test_connection_use_own_agent_from_multiple_registered(self):

        wd = IWD()

        iwctl = subprocess.Popen(['iwctl', '-P', 'secret_ssid2'])
        # Let iwctl to start and register its agent.
        wd.wait(2)

        psk_agent = PSKAgent("secret_ssid1")
        wd.register_psk_agent(psk_agent)

        self.check_connection(wd, 'ssid1')

        wd.unregister_psk_agent(psk_agent)

        iwctl.terminate()
        iwctl.communicate()

        IWD.clear_storage()
예제 #7
0
    def check_mfp_connection(self, wd, device, ssid, throws_exception):
        ordered_network = device.get_ordered_network(ssid)

        condition = 'not obj.connected'
        wd.wait_for_object_condition(ordered_network.network_object, condition)

        if throws_exception:
            with self.assertRaises(iwd.NotSupportedEx):
                ordered_network.network_object.connect()
            return
        else:
            ordered_network.network_object.connect()

        condition = 'obj.state == DeviceState.connected'
        wd.wait_for_object_condition(device, condition)

        device.disconnect()

        condition = 'not obj.connected'
        wd.wait_for_object_condition(ordered_network.network_object, condition)

        IWD.clear_storage()
    def test_connection(self):
        wd = IWD(True)

        psk_agent = PSKAgent("secret123")
        wd.register_psk_agent(psk_agent)

        device = wd.list_devices(1)[0]
        ordered_network = device.get_ordered_network('ssidOpen',
                                                     scan_if_needed=True)

        device.connect_hidden_network_async(name='ssidSomeHidden',
                                            reply_handler=self._success,
                                            error_handler=self._failure)

        ordered_network.network_object.connect()

        condition = 'obj.state == DeviceState.connected'
        wd.wait_for_object_condition(device, condition)

        condition = 'obj.connected_network is not None'
        wd.wait_for_object_condition(device, condition)

        testutil.test_iface_operstate(device.name)
        device.disconnect()

        condition = 'obj.state == DeviceState.disconnected'
        wd.wait_for_object_condition(device, condition)

        wd.unregister_psk_agent(psk_agent)

        IWD.clear_storage()

        while not self._done:
            time.sleep(.300)

        if self._ex is not None:
            if self._ex.get_dbus_name() != 'net.connman.iwd.Failed':
                raise self._ex
예제 #9
0
    def stage_iwd(self, config_dir):

        wd = IWD(True, config_dir)

        psk_agent = PSKAgent("secret123")
        wd.register_psk_agent(psk_agent)

        devices = wd.list_devices();
        self.assertIsNotNone(devices)
        device = devices[0]

        condition = 'not obj.scanning'
        wd.wait_for_object_condition(device, condition)

        device.scan()

        condition = 'not obj.scanning'
        wd.wait_for_object_condition(device, condition)

        if config_dir == '/tmp/IWD-MFP2':
            self.check_mfp_connection(wd, device, 'ssidMFP0', True)
        else:
            self.check_mfp_connection(wd, device, 'ssidMFP0', False)

        self.check_mfp_connection(wd, device, 'ssidMFP1', False)

        if config_dir == '/tmp/IWD-MFP0':
            self.check_mfp_connection(wd, device, 'ssidMFP2', True)
        else:
            self.check_mfp_connection(wd, device, 'ssidMFP2', False)

        wd.unregister_psk_agent(psk_agent)

        del wd

        IWD.clear_storage()
예제 #10
0
파일: hotspot_test.py 프로젝트: siho22/eiwd
 def tearDownClass(cls):
     IWD.clear_storage()
     os.remove('/tmp/main.conf')
예제 #11
0
    def test_wpa(self):
        tca = TestConnectAutoConnect()
        tca.validate('ssidHiddenWPA', False, None, True)
        tca.validate('ssidHiddenWPA', True, None, True)

        IWD.clear_storage()
예제 #12
0
 def tearDownClass(cls):
     IWD.clear_storage()
     ctx.stop_process(cls.dhcpd_pid)
     cls.dhcpd_pid = None
     os.remove('/tmp/dhcpd.leases')
예제 #13
0
    def tearDownClass(cls):
        IWD.clear_storage(storage_dir='/tmp/ead')

        shutil.rmtree('/tmp/ead')
예제 #14
0
    def tearDownClass(cls):
        IWD.clear_storage()

        cls.auth.stop()
        cls.auth = None
예제 #15
0
    def test_open(self):
        tca = TestConnectAutoConnect()
        tca.validate('ssidOpen', False)
        tca.validate('ssidOpen', True)

        IWD.clear_storage()
예제 #16
0
 def tearDownClass(cls):
     IWD.clear_storage()
     cls.dhcpd_pid.kill()
     os.system('rm -rf /tmp/dhcpd.leases')
예제 #17
0
 def tearDownClass(cls):
     IWD.clear_storage()
     cls.bss_hostapd = None
     cls.bss_radio = None
예제 #18
0
 def tearDownClass(cls):
     IWD.clear_storage()
예제 #19
0
 def tearDownClass(cls):
     IWD.clear_storage()
     cls.hostapd = None