[AWARE] Mismatch service type when both are active should pass
An unsolicited publish together with an active subscribe actually
DO match. The subscriber continues to respond to received discovery
packets even if it is also actively scanning for such. Therefore,
a service discovery (match) will occur.
Bug: 38505721
Test: all mismatch tests pass
Change-Id: I673a46400d840f0437c71bd1634800f4c6dfe70a
diff --git a/acts/tests/google/wifi/aware/functional/DiscoveryTest.py b/acts/tests/google/wifi/aware/functional/DiscoveryTest.py
index eae4670..b5bd0b4 100644
--- a/acts/tests/google/wifi/aware/functional/DiscoveryTest.py
+++ b/acts/tests/google/wifi/aware/functional/DiscoveryTest.py
@@ -422,57 +422,19 @@
# verify that there were no other events
autils.verify_no_more_events(dut)
- def negative_discovery_test_utility(self, p_dut, s_dut, p_config, s_config):
- """Utility which runs a negative discovery test:
- - Start discovery (publish/subscribe) with TTL=0 (non-self-terminating)
- - Validate no service is discovered
- - Terminate discovery sessions
-
- Uses typical payload size.
-
- Args:
- p_dut: Publish device under test
- s_dut: Subscribe device under test
- p_config: Publish discovery configuration
- s_config: Subscribe discovery configuration
- """
- # Publisher+Subscriber: attach and wait for confirmation
- p_id = p_dut.droid.wifiAwareAttach(False)
- autils.wait_for_event(p_dut, aconsts.EVENT_CB_ON_ATTACHED)
- s_id = s_dut.droid.wifiAwareAttach(False)
- autils.wait_for_event(s_dut, aconsts.EVENT_CB_ON_ATTACHED)
-
- # Publisher: start publish and wait for confirmation
- p_disc_id = p_dut.droid.wifiAwarePublish(p_id, p_config)
- autils.wait_for_event(p_dut, aconsts.SESSION_CB_ON_PUBLISH_STARTED)
-
- # Subscriber: start subscribe and wait for confirmation
- s_disc_id = s_dut.droid.wifiAwareSubscribe(s_id, s_config)
- autils.wait_for_event(s_dut, aconsts.SESSION_CB_ON_SUBSCRIBE_STARTED)
-
- # Subscriber: fail on service discovery
- autils.fail_on_event(s_dut, aconsts.SESSION_CB_ON_SERVICE_DISCOVERED)
-
- # Publisher+Subscriber: Terminate sessions
- p_dut.droid.wifiAwareDestroyDiscoverySession(p_disc_id)
- s_dut.droid.wifiAwareDestroyDiscoverySession(s_disc_id)
-
- # verify that there were no other events (including terminations)
- time.sleep(autils.EVENT_TIMEOUT)
- autils.verify_no_more_events(p_dut, timeout=0)
- autils.verify_no_more_events(s_dut, timeout=0)
-
- def negative_discovery_mismatch_test_utility(self,
- p_type,
- s_type,
- p_service_name=None,
- s_service_name=None,
- p_mf_1=None,
- s_mf_1=None):
+ def discovery_mismatch_test_utility(self,
+ is_expected_to_pass,
+ p_type,
+ s_type,
+ p_service_name=None,
+ s_service_name=None,
+ p_mf_1=None,
+ s_mf_1=None):
"""Utility which runs the negative discovery test for mismatched service
configs.
Args:
+ is_expected_to_pass: True if positive test, False if negative
p_type: Publish discovery type
s_type: Subscribe discovery type
p_service_name: Publish service name (or None to leave unchanged)
@@ -515,7 +477,33 @@
s_mf_1,
bytes(range(40))])
- self.negative_discovery_test_utility(p_dut, s_dut, p_config, s_config)
+ p_id = p_dut.droid.wifiAwareAttach(False)
+ autils.wait_for_event(p_dut, aconsts.EVENT_CB_ON_ATTACHED)
+ s_id = s_dut.droid.wifiAwareAttach(False)
+ autils.wait_for_event(s_dut, aconsts.EVENT_CB_ON_ATTACHED)
+
+ # Publisher: start publish and wait for confirmation
+ p_disc_id = p_dut.droid.wifiAwarePublish(p_id, p_config)
+ autils.wait_for_event(p_dut, aconsts.SESSION_CB_ON_PUBLISH_STARTED)
+
+ # Subscriber: start subscribe and wait for confirmation
+ s_disc_id = s_dut.droid.wifiAwareSubscribe(s_id, s_config)
+ autils.wait_for_event(s_dut, aconsts.SESSION_CB_ON_SUBSCRIBE_STARTED)
+
+ # Subscriber: fail on service discovery
+ if is_expected_to_pass:
+ autils.wait_for_event(s_dut, aconsts.SESSION_CB_ON_SERVICE_DISCOVERED)
+ else:
+ autils.fail_on_event(s_dut, aconsts.SESSION_CB_ON_SERVICE_DISCOVERED)
+
+ # Publisher+Subscriber: Terminate sessions
+ p_dut.droid.wifiAwareDestroyDiscoverySession(p_disc_id)
+ s_dut.droid.wifiAwareDestroyDiscoverySession(s_disc_id)
+
+ # verify that there were no other events (including terminations)
+ time.sleep(autils.EVENT_TIMEOUT)
+ autils.verify_no_more_events(p_dut, timeout=0)
+ autils.verify_no_more_events(s_dut, timeout=0)
#######################################
@@ -717,7 +705,8 @@
- Unsolicited publish
- Passive subscribe
"""
- self.negative_discovery_mismatch_test_utility(
+ self.discovery_mismatch_test_utility(
+ is_expected_to_pass=False,
p_type=aconsts.PUBLISH_TYPE_UNSOLICITED,
s_type=aconsts.SUBSCRIBE_TYPE_PASSIVE,
p_service_name="GoogleTestServiceXXX",
@@ -728,7 +717,8 @@
- Solicited publish
- Active subscribe
"""
- self.negative_discovery_mismatch_test_utility(
+ self.discovery_mismatch_test_utility(
+ is_expected_to_pass=False,
p_type=aconsts.PUBLISH_TYPE_SOLICITED,
s_type=aconsts.SUBSCRIBE_TYPE_ACTIVE,
p_service_name="GoogleTestServiceXXX",
@@ -749,7 +739,8 @@
- Unsolicited publish
- Active subscribe
"""
- self.negative_discovery_mismatch_test_utility(
+ self.discovery_mismatch_test_utility(
+ is_expected_to_pass=True,
p_type=aconsts.PUBLISH_TYPE_UNSOLICITED,
s_type=aconsts.SUBSCRIBE_TYPE_ACTIVE)
@@ -758,7 +749,8 @@
- Unsolicited publish
- Active subscribe
"""
- self.negative_discovery_mismatch_test_utility(
+ self.discovery_mismatch_test_utility(
+ is_expected_to_pass=False,
p_type=aconsts.PUBLISH_TYPE_SOLICITED,
s_type=aconsts.SUBSCRIBE_TYPE_PASSIVE)
@@ -777,7 +769,8 @@
- Unsolicited publish
- Passive subscribe
"""
- self.negative_discovery_mismatch_test_utility(
+ self.discovery_mismatch_test_utility(
+ is_expected_to_pass=False,
p_type=aconsts.PUBLISH_TYPE_UNSOLICITED,
s_type=aconsts.SUBSCRIBE_TYPE_PASSIVE,
p_mf_1="hello there string",
@@ -788,7 +781,8 @@
- Solicited publish
- Active subscribe
"""
- self.negative_discovery_mismatch_test_utility(
+ self.discovery_mismatch_test_utility(
+ is_expected_to_pass=False,
p_type=aconsts.PUBLISH_TYPE_SOLICITED,
s_type=aconsts.SUBSCRIBE_TYPE_ACTIVE,
p_mf_1="hello there string",