• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python3.4
2#
3#   Copyright 2017 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17import queue
18import time
19
20from acts import asserts
21from acts.test_decorators import test_tracker_info
22from acts.test_utils.wifi.aware import aware_const as aconsts
23from acts.test_utils.wifi.aware import aware_test_utils as autils
24from acts.test_utils.wifi.aware.AwareBaseTest import AwareBaseTest
25from acts.test_utils.wifi.rtt import rtt_const as rconsts
26from acts.test_utils.wifi.rtt import rtt_test_utils as rutils
27from acts.test_utils.wifi.rtt.RttBaseTest import RttBaseTest
28
29
30class RangeAwareTest(AwareBaseTest, RttBaseTest):
31    """Test class for RTT ranging to Wi-Fi Aware peers"""
32    SERVICE_NAME = "GoogleTestServiceXY"
33
34    # Number of RTT iterations
35    NUM_ITER = 10
36
37    # Time gap (in seconds) between iterations
38    TIME_BETWEEN_ITERATIONS = 0
39
40    # Time gap (in seconds) when switching between Initiator and Responder
41    TIME_BETWEEN_ROLES = 4
42
43    # Min and max of the test subscribe range.
44    DISTANCE_MIN = 0
45    DISTANCE_MAX = 1000000
46
47    def setup_test(self):
48        """Manual setup here due to multiple inheritance: explicitly execute the
49        setup method from both parents.
50        """
51        AwareBaseTest.setup_test(self)
52        RttBaseTest.setup_test(self)
53
54    def teardown_test(self):
55        """Manual teardown here due to multiple inheritance: explicitly execute the
56        teardown method from both parents.
57        """
58        AwareBaseTest.teardown_test(self)
59        RttBaseTest.teardown_test(self)
60
61    #############################################################################
62
63    def run_rtt_discovery(self, init_dut, resp_mac=None, resp_peer_id=None):
64        """Perform single RTT measurement, using Aware, from the Initiator DUT to
65        a Responder. The RTT Responder can be specified using its MAC address
66        (obtained using out- of-band discovery) or its Peer ID (using Aware
67        discovery).
68
69        Args:
70              init_dut: RTT Initiator device
71              resp_mac: MAC address of the RTT Responder device
72              resp_peer_id: Peer ID of the RTT Responder device
73        """
74        asserts.assert_true(
75            resp_mac is not None or resp_peer_id is not None,
76            "One of the Responder specifications (MAC or Peer ID)"
77            " must be provided!")
78        if resp_mac is not None:
79            id = init_dut.droid.wifiRttStartRangingToAwarePeerMac(resp_mac)
80        else:
81            id = init_dut.droid.wifiRttStartRangingToAwarePeerId(resp_peer_id)
82        event_name = rutils.decorate_event(rconsts.EVENT_CB_RANGING_ON_RESULT,
83                                           id)
84        try:
85            event = init_dut.ed.pop_event(event_name, rutils.EVENT_TIMEOUT)
86            result = event["data"][rconsts.EVENT_CB_RANGING_KEY_RESULTS][0]
87            if resp_mac is not None:
88                rutils.validate_aware_mac_result(result, resp_mac, "DUT")
89            else:
90                rutils.validate_aware_peer_id_result(result, resp_peer_id,
91                                                     "DUT")
92            return result
93        except queue.Empty:
94            self.log.warning("Timed-out waiting for %s", event_name)
95            return None
96
97    def run_rtt_ib_discovery_set(self, do_both_directions, iter_count,
98                                 time_between_iterations, time_between_roles):
99        """Perform a set of RTT measurements, using in-band (Aware) discovery.
100
101        Args:
102              do_both_directions: False - perform all measurements in one direction,
103                                  True - perform 2 measurements one in both directions.
104              iter_count: Number of measurements to perform.
105              time_between_iterations: Number of seconds to wait between iterations.
106              time_between_roles: Number of seconds to wait when switching between
107                                  Initiator and Responder roles (only matters if
108                                  do_both_directions=True).
109
110        Returns: a list of the events containing the RTT results (or None for a
111        failed measurement). If both directions are tested then returns a list of
112        2 elements: one set for each direction.
113        """
114        p_dut = self.android_devices[0]
115        s_dut = self.android_devices[1]
116
117        (p_id, s_id, p_disc_id, s_disc_id, peer_id_on_sub,
118         peer_id_on_pub) = autils.create_discovery_pair(
119             p_dut,
120             s_dut,
121             p_config=autils.add_ranging_to_pub(
122                 autils.create_discovery_config(
123                     self.SERVICE_NAME, aconsts.PUBLISH_TYPE_UNSOLICITED),
124                 True),
125             s_config=autils.add_ranging_to_pub(
126                 autils.create_discovery_config(
127                     self.SERVICE_NAME, aconsts.SUBSCRIBE_TYPE_PASSIVE), True),
128             device_startup_offset=self.device_startup_offset,
129             msg_id=self.get_next_msg_id())
130
131        resultsPS = []
132        resultsSP = []
133        for i in range(iter_count):
134            if i != 0 and time_between_iterations != 0:
135                time.sleep(time_between_iterations)
136
137            # perform RTT from pub -> sub
138            resultsPS.append(
139                self.run_rtt_discovery(p_dut, resp_peer_id=peer_id_on_pub))
140
141            if do_both_directions:
142                if time_between_roles != 0:
143                    time.sleep(time_between_roles)
144
145                # perform RTT from sub -> pub
146                resultsSP.append(
147                    self.run_rtt_discovery(s_dut, resp_peer_id=peer_id_on_sub))
148
149        return resultsPS if not do_both_directions else [resultsPS, resultsSP]
150
151    def run_rtt_oob_discovery_set(self, do_both_directions, iter_count,
152                                  time_between_iterations, time_between_roles):
153        """Perform a set of RTT measurements, using out-of-band discovery.
154
155        Args:
156              do_both_directions: False - perform all measurements in one direction,
157                                  True - perform 2 measurements one in both directions.
158              iter_count: Number of measurements to perform.
159              time_between_iterations: Number of seconds to wait between iterations.
160              time_between_roles: Number of seconds to wait when switching between
161                                  Initiator and Responder roles (only matters if
162                                  do_both_directions=True).
163              enable_ranging: True to enable Ranging, False to disable.
164
165        Returns: a list of the events containing the RTT results (or None for a
166        failed measurement). If both directions are tested then returns a list of
167        2 elements: one set for each direction.
168        """
169        dut0 = self.android_devices[0]
170        dut1 = self.android_devices[1]
171
172        id0, mac0 = autils.attach_with_identity(dut0)
173        id1, mac1 = autils.attach_with_identity(dut1)
174
175        # wait for for devices to synchronize with each other - there are no other
176        # mechanisms to make sure this happens for OOB discovery (except retrying
177        # to execute the data-path request)
178        time.sleep(autils.WAIT_FOR_CLUSTER)
179
180        # start publisher(s) on the Responder(s) with ranging enabled
181        p_config = autils.add_ranging_to_pub(
182            autils.create_discovery_config(self.SERVICE_NAME,
183                                           aconsts.PUBLISH_TYPE_UNSOLICITED),
184            enable_ranging=True)
185        dut1.droid.wifiAwarePublish(id1, p_config)
186        autils.wait_for_event(dut1, aconsts.SESSION_CB_ON_PUBLISH_STARTED)
187        if do_both_directions:
188            dut0.droid.wifiAwarePublish(id0, p_config)
189            autils.wait_for_event(dut0, aconsts.SESSION_CB_ON_PUBLISH_STARTED)
190
191        results01 = []
192        results10 = []
193        for i in range(iter_count):
194            if i != 0 and time_between_iterations != 0:
195                time.sleep(time_between_iterations)
196
197            # perform RTT from dut0 -> dut1
198            results01.append(self.run_rtt_discovery(dut0, resp_mac=mac1))
199
200            if do_both_directions:
201                if time_between_roles != 0:
202                    time.sleep(time_between_roles)
203
204                # perform RTT from dut1 -> dut0
205                results10.append(self.run_rtt_discovery(dut1, resp_mac=mac0))
206
207        return results01 if not do_both_directions else [results01, results10]
208
209    def verify_results(self, results, results_reverse_direction=None, accuracy_evaluation=False):
210        """Verifies the results of the RTT experiment.
211
212        Args:
213              results: List of RTT results.
214              results_reverse_direction: List of RTT results executed in the
215                                        reverse direction. Optional.
216              accuracy_evaluation: False - only evaluate success rate.
217                                   True - evaluate both success rate and accuracy
218                                   default is False.
219        """
220        stats = rutils.extract_stats(results, self.rtt_reference_distance_mm,
221                                     self.rtt_reference_distance_margin_mm,
222                                     self.rtt_min_expected_rssi_dbm)
223        stats_reverse_direction = None
224        if results_reverse_direction is not None:
225            stats_reverse_direction = rutils.extract_stats(
226                results_reverse_direction, self.rtt_reference_distance_mm,
227                self.rtt_reference_distance_margin_mm,
228                self.rtt_min_expected_rssi_dbm)
229        self.log.debug("Stats: %s", stats)
230        if stats_reverse_direction is not None:
231            self.log.debug("Stats in reverse direction: %s",
232                           stats_reverse_direction)
233
234        extras = stats if stats_reverse_direction is None else {
235            "forward": stats,
236            "reverse": stats_reverse_direction
237        }
238
239        asserts.assert_true(
240            stats['num_no_results'] == 0,
241            "Missing (timed-out) results",
242            extras=extras)
243        asserts.assert_false(
244            stats['any_lci_mismatch'], "LCI mismatch", extras=extras)
245        asserts.assert_false(
246            stats['any_lcr_mismatch'], "LCR mismatch", extras=extras)
247        asserts.assert_false(
248            stats['invalid_num_attempted'],
249            "Invalid (0) number of attempts",
250            extras=stats)
251        asserts.assert_false(
252            stats['invalid_num_successful'],
253            "Invalid (0) number of successes",
254            extras=stats)
255        asserts.assert_equal(
256            stats['num_invalid_rssi'], 0, "Invalid RSSI", extras=extras)
257        asserts.assert_true(
258            stats['num_failures'] <=
259            self.rtt_max_failure_rate_two_sided_rtt_percentage *
260            stats['num_results'] / 100,
261            "Failure rate is too high",
262            extras=extras)
263        if accuracy_evaluation:
264            asserts.assert_true(
265                stats['num_range_out_of_margin'] <=
266                self.rtt_max_margin_exceeded_rate_two_sided_rtt_percentage *
267                stats['num_success_results'] / 100,
268                "Results exceeding error margin rate is too high",
269                extras=extras)
270
271        if stats_reverse_direction is not None:
272            asserts.assert_true(
273                stats_reverse_direction['num_no_results'] == 0,
274                "Missing (timed-out) results",
275                extras=extras)
276            asserts.assert_false(
277                stats_reverse_direction['any_lci_mismatch'], "LCI mismatch", extras=extras)
278            asserts.assert_false(
279                stats_reverse_direction['any_lcr_mismatch'], "LCR mismatch", extras=extras)
280            asserts.assert_equal(
281                stats_reverse_direction['num_invalid_rssi'], 0, "Invalid RSSI", extras=extras)
282            asserts.assert_true(
283                stats_reverse_direction['num_failures'] <=
284                self.rtt_max_failure_rate_two_sided_rtt_percentage *
285                stats_reverse_direction['num_results'] / 100,
286                "Failure rate is too high",
287                extras=extras)
288            if accuracy_evaluation:
289                asserts.assert_true(
290                    stats_reverse_direction['num_range_out_of_margin'] <=
291                    self.rtt_max_margin_exceeded_rate_two_sided_rtt_percentage *
292                    stats_reverse_direction['num_success_results'] / 100,
293                    "Results exceeding error margin rate is too high",
294                    extras=extras)
295
296        asserts.explicit_pass("RTT Aware test done", extras=extras)
297
298    def run_rtt_with_aware_session_disabled_ranging(self, disable_publish):
299        """Try to perform RTT operation when there publish or subscribe disabled ranging.
300
301        Args:
302            disable_publish: if true disable ranging on publish config, otherwise disable ranging on
303                            subscribe config
304        """
305        p_dut = self.android_devices[1]
306        s_dut = self.android_devices[0]
307        pub_config = autils.create_discovery_config(
308            self.SERVICE_NAME, aconsts.PUBLISH_TYPE_UNSOLICITED)
309        sub_config = autils.create_discovery_config(
310            self.SERVICE_NAME, aconsts.SUBSCRIBE_TYPE_PASSIVE)
311        if disable_publish:
312            sub_config = autils.add_ranging_to_sub(sub_config, self.DISTANCE_MIN, self.DISTANCE_MAX)
313        else:
314            pub_config = autils.add_ranging_to_pub(pub_config, True)
315        (p_id, s_id, p_disc_id, s_disc_id, peer_id_on_sub,
316         peer_id_on_pub) = autils.create_discovery_pair(
317            p_dut,
318            s_dut,
319            p_config=pub_config,
320            s_config=sub_config,
321            device_startup_offset=self.device_startup_offset,
322            msg_id=self.get_next_msg_id())
323        for i in range(self.NUM_ITER):
324            result_sub = self.run_rtt_discovery(s_dut, resp_peer_id=peer_id_on_sub)
325            asserts.assert_equal(rconsts.EVENT_CB_RANGING_STATUS_FAIL,
326                                 result_sub[rconsts.EVENT_CB_RANGING_KEY_STATUS],
327                                 "Ranging to publisher should fail.",
328                                 extras={"data": result_sub})
329
330        time.sleep(self.TIME_BETWEEN_ROLES)
331
332        for i in range(self.NUM_ITER):
333            result_pub = self.run_rtt_discovery(p_dut, resp_peer_id=peer_id_on_pub)
334            asserts.assert_equal(rconsts.EVENT_CB_RANGING_STATUS_FAIL,
335                                 result_pub[rconsts.EVENT_CB_RANGING_KEY_STATUS],
336                                 "Ranging to subscriber should fail.",
337                                 extras={"data": result_pub})
338
339    #############################################################################
340
341    @test_tracker_info(uuid="9e4e7ab4-2254-498c-9788-21e15ed9a370")
342    def test_rtt_oob_discovery_one_way(self):
343        """Perform RTT between 2 Wi-Fi Aware devices. Use out-of-band discovery
344        to communicate the MAC addresses to the peer. Test one-direction RTT only.
345        Functionality test: Only evaluate success rate.
346        """
347        rtt_results = self.run_rtt_oob_discovery_set(
348            do_both_directions=False,
349            iter_count=self.NUM_ITER,
350            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
351            time_between_roles=self.TIME_BETWEEN_ROLES)
352        self.verify_results(rtt_results)
353
354    @test_tracker_info(uuid="22edba77-eeb2-43ee-875a-84437550ad84")
355    def test_rtt_oob_discovery_both_ways(self):
356        """Perform RTT between 2 Wi-Fi Aware devices. Use out-of-band discovery
357        to communicate the MAC addresses to the peer. Test RTT both-ways:
358        switching rapidly between Initiator and Responder.
359        Functionality test: Only evaluate success rate.
360        """
361        rtt_results1, rtt_results2 = self.run_rtt_oob_discovery_set(
362            do_both_directions=True,
363            iter_count=self.NUM_ITER,
364            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
365            time_between_roles=self.TIME_BETWEEN_ROLES)
366        self.verify_results(rtt_results1, rtt_results2)
367
368    @test_tracker_info(uuid="18cef4be-95b4-4f7d-a140-5165874e7d1c")
369    def test_rtt_ib_discovery_one_way(self):
370        """Perform RTT between 2 Wi-Fi Aware devices. Use in-band (Aware) discovery
371        to communicate the MAC addresses to the peer. Test one-direction RTT only.
372        Functionality test: Only evaluate success rate.
373        """
374        rtt_results = self.run_rtt_ib_discovery_set(
375            do_both_directions=False,
376            iter_count=self.NUM_ITER,
377            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
378            time_between_roles=self.TIME_BETWEEN_ROLES)
379        self.verify_results(rtt_results)
380
381    @test_tracker_info(uuid="c67c8e70-c417-42d9-9bca-af3a89f1ddd9")
382    def test_rtt_ib_discovery_both_ways(self):
383        """Perform RTT between 2 Wi-Fi Aware devices. Use in-band (Aware) discovery
384        to communicate the MAC addresses to the peer. Test RTT both-ways:
385        switching rapidly between Initiator and Responder.
386        Functionality test: Only evaluate success rate.
387        """
388        rtt_results1, rtt_results2 = self.run_rtt_ib_discovery_set(
389            do_both_directions=True,
390            iter_count=self.NUM_ITER,
391            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
392            time_between_roles=self.TIME_BETWEEN_ROLES)
393        self.verify_results(rtt_results1, rtt_results2)
394
395    @test_tracker_info(uuid="3a1d19a2-7241-49e0-aaf2-0a1da4c29783")
396    def test_rtt_oob_discovery_one_way_with_accuracy_evaluation(self):
397        """Perform RTT between 2 Wi-Fi Aware devices. Use out-of-band discovery
398        to communicate the MAC addresses to the peer. Test one-direction RTT only.
399        Performance test: evaluate success rate and accuracy.
400        """
401        rtt_results = self.run_rtt_oob_discovery_set(
402            do_both_directions=False,
403            iter_count=self.NUM_ITER,
404            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
405            time_between_roles=self.TIME_BETWEEN_ROLES)
406        self.verify_results(rtt_results, accuracy_evaluation=True)
407
408    @test_tracker_info(uuid="82f954a5-c0ec-4bc6-8940-3b72199328ac")
409    def test_rtt_oob_discovery_both_ways_with_accuracy_evaluation(self):
410        """Perform RTT between 2 Wi-Fi Aware devices. Use out-of-band discovery
411        to communicate the MAC addresses to the peer. Test RTT both-ways:
412        switching rapidly between Initiator and Responder.
413        Performance test: evaluate success rate and accuracy.
414        """
415        rtt_results1, rtt_results2 = self.run_rtt_oob_discovery_set(
416            do_both_directions=True,
417            iter_count=self.NUM_ITER,
418            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
419            time_between_roles=self.TIME_BETWEEN_ROLES)
420        self.verify_results(rtt_results1, rtt_results2, accuracy_evaluation=True)
421
422    @test_tracker_info(uuid="4194e00c-ea49-488e-b67f-ad9360daa5fa")
423    def test_rtt_ib_discovery_one_way_with_accuracy_evaluation(self):
424        """Perform RTT between 2 Wi-Fi Aware devices. Use in-band (Aware) discovery
425        to communicate the MAC addresses to the peer. Test one-direction RTT only.
426        Performance test: evaluate success rate and accuracy.
427        """
428        rtt_results = self.run_rtt_ib_discovery_set(
429            do_both_directions=False,
430            iter_count=self.NUM_ITER,
431            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
432            time_between_roles=self.TIME_BETWEEN_ROLES)
433        self.verify_results(rtt_results, accuracy_evaluation=True)
434
435    @test_tracker_info(uuid="bea3ac8b-756d-4cd8-8936-b8bfe64676c9")
436    def test_rtt_ib_discovery_both_ways_with_accuracy_evaluation(self):
437        """Perform RTT between 2 Wi-Fi Aware devices. Use in-band (Aware) discovery
438        to communicate the MAC addresses to the peer. Test RTT both-ways:
439        switching rapidly between Initiator and Responder.
440        Performance test: evaluate success rate and accuracy.
441        """
442        rtt_results1, rtt_results2 = self.run_rtt_ib_discovery_set(
443            do_both_directions=True,
444            iter_count=self.NUM_ITER,
445            time_between_iterations=self.TIME_BETWEEN_ITERATIONS,
446            time_between_roles=self.TIME_BETWEEN_ROLES)
447        self.verify_results(rtt_results1, rtt_results2, accuracy_evaluation=True)
448
449    @test_tracker_info(uuid="54f9693d-45e5-4979-adbb-1b875d217c0c")
450    def test_rtt_without_initiator_aware(self):
451        """Try to perform RTT operation when there is no local Aware session (on the
452        Initiator). The Responder is configured normally: Aware on and a Publisher
453        with Ranging enable. Should FAIL.
454        """
455        init_dut = self.android_devices[0]
456        resp_dut = self.android_devices[1]
457
458        # Enable a Responder and start a Publisher
459        resp_id = resp_dut.droid.wifiAwareAttach(True)
460        autils.wait_for_event(resp_dut, aconsts.EVENT_CB_ON_ATTACHED)
461        resp_ident_event = autils.wait_for_event(
462            resp_dut, aconsts.EVENT_CB_ON_IDENTITY_CHANGED)
463        resp_mac = resp_ident_event['data']['mac']
464
465        resp_config = autils.add_ranging_to_pub(
466            autils.create_discovery_config(self.SERVICE_NAME,
467                                           aconsts.PUBLISH_TYPE_UNSOLICITED),
468            enable_ranging=True)
469        resp_dut.droid.wifiAwarePublish(resp_id, resp_config)
470        autils.wait_for_event(resp_dut, aconsts.SESSION_CB_ON_PUBLISH_STARTED)
471
472        # Initiate an RTT to Responder (no Aware started on Initiator!)
473        results = []
474        num_no_responses = 0
475        num_successes = 0
476        for i in range(self.NUM_ITER):
477            result = self.run_rtt_discovery(init_dut, resp_mac=resp_mac)
478            self.log.debug("result: %s", result)
479            results.append(result)
480            if result is None:
481                num_no_responses = num_no_responses + 1
482            elif (result[rconsts.EVENT_CB_RANGING_KEY_STATUS] ==
483                  rconsts.EVENT_CB_RANGING_STATUS_SUCCESS):
484                num_successes = num_successes + 1
485
486        asserts.assert_equal(
487            num_no_responses, 0, "No RTT response?", extras={"data": results})
488        asserts.assert_equal(
489            num_successes,
490            0,
491            "Aware RTT w/o Aware should FAIL!",
492            extras={"data": results})
493        asserts.explicit_pass("RTT Aware test done", extras={"data": results})
494
495    @test_tracker_info(uuid="87a69053-8261-4928-8ec1-c93aac7f3a8d")
496    def test_rtt_without_responder_aware(self):
497        """Try to perform RTT operation when there is no peer Aware session (on the
498        Responder). Should FAIL."""
499        init_dut = self.android_devices[0]
500        resp_dut = self.android_devices[1]
501
502        # Enable a Responder and start a Publisher
503        resp_id = resp_dut.droid.wifiAwareAttach(True)
504        autils.wait_for_event(resp_dut, aconsts.EVENT_CB_ON_ATTACHED)
505        resp_ident_event = autils.wait_for_event(
506            resp_dut, aconsts.EVENT_CB_ON_IDENTITY_CHANGED)
507        resp_mac = resp_ident_event['data']['mac']
508
509        resp_config = autils.add_ranging_to_pub(
510            autils.create_discovery_config(self.SERVICE_NAME,
511                                           aconsts.PUBLISH_TYPE_UNSOLICITED),
512            enable_ranging=True)
513        resp_dut.droid.wifiAwarePublish(resp_id, resp_config)
514        autils.wait_for_event(resp_dut, aconsts.SESSION_CB_ON_PUBLISH_STARTED)
515
516        # Disable Responder
517        resp_dut.droid.wifiAwareDestroy(resp_id)
518
519        # Enable the Initiator
520        init_id = init_dut.droid.wifiAwareAttach()
521        autils.wait_for_event(init_dut, aconsts.EVENT_CB_ON_ATTACHED)
522
523        # Initiate an RTT to Responder (no Aware started on Initiator!)
524        results = []
525        num_no_responses = 0
526        num_successes = 0
527        for i in range(self.NUM_ITER):
528            result = self.run_rtt_discovery(init_dut, resp_mac=resp_mac)
529            self.log.debug("result: %s", result)
530            results.append(result)
531            if result is None:
532                num_no_responses = num_no_responses + 1
533            elif (result[rconsts.EVENT_CB_RANGING_KEY_STATUS] ==
534                  rconsts.EVENT_CB_RANGING_STATUS_SUCCESS):
535                num_successes = num_successes + 1
536
537        asserts.assert_equal(
538            num_no_responses, 0, "No RTT response?", extras={"data": results})
539        asserts.assert_equal(
540            num_successes,
541            0,
542            "Aware RTT w/o Aware should FAIL!",
543            extras={"data": results})
544        asserts.explicit_pass("RTT Aware test done", extras={"data": results})
545
546    @test_tracker_info(uuid="80b0f96e-f87d-4dc9-a2b9-fae48558c8d8")
547    def test_rtt_with_publish_ranging_disabled(self):
548        """Try to perform RTT operation when publish ranging disabled, should fail.
549        """
550        self.run_rtt_with_aware_session_disabled_ranging(True)
551
552    @test_tracker_info(uuid="cb93a902-9b7a-4734-ba81-864878f9fa55")
553    def test_rtt_with_subscribe_ranging_disabled(self):
554        """Try to perform RTT operation when subscribe ranging disabled, should fail.
555        """
556        self.run_rtt_with_aware_session_disabled_ranging(False)
557