Beispiel #1
0
    def setup_test(self):
        super().setup_test()

        self.dut.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))
        self.cert.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))

        self.dut.name = b'DUT Device'
        self.dut.address = self.dut.hci_controller.GetMacAddress(
            empty_proto.Empty()).address
        self.cert.name = b'Cert Device'
        self.cert.address = self.cert.hci_controller.GetMacAddress(
            empty_proto.Empty()).address

        # TODO(optedoblivion): Make this happen in PySecurity or GdDevice
        self.dut.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.dut.name))
        self.cert.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.cert.name))

        self.dut_security = PySecurity(self.dut)
        self.cert_security = CertSecurity(self.cert)

        self.dut_address = common.BluetoothAddressWithType(
            address=common.BluetoothAddress(
                address=bytes(b'DD:05:04:03:02:01')),
            type=common.RANDOM_DEVICE_ADDRESS)
        privacy_policy = le_initiator_address_facade.PrivacyPolicy(
            address_policy=le_initiator_address_facade.AddressPolicy.
            USE_STATIC_ADDRESS,
            address_with_type=self.dut_address)
        self.dut.security.SetLeInitiatorAddressPolicy(privacy_policy)
    def setup_test(self):
        super().setup_test()

        self.dut.address = self.dut.controller_read_only_property.ReadLocalAddress(
            empty_proto.Empty()).address
        self.cert.address = self.cert.controller_read_only_property.ReadLocalAddress(
            empty_proto.Empty()).address

        self.dut.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))
        self.cert.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))

        self.dut_address = common.BluetoothAddress(address=self.dut.address)
        self.cert_address = common.BluetoothAddress(address=self.cert.address)

        self.dut_address_with_type = common.BluetoothAddressWithType()
        self.dut_address_with_type.address.CopyFrom(self.dut_address)
        self.dut_address_with_type.type = common.BluetoothPeerAddressTypeEnum.PUBLIC_DEVICE_OR_IDENTITY_ADDRESS

        self.cert_address_with_type = common.BluetoothAddressWithType()
        self.cert_address_with_type.address.CopyFrom(self.cert_address)
        self.cert_address_with_type.type = common.BluetoothPeerAddressTypeEnum.PUBLIC_DEVICE_OR_IDENTITY_ADDRESS

        self.dut.wait_channel_ready()
        self.cert.wait_channel_ready()

        self.cert_name = b'ImTheCert'
        self.cert.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.cert_name))
        self.dut_name = b'ImTheDUT'
        self.dut.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.dut_name))
Beispiel #3
0
    def test_write_local_name(self):
        self.dut.hci_controller.WriteLocalName(controller_facade.NameMsg(name=b'ImTheDUT'))
        self.cert.hci_controller.WriteLocalName(controller_facade.NameMsg(name=b'ImTheCert'))
        cert_name = self.cert.hci_controller.GetLocalNameSimple()
        dut_name = self.dut.hci_controller.GetLocalNameSimple()

        assertThat(dut_name).isEqualTo(b'ImTheDUT')
        assertThat(cert_name).isEqualTo(b'ImTheCert')
Beispiel #4
0
 def test_write_local_name(self):
     self.device_under_test.hci_controller.WriteLocalName(
         controller_facade.NameMsg(name=b'ImTheDUT'))
     self.cert_device.hci_controller.WriteLocalName(
         controller_facade.NameMsg(name=b'ImTheCert'))
     cert_name_msg = self.cert_device.hci_controller.GetLocalName(
         empty_proto.Empty()).name
     dut_name_msg = self.device_under_test.hci_controller.GetLocalName(
         empty_proto.Empty()).name
     asserts.assert_true(dut_name_msg == b'ImTheDUT',
                         msg="unexpected dut name %s" % dut_name_msg)
     asserts.assert_true(cert_name_msg == b'ImTheCert',
                         msg="unexpected cert name %s" % cert_name_msg)
Beispiel #5
0
    def setup_test(self):
        self.device_under_test.rootservice.StartStack(
            facade_rootservice_pb2.StartStackRequest(
                module_under_test=facade_rootservice_pb2.BluetoothModule.Value(
                    'SECURITY'), ))
        self.cert_device.rootservice.StartStack(
            facade_rootservice_pb2.StartStackRequest(
                module_under_test=facade_rootservice_pb2.BluetoothModule.Value(
                    'L2CAP'), ))

        self.device_under_test.address = self.device_under_test.controller_read_only_property.ReadLocalAddress(
            empty_proto.Empty()).address
        self.cert_device.address = self.cert_device.controller_read_only_property.ReadLocalAddress(
            empty_proto.Empty()).address

        self.device_under_test.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))
        self.cert_device.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))

        self.dut_address = common.BluetoothAddress(
            address=self.device_under_test.address)
        self.cert_address = common.BluetoothAddress(
            address=self.cert_device.address)

        self.dut_address_with_type = common.BluetoothAddressWithType()
        self.dut_address_with_type.address.CopyFrom(self.dut_address)
        self.dut_address_with_type.type = common.BluetoothPeerAddressTypeEnum.PUBLIC_DEVICE_OR_IDENTITY_ADDRESS

        self.cert_address_with_type = common.BluetoothAddressWithType()
        self.cert_address_with_type.address.CopyFrom(self.cert_address)
        self.cert_address_with_type.type = common.BluetoothPeerAddressTypeEnum.PUBLIC_DEVICE_OR_IDENTITY_ADDRESS

        self.device_under_test.wait_channel_ready()
        self.cert_device.wait_channel_ready()

        self.cert_name = b'ImTheCert'
        self.cert_device.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.cert_name))
        self.dut_name = b'ImTheDUT'
        self.device_under_test.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.dut_name))
    def setup_test(self):
        super().setup_test()

        self.dut.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))
        self.cert.neighbor.EnablePageScan(
            neighbor_facade.EnableMsg(enabled=True))

        self.dut.name = b'DUT Device'
        self.dut.address = self.dut.hci_controller.GetMacAddress(
            empty_proto.Empty()).address
        self.cert.name = b'Cert Device'
        self.cert.address = self.cert.hci_controller.GetMacAddress(
            empty_proto.Empty()).address

        # TODO(optedoblivion): Make this happen in PySecurity or GdDevice
        self.dut.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.dut.name))
        self.cert.hci_controller.WriteLocalName(
            controller_facade.NameMsg(name=self.cert.name))

        self.dut_security = PySecurity(self.dut)
        self.cert_security = CertSecurity(self.cert)