| #!/usr/bin/env python3 |
| # |
| # Copyright 2022 The Fuchsia Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| """ |
| This test exercises basic setup of various GATT server configurations. |
| |
| Setup: |
| This test only requires one fuchsia device as the purpose is to test |
| different configurations of valid GATT services. |
| """ |
| |
| from antlion import signals |
| from antlion.base_test import BaseTestClass |
| |
| import gatt_server_databases as database |
| |
| |
| class GattServerSetupTest(BaseTestClass): |
| err_message = "Setting up database failed with: {}" |
| |
| def setup_class(self): |
| super().setup_class() |
| self.fuchsia_dut = self.fuchsia_devices[0] |
| |
| def setup_database(self, database): |
| setup_result = self.fuchsia_dut.sl4f.gatts_lib.publishServer(database) |
| if setup_result.get("error") is None: |
| signals.TestPass(setup_result.get("result")) |
| else: |
| raise signals.TestFailure( |
| self.err_message.format(setup_result.get("error"))) |
| |
| def test_teardown(self): |
| self.fuchsia_dut.sl4f.gatts_lib.closeServer() |
| |
| def test_single_primary_service(self): |
| """Test GATT Server Setup: Single Primary Service |
| |
| Test a single primary service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.SINGLE_PRIMARY_SERVICE) |
| |
| def test_single_secondary_service(self): |
| """Test GATT Server Setup: Single Secondary Service |
| |
| Test a single secondary service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.SINGLE_SECONDARY_SERVICE) |
| |
| def test_primary_and_secondary_service(self): |
| """Test GATT Server Setup: Primary and secondary service |
| |
| Test primary and secondary service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.PRIMARY_AND_SECONDARY_SERVICES) |
| |
| def test_duplicate_services(self): |
| """Test GATT Server Setup: Duplicate service uuids |
| |
| Test duplicate service uuids as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.DUPLICATE_SERVICES) |
| |
| ### Begin SIG defined services ### |
| |
| def test_alert_notification_service(self): |
| """Test GATT Server Setup: Alert Notification Service |
| |
| Test Alert Notification Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.ALERT_NOTIFICATION_SERVICE) |
| |
| def test_automation_io_service(self): |
| """Test GATT Server Setup: Automation IO |
| |
| Test Automation IO as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.AUTOMATION_IO_SERVICE) |
| |
| def test_battery_service(self): |
| """Test GATT Server Setup: Battery Service |
| |
| Test Battery Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.BATTERY_SERVICE) |
| |
| def test_blood_pressure_service(self): |
| """Test GATT Server Setup: Blood Pressure |
| |
| Test Blood Pressure as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.BLOOD_PRESSURE_SERVICE) |
| |
| def test_body_composition_service(self): |
| """Test GATT Server Setup: Body Composition |
| |
| Test Body Composition as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.BODY_COMPOSITION_SERVICE) |
| |
| def test_bond_management_service(self): |
| """Test GATT Server Setup: Bond Management Service |
| |
| Test Bond Management Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.BOND_MANAGEMENT_SERVICE) |
| |
| def test_continuous_glucose_monitoring_service(self): |
| """Test GATT Server Setup: Continuous Glucose Monitoring |
| |
| Test Continuous Glucose Monitoring as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.CONTINUOUS_GLUCOSE_MONITORING_SERVICE) |
| |
| def test_current_time_service(self): |
| """Test GATT Server Setup: Current Time Service |
| |
| Test Current Time Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.CURRENT_TIME_SERVICE) |
| |
| def test_cycling_power_service(self): |
| """Test GATT Server Setup: Cycling Power |
| |
| Test Cycling Power as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.CYCLING_POWER_SERVICE) |
| |
| def test_cycling_speed_and_cadence_service(self): |
| """Test GATT Server Setup: Cycling Speed and Cadence |
| |
| Test Cycling Speed and Cadence as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.CYCLING_SPEED_AND_CADENCE_SERVICE) |
| |
| def test_device_information_service(self): |
| """Test GATT Server Setup: Device Information |
| |
| Test Device Information as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.DEVICE_INFORMATION_SERVICE) |
| |
| def test_environmental_sensing_service(self): |
| """Test GATT Server Setup: Environmental Sensing |
| |
| Test Environmental Sensing as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.ENVIRONMENTAL_SENSING_SERVICE) |
| |
| def test_fitness_machine_service(self): |
| """Test GATT Server Setup: Fitness Machine |
| |
| Test Fitness Machine as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.FITNESS_MACHINE_SERVICE) |
| |
| def test_glucose_service(self): |
| """Test GATT Server Setup: Glucose |
| |
| Test Glucose as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.GLUCOSE_SERVICE) |
| |
| def test_health_thermometer_service(self): |
| """Test GATT Server Setup: Health Thermometer |
| |
| Test Health Thermometer as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.HEALTH_THERMOMETER_SERVICE) |
| |
| def test_heart_rate_service(self): |
| """Test GATT Server Setup: Heart Rate |
| |
| Test Heart Rate as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.HEART_RATE_SERVICE) |
| |
| def test_http_proxy_service(self): |
| """Test GATT Server Setup: HTTP Proxy |
| |
| Test HTTP Proxy as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.HTTP_PROXY_SERVICE) |
| |
| def test_human_interface_device_service(self): |
| """Test GATT Server Setup: Human Interface Device |
| |
| Test Human Interface Device as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.HUMAN_INTERFACE_DEVICE_SERVICE) |
| |
| def test_immediate_alert_service(self): |
| """Test GATT Server Setup: Immediate Alert |
| |
| Test Immediate Alert as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.IMMEDIATE_ALERT_SERVICE) |
| |
| def test_indoor_positioning_service(self): |
| """Test GATT Server Setup: Indoor Positioning |
| |
| Test Indoor Positioning as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.INDOOR_POSITIONING_SERVICE) |
| |
| def test_insulin_delivery_service(self): |
| """Test GATT Server Setup: Insulin Delivery |
| |
| Test Insulin Delivery as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.INSULIN_DELIVERY_SERVICE) |
| |
| def test_internet_protocol_support_service(self): |
| """Test GATT Server Setup: Internet Protocol Support Service |
| |
| Test Internet Protocol Support Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.INTERNET_PROTOCOL_SUPPORT_SERVICE) |
| |
| def test_link_loss_service(self): |
| """Test GATT Server Setup: Link Loss |
| |
| Test Link Loss as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.LINK_LOSS_SERVICE) |
| |
| def test_location_and_navigation_service(self): |
| """Test GATT Server Setup: Location and Navigation |
| |
| Test Location and Navigation as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.LOCATION_AND_NAVIGATION_SERVICE) |
| |
| def test_mesh_provisioning_service(self): |
| """Test GATT Server Setup: Mesh Provisioning Service |
| |
| Test Mesh Provisioning Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.MESH_PROVISIONING_SERVICE) |
| |
| def test_mesh_proxy_service(self): |
| """Test GATT Server Setup: Mesh Proxy Service |
| |
| Test Mesh Proxy Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.MESH_PROXY_SERVICE) |
| |
| def test_next_dst_change_service(self): |
| """Test GATT Server Setup: Next DST Change Service |
| |
| Test Next DST Change Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.NEXT_DST_CHANGE_SERVICE) |
| |
| def test_object_transfer_service(self): |
| """Test GATT Server Setup: Object Transfer Service |
| |
| Test Object Transfer Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.OBJECT_TRANSFER_SERVICE) |
| |
| def test_phone_alert_status_service(self): |
| """Test GATT Server Setup: Phone Alert Status Service |
| |
| Test Phone Alert Status Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.PHONE_ALERT_STATUS_SERVICE) |
| |
| def test_pulse_oximeter_service(self): |
| """Test GATT Server Setup: Pulse Oximeter Service |
| |
| Test Pulse Oximeter Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.PULSE_OXIMETER_SERVICE) |
| |
| def test_reconnection_configuration_service(self): |
| """Test GATT Server Setup: Reconnection Configuration |
| |
| Test Reconnection Configuration as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.RECONNECTION_CONFIGURATION_SERVICE) |
| |
| def test_reference_time_update_service(self): |
| """Test GATT Server Setup: Reference Time Update Service |
| |
| Test Reference Time Update Service as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.REFERENCE_TIME_UPDATE_SERVICE) |
| |
| def test_running_speed_and_cadence_service(self): |
| """Test GATT Server Setup: Running Speed and Cadence |
| |
| Test Running Speed and Cadence as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.RUNNING_SPEED_AND_CADENCE_SERVICE) |
| |
| def test_scan_parameters_service(self): |
| """Test GATT Server Setup: Scan Parameters |
| |
| Test Scan Parameters as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.SCAN_PARAMETERS_SERVICE) |
| |
| def test_transport_discovery_service(self): |
| """Test GATT Server Setup: Transport Discovery |
| |
| Test Transport Discovery as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.TRANSPORT_DISCOVERY_SERVICE) |
| |
| def test_tx_power_service(self): |
| """Test GATT Server Setup: Tx Power |
| |
| Test Tx Power as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.TX_POWER_SERVICE) |
| |
| def test_user_data_service(self): |
| """Test GATT Server Setup: User Data |
| |
| Test User Data as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.USER_DATA_SERVICE) |
| |
| def test_weight_scale_service(self): |
| """Test GATT Server Setup: Weight Scale |
| |
| Test Weight Scale as a GATT server input. |
| |
| Steps: |
| 1. Setup input database |
| |
| Expected Result: |
| Verify that there are no errors after setting up the input database. |
| |
| Returns: |
| signals.TestPass if no errors |
| signals.TestFailure if there are any errors during setup |
| |
| TAGS: GATT |
| Priority: 1 |
| """ |
| self.setup_database(database.WEIGHT_SCALE_SERVICE) |
| |
| ### End SIG defined services ### |