summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2020-02-25 17:09:21 -0800
committerKai Shi <kaishi@google.com>2020-03-03 18:51:39 +0000
commitd7d14da8eafb570f00287ac715d31ebca6fca164 (patch)
tree40d0ca7a3d4d8b2caecc67d029c3be166c05cda3 /tests
parent57281a616601d703cd89904a92c68d320f426190 (diff)
Add EAP methods in WifiMetrics
To help find the root cause of high authentication failure rate in enterprise network, add EAP method and authentication phase2 method in connection event metrics. Bug: 150237135 Test: manual Test: atest com.android.server.wifi Change-Id: I0c4ab436b1e43cc52d4bd4dab6c01db53fec91a6
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 73ac30f41..11769576c 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -58,6 +58,7 @@ import android.net.wifi.IOnWifiUsabilityStatsListener;
import android.net.wifi.ScanResult;
import android.net.wifi.SupplicantState;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiEnterpriseConfig;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiSsid;
@@ -1371,10 +1372,17 @@ public class WifiMetricsTest {
when(networkDetail.getDtimInterval()).thenReturn(NETWORK_DETAIL_DTIM);
ScanResult scanResult = mock(ScanResult.class);
scanResult.level = SCAN_RESULT_LEVEL;
+ scanResult.capabilities = "EAP";
WifiConfiguration config = mock(WifiConfiguration.class);
config.SSID = "\"" + SSID + "\"";
config.dtimInterval = CONFIG_DTIM;
config.macRandomizationSetting = WifiConfiguration.RANDOMIZATION_PERSISTENT;
+ config.allowedKeyManagement = new BitSet();
+ config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
+ config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.IEEE8021X);
+ config.enterpriseConfig = new WifiEnterpriseConfig();
+ config.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.TTLS);
+ config.enterpriseConfig.setPhase2Method(WifiEnterpriseConfig.Phase2.MSCHAPV2);
WifiConfiguration.NetworkSelectionStatus networkSelectionStat =
mock(WifiConfiguration.NetworkSelectionStatus.class);
when(networkSelectionStat.getCandidate()).thenReturn(scanResult);
@@ -1395,7 +1403,9 @@ public class WifiMetricsTest {
WifiMetricsProto.ConnectionEvent.HLF_NONE,
WifiMetricsProto.ConnectionEvent.FAILURE_REASON_UNKNOWN);
+ //Change configuration to open without randomization
config.macRandomizationSetting = WifiConfiguration.RANDOMIZATION_NONE;
+ scanResult.capabilities = "";
//Create a connection event using the config and a scan detail
mWifiMetrics.startConnectionEvent(config, "Green",
WifiMetricsProto.ConnectionEvent.ROAM_NONE);
@@ -1411,8 +1421,20 @@ public class WifiMetricsTest {
//Check that the correct values are being flowed through
assertEquals(2, mDecodedProto.connectionEvent.length);
assertEquals(CONFIG_DTIM, mDecodedProto.connectionEvent[0].routerFingerprint.dtim);
+ assertEquals(WifiMetricsProto.RouterFingerPrint.AUTH_ENTERPRISE,
+ mDecodedProto.connectionEvent[0].routerFingerprint.authentication);
+ assertEquals(WifiMetricsProto.RouterFingerPrint.TYPE_EAP_TTLS,
+ mDecodedProto.connectionEvent[0].routerFingerprint.eapMethod);
+ assertEquals(WifiMetricsProto.RouterFingerPrint.TYPE_PHASE2_MSCHAPV2,
+ mDecodedProto.connectionEvent[0].routerFingerprint.authPhase2Method);
assertEquals(SCAN_RESULT_LEVEL, mDecodedProto.connectionEvent[0].signalStrength);
assertEquals(NETWORK_DETAIL_DTIM, mDecodedProto.connectionEvent[1].routerFingerprint.dtim);
+ assertEquals(WifiMetricsProto.RouterFingerPrint.AUTH_OPEN,
+ mDecodedProto.connectionEvent[1].routerFingerprint.authentication);
+ assertEquals(WifiMetricsProto.RouterFingerPrint.TYPE_EAP_UNKNOWN,
+ mDecodedProto.connectionEvent[1].routerFingerprint.eapMethod);
+ assertEquals(WifiMetricsProto.RouterFingerPrint.TYPE_PHASE2_NONE,
+ mDecodedProto.connectionEvent[1].routerFingerprint.authPhase2Method);
assertEquals(SCAN_RESULT_LEVEL, mDecodedProto.connectionEvent[1].signalStrength);
assertEquals(NETWORK_DETAIL_WIFIMODE,
mDecodedProto.connectionEvent[1].routerFingerprint.routerTechnology);