wifi: Add VTS for wifi hal and hostapd hal.
Tested on S5 and O6.
Found VTS gets failure on wlan1
b/177389456 to track for O6
b/177483254 to track for S5
But both of O6 and S5 will get pass because it uses wlan0.
Bug: 162686273
Bug: 173999527
Test: atest -c VtsHalWifiHostapdV1_3TargetTest
Test: atest -c VtsHalWifiApV1_5TargetTest
Change-Id: Idbaa7fb2f95abc954fda8daf8670e4a57b453030
diff --git a/wifi/1.5/vts/functional/Android.bp b/wifi/1.5/vts/functional/Android.bp
index 2d8b412..118822a 100644
--- a/wifi/1.5/vts/functional/Android.bp
+++ b/wifi/1.5/vts/functional/Android.bp
@@ -14,6 +14,27 @@
// limitations under the License.
//
+cc_library_static {
+ name: "VtsHalWifiV1_5TargetTestUtil",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "wifi_hidl_test_utils_1_5.cpp",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+ shared_libs: [
+ "libnativehelper",
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.3",
+ "android.hardware.wifi@1.5",
+ "libwifi-system-iface",
+ ],
+}
+
cc_test {
name: "VtsHalWifiV1_5TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
@@ -67,9 +88,11 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
"wifi_chip_hidl_ap_test.cpp",
+ "wifi_ap_iface_hidl_test.cpp",
],
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiV1_5TargetTestUtil",
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
diff --git a/wifi/1.5/vts/functional/wifi_ap_iface_hidl_test.cpp b/wifi/1.5/vts/functional/wifi_ap_iface_hidl_test.cpp
new file mode 100644
index 0000000..e47b14d
--- /dev/null
+++ b/wifi/1.5/vts/functional/wifi_ap_iface_hidl_test.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#include <VtsCoreUtil.h>
+#include <VtsHalHidlTargetCallbackBase.h>
+#include <android-base/logging.h>
+
+#undef NAN // NAN is defined in bionic/libc/include/math.h:38
+
+#include <android/hardware/wifi/1.4/IWifiChipEventCallback.h>
+#include <android/hardware/wifi/1.5/IWifi.h>
+#include <android/hardware/wifi/1.5/IWifiApIface.h>
+#include <android/hardware/wifi/1.5/IWifiChip.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+
+#include "wifi_hidl_call_util.h"
+#include "wifi_hidl_test_utils.h"
+#include "wifi_hidl_test_utils_1_5.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::V1_0::ChipModeId;
+using ::android::hardware::wifi::V1_0::IfaceType;
+using ::android::hardware::wifi::V1_0::IWifiIface;
+using ::android::hardware::wifi::V1_0::WifiDebugRingBufferStatus;
+using ::android::hardware::wifi::V1_0::WifiStatus;
+using ::android::hardware::wifi::V1_0::WifiStatusCode;
+using ::android::hardware::wifi::V1_4::IWifiChipEventCallback;
+using ::android::hardware::wifi::V1_5::IWifiApIface;
+using ::android::hardware::wifi::V1_5::IWifiChip;
+
+/**
+ * Fixture for IWifiChip tests that are conditioned on SoftAP support.
+ */
+class WifiApIfaceHidlTest : public ::testing::TestWithParam<std::string> {
+ public:
+ virtual void SetUp() override {
+ isBridgedSupport_ = testing::checkSubstringInCommandOutput(
+ "/system/bin/cmd wifi get-softap-supported-features",
+ "wifi_softap_bridged_ap_supported");
+ // Make sure to start with a clean state
+ stopWifi(GetInstanceName());
+ }
+
+ virtual void TearDown() override { stopWifi(GetInstanceName()); }
+
+ protected:
+ bool isBridgedSupport_ = false;
+ std::string GetInstanceName() { return GetParam(); }
+};
+
+/*
+ * resetToFactoryMacAddress
+ */
+TEST_P(WifiApIfaceHidlTest, resetToFactoryMacAddressInBridgedModeTest) {
+ if (!isBridgedSupport_) GTEST_SKIP() << "Missing Bridged AP support";
+ sp<IWifiApIface> wifi_ap_iface =
+ getBridgedWifiApIface_1_5(GetInstanceName());
+ ASSERT_NE(nullptr, wifi_ap_iface.get());
+ const auto& status = HIDL_INVOKE(wifi_ap_iface, resetToFactoryMacAddress);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
+}
+
+/*
+ * resetToFactoryMacAddress
+ */
+TEST_P(WifiApIfaceHidlTest, resetToFactoryMacAddressTest) {
+ sp<IWifiApIface> wifi_ap_iface = getWifiApIface_1_5(GetInstanceName());
+ ASSERT_NE(nullptr, wifi_ap_iface.get());
+ const auto& status = HIDL_INVOKE(wifi_ap_iface, resetToFactoryMacAddress);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiApIfaceHidlTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, WifiApIfaceHidlTest,
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(
+ ::android::hardware::wifi::V1_5::IWifi::descriptor)),
+ android::hardware::PrintInstanceNameToString);
diff --git a/wifi/1.5/vts/functional/wifi_chip_hidl_ap_test.cpp b/wifi/1.5/vts/functional/wifi_chip_hidl_ap_test.cpp
index 395d317..922c9a7 100644
--- a/wifi/1.5/vts/functional/wifi_chip_hidl_ap_test.cpp
+++ b/wifi/1.5/vts/functional/wifi_chip_hidl_ap_test.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <VtsCoreUtil.h>
#include <VtsHalHidlTargetCallbackBase.h>
#include <android-base/logging.h>
@@ -51,6 +52,9 @@
class WifiChipHidlTest : public ::testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
+ isBridgedSupport_ = testing::checkSubstringInCommandOutput(
+ "/system/bin/cmd wifi get-softap-supported-features",
+ "wifi_softap_bridged_ap_supported");
// Make sure to start with a clean state
stopWifi(GetInstanceName());
@@ -61,6 +65,7 @@
virtual void TearDown() override { stopWifi(GetInstanceName()); }
protected:
+ bool isBridgedSupport_ = false;
// Helper function to configure the Chip in one of the supported modes.
// Most of the non-mode-configuration-related methods require chip
// to be first configured.
@@ -71,19 +76,12 @@
return mode_id;
}
- WifiStatusCode createApIface(sp<IWifiApIface>* ap_iface) {
- configureChipForIfaceType(IfaceType::AP, true);
- const auto& status_and_iface = HIDL_INVOKE(wifi_chip_, createApIface);
- *ap_iface = IWifiApIface::castFrom(status_and_iface.second);
- return status_and_iface.first.code;
- }
-
- WifiStatusCode createBridgedApIface(sp<IWifiApIface>* ap_iface) {
+ void createBridgedApIface(sp<IWifiApIface>* ap_iface) {
configureChipForIfaceType(IfaceType::AP, true);
const auto& status_and_iface =
HIDL_INVOKE(wifi_chip_, createBridgedApIface);
*ap_iface = status_and_iface.second;
- return status_and_iface.first.code;
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_iface.first.code);
}
sp<IWifiChip> wifi_chip_;
@@ -92,19 +90,25 @@
std::string GetInstanceName() { return GetParam(); }
};
-// TODO: b/173999527. Add test for bridged API.
-
-/*
- * resetToFactoryMacAddress
+/**
+ * createBridgedApIface & removeIfaceInstanceFromBridgedApIface
*/
-TEST_P(WifiChipHidlTest, resetToFactoryMacAddressTest) {
+TEST_P(WifiChipHidlTest,
+ createBridgedApIfaceAndremoveIfaceInstanceFromBridgedApIfaceTest) {
+ if (!isBridgedSupport_) GTEST_SKIP() << "Missing Bridged AP support";
sp<IWifiApIface> wifi_ap_iface;
- const auto& status_code = createApIface(&wifi_ap_iface);
- if (status_code != WifiStatusCode::SUCCESS) {
- EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status_code);
- }
- const auto& status = HIDL_INVOKE(wifi_ap_iface, resetToFactoryMacAddress);
- EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
+ createBridgedApIface(&wifi_ap_iface);
+ ASSERT_NE(nullptr, wifi_ap_iface.get());
+ const auto& status_and_name = HIDL_INVOKE(wifi_ap_iface, getName);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_name.first.code);
+ // TODO: b/173999527, add API to get instance name to replace it.
+ std::string br_name = status_and_name.second; // ap_br_ is the pre-fix
+ std::string instance_name =
+ br_name.substr(6, br_name.length()); // remove the pre-fex
+ const auto& status_code =
+ HIDL_INVOKE(wifi_chip_, removeIfaceInstanceFromBridgedApIface, br_name,
+ instance_name);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_code.code);
}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipHidlTest);
diff --git a/wifi/1.5/vts/functional/wifi_hidl_test_utils_1_5.cpp b/wifi/1.5/vts/functional/wifi_hidl_test_utils_1_5.cpp
new file mode 100644
index 0000000..f1da2ea
--- /dev/null
+++ b/wifi/1.5/vts/functional/wifi_hidl_test_utils_1_5.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#include <VtsHalHidlTargetCallbackBase.h>
+#include <android-base/logging.h>
+
+#undef NAN // NAN is defined in bionic/libc/include/math.h:38
+
+#include <android/hardware/wifi/1.5/IWifi.h>
+#include <android/hardware/wifi/1.5/IWifiApIface.h>
+#include <android/hardware/wifi/1.5/IWifiChip.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+
+#include "wifi_hidl_call_util.h"
+#include "wifi_hidl_test_utils.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::V1_0::ChipModeId;
+using ::android::hardware::wifi::V1_0::IfaceType;
+using ::android::hardware::wifi::V1_5::IWifiApIface;
+using ::android::hardware::wifi::V1_5::IWifiChip;
+
+sp<IWifiChip> getWifiChip_1_5(const std::string& instance_name) {
+ return IWifiChip::castFrom(getWifiChip(instance_name));
+}
+
+sp<IWifiApIface> getWifiApIface_1_5(const std::string& instance_name) {
+ ChipModeId mode_id;
+ sp<IWifiChip> wifi_chip_ = getWifiChip_1_5(instance_name);
+ configureChipToSupportIfaceType(wifi_chip_, IfaceType::AP, &mode_id);
+ const auto& status_and_iface = HIDL_INVOKE(wifi_chip_, createApIface);
+ return IWifiApIface::castFrom(status_and_iface.second);
+}
+
+sp<IWifiApIface> getBridgedWifiApIface_1_5(const std::string& instance_name) {
+ ChipModeId mode_id;
+ sp<IWifiChip> wifi_chip_ = getWifiChip_1_5(instance_name);
+ configureChipToSupportIfaceType(wifi_chip_, IfaceType::AP, &mode_id);
+ const auto& status_and_iface =
+ HIDL_INVOKE(wifi_chip_, createBridgedApIface);
+ return IWifiApIface::castFrom(status_and_iface.second);
+}
diff --git a/wifi/1.5/vts/functional/wifi_hidl_test_utils_1_5.h b/wifi/1.5/vts/functional/wifi_hidl_test_utils_1_5.h
new file mode 100644
index 0000000..1b8b737
--- /dev/null
+++ b/wifi/1.5/vts/functional/wifi_hidl_test_utils_1_5.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <android/hardware/wifi/1.5/IWifi.h>
+#include <android/hardware/wifi/1.5/IWifiApIface.h>
+#include <android/hardware/wifi/1.5/IWifiChip.h>
+
+#include <getopt.h>
+
+#include <VtsHalHidlTargetTestEnvBase.h>
+// Helper functions to obtain references to the various HIDL interface objects.
+// Note: We only have a single instance of each of these objects currently.
+// These helper functions should be modified to return vectors if we support
+// multiple instances.
+android::sp<android::hardware::wifi::V1_5::IWifiChip> getWifiChip_1_5(
+ const std::string& instance_name);
+android::sp<android::hardware::wifi::V1_5::IWifiApIface> getWifiApIface_1_5(
+ const std::string& instance_name);
+android::sp<android::hardware::wifi::V1_5::IWifiApIface>
+getBridgedWifiApIface_1_5(const std::string& instance_name);
diff --git a/wifi/hostapd/1.3/vts/functional/Android.bp b/wifi/hostapd/1.3/vts/functional/Android.bp
index 07cebb0..ed18bb6 100644
--- a/wifi/hostapd/1.3/vts/functional/Android.bp
+++ b/wifi/hostapd/1.3/vts/functional/Android.bp
@@ -22,12 +22,18 @@
],
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiV1_5TargetTestUtil",
"VtsHalWifiHostapdV1_0TargetTestUtil",
"android.hardware.wifi.hostapd@1.0",
"android.hardware.wifi.hostapd@1.1",
"android.hardware.wifi.hostapd@1.2",
"android.hardware.wifi.hostapd@1.3",
"android.hardware.wifi@1.0",
+ "android.hardware.wifi@1.1",
+ "android.hardware.wifi@1.2",
+ "android.hardware.wifi@1.3",
+ "android.hardware.wifi@1.4",
+ "android.hardware.wifi@1.5",
"libgmock",
"libwifi-system",
"libwifi-system-iface",
diff --git a/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
index a22252c..4e63c56 100644
--- a/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
@@ -28,6 +28,7 @@
#include "hostapd_hidl_call_util.h"
#include "hostapd_hidl_test_utils.h"
+#include "wifi_hidl_test_utils_1_5.h"
using ::android::sp;
using ::android::hardware::hidl_string;
@@ -38,6 +39,8 @@
using ::android::hardware::wifi::hostapd::V1_2::Ieee80211ReasonCode;
using ::android::hardware::wifi::hostapd::V1_3::IHostapd;
using ::android::hardware::wifi::V1_0::IWifi;
+using ::android::hardware::wifi::V1_0::WifiStatusCode;
+using ::android::hardware::wifi::V1_5::IWifiApIface;
namespace {
constexpr unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1',
@@ -71,16 +74,39 @@
isWpa3SaeSupport_ = testing::checkSubstringInCommandOutput(
"/system/bin/cmd wifi get-softap-supported-features",
"wifi_softap_wpa3_sae_supported");
+ isBridgedSupport_ = testing::checkSubstringInCommandOutput(
+ "/system/bin/cmd wifi get-softap-supported-features",
+ "wifi_softap_bridged_ap_supported");
}
virtual void TearDown() override {
HIDL_INVOKE_VOID_WITHOUT_ARGUMENTS(hostapd_, terminate);
stopHostapd(wifi_instance_name_);
+ // Wait 3 seconds to allow driver processing load/unload between two
+ // test cases.
+ sleep(3);
}
protected:
bool isWpa3SaeSupport_ = false;
bool isAcsSupport_ = false;
+ bool isBridgedSupport_ = false;
+
+ std::string setupApIfaceAndGetName(bool isBridged) {
+ sp<IWifiApIface> wifi_ap_iface;
+ if (isBridged) {
+ wifi_ap_iface = getBridgedWifiApIface_1_5(wifi_instance_name_);
+ } else {
+ wifi_ap_iface = getWifiApIface_1_5(wifi_instance_name_);
+ }
+ EXPECT_NE(nullptr, wifi_ap_iface.get());
+
+ const auto& status_and_name = HIDL_INVOKE(wifi_ap_iface, getName);
+ EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_name.first.code);
+ return status_and_name.second;
+ }
+
+ // TODO: b/177483254, remove it after fix wlan1 failure case.
std::string getPrimaryWlanIfaceName() {
std::array<char, PROPERTY_VALUE_MAX> buffer;
auto res = property_get("ro.vendor.wifi.sap.interface", buffer.data(),
@@ -90,7 +116,7 @@
return buffer.data();
}
- IHostapd::IfaceParams getIfaceParamsWithoutAcs() {
+ IHostapd::IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) {
::android::hardware::wifi::hostapd::V1_0::IHostapd::IfaceParams
iface_params;
::android::hardware::wifi::hostapd::V1_1::IHostapd::IfaceParams
@@ -106,7 +132,7 @@
::android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams
channelParams_1_3;
- iface_params.ifaceName = getPrimaryWlanIfaceName();
+ iface_params.ifaceName = iface_name;
iface_params.hwModeParams.enable80211N = true;
iface_params.hwModeParams.enable80211AC = false;
iface_params.channelParams.enableAcs = false;
@@ -133,9 +159,41 @@
return iface_params_1_3;
}
- IHostapd::IfaceParams getIfaceParamsWithAcs() {
+ IHostapd::IfaceParams getIfaceParamsWithBridgedModeACS(
+ std::string iface_name) {
// First get the settings for WithoutAcs and then make changes
- IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithoutAcs();
+ IHostapd::IfaceParams iface_params_1_3 =
+ getIfaceParamsWithoutAcs(iface_name);
+ iface_params_1_3.V1_2.V1_1.V1_0.channelParams.enableAcs = true;
+ iface_params_1_3.V1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs =
+ true;
+
+ std::vector<
+ ::android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams>
+ vec_channelParams;
+
+ vec_channelParams.push_back(iface_params_1_3.channelParamsList[0]);
+
+ ::android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams
+ second_channelParams_1_3;
+ second_channelParams_1_3.channel = 0;
+ second_channelParams_1_3.enableAcs = true;
+ second_channelParams_1_3.bandMask = 0;
+ second_channelParams_1_3.bandMask |= IHostapd::BandMask::BAND_5_GHZ;
+ second_channelParams_1_3.V1_2 = iface_params_1_3.V1_2.channelParams;
+ second_channelParams_1_3.V1_2.bandMask = 0;
+ second_channelParams_1_3.V1_2.bandMask |=
+ IHostapd::BandMask::BAND_5_GHZ;
+ vec_channelParams.push_back(second_channelParams_1_3);
+
+ iface_params_1_3.channelParamsList = vec_channelParams;
+ return iface_params_1_3;
+ }
+
+ IHostapd::IfaceParams getIfaceParamsWithAcs(std::string iface_name) {
+ // First get the settings for WithoutAcs and then make changes
+ IHostapd::IfaceParams iface_params_1_3 =
+ getIfaceParamsWithoutAcs(iface_name);
iface_params_1_3.V1_2.V1_1.V1_0.channelParams.enableAcs = true;
iface_params_1_3.V1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs =
true;
@@ -153,8 +211,10 @@
return iface_params_1_3;
}
- IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange() {
- IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithAcs();
+ IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange(
+ std::string iface_name) {
+ IHostapd::IfaceParams iface_params_1_3 =
+ getIfaceParamsWithAcs(iface_name);
::android::hardware::wifi::hostapd::V1_2::IHostapd::AcsFrequencyRange
acsFrequencyRange;
acsFrequencyRange.start = 2412;
@@ -170,9 +230,10 @@
return iface_params_1_3;
}
- IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange() {
+ IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange(
+ std::string iface_name) {
IHostapd::IfaceParams iface_params_1_3 =
- getIfaceParamsWithAcsAndFreqRange();
+ getIfaceParamsWithAcsAndFreqRange(iface_name);
iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz[0].start =
222;
iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz[0].end =
@@ -250,8 +311,10 @@
return nw_params_1_3;
}
- IHostapd::IfaceParams getIfaceParamsWithInvalidChannel() {
- IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithoutAcs();
+ IHostapd::IfaceParams getIfaceParamsWithInvalidChannel(
+ std::string iface_name) {
+ IHostapd::IfaceParams iface_params_1_3 =
+ getIfaceParamsWithoutAcs(iface_name);
iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel =
kIfaceInvalidChannel;
iface_params_1_3.channelParamsList[0].channel =
@@ -271,8 +334,11 @@
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithAcs(), getPskNwParams());
+ getIfaceParamsWithAcs(ifname), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -282,9 +348,12 @@
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
- auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithAcsAndFreqRange(), getPskNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithAcsAndFreqRange(ifname),
+ getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -294,8 +363,11 @@
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithAcsAndInvalidFreqRange(),
+ getIfaceParamsWithAcsAndInvalidFreqRange(ifname),
getPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@@ -306,8 +378,11 @@
*/
TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithAcs(), getOpenNwParams());
+ getIfaceParamsWithAcs(ifname), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -316,8 +391,12 @@
* Access point creation should pass.
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithoutAcs(), getPskNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status =
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -326,9 +405,12 @@
* Access point creation should pass.
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcsAndNonMetered) {
- auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithoutAcs(),
- getPskNwParamsWithNonMetered());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname),
+ getPskNwParamsWithNonMetered());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -337,8 +419,12 @@
* Access point creation should pass.
*/
TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithoutAcs(), getOpenNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status =
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -348,9 +434,12 @@
*/
TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
- auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithoutAcs(),
- getSaeTransitionNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname),
+ getSaeTransitionNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -360,8 +449,12 @@
*/
TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
- auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithoutAcs(), getSaeNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status =
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname), getSaeNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@@ -371,11 +464,14 @@
*/
TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
- auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithAcs(), getPskNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status_1_2 =
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithAcs(ifname),
+ getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
- auto status =
- HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
+ auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname);
EXPECT_EQ(
android::hardware::wifi::hostapd::V1_0::HostapdStatusCode::SUCCESS,
status.code);
@@ -386,11 +482,14 @@
* Access point creation & removal should pass.
*/
TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
- auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithoutAcs(), getPskNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status_1_2 =
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
- auto status =
- HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
+ auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname);
EXPECT_EQ(
android::hardware::wifi::hostapd::V1_0::HostapdStatusCode::SUCCESS,
status.code);
@@ -401,9 +500,12 @@
* Access point creation should fail.
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
- getIfaceParamsWithInvalidChannel(), getPskNwParams());
+ getIfaceParamsWithInvalidChannel(ifname), getPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@@ -412,9 +514,12 @@
* Access point creation should fail.
*/
TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithoutAcs(),
- getInvalidPskNwParams());
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname), getInvalidPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@@ -424,9 +529,12 @@
*/
TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
- auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithoutAcs(),
- getInvalidSaeTransitionNwParams());
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
+ auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname),
+ getInvalidSaeTransitionNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@@ -436,9 +544,12 @@
*/
TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
auto status =
- HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithoutAcs(),
- getInvalidSaeNwParams());
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname), getInvalidSaeNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@@ -447,21 +558,30 @@
* when hotspot interface available.
*/
TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) {
+ // TODO: Use setupApIfaceAndGetName after fixing b/177483254
+ // std::string ifname = setupApIfaceAndGetName(false);
+ std::string ifname = getPrimaryWlanIfaceName();
auto status_1_2 =
- HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithoutAcs(),
- getOpenNwParams());
+ HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithoutAcs(ifname), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
- status_1_2 =
- HIDL_INVOKE(hostapd_, forceClientDisconnect, getPrimaryWlanIfaceName(),
- kTestZeroMacAddr, kTestDisconnectReasonCode);
+ status_1_2 = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname,
+ kTestZeroMacAddr, kTestDisconnectReasonCode);
EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code);
}
/**
* AddAccessPointWithDualBandConfig should pass
*/
-// TODO: Add it after VendorHal ready & add feature support check.
+TEST_P(HostapdHidlTest, AddAccessPointWithDualBandConfig) {
+ if (!isBridgedSupport_) GTEST_SKIP() << "Missing Bridged AP support";
+ std::string ifname = setupApIfaceAndGetName(true);
+ auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
+ getIfaceParamsWithBridgedModeACS(ifname),
+ getOpenNwParams());
+ EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
+}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HostapdHidlTest);
INSTANTIATE_TEST_CASE_P(