Merge pull request #55 from Telecominfraproject/WIFI-2430_passpoint

Passpoint libraries, fixtures and tests
This commit is contained in:
Shivam Thakur
2021-06-18 19:59:33 +05:30
committed by GitHub
7 changed files with 1498 additions and 15 deletions

View File

@@ -28,17 +28,17 @@ class ConfigureController:
def set_credentials(self, controller_data=None):
if dict(controller_data).keys().__contains__("username") and dict(controller_data).keys().__contains__(
"password"):
self.configuration.username = controller_data["username"]
self.configuration.password = controller_data["password"]
print("Login Credentials set to custom: \n user_id: %s\n password: %s\n" % (controller_data["username"],
controller_data["password"]))
return True
else:
self.configuration.username = "support@example.com"
self.configuration.password = "support"
print("Login Credentials set to default: \n user_id: %s\n password: %s\n" % ("support@example.com",
"support"))
return False
else:
self.configuration.username = controller_data["username"]
self.configuration.password = controller_data["password"]
print("Login Credentials set to custom: \n user_id: %s\n password: %s\n" % (controller_data['userId'],
controller_data['password']))
return True
def select_controller_data(self, controller_data=None):
if dict(controller_data).keys().__contains__("url") is None:
@@ -103,6 +103,8 @@ class Controller(ConfigureController):
"Authorization": "Bearer " + self.bearer._access_token
}
self.api_client.configuration.refresh_api_key_hook = self.refresh_instance
self.ping_response = self.portal_ping()
print("Portal details :: \n", self.ping_response)
except Exception as e:
self.bearer = False
print(e)
@@ -118,7 +120,7 @@ class Controller(ConfigureController):
def refresh_instance(self):
# Refresh token 10 seconds before it's expiry
if time.time() - self.token_timestamp > self.token_expiry:
if time.time() - self.token_timestamp > self.token_expiry - 10:
self.token_timestamp = time.time()
print("Refreshing the controller API token")
self.disconnect_Controller()
@@ -134,7 +136,7 @@ class Controller(ConfigureController):
}
self.api_client.configuration.refresh_api_key_hook = self.refresh_instance
self.ping_response = self.portal_ping()
# print(self.bearer)
print("Portal details :: \n", self.ping_response)
if self.ping_response._application_name != 'PortalServer':
print("Server not Reachable")
exit()
@@ -287,8 +289,13 @@ class ProfileUtility:
"ssid": [],
"ap": [],
"radius": [],
"rf": []
"rf": [],
"passpoint_osu_id_provider": [],
"passpoint_operator": [],
"passpoint_venue": [],
"passpoint": []
}
self.profile_name_with_id = {}
self.default_profiles = {}
self.profile_ids = []
@@ -298,8 +305,13 @@ class ProfileUtility:
"ssid": [],
"ap": [],
"radius": [],
"rf": []
"rf": [],
"passpoint_osu_id_provider": [],
"passpoint_operator": [],
"passpoint_venue": [],
"passpoint": []
}
self.profile_name_with_id = {}
self.default_profiles = {}
self.profile_ids = []
@@ -519,6 +531,7 @@ class ProfileUtility:
profile_id = profile._id
self.profile_creation_ids['ssid'].append(profile_id)
self.profile_ids.append(profile_id)
self.profile_name_with_id[profile_data["ssid_name"]] = profile_id
except Exception as e:
print(e)
profile = "error"
@@ -809,6 +822,258 @@ class ProfileUtility:
profile = False
return profile
def __get_boolean(self, flag):
return 'true' if flag in ["Enabled", "True"] else 'false'
# wpa eap general method
def __create_wpa_eap_passpoint_ssid_profiles(self, profile_data=None, secure_mode=None):
try:
if profile_data is None or secure_mode is None:
return False
default_profile = self.default_profiles["ssid"]
default_profile._details["appliedRadios"] = profile_data["appliedRadios"]
default_profile._name = profile_data["profile_name"]
default_profile._details["vlanId"] = profile_data["vlan"]
default_profile._details["ssid"] = profile_data["ssid_name"]
default_profile._details["forwardMode"] = profile_data["mode"]
default_profile._details["radiusServiceId"] = self.profile_creation_ids["radius"][0]
default_profile._child_profile_ids = self.profile_creation_ids["radius"]
default_profile._details["secureMode"] = secure_mode
profile = self.profile_client.create_profile(body=default_profile)
profile_id = profile._id
self.profile_creation_ids["ssid"].append(profile_id)
self.profile_ids.append(profile_id)
self.profile_name_with_id[profile_data["ssid_name"]] = profile_id
except Exception as e:
print(e)
profile = False
return profile
# wpa eap passpoint
def create_wpa_eap_passpoint_ssid_profile(self, profile_data=None):
if profile_data is None:
return False
return self.__create_wpa_eap_passpoint_ssid_profiles(profile_data, "wpaEAP")
# wpa2 eap passpoint
def create_wpa2_eap_passpoint_ssid_profile(self, profile_data=None):
if profile_data is None:
return False
return self.__create_wpa_eap_passpoint_ssid_profiles(profile_data, "wpa2EAP")
# wpa2only eap passpoint
def create_wpa2_only_eap_passpoint_ssid_profile(self, profile_data=None):
if profile_data is None:
return False
return self.__create_wpa_eap_passpoint_ssid_profiles(profile_data, "wpa2OnlyEAP")
# passpoint osu id provider profile
def create_passpoint_osu_id_provider_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = dict()
default_profile["model_type"] = "Profile"
default_profile["customerId"] = self.sdk_client.customer_id
default_profile["profileType"] = "passpoint_osu_id_provider"
default_profile["name"] = profile_data["profile_name"]
details = dict()
details["model_type"] = "PasspointOsuProviderProfile"
mcc_mnc = dict()
if (profile_data["mcc"] and profile_data["mnc"]) is not None:
mcc_mnc = {"mcc": profile_data["mcc"], "mnc": profile_data["mnc"]}
if profile_data["network"] is not None:
mcc_mnc["network"] = profile_data["network"]
if mcc_mnc:
details["mccMncList"] = [mcc_mnc]
if (profile_data["mcc"] and profile_data["mnc"]) is not None:
details["mccMncList"] = [{"mcc": profile_data["mcc"], "mnc": profile_data["mnc"]}]
if profile_data["osu_nai_standalone"] is not None:
details["osuNaiStandalone"] = profile_data["osu_nai_standalone"]
if profile_data["osu_nai_shared"] is not None:
details["osuNaiShared"] = profile_data["osu_nai_shared"]
if profile_data["nai_realms"] is not None:
details["naiRealmList"] = [{"naiRealms": [profile_data["nai_realms"]["domain"]],
"encoding": profile_data["nai_realms"]["encoding"],
"eapMap": profile_data["nai_realms"]["eap_map"]
}]
details["roamingOi"] = profile_data["roaming_oi"]
default_profile['details'] = details
default_profile['childProfileIds'] = []
profile = self.profile_client.create_profile(body=default_profile)
profile_id = profile._id
self.profile_creation_ids["passpoint_osu_id_provider"].append(profile_id)
self.profile_ids.append(profile_id)
except Exception as e:
print(e)
profile = False
return profile
# passpoint operator profile
def create_passpoint_operator_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = dict()
default_profile["model_type"] = "Profile"
default_profile["customerId"] = self.sdk_client.customer_id
default_profile["profileType"] = "passpoint_operator"
default_profile["name"] = profile_data["profile_name"]
default_profile["details"] = dict()
default_profile["details"]["model_type"] = "PasspointOperatorProfile"
default_profile["details"]["serverOnlyAuthenticatedL2EncryptionNetwork"] = \
self.__get_boolean(profile_data["osen"])
operator_names = []
operators = profile_data["operator_names"]
for operator in profile_data["operator_names"]:
operator_temp = dict()
for key in operator.keys():
if key == "name":
operator_temp["dupleName"] = operator["name"]
else:
operator_temp[key] = operator[key]
operator_names.append(operator_temp)
default_profile["details"]["operatorFriendlyName"] = operator_names
default_profile["details"]["domainNameList"] = profile_data["domain_name_list"]
default_profile["childProfileIds"] = []
profile = self.profile_client.create_profile(body=default_profile)
profile_id = profile._id
self.profile_creation_ids["passpoint_operator"].append(profile_id)
self.profile_ids.append(profile_id)
except Exception as e:
profile = False
return profile
# passpoint venue profile
def create_passpoint_venue_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = dict()
default_profile["model_type"] = "Profile"
default_profile["customerId"] = self.sdk_client.customer_id
default_profile["profileType"] = "passpoint_venue"
default_profile["name"] = profile_data["profile_name"]
default_profile["details"] = dict()
default_profile["details"]["model_type"] = "PasspointVenueProfile"
venue_names = []
for venue in profile_data["venue_names"]:
venue_temp = dict()
for key in venue.keys():
if key == "name":
venue_temp["dupleName"] = venue["name"]
if key == "url":
venue_temp["venueUrl"] = venue["url"]
venue_names.append(venue_temp)
default_profile["details"]["venueNameSet"] = venue_names
allowed_venue_groups = {"Unspecified": 0, "Assembly": 1, "Business": 2, "Educational": 3,
"Factory and Industrial": 4, "Institutional": 5, "Mercantile": 6, "Residential": 7}
allowed_venue_types = {"Unspecified Assembly": 0, "Areana": 1, "Stadium": 2, "Passenger Terminal": 3,
"Amphitheatre": 4, "Amusement Park": 5, "Place of Worship": 6,
"Convention Center": 7,
"Library": 8, "Museum": 9, "Restaurant": 10, "Theatre": 11, "Bar": 12,
"Coffee Shop": 13,
"Zoo or Aquarium": 14, "Emergency Coordination Center": 15,
"Unspecified Business": 0, "Doctor or Dentist office": 1, "Bank": 2,
"Fire Station": 3,
"Police Station": 4, "Post Office": 5, "Professional Office": 6,
"Research and Development Facility": 7, "Attorney Office": 8,
"Unspecified Educational": 0, "School, Primary": 1, "School, Secondary": 2,
"University or College": 3, "Unspecified Factory and Industrial": 0, "Factory": 1,
"Unspecified Institutional": 0, "Hospital": 1, "Long-Term Care Facility": 2,
"Alcohol and Drug Re-habilitation Center": 3, "Group Home": 4, "Prison or Jail": 5,
"Unspecified Mercantile": 0, "Retail Store": 1, "Grocery Market": 2,
"Automotive Service Station": 3, "Shopping Mall": 4, "Gas Station": 5,
"Unspecified Residential": 0, "Pivate Residence": 1, "Hotel or Model": 2,
"Dormitory": 3, "Boarding House": 4}
default_profile["details"]["venueTypeAssignment"] = {"venueGroupId":
allowed_venue_groups[
profile_data["venue_type"]["group"]],
"venueTypeId":
allowed_venue_types[
profile_data["venue_type"]["type"]]}
default_profile["childProfileIds"] = []
profile = self.profile_client.create_profile(body=default_profile)
profile_id = profile._id
self.profile_creation_ids["passpoint_venue"].append(profile_id)
self.profile_ids.append(profile_id)
except Exception as e:
print(e)
profile = False
return profile
# passpoint profile
def create_passpoint_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = dict()
default_profile["model_type"] = "Profile"
default_profile["customerId"] = self.sdk_client.customer_id
default_profile["profileType"] = "passpoint"
default_profile["name"] = profile_data["profile_name"]
default_profile["details"] = dict()
default_profile["details"]["model_type"] = "PasspointProfile"
default_profile["details"]["enableInterworkingAndHs20"] = self.__get_boolean(
profile_data["interworking_hs2dot0"])
if profile_data["hessid"] is not None:
default_profile["details"]["hessid"] = dict()
default_profile["details"]["hessid"]["addressAsString"] = profile_data["hessid"]
default_profile["details"]["passpointAccessNetworkType"] = \
profile_data["access_network"]["Access Network Type"].replace(' ', '_').lower()
default_profile["details"]["passpointNetworkAuthenticationType"] = \
profile_data["access_network"]["Authentication Type"].replace('&', 'and').replace(' ', '_').lower()
default_profile["details"]["emergencyServicesReachable"] = self.__get_boolean(
profile_data["access_network"][
"Emergency Services Reachable"])
default_profile["details"]["unauthenticatedEmergencyServiceAccessible"] = self.__get_boolean(
profile_data["access_network"][
"Unauthenticated Emergency Service"])
default_profile["details"]["internetConnectivity"] = self.__get_boolean(profile_data["ip_connectivity"][
"Internet Connectivity"])
capability_set = []
for cap in profile_data["ip_connectivity"]["Connection Capability"]:
capability_info = dict()
capability_info["connectionCapabilitiesPortNumber"] = cap["port"]
capability_info["connectionCapabilitiesIpProtocol"] = cap["protocol"]
capability_info["connectionCapabilitiesStatus"] = cap["status"]
capability_set.append(capability_info)
default_profile["details"]["connectionCapabilitySet"] = capability_set
default_profile["details"]["ipAddressTypeAvailability"] = profile_data["ip_connectivity"]["IP Address Type"]
allowed_gas_address_behavior = {"P2P Spec Workaround From Request": "p2pSpecWorkaroundFromRequest",
"forceNonCompliantBehaviourFromRequest": "forceNonCompliantBehaviourFromRequest",
"IEEE 80211 Standard Compliant Only": "ieee80211StandardCompliantOnly"}
default_profile["details"]["gasAddr3Behaviour"] = allowed_gas_address_behavior[
profile_data["ip_connectivity"]
["GAS Address 3 Behaviour"]]
default_profile["details"]["anqpDomainId"] = profile_data["ip_connectivity"]["ANQP Domain ID"]
default_profile["details"]["disableDownstreamGroupAddressedForwarding"] = self.__get_boolean(
profile_data["ip_connectivity"][
"Disable DGAF"])
default_profile["details"]["associatedAccessSsidProfileIds"] = profile_data["allowed_ssids"]
default_profile["details"]["passpointOperatorProfileId"] = self.profile_creation_ids["passpoint_operator"][0]
default_profile["details"]["passpointVenueProfileId"] = self.profile_creation_ids["passpoint_venue"][0]
default_profile["details"]["passpointOsuProviderProfileIds"] = self.profile_creation_ids[
"passpoint_osu_id_provider"]
default_profile["details"]["accessNetworkType"] = \
profile_data["access_network"]["Access Network Type"].replace(' ', '_').lower()
# osuSsidProfileId is needed for R2
default_profile["details"]["networkAuthenticationType"] = \
profile_data["access_network"]["Authentication Type"].replace('&', 'and').replace(' ', '_').lower()
default_profile["childProfileIds"] = self.profile_creation_ids["passpoint_venue"] + \
self.profile_creation_ids["passpoint_operator"] + \
self.profile_creation_ids["passpoint_osu_id_provider"]
profile = self.profile_client.create_profile(body=default_profile)
profile_id = profile._id
self.profile_creation_ids["passpoint"].append(profile_id)
self.profile_ids.append(profile_id)
except Exception as e:
print(e)
profile = False
return profile
"""
method call: used to create a ap profile that contains the given ssid profiles
"""
@@ -820,7 +1085,8 @@ class ProfileUtility:
default_profile = self.default_profiles['equipment_ap_2_radios']
default_profile._child_profile_ids = []
for i in self.profile_creation_ids:
if i != 'ap':
if i not in ["ap", "passpoint_osu_id_provider", "passpoint_operator", "passpoint_venue", "passpoint",
"radius"]:
for j in self.profile_creation_ids[i]:
default_profile._child_profile_ids.append(j)
@@ -831,11 +1097,61 @@ class ProfileUtility:
self.profile_ids.append(default_profile._id)
return default_profile
"""
method call: used to create a ap profile that contains the given ssid profiles
"""
def set_ap_profile_custom(self, profile_data=None):
self.sdk_client.refresh_instance()
if profile_data is None:
return False
default_profile = self.default_profiles['equipment_ap_2_radios']
default_profile._child_profile_ids = []
for i in self.profile_creation_ids:
if i not in ["ap", "passpoint_osu_id_provider", "passpoint_operator", "passpoint_venue", "passpoint",
"radius", "ssid"]:
for j in self.profile_creation_ids[i]:
default_profile._child_profile_ids.append(j)
for ssid in profile_data["ssid_names"]:
default_profile._child_profile_ids.append(self.profile_name_with_id[ssid])
default_profile._name = profile_data['profile_name']
default_profile = self.profile_client.create_profile(body=default_profile)
self.profile_creation_ids['ap'] = default_profile._id
self.profile_ids.append(default_profile._id)
return default_profile
"""
method call: used to create a ap profile that contains the specific ssid profiles
"""
def update_ap_profile(self, profile_data=None):
self.sdk_client.refresh_instance()
if profile_data is None:
print("profile info is None, Please specify the profile info that you want to update")
return False
child_profiles_to_apply = []
try:
for ssid in profile_data["ssid_names"]:
child_profiles_to_apply.append(self.profile_name_with_id[ssid])
default_profile = self.get_profile_by_name(profile_name=profile_data["profile_name"])
for i in self.profile_creation_ids:
if i not in ["ap", "passpoint_osu_id_provider", "passpoint_operator", "passpoint_venue", "passpoint",
"radius", "ssid"]:
for j in self.profile_creation_ids[i]:
child_profiles_to_apply.append(j)
default_profile._child_profile_ids = child_profiles_to_apply
default_profile = self.profile_client.update_profile(default_profile)
return True
except Exception as e:
print(e)
return False
"""
method call: used to create a radius profile with the settings given
"""
def create_radius_profile(self, radius_info=None):
def create_radius_profile(self, radius_info=None, radius_accounting_info=None):
self.sdk_client.refresh_instance()
default_profile = self.default_profiles['radius']
default_profile._name = radius_info['name']
@@ -843,6 +1159,11 @@ class ProfileUtility:
default_profile._details['primaryRadiusAuthServer']['ipAddress'] = radius_info['ip']
default_profile._details['primaryRadiusAuthServer']['port'] = radius_info['port']
default_profile._details['primaryRadiusAuthServer']['secret'] = radius_info['secret']
if radius_accounting_info is not None:
default_profile._details["primaryRadiusAccountingServer"] = {}
default_profile._details["primaryRadiusAccountingServer"]["ipAddress"] = radius_accounting_info["ip"]
default_profile._details["primaryRadiusAccountingServer"]["port"] = radius_accounting_info["port"]
default_profile._details["primaryRadiusAccountingServer"]["secret"] = radius_accounting_info["secret"]
default_profile = self.profile_client.create_profile(body=default_profile)
self.profile_creation_ids['radius'] = [default_profile._id]
self.profile_ids.append(default_profile._id)
@@ -885,6 +1206,44 @@ class ProfileUtility:
except Exception as e:
return False
def update_ssid_profile(self, profile_info=None):
self.sdk_client.refresh_instance()
if profile_info is None:
print("profile info is None, Please specify the profile info that you want to update")
return False
try:
profile = self.get_profile_by_name(profile_name=profile_info["ssid_profile_name"])
profile._details["radiusServiceId"] = self.profile_creation_ids["radius"][0]
profile._child_profile_ids = self.profile_creation_ids["radius"] + self.profile_creation_ids["passpoint"]
if "radius_configuration" in profile_info.keys():
if "radius_acounting_service_interval" in profile_info["radius_configuration"].keys():
profile._details["radiusAcountingServiceInterval"] = profile_info["radius_configuration"]["radius_acounting_service_interval"]
if "user_defined_nas_id" in profile_info["radius_configuration"].keys():
profile._details["radiusClientConfiguration"]["userDefinedNasId"] = profile_info["radius_configuration"]["user_defined_nas_id"]
if "operator_id" in profile_info["radius_configuration"].keys():
profile._details["radiusClientConfiguration"]["operatorId"] = profile_info["radius_configuration"]["operator_id"]
self.profile_client.update_profile(profile)
return True
except Exception as e:
print(e)
return False
def clear_ssid_profile(self, profile_name=None):
if profile_name is None:
print("profile name is None, Please specify the ssid profile name that you want to update")
return False
try:
profile = self.get_profile_by_name(profile_name=profile_name)
profile._details["radiusServiceId"] = None
profile._child_profile_ids = []
self.profile_client.update_profile(profile)
return True
except Exception as e:
print(e)
return False
"""
method to delete a profile by its id
"""

View File

@@ -172,6 +172,80 @@ RADIUS_SERVER_DATA = {
"pk_password": "whatever"
}
PASSPOINT_RADIUS_SERVER_DATA = {
"ip": "52.234.179.191",
"port": 11812,
"secret": "yeababy20!",
"user": "nolaradius",
"password": "nolastart",
"pk_password": "whatever"
}
PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA = {
"ip": "52.234.179.191",
"port": 11813,
"secret": "yeababy20!"
}
PASSPOINT_PROVIDER_INFO = {
"mcc": None,
"mnc": None,
"network": None,
"nai_realms": {
"domain": "oss.ameriband.com",
"encoding": 0,
"eap_map": {"EAP-TTLS with username/password": ["Credential Type:username/password",
"Non-EAP Inner Authentication Type:MSCHAPV2"]}
},
"osu_nai_standalone": "anonymous@ameriband.com",
"osu_nai_shared": "anonymous@ameriband.com",
"roaming_oi": []
}
PASSPOINT_OPERATOR_INFO = {
"osen": "Disabled",
"domain_name_list": ["telecominfraproject.atlassian.net"],
"operator_names": [
{"locale": "eng", "name": "Default friendly passpoint_operator name"},
{"locale": "fra", "name": "Nom de l'opérateur convivial par défaut"}
]
}
PASSPOINT_VENUE_INFO = {
"venue_type": {"group": "Business", "type": "Police Station"},
"venue_names": [
{"locale": "eng", "name": "Example passpoint_venue", "url": "http://www.example.com/info-eng"},
{"locale": "fra", "name": "Exemple de lieu", "url": "http://www.example.com/info-fra"}
]
}
PASSPOINT_PROFILE_INFO = {
"profile_download_url_ios": "https://onboard.almondlabs.net/ttls/AmeriBand-Profile.mobileconfig",
"profile_download_url_android": "https://onboard.almondlabs.net/ttls/androidconfig.cfg",
"profile_name_on_device": "AmeriBand",
"radius_configuration": {
"user_defined_nas_id": "FB001AP001",
"operator_id": "AmeribandTIP",
"radius_acounting_service_interval": 60
},
"interworking_hs2dot0": "Enabled",
"hessid": None,
"access_network": {
"Access Network Type": "Free Public Network",
"Authentication Type": "Acceptance of Terms & Conditions",
"Emergency Services Reachable": "Enabled",
"Unauthenticated Emergency Service": "Disabled",
},
"ip_connectivity": {
"Internet Connectivity": "Enabled",
"IP Address Type": "Public IPv4 Address Available",
"Connection Capability": [{"status": "open", "protocol": "TCP", "port": 8888}],
"ANQP Domain ID": 1234,
"GAS Address 3 Behaviour": "P2P Spec Workaround From Request",
"Disable DGAF": False
}
}
TEST_CASES = {
"ap_upgrade": 2233,
"5g_wpa2_bridge": 2236,
@@ -359,5 +433,4 @@ TEST_CASES = {
"5g_open_nat": 4322,
"2g_open_vlan": 9897,
"5g_open_vlan": 9898
}
}

View File

@@ -398,7 +398,7 @@ def get_security_flags():
"""used to get the essential markers on security and band"""
# Add more classifications as we go
security = ["open", "wpa", "wep", "wpa2_personal", "wpa3_personal", "wpa3_personal_mixed",
"wpa_wpa2_enterprise_mixed",
"wpa_wpa2_enterprise_mixed", "wpa2_eap", "wpa2_only_eap",
"wpa_wpa2_personal_mixed", "wpa_enterprise", "wpa2_enterprise", "wpa3_enterprise_mixed",
"wpa3_enterprise", "twog", "fiveg", "radius"]
yield security

View File

@@ -0,0 +1,391 @@
import os
import sys
sys.path.append(
os.path.dirname(
os.path.realpath(__file__)
)
)
if "libs" not in sys.path:
sys.path.append(f"../libs")
import time
import pytest
import allure
from collections import defaultdict
from lanforge.lf_tests import RunTest
from configuration import PASSPOINT_RADIUS_SERVER_DATA
from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA
from configuration import PASSPOINT_PROVIDER_INFO
from configuration import PASSPOINT_OPERATOR_INFO
from configuration import PASSPOINT_VENUE_INFO
from configuration import PASSPOINT_PROFILE_INFO
from controller.controller import ProfileUtility
@allure.feature("PASSPOINT CONNECTIVITY SETUP")
@pytest.fixture(scope="class")
def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_id,
instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info,
passpoint_venue_info, passpoint_profile_info,
get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos):
instantiate_profile = instantiate_profile(sdk_client=setup_controller)
vlan_id, mode = 0, 0
instantiate_profile.cleanup_objects()
parameter = dict(request.param)
test_cases = {}
profile_data = {}
if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]:
print("Invalid Mode: ", parameter["mode"])
allure.attach(body=parameter["mode"], name="Invalid Mode: ")
yield test_cases
if parameter["mode"] == "NAT":
mode = "NAT"
vlan_id = 1
if parameter["mode"] == "BRIDGE":
mode = "BRIDGE"
vlan_id = 1
if parameter["mode"] == "VLAN":
mode = "BRIDGE"
vlan_id = setup_vlan
ap_profile = testbed + "-Equipment-AP-Passpoint"
instantiate_profile.delete_profile_by_name(profile_name=ap_profile)
profile_data["equipment_ap"] = {"profile_name": ap_profile}
profile_data["ssid"] = {}
# Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for
# profile download - passpoint_profile_download
profile_data["allowed_ssids"] = []
for i in parameter["ssid_modes"]:
profile_data["ssid"][i] = []
for j in range(len(parameter["ssid_modes"][i])):
profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"]
data = parameter["ssid_modes"][i][j]
data["profile_name"] = profile_name
if "mode" not in dict(data).keys():
data["mode"] = mode
if "vlan" not in dict(data).keys():
data["vlan"] = vlan_id
instantiate_profile.delete_profile_by_name(profile_name=profile_name)
profile_data["ssid"][i].append(data)
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode)
time.sleep(10)
# RF Profile Creation
rf_profile_data = {
"name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"]
}
try:
instantiate_profile.delete_profile_by_name(profile_name=rf_profile_data["name"])
rf_profile_data = instantiate_profile.set_rf_profile(profile_data=rf_profile_data,
mode=get_configuration["access_point"][0]["mode"])
allure.attach(body=str(rf_profile_data),
name="RF Profile Created : " + get_configuration["access_point"][0]["mode"])
except Exception as e:
print(e)
allure.attach(body=str(e), name="Exception ")
# Radius Profile Creation
passpoint_radius_server_info = passpoint_radius_server_info
passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile"
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile")
try:
instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info,
radius_accounting_info=passpoint_radius_accounting_server_info)
test_cases["radius_profile"] = True
allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created")
except Exception as e:
print(e)
test_cases["radius_profile"] = False
# SSID Profile Creation
for mode in profile_data["ssid"]:
if mode == "open":
for j in profile_data["ssid"][mode]:
try:
if "is2dot4GHz" in list(j["appliedRadios"]):
creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j)
test_cases[j["ssid_name"]] = {"sdk": True}
allure.attach(body=str(creates_profile), name="SSID Profile Created")
except Exception as e:
print(e)
test_cases[j["ssid_name"]] = {"sdk": False}
allure.attach(body=str(e), name="SSID Profile Creation Failed")
if mode == "wpa_eap":
for j in profile_data["ssid"][mode]:
if mode in get_markers.keys() and get_markers[mode]:
try:
if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list(
j["appliedRadios"]):
creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j)
profile_data["allowed_ssids"].append(creates_profile._id)
test_cases[j["ssid_name"]] = {"sdk": True}
allure.attach(body=str(creates_profile), name="SSID Profile Created")
except Exception as e:
print(e)
test_cases[j["ssid_name"]] = {"sdk": False}
allure.attach(body=str(e), name="SSID Profile Creation Failed")
try:
if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list(
j["appliedRadios"]):
creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j)
profile_data["allowed_ssids"].append(creates_profile._id)
test_cases[j["ssid_name"]] = {"sdk": True}
allure.attach(body=str(creates_profile), name="SSID Profile Created")
except Exception as e:
print(e)
test_cases[j["wpa_eap_5g"]] = {"sdk": False}
allure.attach(body=str(e), name="SSID Profile Creation Failed")
if mode == "wpa2_eap":
for j in profile_data["ssid"][mode]:
if mode in get_markers.keys() and get_markers[mode]:
try:
if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list(
j["appliedRadios"]):
creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j)
profile_data["allowed_ssids"].append(creates_profile._id)
test_cases[j["ssid_name"]] = {"sdk": True}
allure.attach(body=str(creates_profile), name="SSID Profile Created")
except Exception as e:
print(e)
test_cases[j["ssid_name"]] = {"sdk": False}
allure.attach(body=str(e), name="SSID Profile Creation Failed")
try:
if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list(
j["appliedRadios"]):
creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j)
profile_data["allowed_ssids"].append(creates_profile._id)
test_cases[j["ssid_name"]] = {"sdk": True}
allure.attach(body=str(creates_profile), name="SSID Profile Created")
except Exception as e:
print(e)
test_cases[j["ssid_name"]] = {"sdk": False}
allure.attach(body=str(e), name="SSID Profile Creation Failed")
if mode == "wpa2_only_eap":
for j in profile_data["ssid"][mode]:
if mode in get_markers.keys() and get_markers[mode]:
try:
if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list(
j["appliedRadios"]):
creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile(
profile_data=j)
profile_data["allowed_ssids"].append(creates_profile._id)
test_cases[j["ssid_name"]] = {"sdk": True}
allure.attach(body=str(creates_profile), name="SSID Profile Created")
except Exception as e:
print(e)
test_cases[j["ssid_name"]] = {"sdk": False}
allure.attach(body=str(e), name="SSID Profile Creation Failed")
try:
if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list(
j["appliedRadios"]):
creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile(
profile_data=j)
profile_data["allowed_ssids"].append(creates_profile._id)
test_cases[j["ssid_name"]] = {"sdk": True}
allure.attach(body=str(creates_profile), name="SSID Profile Created")
except Exception as e:
print(e)
test_cases[j["ssid_name"]] = {"sdk": False}
allure.attach(body=str(e), name="SSID Profile Creation Failed")
# Passpoint OSU ID provider profile creation
passpoint_provider_info = passpoint_provider_info
test_cases["passpoint_osu_id_provider"] = dict()
profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile"
passpoint_provider_info["profile_name"] = profile_name
instantiate_profile.delete_profile_by_name(profile_name=profile_name)
try:
creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile(
profile_data=passpoint_provider_info)
allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created")
test_cases["passpoint_osu_id_provider"] = {"sdk": True}
except Exception as e:
print(e)
test_cases["passpoint_osu_id_provider"] = {"sdk": False}
allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed")
# Passpoint operator profile creation
test_cases["passpoint_operator_profile"] = dict()
passpoint_operator_info = passpoint_operator_info
profile_name = testbed + "-Automation-Passpoint-Operator-Profile"
passpoint_operator_info["profile_name"] = profile_name
instantiate_profile.delete_profile_by_name(profile_name=profile_name)
try:
creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info)
allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created")
test_cases["passpoint_operator_profile"] = {"sdk": True}
profile_data["passpoint_operator"] = profile_name
except Exception as e:
print(e)
test_cases["passpoint_operator_profile"] = {"sdk": False}
allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed")
# Passpoint Venue profile creation
passpoint_venue_info = passpoint_venue_info
test_cases["passpoint_venue_profile"] = dict()
profile_name = testbed + "-Automation-Passpoint-Venue-Profile"
passpoint_venue_info["profile_name"] = profile_name
instantiate_profile.delete_profile_by_name(profile_name=profile_name)
try:
creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info)
allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created")
test_cases["passpoint_venue_profile"] = {"sdk": True}
profile_data["passpoint_venue"] = profile_name
except Exception as e:
print(e)
test_cases["passpoint_venue"] = {"sdk": False}
allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed")
# Passpoint profile creation
passpoint_profile_info = passpoint_profile_info
profile_name = testbed + "-Automation-Passpoint-Profile"
passpoint_profile_info["profile_name"] = profile_name
passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"]
instantiate_profile.delete_profile_by_name(profile_name=profile_name)
try:
creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info)
allure.attach(body=str(creates_profile), name="Passpoint Profile Created")
test_cases["passpoint"] = {"sdk": True}
profile_data["passpoint"] = profile_name
except Exception as e:
print(e)
test_cases["passpoint"] = {"sdk": False}
allure.attach(body=str(e), name="Passpoint Profile Creation Failed")
# Update SSID profile with passpoint config
passpoint_profile_info = passpoint_profile_info
ssid_to_apply = None
for ssid_profile in profile_data["ssid"].keys():
for ssid in profile_data["ssid"][ssid_profile]:
if ssid["ssid_name"] == "passpoint_profile_download":
ssid_to_apply = ssid["ssid_name"]
continue
if ssid["ssid_name"] in test_cases.keys():
allure.attach(body=str(ssid), name="Updating SSID profile")
passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"]
instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info)
# Equipment AP Profile Creation
ap_profile_info = dict()
ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"]
ap_profile_info["ssid_names"] = [ssid_to_apply]
try:
instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info)
test_cases["equipment_ap"] = {"sdk": True}
allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created")
except Exception as e:
print(e)
test_cases["equipment_ap"] = {"sdk": False}
allure.attach(body=str(e), name="Equipment AP Profile Creation Failed")
def teardown_session():
print("\nRemoving Profiles")
instantiate_profile.delete_profile_by_name(profile_name=profile_data['equipment_ap']['profile_name'])
instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["ssid"])
instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["radius"])
instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["rf"])
instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_osu_id_provider"])
instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_operator"])
instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"])
instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"])
allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"),
name="Tear Down in Profiles ")
time.sleep(20)
request.addfinalizer(teardown_session)
yield test_cases, instantiate_profile, profile_data
@pytest.fixture(scope="function")
def push_ap_profile(request, setup_profiles, get_equipment_id, get_apnos, get_configuration):
parameter = dict(request.param)
test_cases, instantiate_profile, profile_data = setup_profiles
ssid_names = parameter["ssid_names"]
ap_profile_info = dict()
ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"]
test_cases = {}
ap_profile_info["ssid_names"] = ssid_names
try:
instantiate_profile.update_ap_profile(profile_data=ap_profile_info)
test_cases["equipment_ap"] = {"sdk": True}
allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated")
except Exception as e:
print(e)
test_cases["equipment_ap"] = {"sdk": False}
allure.attach(body=str(e), name="Equipment AP Profile Update Failed")
print("Pushing profiles on AP :: ", ap_profile_info)
allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP :: ")
# Push the Equipment AP Profile to AP
try:
for i in get_equipment_id:
instantiate_profile.push_profile_old_method(equipment_id=i)
except Exception as e:
print(e)
print("failed to push AP Profile")
# Check the VIF Config and VIF State of SSIDs
time_start = time.time()
ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/")
while time.time() - time_start < 240:
if ((time.time() - time_start) / 10) == 15:
ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/")
vif_config = list(ap_ssh.get_vif_config_ssids())
vif_config.sort()
vif_state = list(ap_ssh.get_vif_state_ssids())
vif_state.sort()
for ssid in ssid_names:
test_cases[ssid] = dict()
test_cases[ssid]["vif_config"] = True if ssid in vif_config else False
test_cases[ssid]["vif_state"] = True if ssid in vif_state else False
ssid_names.sort()
if vif_config == ssid_names == vif_state:
print("Waiting for Radios to apply config ")
time.sleep(200)
break
time.sleep(10)
allure.attach(body=str(vif_config), name="vifC status on AP :: ")
allure.attach(body=str(vif_state), name="vifS status on AP :: ")
yield test_cases
@pytest.fixture(scope="session")
def passpoint_radius_server_info():
allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ")
yield PASSPOINT_RADIUS_SERVER_DATA
@pytest.fixture(scope="session")
def passpoint_radius_accounting_server_info():
allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ")
yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA
@pytest.fixture(scope="session")
def passpoint_provider_info():
allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ")
yield PASSPOINT_PROVIDER_INFO
@pytest.fixture(scope="session")
def passpoint_operator_info():
allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ")
yield PASSPOINT_OPERATOR_INFO
@pytest.fixture(scope="session")
def passpoint_venue_info():
allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ")
yield PASSPOINT_VENUE_INFO
@pytest.fixture(scope="session")
def passpoint_profile_info():
allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ")
yield PASSPOINT_PROFILE_INFO

View File

@@ -0,0 +1,220 @@
"""
EAP Passpoint Test: BRIDGE Mode
pytest -m "interop_iOS and eap_passpoint and bridge"
"""
import allure
import pytest
pytestmark = [pytest.mark.interop_iOS, pytest.mark.eap_passpoint, pytest.mark.bridge]
setup_params_eap = {
"mode": "BRIDGE",
"ssid_modes": {
"open": [
{"ssid_name": "passpoint_profile_download", "appliedRadios": ["is2dot4GHz"]}
],
"wpa2_eap": [
{"ssid_name": "ssid_wpa2_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
],
"wpa2_only_eap": [
{"ssid_name": "ssid_wpa2_only_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_only_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
]
}
}
@allure.feature("BRIDGE MODE EAP PASSPOINT SETUP")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_eap],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestBRIDGEModeEapAuth(object):
"""
EAP Passpoint BRIDGE Mode
pytest -m "interop_iOS and eap_passpoint and bridge"
"""
def test_eap_passpoint_osu_id_provider_creation(self, setup_profiles):
"""
EAP Passpoint BRIDGE Mode : OSU ID provider profile creation
pytest -m "interop_iOS and eap_passpoint and bridge"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_osu_id_provider']['sdk']
if result:
allure.attach(name="OSU ID provider profile creation successful ", body="")
else:
allure.attach(name="OSU ID provider profile creation failed ", body="")
assert result
def test_eap_passpoint_operator_creation(self, setup_profiles):
"""
EAP Passpoint BRIDGE Mode : Passpoint operator profile creation
pytest -m "interop_iOS and eap_passpoint and bridge"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_operator_profile']['sdk']
if result:
allure.attach(name="Passpoint operator profile creation successful ", body="")
else:
allure.attach(name="Passpoint operator profile creation failed ", body="")
assert result
def test_eap_passpoint_venue_creation(self, setup_profiles):
"""
EAP Passpoint BRIDGE Mode : Passpoint venue provider profile creation
pytest -m "interop_iOS and eap_passpoint and bridge"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_venue_profile']['sdk']
if result:
allure.attach(name="Passpoint venue provider profile creation successful ", body="")
else:
allure.attach(name="Passpoint venue provider profile creation failed ", body="")
assert result
def test_eap_passpoint_creation(self, setup_profiles):
"""
EAP Passpoint BRIDGE Mode : Passpoint profile creation
pytest -m "interop_iOS and eap_passpoint and bridge"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint']['sdk']
if result:
allure.attach(name="Passpoint profile creation successful ", body="")
else:
allure.attach(name="Passpoint profile creation failed ", body="")
assert result
@pytest.mark.wpa2_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_eap_2g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint BRIDGE Mode
pytest -m "interop_iOS and eap_passpoint and bridge and wpa2_eap and twog"
"""
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_eap_5g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint BRIDGE Mode
pytest -m "interop_iOS and eap_passpoint and bridge and wpa2_eap and fiveg"
"""
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_only_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_only_eap_2g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint BRIDGE Mode
pytest -m "interop_iOS and eap_passpoint and bridge and wpa2_only_eap and twog"
"""
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_only_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_only_eap_5g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint BRIDGE Mode
pytest -m "interop_iOS and eap_passpoint and bridge and wpa2_only_eap and fiveg"
"""
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])

View File

@@ -0,0 +1,220 @@
"""
EAP Passpoint Test: NAT Mode
pytest -m "interop_iOS and eap_passpoint and nat"
"""
import allure
import pytest
pytestmark = [pytest.mark.interop_iOS, pytest.mark.eap_passpoint, pytest.mark.nat]
setup_params_eap = {
"mode": "NAT",
"ssid_modes": {
"open": [
{"ssid_name": "passpoint_profile_download", "appliedRadios": ["is2dot4GHz"]}
],
"wpa2_eap": [
{"ssid_name": "ssid_wpa2_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
],
"wpa2_only_eap": [
{"ssid_name": "ssid_wpa2_only_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_only_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
]
}
}
@allure.feature("NAT MODE EAP PASSPOINT SETUP")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_eap],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestNATModeEapAuth(object):
"""
EAP Passpoint NAT Mode
pytest -m "interop_iOS and eap_passpoint and nat"
"""
def test_eap_passpoint_osu_id_provider_creation(self, setup_profiles):
"""
EAP Passpoint NAT Mode : OSU ID provider profile creation
pytest -m "interop_iOS and eap_passpoint and nat"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_osu_id_provider']['sdk']
if result:
allure.attach(name="OSU ID provider profile creation successful ", body="")
else:
allure.attach(name="OSU ID provider profile creation failed ", body="")
assert result
def test_eap_passpoint_operator_creation(self, setup_profiles):
"""
EAP Passpoint NAT Mode : Passpoint operator profile creation
pytest -m "interop_iOS and eap_passpoint and nat"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_operator_profile']['sdk']
if result:
allure.attach(name="Passpoint operator profile creation successful ", body="")
else:
allure.attach(name="Passpoint operator profile creation failed ", body="")
assert result
def test_eap_passpoint_venue_creation(self, setup_profiles):
"""
EAP Passpoint NAT Mode : Passpoint venue provider profile creation
pytest -m "interop_iOS and eap_passpoint and nat"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_venue_profile']['sdk']
if result:
allure.attach(name="Passpoint venue provider profile creation successful ", body="")
else:
allure.attach(name="Passpoint venue provider profile creation failed ", body="")
assert result
def test_eap_passpoint_creation(self, setup_profiles):
"""
EAP Passpoint NAT Mode : Passpoint profile creation
pytest -m "interop_iOS and eap_passpoint and nat"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint']['sdk']
if result:
allure.attach(name="Passpoint profile creation successful ", body="")
else:
allure.attach(name="Passpoint profile creation failed ", body="")
assert result
@pytest.mark.wpa2_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_eap_2g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint NAT Mode
pytest -m "interop_iOS and eap_passpoint and nat and wpa2_eap and twog"
"""
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_eap_5g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint NAT Mode
pytest -m "interop_iOS and eap_passpoint and nat and wpa2_eap and fiveg"
"""
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_only_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_only_eap_2g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint NAT Mode
pytest -m "interop_iOS and eap_passpoint and nat and wpa2_only_eap and twog"
"""
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_only_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_only_eap_5g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint NAT Mode
pytest -m "interop_iOS and eap_passpoint and nat and wpa2_only_eap and fiveg"
"""
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])

View File

@@ -0,0 +1,220 @@
"""
EAP Passpoint Test: VLAN Mode
pytest -m "interop_iOS and eap_passpoint and vlan"
"""
import allure
import pytest
pytestmark = [pytest.mark.interop_iOS, pytest.mark.eap_passpoint, pytest.mark.vlan]
setup_params_eap = {
"mode": "VLAN",
"ssid_modes": {
"open": [
{"ssid_name": "passpoint_profile_download", "appliedRadios": ["is2dot4GHz"]}
],
"wpa2_eap": [
{"ssid_name": "ssid_wpa2_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
],
"wpa2_only_eap": [
{"ssid_name": "ssid_wpa2_only_eap_passpoint_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa2_only_eap_passpoint_5g", "appliedRadios": ["is5GHz"]}
]
}
}
@allure.feature("VLAN MODE EAP PASSPOINT SETUP")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_eap],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestVLANModeEapAuth(object):
"""
EAP Passpoint VLAN Mode
pytest -m "interop_iOS and eap_passpoint and vlan"
"""
def test_eap_passpoint_osu_id_provider_creation(self, setup_profiles):
"""
EAP Passpoint VLAN Mode : OSU ID provider profile creation
pytest -m "interop_iOS and eap_passpoint and vlan"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_osu_id_provider']['sdk']
if result:
allure.attach(name="OSU ID provider profile creation successful ", body="")
else:
allure.attach(name="OSU ID provider profile creation failed ", body="")
assert result
def test_eap_passpoint_operator_creation(self, setup_profiles):
"""
EAP Passpoint VLAN Mode : Passpoint operator profile creation
pytest -m "interop_iOS and eap_passpoint and vlan"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_operator_profile']['sdk']
if result:
allure.attach(name="Passpoint operator profile creation successful ", body="")
else:
allure.attach(name="Passpoint operator profile creation failed ", body="")
assert result
def test_eap_passpoint_venue_creation(self, setup_profiles):
"""
EAP Passpoint VLAN Mode : Passpoint venue provider profile creation
pytest -m "interop_iOS and eap_passpoint and vlan"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint_venue_profile']['sdk']
if result:
allure.attach(name="Passpoint venue provider profile creation successful ", body="")
else:
allure.attach(name="Passpoint venue provider profile creation failed ", body="")
assert result
def test_eap_passpoint_creation(self, setup_profiles):
"""
EAP Passpoint VLAN Mode : Passpoint profile creation
pytest -m "interop_iOS and eap_passpoint and vlan"
"""
test_cases, instantiate_profile, profile_data = setup_profiles
result = test_cases['passpoint']['sdk']
if result:
allure.attach(name="Passpoint profile creation successful ", body="")
else:
allure.attach(name="Passpoint profile creation failed ", body="")
assert result
@pytest.mark.wpa2_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_eap_2g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint VLAN Mode
pytest -m "interop_iOS and eap_passpoint and vlan and wpa2_eap and twog"
"""
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_2g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_eap_5g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint VLAN Mode
pytest -m "interop_iOS and eap_passpoint and vlan and wpa2_eap and fiveg"
"""
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_eap_passpoint_5g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_only_eap
@pytest.mark.twog
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_2g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_only_eap_2g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint VLAN Mode
pytest -m "interop_iOS and eap_passpoint and vlan and wpa2_only_eap and twog"
"""
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_2g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_2g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][0]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])
@pytest.mark.wpa2_only_eap
@pytest.mark.fiveg
@pytest.mark.parametrize(
'push_ap_profile',
[{"ssid_names": ["ssid_wpa2_only_eap_passpoint_5g", "passpoint_profile_download"]}],
indirect=True,
scope="function"
)
@pytest.mark.usefixtures("push_ap_profile")
def test_wpa2_only_eap_5g(self, passpoint_profile_info, push_ap_profile):
"""
EAP Passpoint VLAN Mode
pytest -m "interop_iOS and eap_passpoint and vlan and wpa2_only_eap and fiveg"
"""
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_config']
if result:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config push to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
assert result
result = push_ap_profile['ssid_wpa2_only_eap_passpoint_5g']['vif_state']
if result:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g successful ", body="")
else:
allure.attach(name="Config apply to AP for ssid_wpa2_only_eap_passpoint_5g failed", body="")
assert result
print("SSID to download profile :: ", setup_params_eap["ssid_modes"]["open"][0]["ssid_name"])
print("SSID to validate connectivity :: ", setup_params_eap["ssid_modes"]["wpa2_only_eap"][1]["ssid_name"])
print("Profile download URL :: ", passpoint_profile_info["profile_download_url_ios"])
print("Profile name to remove :: ", passpoint_profile_info["profile_name_on_device"])