From b0c37ec0b1cfa9ce63c1054f213d8bfbd09a4cb4 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Tue, 24 Mar 2020 18:59:43 -0700 Subject: DPP R2 metrics 1. Number of DPP R2 capable enrollee responder devices. 2. Number of times DPP R2 compatibility check detected that enrollee responder device is incompatible with the network. Bug: 151455461 Test: atest com.android.server.wifi.DppManagerTest Test: atest com.android.server.wifi.DppMetricsTest Test: Manual - Ran DPP test and verified the counters in dumpsys Change-Id: I2a9943fb44983dc67ee0a056ee71147836aa33c9 --- .../com/android/server/wifi/DppManagerTest.java | 6 + .../com/android/server/wifi/DppMetricsTest.java | 126 +++++++++++++++++++++ 2 files changed, 132 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java b/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java index 19d17c979..e274d680f 100644 --- a/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java @@ -481,6 +481,7 @@ public class DppManagerTest extends WifiBaseTest { dppEventCallback.onSuccess(CONFIGURATION_SENT); mLooper.dispatchAll(); verify(mDppCallback).onSuccess(eq(EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT)); + verify(mDppMetrics, times(1)).updateDppR1CapableEnrolleeResponderDevices(); verify(mDppCallback, never()).onSuccessConfigReceived(anyInt()); verify(mDppCallback, never()).onFailure(anyInt(), anyString(), anyString(), any()); verify(mDppMetrics).updateDppConfiguratorInitiatorRequests(); @@ -861,6 +862,7 @@ public class DppManagerTest extends WifiBaseTest { mLooper.dispatchAll(); verify(mDppCallback) .onProgress(eq(EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_SENT_WAITING_RESPONSE)); + verify(mDppMetrics, times(1)).updateDppR2CapableEnrolleeResponderDevices(); // Generate an onSuccess callback dppEventCallback.onSuccess(CONFIGURATION_APPLIED); @@ -912,6 +914,10 @@ public class DppManagerTest extends WifiBaseTest { verify(mDppMetrics).updateDppConfiguratorInitiatorRequests(); verify(mDppMetrics).updateDppFailure(eq(appFailure)); verify(mDppMetrics).updateDppOperationTime(anyInt()); + if ((internalFailure == CANNOT_FIND_NETWORK) + && (appFailure == EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE)) { + verify(mDppMetrics, times(1)).updateDppR2EnrolleeResponderIncompatibleConfiguration(); + } verifyNoMoreInteractions(mDppMetrics); verifyCleanUpResources(); } diff --git a/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java index fd43578b1..e43da8f06 100644 --- a/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java @@ -18,13 +18,17 @@ package com.android.server.wifi; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_BUSY; +import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CONFIGURATION; +import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION; +import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_URI; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_TIMEOUT; +import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED; import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT; import static com.android.server.wifi.DppMetrics.DPP_OPERATION_TIME; @@ -185,10 +189,16 @@ public class DppMetricsTest extends WifiBaseTest { for (int i = 0; i < value; i++) { mDppMetrics.updateDppConfiguratorSuccess(EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT); } + for (int i = 0; i < value; i++) { + mDppMetrics.updateDppConfiguratorSuccess( + EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED); + } // Confirm that the consolidated log has the expected value checkDppSuccesses(WifiMetricsProto.WifiDppLog.EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT, value); + checkDppSuccesses(WifiMetricsProto.WifiDppLog + .EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED, value); } /** @@ -377,6 +387,65 @@ public class DppMetricsTest extends WifiBaseTest { value); } + /** + * Test EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK + * + * @throws Exception + */ + @Test + public void testUpdateDppFailureCannotFindNetwork() throws Exception { + // Get a random value and call the update method 'value' times + int value = getNumOfTimes(MAX_ITERATIONS) + 1; + + for (int i = 0; i < value; i++) { + mDppMetrics.updateDppFailure(EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK); + } + + // Confirm that the consolidated log has the expected value + checkDppFailures(WifiMetricsProto.WifiDppLog.EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK, + value); + } + + /** + * Test EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION + * + * @throws Exception + */ + @Test + public void testUpdateDppFailureEnrolleeAuthentication() throws Exception { + // Get a random value and call the update method 'value' times + int value = getNumOfTimes(MAX_ITERATIONS) + 1; + + for (int i = 0; i < value; i++) { + mDppMetrics.updateDppFailure(EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION); + } + + // Confirm that the consolidated log has the expected value + checkDppFailures(WifiMetricsProto.WifiDppLog + .EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION, value); + } + + /** + * Test + * EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION + * + * @throws Exception + */ + @Test + public void testUpdateDppFailureEnrolleeRejectedConfiguration() throws Exception { + // Get a random value and call the update method 'value' times + int value = getNumOfTimes(MAX_ITERATIONS) + 1; + + for (int i = 0; i < value; i++) { + mDppMetrics.updateDppFailure( + EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION); + } + + // Confirm that the consolidated log has the expected value + checkDppFailures(WifiMetricsProto.WifiDppLog + .EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION, value); + } + /** * Test DPP operation time histogram. Pick a single time value from each bucket by selecting * the max value minus 1, and call the update method random amount of times with this value. @@ -410,4 +479,61 @@ public class DppMetricsTest extends WifiBaseTest { checkOperationBucketEqualsTo(i, value); } } + + /** + * Test numDppR1CapableEnrolleeResponderDevices + * + * @throws Exception + */ + @Test + public void testUpdateDppR1CapableEnrolleeResponderDevices() throws Exception { + // Get a random value and call the update method 'value' times + int value = getNumOfTimes(MAX_ITERATIONS) + 1; + + for (int i = 0; i < value; i++) { + mDppMetrics.updateDppR1CapableEnrolleeResponderDevices(); + } + + // Confirm that the consolidated log has the expected value + WifiMetricsProto.WifiDppLog mWifiDppLogProto = mDppMetrics.consolidateProto(); + assertEquals(mWifiDppLogProto.numDppR1CapableEnrolleeResponderDevices, value); + } + + /** + * Test numDppR2CapableEnrolleeResponderDevices + * + * @throws Exception + */ + @Test + public void testUpdateDppR2CapableEnrolleeResponderDevices() throws Exception { + // Get a random value and call the update method 'value' times + int value = getNumOfTimes(MAX_ITERATIONS) + 1; + + for (int i = 0; i < value; i++) { + mDppMetrics.updateDppR2CapableEnrolleeResponderDevices(); + } + + // Confirm that the consolidated log has the expected value + WifiMetricsProto.WifiDppLog mWifiDppLogProto = mDppMetrics.consolidateProto(); + assertEquals(mWifiDppLogProto.numDppR2CapableEnrolleeResponderDevices, value); + } + + /** + * Test numDppR2EnrolleeResponderIncompatibleConfiguration + * + * @throws Exception + */ + @Test + public void testUpdateDppR2EnrolleeResponderIncompatibleConfiguration() throws Exception { + // Get a random value and call the update method 'value' times + int value = getNumOfTimes(MAX_ITERATIONS) + 1; + + for (int i = 0; i < value; i++) { + mDppMetrics.updateDppR2EnrolleeResponderIncompatibleConfiguration(); + } + + // Confirm that the consolidated log has the expected value + WifiMetricsProto.WifiDppLog mWifiDppLogProto = mDppMetrics.consolidateProto(); + assertEquals(mWifiDppLogProto.numDppR2EnrolleeResponderIncompatibleConfiguration, value); + } } -- cgit v1.2.3