コード例 #1
0
ファイル: connection_test.py プロジェクト: ernestsora/iwd
    def test_connection_success(self):
        hostapd = HostapdCLI(config='ssidCCMP.conf')

        wd = IWD()

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

        devices = wd.list_devices(1)
        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)

        ordered_network = device.get_ordered_network('ssidCCMP')

        self.assertEqual(ordered_network.type, NetworkType.psk)

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

        ordered_network.network_object.connect()

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

        # Make AP go down ungracefully, when hostapd comes back up it should
        # send an unprotected disassociate frame so the client will re-auth.
        # This will kick off the SA Query procedure
        hostapd.ungraceful_restart()

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

        # IWD should now try and re-connect to the AP

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

        hostapd.wait_for_event('AP-STA-CONNECTED')

        device.disconnect()

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

        wd.unregister_psk_agent(psk_agent)
コード例 #2
0
    def validate_connection(self, wd):
        hostapd = HostapdCLI(config='ssidEAP-TTLS-MSCHAPv2.conf')

        self.assertIsNotNone(hostapd)

        psk_agent = PSKAgent('abc', ('domain\\user', 'testpasswd'))
        wd.register_psk_agent(psk_agent)

        device = wd.list_devices(1)[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)

        ordered_networks = device.get_ordered_networks()
        ordered_network = ordered_networks[0]

        self.assertEqual(ordered_network.name, "ssidEAP-TTLS-MSCHAPv2")
        self.assertEqual(ordered_network.type, NetworkType.eap)

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

        ordered_network.network_object.connect()

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

        hostapd.eapol_reauth(device.address)

        hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
        hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')

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

        testutil.test_iface_operstate()
        testutil.test_ifaces_connected()

        device.disconnect()

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

        wd.unregister_psk_agent(psk_agent)
コード例 #3
0
ファイル: connection_test.py プロジェクト: ernestsora/iwd
    def validate_connection(self, wd):
        hostapd = HostapdCLI(config='ssidEAP-PWD.conf')

        self.assertIsNotNone(hostapd)

        psk_agent = PSKAgent('eap-pwd-identity',
                             ('eap-pwd-identity', 'secret123'))
        wd.register_psk_agent(psk_agent)

        devices = wd.list_devices(1)
        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)

        ordered_network = device.get_ordered_network('ssidEAP-PWD')

        self.assertEqual(ordered_network.type, NetworkType.eap)

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

        ordered_network.network_object.connect()

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

        hostapd.eapol_reauth(device.address)

        hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
        hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')

        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)

        wd.unregister_psk_agent(psk_agent)
コード例 #4
0
    def validate_connection(self, wd):
        hostapd = HostapdCLI(config='ssidEAP-PEAPv0-NoISK.conf')

        self.assertIsNotNone(hostapd)

        devices = wd.list_devices(1)
        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)

        ordered_network = device.get_ordered_network('ssidEAP-PEAPv0-NoISK')

        self.assertEqual(ordered_network.type, NetworkType.eap)

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

        ordered_network.network_object.connect()

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

        hostapd.eapol_reauth(device.address)

        hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
        hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')

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

        testutil.test_iface_operstate()
        testutil.test_ifaces_connected()

        device.disconnect()

        condition = 'not obj.connected'
        wd.wait_for_object_condition(ordered_network.network_object, condition)
コード例 #5
0
ファイル: connection_test.py プロジェクト: siho22/eiwd
    def test_connection_success(self):
        hapd = HostapdCLI(config='ssidRRM.conf')
        wd = IWD()

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

        devices = wd.list_devices(1)
        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)

        ordered_network = device.get_ordered_network('ssidRRM')

        self.assertEqual(ordered_network.type, NetworkType.psk)

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

        ordered_network.network_object.connect()

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

        testutil.test_iface_operstate()
        testutil.test_ifaces_connected()

        hapd.wait_for_event('AP-STA-CONNECTED')

        # This should return both APs
        hapd.req_beacon(device.address, basic_beacon)

        for e in ['BEACON-RESP-RX', 'BEACON-RESP-RX']:
            event = hapd.wait_for_event(e)
            if event:
                print(event)

        sleep(0.5)

        # This should return just ssidRRM
        hapd.req_beacon(device.address, beacon_with_ssid)
        event = hapd.wait_for_event('BEACON-RESP-RX')
        if event:
            print(event)

        sleep(0.5)

        # This should passive scan on channel 11, returning otherSSID
        hapd.req_beacon(device.address, beacon_passive)
        # TODO: See if we are scanning here (scan not initiated from station)

        event = hapd.wait_for_event('BEACON-RESP-RX')
        if event:
            print(event)

        sleep(0.5)

        # This should active scan on channel 11, returning otherSSID
        hapd.req_beacon(device.address, beacon_active)
        # TODO: See if we are scanning here (scan not initiated from station)

        event = hapd.wait_for_event('BEACON-RESP-RX')
        if event:
            print(event)

        sleep(0.5)

        # This should passive scan on channel 11, returning otherSSID
        hapd.req_beacon(device.address, beacon_passive_duration)
        # TODO: See if we are scanning here (scan not initiated from station)

        event = hapd.wait_for_event('BEACON-RESP-RX')
        if event:
            print(event)

        device.disconnect()

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

        wd.unregister_psk_agent(psk_agent)