Files
wlan-testing/tests/e2e/interOp/openroaming_test/iOS/test_OpenRoaming_BridgeMode.py
Sushant Bawiskar 7a4c9724fd Wifi 7159 (#415)
* - To return from perfecto logger if we are running testcases for unique ssid

Signed-off-by: Sushant Bawiskar <sushant.bawiskar@candelatech.com>

* - To add unique ssid schema as a part of testcase

Signed-off-by: Sushant Bawiskar <sushant.bawiskar@candelatech.com>

* - removing marker from openroaming tescases

Signed-off-by: Sushant Bawiskar <sushant.bawiskar@candelatech.com>

* Resolved conflicts in Interop/conftest

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added Android devices needed for cleanup

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Changed marker to match ios and Android test cases with devices in Interop Testing workflow

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added run-lf argument in return function of setup_profiles

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added WIFI branches in reference for allure report generation

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Changed marker to Suite B

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added extra runners

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added Nat mode

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added Vlan mode

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added extra 1 min if --run-lf is used

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* changed cleanup requirements

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added vlan to ssid names in setup profiles of Enterprise mode test

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Changed testbed name

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Changed Regression to performance

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Reverted to original Interop workflow file

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Chnaged file name to performance.yml

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

Co-authored-by: haricharan-jaka <haricharan.jaka@candelatech.com>
2022-03-23 20:33:34 +05:30

327 lines
16 KiB
Python

"""
EAP Passpoint BRIDGE Mode
Run wpa2_eap & Run wpa2_only_eap:
pytest -m "OpenRoaming and interop_ios and fiveg and wpa2_eap and bridge" -s -vvv --testbed interop --skip-upgrade
pytest -m "OpenRoaming and interop_ios and twog and wpa2_eap and bridge" -s -vvv --testbed interop --skip-upgrade
pytest -m "OpenRoaming and interop_ios and fiveg and wpa2_only_eap and bridge" -s -vvv --testbed interop --skip-upgrade
pytest -m "OpenRoaming and interop_ios and twog and wpa2_only_eap and bridge" -s -vvv --testbed interop --skip-upgrade
Run all:
pytest -m "openRoaming and interop_ios and bridge" -s -vvv --testbed interop --skip-upgrade --skip-testrail --collect-only
"""
from logging import exception
import unittest
import warnings
from perfecto.test import TestResultFactory
import pytest
import sys
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.interop_ios, pytest.mark.ios, pytest.mark.openRoaming, pytest.mark.bridge]
# pytestmark = [pytest.mark.openRoaming]
from iOS_lib import closeApp, openApp, ForgetProfileWifiConnection, deleteOpenRoamingInstalledProfile, verifyUploadDownloadSpeediOS, downloadInstallOpenRoamingProfile, ForgetWifiConnection, Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown
setup_params_eap = {
"mode": "BRIDGE",
"ssid_modes": {
"open": [
{"ssid_name": "passpoint_profile_download", "appliedRadios": ["is2dot4GHz"]}
],
"wpa2_eap": [
{"ssid_name": "ssid_wpa2_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
],
"wpa2_only_eap": [
{"ssid_name": "ssid_wpa2_only_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_only_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
]
}
}
@allure.feature("BRIDGE MODE EAP PASSPOINT SETUP")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_eap],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestOpenRoamingBridge(object):
@pytest.mark.wpa2_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_OpenRoaming_2g_WPA2_EAP_BRIDGE(self, passpoint_profile_info, push_ap_profile, request, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
downloadProfileSSID = setup_params_eap["ssid_modes"]["open"][0]["ssid_name"]
downloadProfileSSIDPass = ""
#profileDownloadURL = passpoint_profile_info["profile_download_url_ios"]
profileDownloadURL = "https://onboard.almondlabs.net/ttls/AmeriBand-Profile.mobileconfig"
profileName = passpoint_profile_info["profile_name_on_device"]
profileNameSSID = setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"]
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
#Set Wifi/AP Mode
set_APconnMobileDevice_iOS(request, downloadProfileSSID, downloadProfileSSIDPass, setup_perfectoMobile_iOS, connData)
#Install Profile
downloadInstallOpenRoamingProfile(request, profileDownloadURL, setup_perfectoMobile_iOS, connData)
#ForgetWifi Original
ForgetWifiConnection(request, setup_perfectoMobile_iOS, downloadProfileSSID, connData)
try:
assert verify_APconnMobileDevice_iOS(request, profileNameSSID, setup_perfectoMobile_iOS, connData)
#Verify Upload download Speed from device Selection
verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
except Exception as e:
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
assert False
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
@pytest.mark.wpa2_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_OpenRoaming_5g_WPA2_EAP_BRIDGE(self, passpoint_profile_info, push_ap_profile, request, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
downloadProfileSSID = setup_params_eap["ssid_modes"]["open"][0]["ssid_name"]
downloadProfileSSIDPass = ""
#profileDownloadURL = passpoint_profile_info["profile_download_url_ios"]
profileDownloadURL = "https://onboard.almondlabs.net/ttls/AmeriBand-Profile.mobileconfig"
profileName = passpoint_profile_info["profile_name_on_device"]
profileNameSSID = setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"]
#Setting Perfecto ReportClient....
#SSID to download profile :: passpoint_profile_download
#SSID to validate connectivity :: ssid_wpa2_eap_passpoint_5g
#Profile download URL :: https://onboard.almondlabs.net/ios.html
#Profile name to remove :: AmeriBand
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
#Set Wifi/AP Mode
set_APconnMobileDevice_iOS(request, downloadProfileSSID, downloadProfileSSIDPass, setup_perfectoMobile_iOS, connData)
#Install Profile
downloadInstallOpenRoamingProfile(request, profileDownloadURL, setup_perfectoMobile_iOS, connData)
#ForgetWifi Original
ForgetWifiConnection(request, setup_perfectoMobile_iOS, downloadProfileSSID, connData)
try:
assert verify_APconnMobileDevice_iOS(request, profileNameSSID, setup_perfectoMobile_iOS, connData)
#Verify Upload download Speed from device Selection
verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
except Exception as e:
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
assert False
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
@pytest.mark.wpa2_only_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_OpenRoaming_wpa2_only_eap_2g_BRIDGE(self, passpoint_profile_info, push_ap_profile, request, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
downloadProfileSSID = setup_params_eap["ssid_modes"]["open"][0]["ssid_name"]
downloadProfileSSIDPass = ""
#profileDownloadURL = passpoint_profile_info["profile_download_url_ios"]
profileDownloadURL = "https://onboard.almondlabs.net/ttls/AmeriBand-Profile.mobileconfig"
profileName = passpoint_profile_info["profile_name_on_device"]
profileNameSSID = setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"]
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
#Set Wifi/AP Mode
set_APconnMobileDevice_iOS(request, downloadProfileSSID, downloadProfileSSIDPass, setup_perfectoMobile_iOS, connData)
#Install Profile
downloadInstallOpenRoamingProfile(request, profileDownloadURL, setup_perfectoMobile_iOS, connData)
#ForgetWifi Original
ForgetWifiConnection(request, setup_perfectoMobile_iOS, downloadProfileSSID, connData)
try:
assert verify_APconnMobileDevice_iOS(request, profileNameSSID, setup_perfectoMobile_iOS, connData)
#Verify Upload download Speed from device Selection
verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
except Exception as e:
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
assert False
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
@pytest.mark.wpa2_only_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_OpenRoaming_wpa2_only_eap_5g_BRIDGE(self, passpoint_profile_info, push_ap_profile, request, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
downloadProfileSSID = setup_params_eap["ssid_modes"]["open"][0]["ssid_name"]
downloadProfileSSIDPass = ""
#profileDownloadURL = passpoint_profile_info["profile_download_url_ios"]
profileDownloadURL = "https://onboard.almondlabs.net/ttls/AmeriBand-Profile.mobileconfig"
profileName = passpoint_profile_info["profile_name_on_device"]
profileNameSSID = setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"]
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
#Set Wifi/AP Mode
set_APconnMobileDevice_iOS(request, downloadProfileSSID, downloadProfileSSIDPass, setup_perfectoMobile_iOS, connData)
#Install Profile
downloadInstallOpenRoamingProfile(request, profileDownloadURL, setup_perfectoMobile_iOS, connData)
#ForgetWifi Original
ForgetWifiConnection(request, setup_perfectoMobile_iOS, downloadProfileSSID, connData)
try:
assert verify_APconnMobileDevice_iOS(request, profileNameSSID, setup_perfectoMobile_iOS, connData)
#Verify Upload download Speed from device Selection
verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
except Exception as e:
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)
assert False
#Delete Profile Under Settings
deleteOpenRoamingInstalledProfile(request, profileName, setup_perfectoMobile_iOS, connData)