Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57e4dfd4 authored by Charlie Boutier's avatar Charlie Boutier Committed by Gerrit Code Review
Browse files

Merge "[PTS-Bot] Added 12 GAP test cases :"

parents 184b32ca b1b36a24
Loading
Loading
Loading
Loading
+86 −44
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ class GAPProxy(ProfileProxy):
        if test in {"GAP/SEC/AUT/BV-02-C", "GAP/SEC/SEM/BV-05-C", "GAP/SEC/SEM/BV-08-C"}:
            # we connect then pair, so we have to pair directly in this MMI
            self.pairing_events = self.security.OnPairing()
            self.connection = self.host.Connect(address=pts_addr, manually_confirm=True).connection
            self.connection = self.host.Connect(address=pts_addr).connection
        else:
            self.connection = self.host.Connect(address=pts_addr).connection

@@ -95,8 +95,7 @@ class GAPProxy(ProfileProxy):
        database where Insufficient Authentication error will be returned :
        """

        response = self.gatt.RegisterService(
            service=GattServiceParams(
        response = self.gatt.RegisterService(service=GattServiceParams(
            uuid="955798ce-3022-455c-b759-ee8edcd73d1a",
            characteristics=[
                GattCharacteristicParams(
@@ -135,7 +134,8 @@ class GAPProxy(ProfileProxy):
            if self.counter == 0:
                self.counter += 1
                self.security_storage.DeleteBond(public=pts_addr)
                self.connection = self.host.ConnectLE(own_address_type=OwnAddressType.RANDOM, public=pts_addr).connection
                self.connection = self.host.ConnectLE(own_address_type=OwnAddressType.RANDOM,
                                                      public=pts_addr).connection
                self.security.Secure(connection=self.connection, le=LESecurityLevel.LE_LEVEL3)
                return "OK"

@@ -216,9 +216,11 @@ class GAPProxy(ProfileProxy):
        Please prepare IUT to send an advertising report with Local Name.
        """

        self.advertise = self.host.Advertise(
            own_address_type=OwnAddressType.PUBLIC,
            data=DataTypes(include_complete_local_name=True, include_shortened_local_name=True,))
        self.advertise = self.host.Advertise(own_address_type=OwnAddressType.PUBLIC,
                                             data=DataTypes(
                                                 include_complete_local_name=True,
                                                 include_shortened_local_name=True,
                                             ))

        return "OK"

@@ -244,8 +246,7 @@ class GAPProxy(ProfileProxy):
        Specific Data.
        """

        self.advertise = self.host.Advertise(
            own_address_type=OwnAddressType.PUBLIC,
        self.advertise = self.host.Advertise(own_address_type=OwnAddressType.PUBLIC,
                                             data=DataTypes(manufacturer_specific_data=b"d0n't b3 3v1l!",))

        return "OK"
@@ -256,8 +257,7 @@ class GAPProxy(ProfileProxy):
        Please prepare IUT to send an advertising report with TX Power Level.
        """

        self.advertise = self.host.Advertise(
            own_address_type=OwnAddressType.PUBLIC,
        self.advertise = self.host.Advertise(own_address_type=OwnAddressType.PUBLIC,
                                             data=DataTypes(include_tx_power_level=True,))

        return "OK"
@@ -329,15 +329,18 @@ class GAPProxy(ProfileProxy):
        return "OK"

    @match_description
    def TSC_MMI_iut_confirm_device_discovery(self, name: str, pts_addr: bytes, **kwargs):
    def TSC_MMI_iut_confirm_device_discovery(self, test: str, pts_addr: bytes, **kwargs):
        """
        Please confirm that IUT has discovered PTS and retrieved its name (?P<name>[a-zA-Z\-0-9]*)
        """
        #Verifying if the BD Address matches in Inquiry
        inquiry_responses = self.host.Inquiry()
        for response in inquiry_responses:
            assert response.address == pts_addr, (response.address, pts_addr)
            inquiry_responses.cancel()
            return "Yes"

        device = self.host.GetDevice(connection=self.connection)
        assert name == device.name, (name, device.name)

        return "OK"
        assert False

    @assert_description
    def TSC_MMI_check_if_iut_support_non_connectable_advertising(self, **kwargs):
@@ -535,11 +538,12 @@ class GAPProxy(ProfileProxy):
        return "OK"

    @assert_description
    def TSC_MMI_iut_send_le_disconnect_request(self, pts_addr: bytes, **kwargs):
    def TSC_MMI_iut_send_le_disconnect_request(self, test: str, pts_addr: bytes, **kwargs):
        """
        Please send a disconnect request to terminate connection.
        """

        if test == "GAP/CONN/TERM/BV-01-C":
            self.connection = next(self.advertise).connection
        try:
            self.host.Disconnect(connection=self.connection)
        except Exception:
@@ -554,7 +558,7 @@ class GAPProxy(ProfileProxy):
        """

        self.pairing_events = self.security.OnPairing()

        self.connection = next(self.advertise).connection
        if test == "GAP/DM/BON/BV-01-C":
            # we already started in the previous test
            return "OK"
@@ -602,8 +606,7 @@ class GAPProxy(ProfileProxy):
            scan_responses = self.host.Scan()
            for event in scan_responses:
                address = event.public if event.HasField("public") else event.random
                if (address == pts_addr and
                    event.data.le_discoverability_mode):
                if (address == pts_addr and event.data.le_discoverability_mode):
                    scan_responses.cancel()
                    discovered_le = True
                    return
@@ -619,14 +622,12 @@ class GAPProxy(ProfileProxy):

        return "OK"

    @assert_description
    def TSC_MMI_make_iut_general_discoverable(self, **kwargs):
        """
        Please make IUT general discoverable. Press OK to continue.
        """

        self.host.SetDiscoverabilityMode(
            mode=DiscoverabilityMode.DISCOVERABLE_GENERAL)
        self.host.SetDiscoverabilityMode(mode=DiscoverabilityMode.DISCOVERABLE_GENERAL)

        self.advertise = self.host.Advertise(
            data=DataTypes(le_discoverability_mode=DiscoverabilityMode.DISCOVERABLE_GENERAL),
@@ -657,8 +658,7 @@ class GAPProxy(ProfileProxy):
        Please make IUT not connectable. Press OK to continue.
        """

        self.host.SetDiscoverabilityMode(
            mode=DiscoverabilityMode.NOT_DISCOVERABLE)
        self.host.SetDiscoverabilityMode(mode=DiscoverabilityMode.NOT_DISCOVERABLE)

        self.host.SetConnectabilityMode(mode=ConnectabilityMode.NOT_CONNECTABLE)

@@ -670,8 +670,7 @@ class GAPProxy(ProfileProxy):
        Please make IUT not discoverable. Press OK to continue.
        """

        self.host.SetDiscoverabilityMode(
            mode=DiscoverabilityMode.NOT_DISCOVERABLE)
        self.host.SetDiscoverabilityMode(mode=DiscoverabilityMode.NOT_DISCOVERABLE)
        self.host.SetConnectabilityMode(mode=ConnectabilityMode.NOT_CONNECTABLE)

        return "OK"
@@ -752,8 +751,7 @@ class GAPProxy(ProfileProxy):
        Please enter General Discoverable and Non-Connectable mode.
        """

        self.host.SetDiscoverabilityMode(
            mode=DiscoverabilityMode.DISCOVERABLE_GENERAL)
        self.host.SetDiscoverabilityMode(mode=DiscoverabilityMode.DISCOVERABLE_GENERAL)
        self.host.SetConnectabilityMode(mode=ConnectabilityMode.NOT_CONNECTABLE)

        return "OK"
@@ -876,6 +874,49 @@ class GAPProxy(ProfileProxy):

        return "OK"

    @assert_description
    def TSC_MMI_iut_send_att_connect_request(self, test: str, pts_addr: bytes, **kwargs):
        """
        Please send an ATT connect request to establish an L2CAP channel.
        """
        self.connection = self.host.ConnectLE(own_address_type=OwnAddressType.RANDOM, public=pts_addr).connection

        return "OK"

    @assert_description
    def TSC_MMI_iut_send_ll_connection_update_request(self, **kwargs):
        """
        Please send a LL Connection Parameter Update request using valid
        parameters.
        """

        return "OK"

    @assert_description
    def TSC_MMI_iut_enter_handle_for_insufficient_authentication_or_insufficient_encryption(self, **kwargs):
        """
        Please enter the handle to the characteristic in the IUT database where
        Insufficient Authentication or Insufficient Encryption error will be
        returned:
        """

        response = self.gatt.RegisterService(service=GattServiceParams(
            uuid="955798ce-3022-455c-b759-ee8edcd73d1a",
            characteristics=[
                GattCharacteristicParams(
                    uuid="cf99ed9b-3c43-4343-b8a7-8afa513752ce",
                    properties=0x02,  # PROPERTY_READ,
                    permissions=0x04,  # PERMISSION_READ_ENCRYPTED_MITM
                ),
            ],
        ))

        self.pairing_events = self.security.OnPairing()

        return handle_format(response.service.characteristics[0].handle)

        return "OK"

    @assert_description
    def _mmi_231(self, test: str, pts_addr: bytes, **kwargs):
        """
@@ -912,5 +953,6 @@ class GAPProxy(ProfileProxy):

        Thread(target=task).start()


def handle_format(handle):
    return hex(handle)[2:].zfill(4)
+12 −12
Original line number Diff line number Diff line
@@ -173,8 +173,13 @@
    "GAP/ADV/BV-03-C",
    "GAP/ADV/BV-04-C",
    "GAP/ADV/BV-05-C",
    "GAP/BOND/BON/BV-01-C",
    "GAP/BOND/BON/BV-03-C",
    "GAP/CONN/CPUP/BV-06-C",
    "GAP/CONN/DCEP/BV-03-C",
    "GAP/CONN/GCEP/BV-02-C",
    "GAP/CONN/NCON/BV-01-C",
    "GAP/CONN/TERM/BV-01-C",
    "GAP/CONN/UCON/BV-01-C",
    "GAP/CONN/UCON/BV-02-C",
    "GAP/DISC/GENM/BV-02-C",
@@ -186,8 +191,13 @@
    "GAP/DISC/NONM/BV-01-C",
    "GAP/DM/CON/BV-01-C",
    "GAP/DM/GIN/BV-01-C",
    "GAP/DM/LEP/BV-01-C",
    "GAP/DM/LEP/BV-04-C",
    "GAP/DM/LEP/BV-07-C",
    "GAP/DM/LEP/BV-08-C",
    "GAP/DM/LEP/BV-11-C",
    "GAP/DM/NAD/BV-01-C",
    "GAP/IDLE/DED/BV-02-C",
    "GAP/IDLE/GIN/BV-01-C",
    "GAP/IDLE/NAMP/BV-02-C",
    "GAP/MOD/CON/BV-01-C",
@@ -196,7 +206,9 @@
    "GAP/MOD/NCON/BV-01-C",
    "GAP/MOD/NDIS/BV-01-C",
    "GAP/SEC/AUT/BV-11-C",
    "GAP/SEC/AUT/BV-23-C",
    "GAP/SEC/AUT/BV-12-C",
    "GAP/SEC/SEM/BV-10-C",
    "GAP/SEC/SEM/BV-04-C",
    "GATT/CL/GAC/BV-01-C",
    "GATT/CL/GAD/BV-01-C",
@@ -629,9 +641,7 @@
    "AVRCP/TG/MCN/CB/BV-09-C",
    "AVRCP/TG/NFY/BV-04-C",
    "BNEP/TX-TYPE-0/BV-20-C",
    "GAP/BOND/BON/BV-01-C",
    "GAP/BOND/BON/BV-02-C",
    "GAP/BOND/BON/BV-03-C",
    "GAP/BOND/BON/BV-04-C",
    "GAP/BOND/NBON/BV-01-C",
    "GAP/BOND/NBON/BV-02-C",
@@ -642,28 +652,20 @@
    "GAP/CONN/CPUP/BV-03-C",
    "GAP/CONN/CPUP/BV-04-C",
    "GAP/CONN/CPUP/BV-05-C",
    "GAP/CONN/CPUP/BV-06-C",
    "GAP/CONN/CPUP/BV-08-C",
    "GAP/CONN/DCEP/BV-01-C",
    "GAP/CONN/GCEP/BV-01-C",
    "GAP/CONN/GCEP/BV-02-C",
    "GAP/CONN/NCON/BV-02-C",
    "GAP/CONN/TERM/BV-01-C",
    "GAP/DISC/GENM/BV-01-C",
    "GAP/DISC/NONM/BV-02-C",
    "GAP/DM/BON/BV-01-C",
    "GAP/DM/LEP/BV-01-C",
    "GAP/DM/LEP/BV-02-C",
    "GAP/DM/LEP/BV-05-C",
    "GAP/DM/LEP/BV-06-C",
    "GAP/DM/LEP/BV-07-C",
    "GAP/DM/LEP/BV-08-C",
    "GAP/DM/LEP/BV-09-C",
    "GAP/DM/LEP/BV-10-C",
    "GAP/DM/LEP/BV-11-C",
    "GAP/DM/NAD/BV-02-C",
    "GAP/DM/NCON/BV-01-C",
    "GAP/IDLE/DED/BV-02-C",
    "GAP/IDLE/NAMP/BV-01-C",
    "GAP/SEC/AUT/BV-02-C",
    "GAP/SEC/AUT/BV-13-C",
@@ -674,7 +676,6 @@
    "GAP/SEC/AUT/BV-20-C",
    "GAP/SEC/AUT/BV-21-C",
    "GAP/SEC/AUT/BV-22-C",
    "GAP/SEC/AUT/BV-23-C",
    "GAP/SEC/AUT/BV-24-C",
    "GAP/SEC/SEM/BI-01-C",
    "GAP/SEC/SEM/BI-02-C",
@@ -692,7 +693,6 @@
    "GAP/SEC/SEM/BV-07-C",
    "GAP/SEC/SEM/BV-08-C",
    "GAP/SEC/SEM/BV-09-C",
    "GAP/SEC/SEM/BV-10-C",
    "GAP/SEC/SEM/BV-21-C",
    "GAP/SEC/SEM/BV-22-C",
    "GAP/SEC/SEM/BV-23-C",