Merge pull request #364 from Telecominfraproject/WIFI-6531

Wifi 6531
This commit is contained in:
Shivam Thakur
2022-01-27 22:06:10 +05:30
committed by GitHub
9 changed files with 3552 additions and 0 deletions

View File

@@ -2453,3 +2453,656 @@ def captive_portal_ios(request, WifiName, WifiPass, setup_perfectoMobile, connDa
# --------------------- close app-------------------------------
#closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
#--------------------------------Gets ip address from ssid but it won't get disconnected from it------------------
def get_ip_add_ios(request, WifiName, WifiPass, setup_perfectoMobile, connData):
print("\n-------------------------------------")
print("Select Wifi/Get IP Address IOS Connection")
print("-------------------------------------")
reportFlag = True
is_internet = False
ip_address_element_text = False
print("Verifying Wifi/AP Connection Details....")
report = setup_perfectoMobile[1]
driver = setup_perfectoMobile[0]
report.step_start("Switching Driver Context")
print("Switching Context to Native")
driver.switch_to.context('NATIVE_APP')
# driver.switch_to.context(contexts[0])
report.step_start("Set Wifi Network to " + WifiName)
# Open Settings Application
openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
try:
time.sleep(2)
driver.implicitly_wait(2)
try:
print("Verifying Connected Wifi Connection")
report.step_start("Loading Wifi Page")
element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']")
element.click()
except NoSuchElementException:
print("Exception: Verify Xpath - unable to click on Wifi")
time.sleep(2)
driver.implicitly_wait(2)
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text
try:
if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
driver.implicitly_wait(1)
get_wifi_switch_element.click()
driver.implicitly_wait(1)
i = 0
for i in range(5):
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']")
get_wifi_switch_element_text = get_wifi_switch_element.text
except:
print("Switch is OFF")
if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1:
print("WIFI Switch is ON")
break
else:
try:
get_wifi_switch_element = driver.find_element_by_xpath(
"//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text
except:
print("WIFi switch is ON")
if (get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0):
print("switch is still OFF")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
else:
print("Switch is Still OFF")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
except:
print("No switch element found")
except:
print("get_wifi_switch_element is ON")
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
except:
print("Cannot find WIFI element")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
# ---------------------This is to Forget current connected SSID-------------------------------
try:
time.sleep(3)
print("getting in to Additional details")
report.step_start("Clicking More Info")
additional_details_element = driver.find_element_by_xpath("//*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']")
additional_details_element.click()
try:
print("Forget Connected Network")
forget_ssid = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget This Network']")))
forget_ssid.click()
print("Forget old ssid")
try:
report.step_start("Forget SSID popup1")
forget_ssid_popup = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Forget']")))
forget_ssid_popup.click()
print("**alert** Forget SSID popup killed **alert**")
except:
print("Forget SSID popup not found")
except:
print("couldn't find forget ssid element")
except:
print("No connected SSID")
# ---------------------This is to Forget current connected SSID-------------------------------
# ---------------------To get all available SSID-------------------------------
print("Searching for Wifi: " + WifiName)
# allure.attach(name= body=str("Searching for Wifi: " + WifiName))
time.sleep(2)
report.step_start("Searching SSID")
print("Selecting Wifi: " + WifiName)
ssid_found = False
available_ssids = False
try:
for check_for_all_ssids in range(9):
available_ssids = get_all_available_ssids(driver)
allure.attach(name="Available SSIDs in device: ", body=str(available_ssids))
try:
if WifiName not in available_ssids:
scrollDown(setup_perfectoMobile)
time.sleep(2)
else:
report.step_start("Selecting SSID To Connect")
ssid_found = True
print(WifiName + " : Found in Device")
wifiSelElement = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']")))
print(wifiSelElement)
wifiSelElement.click()
print("Selecting SSID")
# allure.attach(name= body=str(WifiName + " : Found in Device"))
break
except:
print("couldn't connect to " + WifiName)
#request.config.cache.set(key="SelectingWifiFailed", value=str(e))
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
pass
if not ssid_found:
print("could not found " + WifiName + " in device")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
except:
pass
# ---------------------To get all available SSID-------------------------------
# ---------------------This is to Select SSID-------------------------------
# ---------------------This is to Select SSID-------------------------------
# ---------------------Set Password-------------------------------
try:
time.sleep(3)
print("Entering Password")
report.step_start("Entering Password")
wifiPassword = driver.find_element_by_xpath("//*[@label='Password']")
wifiPassword.send_keys(WifiPass)
except NoSuchElementException:
print("Enter Password Page Not Loaded")
# ---------------------Set Password-------------------------------
# ---------------------Click on join-------------------------------
try:
time.sleep(2)
print("Selecting join")
report.step_start("Clicking JOIN")
joinBTN = driver.find_element_by_xpath("//*[@label='Join']")
joinBTN.click()
except Exception as e:
print("Join Button Not Enabled...Password may not be needed")
# ---------------------Click on join-------------------------------
# ---------------------check if internet-------------------------------
try:
WifiInternetErrMsg2 = WebDriverWait(driver, 5).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='No Internet Connection']")))
# = driver.find_element_by_xpath("//*[@label='No Internet Connection']").text
except Exception as e:
is_internet = True
print("No Wifi-AP Error Internet Error: " + WifiName)
# Need to add Wait for Selected Wifi Xpath
# time.sleep(3)
# ---------------------check if internet-------------------------------
# ---------------------Additional INFO-------------------------------
try:
print("Selecting SSID: ", WifiName)
report.step_start("Additional details of SSID")
additional_details_element = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@label='" + WifiName + "']")))
# //*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']
additional_details_element.click()
try:
report.step_start("Checking SSID Name as Expected")
print("Checking SSID Name")
ssidname_text = driver.find_element_by_xpath("//*[@label='" + WifiName + "']").text
print(ssidname_text)
if(ssidname_text == WifiName):
print("SSID Matched")
allure.attach(name="SSID Matched ", body=str(WifiName))
else:
print("SSID Not Matched")
allure.attach(name="SSID Not Matched ", body=str(WifiName))
reportFlag = False
assert reportFlag
except:
print("SSID is not Checked in more Info")
try:
report.step_start("Checking WiFi Address")
print("Checking WIFI address")
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
wifi_address_element_text = driver.find_element_by_xpath(
"(//*[@label='Wi-Fi Address']/parent::*/XCUIElementTypeStaticText)[2]").text
print("wifi_address_element_text: ", wifi_address_element_text)
allure.attach(name="Connected SSID WiFi-Address: ", body=str(wifi_address_element_text))
except Exception as e:
print("WiFi-Address not Found")
try:
report.step_start("Checking IP Address")
print("Checking IP address")
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
ip_address_element_text = driver.find_element_by_xpath(
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
print("ip_address_element_text: ", ip_address_element_text)
except Exception as e:
print("IP Address not Found")
request.config.cache.set(key="select IP failed", value=str(e))
except Exception as e:
request.config.cache.set(key="select additional info failed", value=str(e))
# ---------------------Additional INFO-------------------------------
# --------------------- close app-------------------------------
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
#----------------Gets ip address of Enterprise ssids and won't forget it---------------
def get_ip_add_eap_ios(request, WifiName, User, ttls_passwd, setup_perfectoMobile, connData):
print("\n-------------------------------------")
print("Get IP Address Enterprise IOS Connection")
print("-------------------------------------")
reportFlag = True
is_internet = False
ip_address_element_text = False
print("Verifying Wifi/AP Connection Details....")
report = setup_perfectoMobile[1]
driver = setup_perfectoMobile[0]
report.step_start("Switching Driver Context")
print("Switching Context to Native")
driver.switch_to.context('NATIVE_APP')
# driver.switch_to.context(contexts[0])
report.step_start("Set Wifi Network to " + WifiName)
# Open Settings Application
openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
try:
time.sleep(2)
driver.implicitly_wait(2)
try:
print("Verifying Connected Wifi Connection")
report.step_start("Loading Wifi Page")
element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']")
element.click()
except NoSuchElementException:
print("Exception: Verify Xpath - unable to click on Wifi")
time.sleep(2)
driver.implicitly_wait(2)
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text
try:
if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
driver.implicitly_wait(1)
get_wifi_switch_element.click()
driver.implicitly_wait(1)
i = 0
for i in range(5):
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']")
get_wifi_switch_element_text = get_wifi_switch_element.text
except:
print("switch is OFF")
if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1:
print("WIFI Switch is ON")
break
else:
try:
get_wifi_switch_element = driver.find_element_by_xpath(
"//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text
except:
print("WIFi switch is ON")
if (get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0):
print("switch is still OFF")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
else:
print("Switch is Still OFF")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
except:
print("No switch element found")
except:
print("get_wifi_switch_element is ON")
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
except:
print("Cannot find WIFI element")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
# ---------------------This is to Forget current connected SSID-------------------------------
try:
time.sleep(2)
report.step_start("Selecting Connected SSID Info")
print("getting in to Additional details")
additional_details_element = driver.find_element_by_xpath(
"//*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']")
additional_details_element.click()
try:
print("Forget Connected Network")
report.step_start("Forget Connected SSID")
forget_ssid = driver.find_element_by_xpath("//*[@label='Forget This Network']")
forget_ssid.click()
print("Forget old ssid")
try:
report.step_start("Forget SSID popup1")
forget_ssid_popup = driver.find_element_by_xpath("//*[@label='Forget']")
forget_ssid_popup.click()
print("**alert** Forget SSID popup killed **alert**")
except:
print("Forget SSID popup not found")
except:
print("couldn't find forget ssid element")
except:
print("No connected SSID")
# ---------------------This is to Forget current connected SSID-------------------------------
# ---------------------To get all available SSID-------------------------------
print("Searching for Wifi: " + WifiName)
# allure.attach(name= body=str("Searching for Wifi: " + WifiName))
time.sleep(2)
print("Selecting Wifi: " + WifiName)
ssid_found = False
available_ssids = False
try:
for check_for_all_ssids in range(9):
available_ssids = get_all_available_ssids(driver)
allure.attach(name="Available SSIDs in device: ", body=str(available_ssids))
try:
if WifiName not in available_ssids:
scrollDown(setup_perfectoMobile)
time.sleep(2)
else:
report.step_start("Selecting SSID To Connect")
ssid_found = True
print(WifiName + " : Found in Device")
wifiSelElement = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='" + WifiName + "']")))
print(wifiSelElement)
wifiSelElement.click()
print("Selecting SSID")
# allure.attach(name= body=str(WifiName + " : Found in Device"))
break
except:
print("couldn't connect to " + WifiName)
# request.config.cache.set(key="SelectingWifiFailed", value=str(e))
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
pass
if not ssid_found:
print("could not found " + WifiName + " in device")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
except:
pass
# ---------------------To get all available SSID-------------------------------
# Set username
# -------------------------------------------------------
try:
driver.implicitly_wait(5)
report.step_start("Entering User")
print("Entering User name")
wifiUserElement = driver.find_element_by_xpath("//*[@label='Username']")
wifiUserElement.send_keys(User)
except NoSuchElementException:
print("Password Page Not Loaded, password May be cached in the System")
# -------------------------------------------------------
# ---------------------Set Password-------------------------------
try:
driver.implicitly_wait(5)
report.step_start("Entering Password")
print("Entering password")
wifiPassword = driver.find_element_by_xpath("//*[@label='Password']")
wifiPassword.send_keys(ttls_passwd)
except NoSuchElementException:
print("Enter Password Page Not Loaded")
# ---------------------Set Password-------------------------------
# -------------------------------------------------------
# ---------------------Click on join-------------------------------
try:
report.step_start("Clicking Join")
print("Clicking Join")
joinBTN = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Join']")))
joinBTN.click()
except Exception as e:
print("Join Button Not Enabled...Password may not be needed")
# ---------------------Click on join-------------------------------
# Selecting certificate
# -------------------------------------------------------
try:
report.step_start("Clicking Trust CA Cert")
print("Clicking Trust CA Cert")
certElement = WebDriverWait(driver, 30).until(EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='Trust']")))
certElement.click()
except NoSuchElementException:
print("Password Page Not Loaded, password May be cached in the System")
# ---------------------check if internet-------------------------------
try:
report.step_start("Checking Internet connection")
WifiInternetErrMsg2 = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@label='No Internet Connection']")))
# = driver.find_element_by_xpath("//*[@label='No Internet Connection']").text
except Exception as e:
is_internet = True
print("No Wifi-AP Error Internet Error: " + WifiName)
# Need to add Wait for Selected Wifi Xpath
# time.sleep(3)
# ---------------------check if internet-------------------------------
# ---------------------Additional INFO-------------------------------
try:
driver.implicitly_wait(2)
print("Selecting SSID: ", WifiName)
report.step_start("Selecting More Info")
additional_details_element = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@label='" + WifiName + "']")))
# //*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']
additional_details_element.click()
try:
report.step_start("Checking SSID Name as Expected")
print("Checking SSID Name")
ssidname_text = driver.find_element_by_xpath("//*[@label='" + WifiName + "']").text
print(ssidname_text)
if(ssidname_text == WifiName):
print("SSID Matched")
allure.attach(name="SSID Matched ", body=str(WifiName))
else:
print("SSID Not Matched")
allure.attach(name="SSID Not Matched ", body=str(WifiName))
reportFlag = False
assert reportFlag
except:
print("SSID is not Checked in more Info")
try:
report.step_start("Checking WiFi Address")
print("Checking WIFI address")
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
wifi_address_element_text = driver.find_element_by_xpath(
"(//*[@label='Wi-Fi Address']/parent::*/XCUIElementTypeStaticText)[2]").text
print("wifi_address_element_text: ", wifi_address_element_text)
allure.attach(name="Connected SSID WiFi-Address: ", body=str(wifi_address_element_text))
except Exception as e:
print("WiFi-Address not Found")
allure.attach(name="No Connected SSID WiFi-Address Found")
try:
driver.implicitly_wait(5)
print("Checking IP address")
report.step_start("Checking IP address")
time.sleep(4)
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
ip_address_element_text = driver.find_element_by_xpath(
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
print("ip_address_element_text: ", ip_address_element_text)
except Exception as e:
print("IP Address not Found")
request.config.cache.set(key="select IP failed", value=str(e))
except Exception as e:
request.config.cache.set(key="select additional info failed", value=str(e))
# ---------------------Additional INFO-------------------------------
# --------------------- close app-------------------------------
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
#------------------Gets the ip address of already connected ssid---------------------------------------
def get_ip_add_check_ios(request, WifiName, WifiPass, setup_perfectoMobile, connData):
print("\n-------------------------------------")
print("Select Wifi/Get IP Address IOS Connection")
print("-------------------------------------")
reportFlag = True
is_internet = False
ip_address_element_text = False
print("Verifying Wifi/AP Connection Details....")
report = setup_perfectoMobile[1]
driver = setup_perfectoMobile[0]
report.step_start("Switching Driver Context")
print("Switching Context to Native")
driver.switch_to.context('NATIVE_APP')
# driver.switch_to.context(contexts[0])
report.step_start("Set Wifi Network to " + WifiName)
# Open Settings Application
openApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
try:
time.sleep(2)
driver.implicitly_wait(2)
try:
print("Verifying Connected Wifi Connection")
report.step_start("Loading Wifi Page")
element = driver.find_element_by_xpath("//XCUIElementTypeCell[@name='Wi-Fi']")
element.click()
except NoSuchElementException:
print("Exception: Verify Xpath - unable to click on Wifi")
time.sleep(2)
driver.implicitly_wait(2)
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text
try:
if get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='0']")
driver.implicitly_wait(1)
get_wifi_switch_element.click()
driver.implicitly_wait(1)
i = 0
for i in range(5):
try:
get_wifi_switch_element = driver.find_element_by_xpath("//*[@label='Wi-Fi' and @value='1']")
get_wifi_switch_element_text = get_wifi_switch_element.text
except:
print("Switch is OFF")
if get_wifi_switch_element_text == "1" or get_wifi_switch_element_text == 1:
print("WIFI Switch is ON")
break
else:
try:
get_wifi_switch_element = driver.find_element_by_xpath(
"//*[@label='Wi-Fi' and @value='0']")
get_wifi_switch_element_text = get_wifi_switch_element.text
except:
print("WIFi switch is ON")
if (get_wifi_switch_element_text == "0" or get_wifi_switch_element_text == 0):
print("switch is still OFF")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
else:
print("Switch is Still OFF")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
except:
print("No switch element found")
except:
print("get_wifi_switch_element is ON")
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
except:
print("Cannot find WIFI element")
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet
# ---------------------Additional INFO-------------------------------
try:
print("Selecting SSID: ", WifiName)
report.step_start("Additional details of SSID")
additional_details_element = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@label='" + WifiName + "']")))
# //*[@label='selected']/parent::*/parent::*/XCUIElementTypeButton[@label='More Info']
additional_details_element.click()
try:
report.step_start("Checking SSID Name as Expected")
print("Checking SSID Name")
ssidname_text = driver.find_element_by_xpath("//*[@label='" + WifiName + "']").text
print(ssidname_text)
if(ssidname_text == WifiName):
print("SSID Matched")
allure.attach(name="SSID Matched ", body=str(WifiName))
else:
print("SSID Not Matched")
allure.attach(name="SSID Not Matched ", body=str(WifiName))
reportFlag = False
assert reportFlag
except:
print("SSID is not Checked in more Info")
try:
report.step_start("Checking WiFi Address")
print("Checking WIFI address")
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
wifi_address_element_text = driver.find_element_by_xpath(
"(//*[@label='Wi-Fi Address']/parent::*/XCUIElementTypeStaticText)[2]").text
print("wifi_address_element_text: ", wifi_address_element_text)
allure.attach(name="Connected SSID WiFi-Address: ", body=str(wifi_address_element_text))
except Exception as e:
print("WiFi-Address not Found")
try:
report.step_start("Checking IP Address")
print("Checking IP address")
# (//*[@label="IP Address"]/parent::*/XCUIElementTypeStaticText)[2]
ip_address_element_text = driver.find_element_by_xpath(
"(//*[@label='IP Address']/parent::*/XCUIElementTypeStaticText)[2]").text
print("ip_address_element_text: ", ip_address_element_text)
except Exception as e:
print("IP Address not Found")
request.config.cache.set(key="select IP failed", value=str(e))
except Exception as e:
request.config.cache.set(key="select additional info failed", value=str(e))
# ---------------------Additional INFO-------------------------------
# --------------------- close app-------------------------------
closeApp(connData["bundleId-iOS-Settings"], setup_perfectoMobile)
return ip_address_element_text, is_internet

View File

@@ -0,0 +1,342 @@
from logging import exception
import io
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 random
import string
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \
Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\
verifyUploadDownloadSpeediOS, get_ip_add_eap_ios, get_ip_add_check_ios, wifi_connect_eap, wifi_disconnect_and_forget
pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, pytest.mark.client_reconnect
, pytest.mark.bridge, pytest.mark.enterprise, pytest.mark.ToggleAirplaneMode]
setup_params_enterprise = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"]}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}],
"wpa_enterprise": [
{"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}]},
"rf": {},
"radius": True
}
for sec_modes in setup_params_enterprise['ssid_modes'].keys():
for i in range(len(setup_params_enterprise['ssid_modes'][sec_modes])):
N = 3
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string
@allure.suite(suite_name="interop Regression")
@allure.sub_suite(sub_suite_name="Bridge Mode EAP Client ReConnect : Suite-A")
@pytest.mark.suiteA
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_enterprise],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeBridgeModeEnterpriseTTLSSuiteA(object):
""" SuiteA Enterprise Test Cases
pytest -m "client_reconnect and bridge and enterprise and ttls and interop and suiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6545", name="WIFI-6545")
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA2_Eap_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6546", name="WIFI-6546")
@pytest.mark.twog
@pytest.mark.wpa2_enterprise
def test_ToggleAirplaneMode_2g_WPA2_Eap_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6547", name="WIFI-6547")
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA3_Eap_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
""" wpa2 enterprise 5g
pytest -m "client_connect and bridge and enterprise and ttls and wpa_enterprise and fiveg"
"""
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS,
connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6548", name="WIFI-6548")
@pytest.mark.twog
@pytest.mark.wpa3_enterprise
def test_ToggleAirplaneMode_2g_WPA3_Eap_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6543", name="WIFI-6543")
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA_Eap_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
""" wpa enterprise 5g
pytest -m "client_connect and bridge and enterprise and ttls and wpa_enterprise and fiveg"
"""
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6544", name="WIFI-6544")
@pytest.mark.twog
@pytest.mark.wpa_enterprise
def test_ToggleAirplaneMode_2g_WPA_Eap_Bridge(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False

View File

@@ -0,0 +1,624 @@
from logging import exception
import io
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 random
import string
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \
Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\
verifyUploadDownloadSpeediOS, get_ip_add_ios, get_ip_add_check_ios, wifi_connect, wifi_disconnect_and_forget
pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios,
pytest.mark.client_reconnect, pytest.mark.bridge, pytest.mark.ToggleAirplaneMode]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["5G"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["5G"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
for sec_modes in setup_params_general['ssid_modes'].keys():
for i in range(len(setup_params_general['ssid_modes'][sec_modes])):
N = 3
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_general['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="Bridge Mode Client Reconnect : Suite-A")
@pytest.mark.InteropsuiteA
@allure.feature("BRIDGE MODE CLIENT RECONNECT")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeSuiteOneBridge(object):
""" Client Connectivity SuiteA
pytest -m "client_reconnect and bridge and InteropsuiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6531", name="WIFI-6531")
@pytest.mark.fiveg
@pytest.mark.wpa2_personal
def test_ToggleAirplaneMode_5g_WPA2_Personal_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6532", name="WIFI-6532")
@pytest.mark.twog
@pytest.mark.wpa2_personal
def test_ToggleAirplaneMode_2g_WPA2_Personal_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6533", name="WIFI-6533")
@pytest.mark.fiveg
@pytest.mark.wpa
def test_ToggleAirplaneMode_5g_WPA_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6534", name="WIFI-6534")
@pytest.mark.twog
@pytest.mark.wpa
def test_ToggleAirplaneMode_2g_WPA_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6537", name="WIFI-6537")
@pytest.mark.fiveg
@pytest.mark.open
def test_ToggleAirplaneMode_5g_Open_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6538", name="WIFI-6538")
@pytest.mark.twog
@pytest.mark.open
def test_ToggleAirplaneMode_2g_Open_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
setup_params_general_two = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa3_personal": [
{"ssid_name": "ssid_wpa3_p_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa3_p_5g", "appliedRadios": ["5G"],
"security_key": "something"}],
"wpa3_personal_mixed": [
{"ssid_name": "ssid_wpa3_p_m_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa3_p_m_5g", "appliedRadios": ["5G"],
"security_key": "something"}],
"wpa_wpa2_personal_mixed": [
{"ssid_name": "ssid_wpa_wpa2_p_m_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa_wpa2_p_m_5g", "appliedRadios": ["5G"],
"security_key": "something"}]
},
"rf": {},
"radius": False
}
for sec_modes in setup_params_general_two['ssid_modes'].keys():
for i in range(len(setup_params_general_two['ssid_modes'][sec_modes])):
N = 2
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_general_two['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general_two['ssid_modes'][sec_modes][i]['ssid_name'].replace("ssid_","") + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="Bridge Mode Client Reconnect : Suite-B")
@pytest.mark.InteropsuiteB
@allure.feature("BRIDGE MODE CLIENT Reconnect")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general_two],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeSuiteBridgeTwo(object):
""" Client Connectivity SuiteA
pytest -m "client_reconnect and bridge and InteropsuiteB"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6535", name="WIFI-6535")
@pytest.mark.fiveg
@pytest.mark.wpa3_personal
def test_ToggleAirplaneMode_5g_wpa3_personal_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6536", name="WIFI-6536")
@pytest.mark.twog
@pytest.mark.wpa3_personal
def test_ToggleAirplaneMode_2g_wpa3_personal_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6539", name="WIFI-6539")
@pytest.mark.fiveg
@pytest.mark.wpa3_personal_mixed
def test_ToggleAirplaneMode_5g_wpa3_personal_mixed_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal_mixed"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6540", name="WIFI-6540")
@pytest.mark.twog
@pytest.mark.wpa3_personal_mixed
def test_ToggleAirplaneMode_2g_wpa3_personal_mixed_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal_mixed"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6541", name="WIFI-6541")
@pytest.mark.fiveg
@pytest.mark.wpa_wpa2_personal_mixed
def test_ToggleAirplaneMode_5g_wpa_wpa2_personal_mixed_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa_wpa2_personal_mixed"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6542", name="WIFI-6542")
@pytest.mark.twog
@pytest.mark.wpa_wpa2_personal_mixed
def test_ToggleAirplaneMode_2g_wpa_wpa2_personal_mixed_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa_wpa2_personal_mixed"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
# ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False

View File

@@ -0,0 +1,342 @@
from logging import exception
import io
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 random
import string
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \
Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\
verifyUploadDownloadSpeediOS, get_ip_add_eap_ios, get_ip_add_check_ios, wifi_connect_eap, wifi_disconnect_and_forget
pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, pytest.mark.client_reconnect
,pytest.mark.ToggleAirplaneMode, pytest.mark.nat, pytest.mark.enterprise]
setup_params_enterprise = {
"mode": "NAT",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"]}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}],
"wpa_enterprise": [
{"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}]},
"rf": {},
"radius": True
}
for sec_modes in setup_params_enterprise['ssid_modes'].keys():
for i in range(len(setup_params_enterprise['ssid_modes'][sec_modes])):
N = 3
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="Nat Mode EAP Client ReConnect : Suite-A")
@pytest.mark.suiteA
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_enterprise],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeNatModeEnterpriseTTLSSuiteA(object):
""" SuiteA Enterprise Test Cases
pytest -m "client_reconnect and nat and enterprise and ttls and interop and suiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6561", name="WIFI-6561")
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA2_Eap_Nat(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6562", name="WIFI-6562")
@pytest.mark.twog
@pytest.mark.wpa2_enterprise
def test_ToggleAirplaneMode_2g_WPA2_Eap_Nat(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6563", name="WIFI-6563")
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA3_Eap_Nat(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
""" wpa2 enterprise 5g
pytest -m "client_connect and bridge and enterprise and ttls and wpa_enterprise and fiveg"
"""
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS,
connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6564", name="WIFI-6564")
@pytest.mark.twog
@pytest.mark.wpa3_enterprise
def test_ToggleAirplaneMode_2g_WPA3_Eap_Nat(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6559", name="WIFI-6559")
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA_Eap_Nat(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
""" wpa enterprise 5g
pytest -m "client_connect and bridge and enterprise and ttls and wpa_enterprise and fiveg"
"""
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6560", name="WIFI-6560")
@pytest.mark.twog
@pytest.mark.wpa_enterprise
def test_ToggleAirplaneMode_2g_WPA_Eap_Nat(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False

View File

@@ -0,0 +1,626 @@
from logging import exception
import io
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 random
import string
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \
Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\
verifyUploadDownloadSpeediOS, get_ip_add_ios, get_ip_add_check_ios, wifi_connect, wifi_disconnect_and_forget
pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios,
pytest.mark.client_reconnect, pytest.mark.ToggleAirplaneMode, pytest.mark.nat]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["5G"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["5G"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
for sec_modes in setup_params_general['ssid_modes'].keys():
for i in range(len(setup_params_general['ssid_modes'][sec_modes])):
N = 3
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_general['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="Nat Mode Client Reconnect : Suite-A")
@pytest.mark.InteropsuiteA
@allure.feature("NAT MODE CLIENT RECONNECT")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeSuiteOneNat(object):
""" Client Connectivity SuiteA
pytest -m "client_reconnect and nat and InteropsuiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6549", name="WIFI-6549")
@pytest.mark.fiveg
@pytest.mark.wpa2_personal
def test_ToggleAirplaneMode_5g_WPA2_Personal_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6550", name="WIFI-6550")
@pytest.mark.twog
@pytest.mark.wpa2_personal
def test_ToggleAirplaneMode_2g_WPA2_Personal_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6553", name="WIFI-6553")
@pytest.mark.fiveg
@pytest.mark.wpa
def test_ToggleAirplaneMode_5g_WPA_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6554", name="WIFI-6554")
@pytest.mark.twog
@pytest.mark.wpa
def test_ToggleAirplaneMode_2g_WPA_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6569", name="WIFI-6569")
@pytest.mark.fiveg
@pytest.mark.open
def test_ToggleAirplaneMode_5g_Open_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6570", name="WIFI-6570")
@pytest.mark.twog
@pytest.mark.open
def test_ToggleAirplaneMode_2g_Open_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
setup_params_general_two = {
"mode": "NAT",
"ssid_modes": {
"wpa3_personal": [
{"ssid_name": "ssid_wpa3_p_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa3_p_5g", "appliedRadios": ["5G"],
"security_key": "something"}],
"wpa3_personal_mixed": [
{"ssid_name": "ssid_wpa3_p_m_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa3_p_m_5g", "appliedRadios": ["5G"],
"security_key": "something"}],
"wpa_wpa2_personal_mixed": [
{"ssid_name": "ssid_wpa_wpa2_p_m_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa_wpa2_p_m_5g", "appliedRadios": ["5G"],
"security_key": "something"}]
},
"rf": {},
"radius": False
}
for sec_modes in setup_params_general_two['ssid_modes'].keys():
for i in range(len(setup_params_general_two['ssid_modes'][sec_modes])):
N = 3
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_general_two['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general_two['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="NAT Mode Client Reconnect : Suite-B")
@pytest.mark.InteropsuiteB
@allure.feature("NAT MODE CLIENT Reconnect")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general_two],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeSuiteNatTwo(object):
""" Client Connectivity SuiteA
pytest -m "client_reconnect and nat and InteropsuiteB"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6551", name="WIFI-6551")
@pytest.mark.fiveg
@pytest.mark.wpa3_personal
def test_ToggleAirplaneMode_5g_wpa3_personal_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6552", name="WIFI-6552")
@pytest.mark.twog
@pytest.mark.wpa3_personal
def test_ToggleAirplaneMode_2g_wpa3_personal_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6555", name="WIFI-6555")
@pytest.mark.fiveg
@pytest.mark.wpa3_personal_mixed
def test_ToggleAirplaneMode_5g_wpa3_personal_mixed_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal_mixed"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6556", name="WIFI-6556")
@pytest.mark.twog
@pytest.mark.wpa3_personal_mixed
def test_ToggleAirplaneMode_2g_wpa3_personal_mixed_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal_mixed"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6557", name="WIFI-6557")
@pytest.mark.fiveg
@pytest.mark.wpa_wpa2_personal_mixed
def test_ToggleAirplaneMode_5g_wpa_wpa2_personal_mixed_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa_wpa2_personal_mixed"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6558", name="WIFI-6558")
@pytest.mark.twog
@pytest.mark.wpa_wpa2_personal_mixed
def test_ToggleAirplaneMode_2g_wpa_wpa2_personal_mixed_NAT(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa_wpa2_personal_mixed"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
# ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False

View File

@@ -0,0 +1,342 @@
from logging import exception
import io
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 random
import string
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \
Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\
verifyUploadDownloadSpeediOS, get_ip_add_eap_ios, get_ip_add_check_ios, wifi_connect_eap, wifi_disconnect_and_forget
pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios, pytest.mark.client_reconnect
,pytest.mark.ToggleAirplaneMode, pytest.mark.vlan, pytest.mark.enterprise]
setup_params_enterprise = {
"mode": "VLAN",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan": 100},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan": 100}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"], "vlan": 100},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"], "vlan": 100}],
"wpa_enterprise": [
{"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"], "vlan": 100},
{"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"], "vlan": 100}]},
"rf": {},
"radius": True
}
for sec_modes in setup_params_enterprise['ssid_modes'].keys():
for i in range(len(setup_params_enterprise['ssid_modes'][sec_modes])):
N = 3
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_enterprise['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="VLAN Mode EAP Client ReConnect : Suite-A")
@pytest.mark.suiteA
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_enterprise],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeVlanModeEnterpriseTTLSSuiteA(object):
""" SuiteA Enterprise Test Cases
pytest -m "client_reconnect and vlan and enterprise and ttls and interop and suiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6585", name="WIFI-6585")
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA2_Eap_VLAN(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6586", name="WIFI-6586")
@pytest.mark.twog
@pytest.mark.wpa2_enterprise
def test_ToggleAirplaneMode_2g_WPA2_Eap_VLAN(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6587", name="WIFI-6587")
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA3_Eap_VLAN(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
""" wpa2 enterprise 5g
pytest -m "client_connect and bridge and enterprise and ttls and wpa_enterprise and fiveg"
"""
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS,
connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6588", name="WIFI-6588")
@pytest.mark.twog
@pytest.mark.wpa3_enterprise
def test_ToggleAirplaneMode_2g_WPA3_Eap_VLAN(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6583", name="WIFI-6583")
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_ToggleAirplaneMode_5g_WPA_Eap_VLAN(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
""" wpa enterprise 5g
pytest -m "client_connect and bridge and enterprise and ttls and wpa_enterprise and fiveg"
"""
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6584", name="WIFI-6584")
@pytest.mark.twog
@pytest.mark.wpa_enterprise
def test_ToggleAirplaneMode_2g_WPA_Eap_VLAN(self, request, get_vif_state, get_ToggleAirplaneMode_data
, setup_perfectoMobile_iOS, radius_info, get_ap_logs):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ["BLANK"]
# ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
# print ("SSID_PASS: " + ssidPassword)
ttls_passwd = radius_info["password"]
identity = radius_info['user']
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_eap_ios(request, ssidName, identity, ttls_passwd, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False

View File

@@ -0,0 +1,623 @@
from logging import exception
import io
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 random
import string
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \
Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\
get_ip_add_ios, get_ip_add_check_ios
pytestmark = [pytest.mark.regression, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios,
pytest.mark.client_reconnect, pytest.mark.ToggleAirplaneMode, pytest.mark.vlan]
setup_params_general = {
"mode": "VLAN",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["2G"], "vlan": 100},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["5G"], "vlan": 100}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["5G"],
"security_key": "something", "vlan": 100}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"],
"security_key": "something", "vlan": 100}]},
"rf": {},
"radius": False
}
for sec_modes in setup_params_general['ssid_modes'].keys():
for i in range(len(setup_params_general['ssid_modes'][sec_modes])):
N = 3
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_general['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general['ssid_modes'][sec_modes][i]['ssid_name'] + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="Vlan Mode Client Reconnect : Suite-A")
@pytest.mark.InteropsuiteA
@allure.feature("VLAN MODE CLIENT RECONNECT")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeSuiteOneVLAN(object):
""" Client Connectivity SuiteA
pytest -m "client_reconnect and vlan and InteropsuiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6571", name="WIFI-6571")
@pytest.mark.fiveg
@pytest.mark.wpa2_personal
def test_ToggleAirplaneMode_5g_WPA2_Personal_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6572", name="WIFI-6572")
@pytest.mark.twog
@pytest.mark.wpa2_personal
def test_ToggleAirplaneMode_2g_WPA2_Personal_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6575", name="WIFI-6575")
@pytest.mark.fiveg
@pytest.mark.wpa
def test_ToggleAirplaneMode_5g_WPA_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6576", name="WIFI-6576")
@pytest.mark.twog
@pytest.mark.wpa
def test_ToggleAirplaneMode_2g_WPA_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6577", name="WIFI-6577")
@pytest.mark.fiveg
@pytest.mark.open
def test_ToggleAirplaneMode_5g_Open_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6578", name="WIFI-6578")
@pytest.mark.twog
@pytest.mark.open
def test_ToggleAirplaneMode_2g_Open_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
setup_params_general_two = {
"mode": "VLAN",
"ssid_modes": {
"wpa3_personal": [
{"ssid_name": "ssid_wpa3_p_2g", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100},
{"ssid_name": "ssid_wpa3_p_5g", "appliedRadios": ["5G"],
"security_key": "something", "vlan": 100}],
"wpa3_personal_mixed": [
{"ssid_name": "ssid_wpa3_p_m_2g", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100},
{"ssid_name": "ssid_wpa3_p_m_5g", "appliedRadios": ["5G"],
"security_key": "something", "vlan": 100}],
"wpa_wpa2_personal_mixed": [
{"ssid_name": "ssid_wpa_wpa2_p_m_2g", "appliedRadios": ["2G"], "security_key": "something", "vlan": 100},
{"ssid_name": "ssid_wpa_wpa2_p_m_5g", "appliedRadios": ["5G"],
"security_key": "something", "vlan": 100}]
},
"rf": {},
"radius": False
}
for sec_modes in setup_params_general_two['ssid_modes'].keys():
for i in range(len(setup_params_general_two['ssid_modes'][sec_modes])):
N = 2
rand_string = (''.join(random.choices(string.ascii_uppercase +
string.digits, k=N)))+str(int(time.time_ns())%10000)
setup_params_general_two['ssid_modes'][sec_modes][i]['ssid_name'] = setup_params_general_two['ssid_modes'][sec_modes][i]['ssid_name'].replace("ssid_","") + "_"+ rand_string
@allure.suite(suite_name="interop regression")
@allure.sub_suite(sub_suite_name="VLAN Mode Client Reconnect : Suite-B")
@pytest.mark.InteropsuiteB
@allure.feature("VLAN MODE CLIENT Reconnect")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general_two],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestToggleAirplaneModeSuiteVLANTwo(object):
""" Client Connectivity SuiteA
pytest -m "client_reconnect and vlan and InteropsuiteB"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6573", name="WIFI-6573")
@pytest.mark.fiveg
@pytest.mark.wpa3_personal
def test_ToggleAirplaneMode_5g_wpa3_personal_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6574", name="WIFI-6574")
@pytest.mark.twog
@pytest.mark.wpa3_personal
def test_ToggleAirplaneMode_2g_wpa3_personal_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6579", name="WIFI-6579")
@pytest.mark.fiveg
@pytest.mark.wpa3_personal_mixed
def test_ToggleAirplaneMode_5g_wpa3_personal_mixed_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal_mixed"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6580", name="WIFI-6580")
@pytest.mark.twog
@pytest.mark.wpa3_personal_mixed
def test_ToggleAirplaneMode_2g_wpa3_personal_mixed_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa3_personal_mixed"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6581", name="WIFI-6581")
@pytest.mark.fiveg
@pytest.mark.wpa_wpa2_personal_mixed
def test_ToggleAirplaneMode_5g_wpa_wpa2_personal_mixed_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa_wpa2_personal_mixed"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-6582", name="WIFI-6582")
@pytest.mark.twog
@pytest.mark.wpa_wpa2_personal_mixed
def test_ToggleAirplaneMode_2g_wpa_wpa2_personal_mixed_VLAN(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general_two["ssid_modes"]["wpa_wpa2_personal_mixed"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
# ssidPassword = "[BLANK]"
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = get_ip_add_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
#
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
# wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
Toggle_AirplaneMode_iOS(request, setup_perfectoMobile_iOS, connData)
ip_check, is_internet_check = get_ip_add_check_ios(request, ssidName, ssidPassword,
setup_perfectoMobile_iOS, connData)
if (ip_check == ip):
assert True
else:
assert False
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False