mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-01 11:28:09 +00:00
Basic Code Refactoring and Setup for Unit Tests
This commit is contained in:
30
libs/ap_plus_sdk.py
Normal file
30
libs/ap_plus_sdk.py
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
from lab_ap_info import *
|
||||
from JfrogHelper import GetBuild
|
||||
from ap_ssh import ssh_cli_active_fw
|
||||
|
||||
def check_latest_fw(jfrog=None,
|
||||
ap_latest_dict=None,
|
||||
buildid=None):
|
||||
|
||||
############################################################################
|
||||
#################### Jfrog Firmware Check ##################################
|
||||
############################################################################
|
||||
for model in ap_models:
|
||||
# cloudModel = cloud_sdk_models[model]
|
||||
###Check Latest FW on jFrog
|
||||
jfrog_url = 'https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/'
|
||||
url = jfrog_url + model + "/dev/"
|
||||
Build: GetBuild = GetBuild(jfrog["user"], jfrog["pass"])
|
||||
latest_image = Build.get_latest_image(url, buildid)
|
||||
print(model, "Latest FW on jFrog:", latest_image)
|
||||
ap_latest_dict[model] = latest_image
|
||||
return ap_latest_dict
|
||||
|
||||
|
||||
def get_ap_info(args):
|
||||
return ssh_cli_active_fw(args)
|
||||
pass
|
||||
|
||||
|
||||
@@ -839,14 +839,16 @@ class CloudSDK:
|
||||
|
||||
|
||||
|
||||
|
||||
# Library for creating AP Profiles
|
||||
class CreateAPProfiles:
|
||||
|
||||
def __init__(self,
|
||||
command_line_args,
|
||||
cloud = None,
|
||||
cloud_type= "v1",
|
||||
client = None
|
||||
cloud=None,
|
||||
cloud_type="v1",
|
||||
client=None,
|
||||
fw_model=None
|
||||
):
|
||||
|
||||
self.rid = None
|
||||
@@ -860,7 +862,7 @@ class CreateAPProfiles:
|
||||
self.radius_profile = None
|
||||
self.radius_name = None
|
||||
self.cloud = cloud
|
||||
self.client= client
|
||||
self.client = client
|
||||
self.cloud_type = cloud_type
|
||||
self.customer_id = command_line_args.customer_id
|
||||
self.ap_cli_info = ssh_cli_active_fw(self.command_line_args)
|
||||
@@ -868,7 +870,7 @@ class CreateAPProfiles:
|
||||
print("cloud cannot be None")
|
||||
exit()
|
||||
self.ap_cli_fw = self.ap_cli_info['active_fw']
|
||||
self.bearer = self.cloud.get_bearer(self.command_line_args.sdk_base_url , self.cloud_type)
|
||||
self.bearer = self.cloud.get_bearer(self.command_line_args.sdk_base_url, self.cloud_type)
|
||||
self.radius_info = {
|
||||
|
||||
"name": "Lab-RADIUS",
|
||||
@@ -882,22 +884,199 @@ class CreateAPProfiles:
|
||||
"auth_port": 1812
|
||||
}
|
||||
self.ap_models = ["ec420", "ea8300", "ecw5211", "ecw5410"]
|
||||
self.fw_model = fw_model
|
||||
self.report_data = {}
|
||||
self.report_data['tests'] = dict.fromkeys(self.ap_models, "")
|
||||
self.test_cases = {
|
||||
"radius_profile" : None,
|
||||
"ssid_5g_eap_bridge" : None,
|
||||
"ssid_5g_wpa2_bridge" : None,
|
||||
"ssid_5g_wpa_bridge" : None,
|
||||
"ssid_2g_eap_bridge" : None,
|
||||
"ssid_2g_wpa2_bridge" : None,
|
||||
"ssid_2g_wpa_bridge" : None,
|
||||
"ap_bridge" : None,
|
||||
"bridge_vifc" : None,
|
||||
"bridge_vifs" : None
|
||||
"radius_profile": None,
|
||||
"ssid_5g_eap_bridge": None,
|
||||
"ssid_5g_wpa2_bridge": None,
|
||||
"ssid_5g_wpa_bridge": None,
|
||||
"ssid_2g_eap_bridge": None,
|
||||
"ssid_2g_wpa2_bridge": None,
|
||||
"ssid_2g_wpa_bridge": None,
|
||||
"ap_bridge": None,
|
||||
"bridge_vifc": None,
|
||||
"bridge_vifs": None
|
||||
}
|
||||
self.profile_data, self.prof_names, self.prof_names_eap = self.create_profile_data(self.command_line_args,
|
||||
self.fw_model)
|
||||
self.ssid_data, self.psk_data = self.create_ssid_data(self.command_line_args, self.fw_model)
|
||||
|
||||
def create_profile_data(self, args, fw_model):
|
||||
profile_data = {
|
||||
"5g": {"eap":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP_VLAN")
|
||||
},
|
||||
"wpa":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA_VLAN")
|
||||
},
|
||||
"wpa2":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2_VLAN")
|
||||
}
|
||||
},
|
||||
"2g": {"eap":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP_VLAN")
|
||||
},
|
||||
"wpa":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA_VLAN")
|
||||
},
|
||||
"wpa2":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2_VLAN")
|
||||
}
|
||||
}
|
||||
}
|
||||
prof_names = [profile_data["5g"]["wpa2"]["name"], profile_data["5g"]["wpa"]["name"],
|
||||
profile_data["2g"]["wpa2"]["name"], profile_data["2g"]["wpa"]["name"],
|
||||
profile_data["5g"]["wpa2"]["nat"], profile_data["5g"]["wpa"]["nat"],
|
||||
profile_data["2g"]["wpa2"]["nat"], profile_data["2g"]["wpa"]["nat"],
|
||||
profile_data["5g"]["wpa2"]["vlan"], profile_data["5g"]["wpa"]["vlan"],
|
||||
profile_data["2g"]["wpa2"]["vlan"], profile_data["2g"]["wpa"]["vlan"]]
|
||||
|
||||
prof_names_eap = [profile_data["5g"]["eap"]["name"], profile_data["2g"]["eap"]["name"],
|
||||
profile_data["5g"]["eap"]["nat"], profile_data["2g"]["eap"]["nat"],
|
||||
profile_data["5g"]["eap"]["vlan"], profile_data["2g"]["eap"]["vlan"]]
|
||||
|
||||
return profile_data, prof_names, prof_names_eap
|
||||
|
||||
def create_ssid_data(self, args, fw_model):
|
||||
ssid_data = {
|
||||
"5g": {"eap":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP_VLAN")
|
||||
},
|
||||
"wpa":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA_VLAN")
|
||||
},
|
||||
"wpa2":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2_VLAN")
|
||||
}
|
||||
},
|
||||
"2g": {
|
||||
"eap":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP_VLAN")
|
||||
},
|
||||
"wpa":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA_VLAN")
|
||||
},
|
||||
"wpa2":
|
||||
{
|
||||
"name": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2"),
|
||||
"nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2_NAT"),
|
||||
"vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2_VLAN")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
psk_data = {
|
||||
"5g":
|
||||
{
|
||||
"wpa":
|
||||
{
|
||||
"name": "%s-%s" % (fw_model, "5G_WPA"),
|
||||
"nat": "%s-%s" % (fw_model, "5G_WPA_NAT"),
|
||||
"vlan": "%s-%s" % (fw_model, "5G_WPA_VLAN")
|
||||
},
|
||||
"wpa2":
|
||||
{
|
||||
"name": "%s-%s" % (fw_model, "5G_WPA2"),
|
||||
"nat": "%s-%s" % (fw_model, "5G_WPA2_NAT"),
|
||||
"vlan": "%s-%s" % (fw_model, "5G_WPA2_VLAN")
|
||||
}
|
||||
},
|
||||
"2g":
|
||||
{
|
||||
"wpa":
|
||||
{
|
||||
"name": "%s-%s" % (fw_model, "2G_WPA"),
|
||||
"nat": "%s-%s" % (fw_model, "2G_WPA_NAT"),
|
||||
"vlan": "%s-%s" % (fw_model, "2G_WPA_VLAN")
|
||||
},
|
||||
"wpa2":
|
||||
{
|
||||
"name": "%s-%s" % (fw_model, "2G_WPA2"),
|
||||
"nat": "%s-%s" % (fw_model, "2G_WPA2_NAT"),
|
||||
"vlan": "%s-%s" % (fw_model, "2G_WPA2_VLAN")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ssid_data, psk_data
|
||||
|
||||
def set_ssid_psk_data(self,
|
||||
ssid_2g_wpa=None,
|
||||
ssid_5g_wpa=None,
|
||||
psk_2g_wpa=None,
|
||||
psk_5g_wpa=None,
|
||||
ssid_2g_wpa2=None,
|
||||
ssid_5g_wpa2=None,
|
||||
psk_2g_wpa2=None,
|
||||
psk_5g_wpa2=None):
|
||||
if psk_5g_wpa2 is not None:
|
||||
self.psk_data["5g"]["wpa2"]["name"] = psk_5g_wpa2
|
||||
self.psk_data["5g"]["wpa2"]["nat"] = psk_5g_wpa2
|
||||
self.psk_data["5g"]["wpa2"]["vlan"] = psk_5g_wpa2
|
||||
if psk_5g_wpa is not None:
|
||||
self.psk_data["5g"]["wpa"]["name"] = psk_5g_wpa
|
||||
self.psk_data["5g"]["wpa"]["nat"] = psk_5g_wpa
|
||||
self.psk_data["5g"]["wpa"]["vlan"] = psk_5g_wpa
|
||||
if psk_2g_wpa2 is not None:
|
||||
self.psk_data["2g"]["wpa2"]["name"] = psk_2g_wpa2
|
||||
self.psk_data["2g"]["wpa2"]["nat"] = psk_2g_wpa2
|
||||
self.psk_data["2g"]["wpa2"]["vlan"] = psk_2g_wpa2
|
||||
if psk_2g_wpa is not None:
|
||||
self.psk_data["2g"]["wpa"]["name"] = psk_2g_wpa
|
||||
self.psk_data["2g"]["wpa"]["nat"] = psk_2g_wpa
|
||||
self.psk_data["2g"]["wpa"]["nat"] = psk_2g_wpa
|
||||
if ssid_5g_wpa2 is not None:
|
||||
self.ssid_data["5g"]["wpa2"]["name"] = ssid_5g_wpa2
|
||||
self.ssid_data["5g"]["wpa2"]["nat"] = ssid_5g_wpa2
|
||||
self.ssid_data["5g"]["wpa2"]["vlan"] = ssid_5g_wpa2
|
||||
if ssid_5g_wpa is not None:
|
||||
self.ssid_data["5g"]["wpa"]["name"] = ssid_5g_wpa
|
||||
self.ssid_data["5g"]["wpa"]["nat"] = ssid_5g_wpa
|
||||
self.ssid_data["5g"]["wpa"]["vlan"] = ssid_5g_wpa
|
||||
if ssid_2g_wpa2 is not None:
|
||||
self.ssid_data["2g"]["wpa2"]["name"] = ssid_2g_wpa2
|
||||
self.ssid_data["2g"]["wpa2"]["nat"] = ssid_2g_wpa2
|
||||
self.ssid_data["2g"]["wpa2"]["vlan"] = ssid_2g_wpa2
|
||||
if ssid_2g_wpa is not None:
|
||||
self.ssid_data["2g"]["wpa"]["name"] = ssid_2g_wpa
|
||||
self.ssid_data["2g"]["wpa"]["nat"] = ssid_2g_wpa
|
||||
self.ssid_data["2g"]["wpa"]["vlan"] = ssid_2g_wpa
|
||||
|
||||
def create_radius_profile(self, radius_name, rid, key):
|
||||
|
||||
@@ -917,11 +1096,14 @@ class CreateAPProfiles:
|
||||
if self.command_line_args.skip_radius == False:
|
||||
try:
|
||||
print("Into")
|
||||
self.radius_profile = self.cloud.create_or_update_radius_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id,
|
||||
self.radius_template, self.radius_name, self.subnet_name,
|
||||
self.subnet,
|
||||
self.subnet_mask, self.region, self.server_name, self.server_ip,
|
||||
self.secret, self.auth_port)
|
||||
self.radius_profile = self.cloud.create_or_update_radius_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.radius_template, self.radius_name,
|
||||
self.subnet_name,
|
||||
self.subnet,
|
||||
self.subnet_mask, self.region,
|
||||
self.server_name, self.server_ip,
|
||||
self.secret, self.auth_port)
|
||||
print("radius profile Id is", self.radius_profile)
|
||||
client.update_testrail(case_id=self.test_cases["radius_profile"], run_id=self.rid, status_id=1,
|
||||
msg='RADIUS profile created successfully')
|
||||
@@ -938,9 +1120,9 @@ class CreateAPProfiles:
|
||||
msg='Failed to create RADIUS profile')
|
||||
self.test_cases["radius_profile"] = "failed"
|
||||
|
||||
def create_ssid_profiles(self, ssid_profile_data= None, skip_wpa2=False, skip_wpa=False, skip_eap=False):
|
||||
self.ssid_profile_data = ssid_profile_data
|
||||
self.ssid_template = ssid_profile_data["ssid_template"]
|
||||
def create_ssid_profiles(self, ssid_template=None, skip_wpa2=False, skip_wpa=False, skip_eap=False):
|
||||
|
||||
self.ssid_template = ssid_template
|
||||
|
||||
self.fiveG_eap = None
|
||||
self.twoFourG_eap = None
|
||||
@@ -948,18 +1130,23 @@ class CreateAPProfiles:
|
||||
self.twoFourG_wpa2 = None
|
||||
self.fiveG_wpa = None
|
||||
self.twoFourG_wpa = None
|
||||
|
||||
|
||||
# 5G SSID's
|
||||
print("CreateAPProfile::create_ssid_profile, skip-wpa: ", skip_wpa, " skip-wpa2: ", skip_wpa2, " skip-eap: ", skip_eap)
|
||||
print("CreateAPProfile::create_ssid_profile, skip-wpa: ", skip_wpa, " skip-wpa2: ", skip_wpa2, " skip-eap: ",
|
||||
skip_eap)
|
||||
|
||||
# 5G eap
|
||||
if not skip_eap:
|
||||
try:
|
||||
self.fiveG_eap = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template,
|
||||
ssid_profile_data['5G']['eap']['info'][1],
|
||||
ssid_profile_data['5G']['eap']['info'][0], None,
|
||||
self.radius_name,
|
||||
"wpa2OnlyRadius", "BRIDGE", 1, ["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
self.fiveG_eap = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.ssid_template,
|
||||
self.profile_data['5g']['eap']['name'],
|
||||
self.ssid_data['5g']['eap']['name'],
|
||||
None,
|
||||
self.radius_name,
|
||||
"wpa2OnlyRadius", "BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G EAP SSID created successfully - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_bridge"], run_id=self.rid, status_id=1,
|
||||
msg='5G EAP SSID created successfully - bridge mode')
|
||||
@@ -975,14 +1162,18 @@ class CreateAPProfiles:
|
||||
|
||||
# 2.4G eap
|
||||
try:
|
||||
self.twoFourG_eap = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template,
|
||||
ssid_profile_data['2G']['eap']['info'][1],
|
||||
ssid_profile_data['2G']['eap']['info'][0], None,
|
||||
self.radius_name, "wpa2OnlyRadius", "BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
self.twoFourG_eap = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.ssid_template,
|
||||
self.profile_data['2g']['eap']['name'],
|
||||
self.ssid_data['2g']['eap']['name'],
|
||||
None,
|
||||
self.radius_name, "wpa2OnlyRadius",
|
||||
"BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G EAP SSID created successfully - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_2g_eap_bridge"], run_id=self.rid, status_id=1,
|
||||
msg='2.4G EAP SSID created successfully - bridge mode')
|
||||
msg='2.4G EAP SSID created successfully - bridge mode')
|
||||
self.test_cases["ssid_2g_eap_bridge"] = "passed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -990,20 +1181,25 @@ class CreateAPProfiles:
|
||||
self.twoFourG_eap = None
|
||||
print("2.4G EAP SSID create failed - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_2g_eap_bridge"], run_id=self.rid, status_id=5,
|
||||
msg='2.4G EAP SSID create failed - bridge mode')
|
||||
msg='2.4G EAP SSID create failed - bridge mode')
|
||||
self.test_cases["ssid_2g_eap_bridge"] = "failed"
|
||||
|
||||
# 5g wpa2
|
||||
if not skip_wpa2:
|
||||
try:
|
||||
self.fiveG_wpa2 = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template,
|
||||
ssid_profile_data['5G']['wpa2']['info'][1],
|
||||
ssid_profile_data['5G']['wpa2']['info'][0], ssid_profile_data['5G']['wpa2']['psk'][0],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
self.fiveG_wpa2 = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.ssid_template,
|
||||
self.profile_data['5g']['wpa2']['name'],
|
||||
self.ssid_data['5g']['wpa2']['name'],
|
||||
self.psk_data['5g']['wpa2']['name'],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK",
|
||||
"BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA2 SSID created successfully - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa2_bridge"], run_id=self.rid, status_id=1,
|
||||
msg='5G WPA2 SSID created successfully - bridge mode')
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa2_bridge"], run_id=self.rid,
|
||||
status_id=1,
|
||||
msg='5G WPA2 SSID created successfully - bridge mode')
|
||||
self.test_cases["ssid_5g_wpa2_bridge"] = "passed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -1011,19 +1207,24 @@ class CreateAPProfiles:
|
||||
self.fiveG_wpa2 = None
|
||||
print("5G WPA2 SSID create failed - bridge mode")
|
||||
self.client.update_testrail(case_id=test_cases["ssid_5g_wpa2_bridge"], run_id=self.rid, status_id=5,
|
||||
msg='5G WPA2 SSID create failed - bridge mode')
|
||||
msg='5G WPA2 SSID create failed - bridge mode')
|
||||
self.test_cases["ssid_5g_wpa2_bridge"] = "failed"
|
||||
|
||||
# 2.4G wpa2
|
||||
try:
|
||||
self.twoFourG_wpa2 = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template,
|
||||
ssid_profile_data['2G']['wpa2']['info'][1],
|
||||
ssid_profile_data['2G']['wpa2']['info'][0], ssid_profile_data['2G']['wpa2']['psk'][0],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
self.twoFourG_wpa2 = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.ssid_template,
|
||||
self.profile_data['2g']['wpa2']['name'],
|
||||
self.ssid_data['2g']['wpa2']['name'],
|
||||
self.psk_data['2g']['wpa2']['name'],
|
||||
"Radius-Accounting-Profile",
|
||||
"wpa2OnlyPSK", "BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA2 SSID created successfully - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa2_bridge"], run_id=self.rid, status_id=1,
|
||||
msg='2.4G WPA2 SSID created successfully - bridge mode')
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa2_bridge"], run_id=self.rid,
|
||||
status_id=1,
|
||||
msg='2.4G WPA2 SSID created successfully - bridge mode')
|
||||
self.test_cases["ssid_2g_wpa2_bridge"] = "passed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -1031,22 +1232,24 @@ class CreateAPProfiles:
|
||||
self.twoFourG_wpa2 = None
|
||||
print("2.4G WPA2 SSID create failed - bridge mode")
|
||||
self.client.update_testrail(case_id=test_cases["ssid_2g_wpa2_bridge"], run_id=self.rid, status_id=5,
|
||||
msg='2.4G WPA2 SSID create failed - bridge mode')
|
||||
msg='2.4G WPA2 SSID create failed - bridge mode')
|
||||
self.test_cases["ssid_2g_wpa2_bridge"] = "failed"
|
||||
|
||||
|
||||
# 5g wpa
|
||||
|
||||
if not skip_wpa:
|
||||
try:
|
||||
self.fiveG_wpa = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template,
|
||||
ssid_profile_data['5G']['wpa']['info'][1],
|
||||
ssid_profile_data['5G']['wpa']['info'][0], ssid_profile_data['5G']['wpa']['psk'][0],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
self.fiveG_wpa = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.ssid_template,
|
||||
self.profile_data['5g']['wpa']['name'],
|
||||
self.ssid_data['5g']['wpa']['name'],
|
||||
self.psk_data['5g']['wpa']['name'],
|
||||
"Radius-Accounting-Profile", "wpaPSK",
|
||||
"BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA SSID created successfully - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa_bridge"], run_id=self.rid, status_id=1,
|
||||
msg='5G WPA SSID created successfully - bridge mode')
|
||||
msg='5G WPA SSID created successfully - bridge mode')
|
||||
self.test_cases["ssid_5g_wpa_bridge"] = "passed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -1054,19 +1257,23 @@ class CreateAPProfiles:
|
||||
self.fiveG_wpa = None
|
||||
print("5G WPA SSID create failed - bridge mode")
|
||||
self.client.update_testrail(case_id=test_cases["ssid_5g_wpa_bridge"], run_id=self.rid, status_id=5,
|
||||
msg='5G WPA SSID create failed - bridge mode')
|
||||
msg='5G WPA SSID create failed - bridge mode')
|
||||
self.test_cases["ssid_5g_wpa_bridge"] = "failed"
|
||||
|
||||
# 2.4G wpa
|
||||
try:
|
||||
self.twoFourG_wpa = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template,
|
||||
ssid_profile_data['2G']['wpa']['info'][1],
|
||||
ssid_profile_data['2G']['wpa']['info'][0], ssid_profile_data['2G']['wpa']['psk'][0],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
self.twoFourG_wpa = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.ssid_template,
|
||||
self.profile_data['2g']['wpa']['name'],
|
||||
self.ssid_data['2g']['wpa']['name'],
|
||||
self.psk_data['2g']['wpa']['name'],
|
||||
"Radius-Accounting-Profile", "wpaPSK",
|
||||
"BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA SSID created successfully - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa_bridge"], run_id=self.rid, status_id=1,
|
||||
msg='2.4G WPA SSID created successfully - bridge mode')
|
||||
msg='2.4G WPA SSID created successfully - bridge mode')
|
||||
self.test_cases["ssid_2g_wpa_bridge"] = "passed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -1074,11 +1281,9 @@ class CreateAPProfiles:
|
||||
self.twoFourG_wpa = None
|
||||
print("2.4G WPA SSID create failed - bridge mode")
|
||||
self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa_bridge"], run_id=self.rid, status_id=5,
|
||||
msg='2.4G WPA SSID create failed - bridge mode')
|
||||
msg='2.4G WPA SSID create failed - bridge mode')
|
||||
self.test_cases["ssid_2g_wpa_bridge"] = "failed"
|
||||
|
||||
|
||||
|
||||
def create_ap_bridge_profile(self, eq_id=None, fw_model=None):
|
||||
self.ssid_prof_config = []
|
||||
self.ssid_config = []
|
||||
@@ -1088,33 +1293,33 @@ class CreateAPProfiles:
|
||||
|
||||
if self.fiveG_wpa2:
|
||||
self.child_profiles.append(self.fiveG_wpa2)
|
||||
self.ssid_prof_config.append(self.ssid_profile_data['5G']['wpa2']['info'][1])
|
||||
self.ssid_config.append(self.ssid_profile_data['5G']['wpa2']['info'][0])
|
||||
self.ssid_prof_config.append(self.profile_data['5g']['wpa2']['name'])
|
||||
self.ssid_config.append(self.ssid_data['5g']['wpa2']['name'])
|
||||
|
||||
if self.twoFourG_wpa2:
|
||||
self.child_profiles.append(self.twoFourG_wpa2)
|
||||
self.ssid_prof_config.append(self.ssid_profile_data['2G']['wpa2']['info'][1])
|
||||
self.ssid_config.append(self.ssid_profile_data['2G']['wpa2']['info'][0])
|
||||
self.ssid_prof_config.append(self.profile_data['2g']['wpa2']['name'])
|
||||
self.ssid_config.append(self.ssid_data['2g']['wpa2']['name'])
|
||||
|
||||
if self.fiveG_eap:
|
||||
self.child_profiles.append(self.fiveG_eap)
|
||||
self.ssid_prof_config.append(self.ssid_profile_data['5G']['eap']['info'][1])
|
||||
self.ssid_config.append(self.ssid_profile_data['5G']['eap']['info'][0])
|
||||
self.ssid_prof_config.append(self.profile_data['5g']['eap']['name'])
|
||||
self.ssid_config.append(self.ssid_data['5g']['eap']['name'])
|
||||
|
||||
if self.twoFourG_eap:
|
||||
self.child_profiles.append(self.twoFourG_eap)
|
||||
self.ssid_prof_config.append(self.ssid_profile_data['2G']['eap']['info'][1])
|
||||
self.ssid_config.append(self.ssid_profile_data['2G']['eap']['info'][0])
|
||||
self.ssid_prof_config.append(self.profile_data['2g']['eap']['name'])
|
||||
self.ssid_config.append(self.ssid_data['2g']['eap']['name'])
|
||||
|
||||
if self.fiveG_wpa:
|
||||
self.child_profiles.append(self.fiveG_wpa)
|
||||
self.ssid_prof_config.append(self.ssid_profile_data['5G']['wpa']['info'][1])
|
||||
self.ssid_config.append(self.ssid_profile_data['5G']['wpa']['info'][0])
|
||||
self.ssid_prof_config.append(self.profile_data['5g']['wpa']['name'])
|
||||
self.ssid_config.append(self.ssid_data['5g']['wpa']['name'])
|
||||
|
||||
if self.twoFourG_wpa:
|
||||
self.child_profiles.append(self.twoFourG_wpa)
|
||||
self.ssid_prof_config.append(self.ssid_profile_data['2G']['wpa']['info'][1])
|
||||
self.ssid_config.append(self.ssid_profile_data['2G']['wpa']['info'][0])
|
||||
self.ssid_prof_config.append(self.profile_data['2g']['wpa']['name'])
|
||||
self.ssid_config.append(self.ssid_data['2g']['wpa']['name'])
|
||||
|
||||
if self.radius_profile is not None:
|
||||
self.child_profiles.append(self.radius_profile)
|
||||
@@ -1123,13 +1328,15 @@ class CreateAPProfiles:
|
||||
name = self.command_line_args.testbed + "-" + self.fw_model + "_bridge"
|
||||
|
||||
try:
|
||||
self.create_ap_profile = self.cloud.create_or_update_ap_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id,
|
||||
self.command_line_args.default_ap_profile, name,
|
||||
self.child_profiles)
|
||||
self.create_ap_profile = self.cloud.create_or_update_ap_profile(self.command_line_args.sdk_base_url,
|
||||
self.bearer, self.customer_id,
|
||||
self.command_line_args.default_ap_profile,
|
||||
name,
|
||||
self.child_profiles)
|
||||
self.test_profile_id = self.create_ap_profile
|
||||
print("Test Profile ID for Test is:", self.test_profile_id)
|
||||
self.client.update_testrail(case_id=self.test_cases["ap_bridge"], run_id=self.rid, status_id=1,
|
||||
msg='AP profile for bridge tests created successfully')
|
||||
msg='AP profile for bridge tests created successfully')
|
||||
self.test_cases["ap_bridge"] = "passed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -1137,11 +1344,10 @@ class CreateAPProfiles:
|
||||
create_ap_profile = "error"
|
||||
print("Error creating AP profile for bridge tests. Will use existing AP profile")
|
||||
self.client.update_testrail(case_id=self.test_cases["ap_bridge"], run_id=self.rid, status_id=5,
|
||||
msg='AP profile for bridge tests could not be created using API')
|
||||
msg='AP profile for bridge tests could not be created using API')
|
||||
self.test_cases["ap_bridge"] = "failed"
|
||||
self.ap_profile = self.cloud.set_ap_profile(eq_id, self.test_profile_id, self.command_line_args.sdk_base_url, self.bearer)
|
||||
|
||||
|
||||
self.ap_profile = self.cloud.set_ap_profile(eq_id, self.test_profile_id, self.command_line_args.sdk_base_url,
|
||||
self.bearer)
|
||||
|
||||
def cleanup_profile(self):
|
||||
pass
|
||||
@@ -1170,13 +1376,13 @@ class CreateAPProfiles:
|
||||
if set(ssid_list) == set(self.ssid_config):
|
||||
print("SSIDs in Wifi_VIF_Config Match AP Profile Config")
|
||||
self.client.update_testrail(case_id=self.test_cases["bridge_vifc"], run_id=self.rid, status_id=1,
|
||||
msg='SSIDs in VIF Config matches AP Profile Config')
|
||||
msg='SSIDs in VIF Config matches AP Profile Config')
|
||||
self.test_cases["bridge_vifc"] = "passed"
|
||||
ssid_list_ok = True
|
||||
else:
|
||||
print("SSIDs in Wifi_VIF_Config do not match desired AP Profile Config")
|
||||
self.client.update_testrail(case_id=self.test_cases["bridge_vifc"], run_id=self.rid, status_id=5,
|
||||
msg='SSIDs in VIF Config do not match AP Profile Config')
|
||||
msg='SSIDs in VIF Config do not match AP Profile Config')
|
||||
self.test_cases["bridge_vifc"] = "failed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -1184,7 +1390,7 @@ class CreateAPProfiles:
|
||||
ssid_list = "ERROR"
|
||||
print("Error accessing VIF Config from AP CLI")
|
||||
self.client.update_testrail(case_id=self.test_cases["bridge_vifc"], run_id=self.rid, status_id=4,
|
||||
msg='Cannot determine VIF Config - re-test required')
|
||||
msg='Cannot determine VIF Config - re-test required')
|
||||
self.test_cases["bridge_vifc"] = "error"
|
||||
|
||||
# VIF State
|
||||
@@ -1195,13 +1401,13 @@ class CreateAPProfiles:
|
||||
if set(ssid_state) == set(self.ssid_config):
|
||||
print("SSIDs properly applied on AP")
|
||||
self.client.update_testrail(case_id=self.test_cases["bridge_vifs"], run_id=self.rid, status_id=1,
|
||||
msg='SSIDs in VIF Config applied to VIF State')
|
||||
msg='SSIDs in VIF Config applied to VIF State')
|
||||
self.test_cases["bridge_vifs"] = "passed"
|
||||
vif_state_ok = True
|
||||
else:
|
||||
print("SSIDs not applied on AP")
|
||||
self.client.update_testrail(case_id=self.test_cases["bridge_vifs"], run_id=self.rid, status_id=5,
|
||||
msg='SSIDs in VIF Config not applied to VIF State')
|
||||
msg='SSIDs in VIF Config not applied to VIF State')
|
||||
self.test_cases["bridge_vifs"] = "failed"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
@@ -1209,7 +1415,7 @@ class CreateAPProfiles:
|
||||
ssid_list = "ERROR"
|
||||
print("Error accessing VIF State from AP CLI")
|
||||
self.client.update_testrail(case_id=self.test_cases["bridge_vifs"], run_id=self.rid, status_id=4,
|
||||
msg='Cannot determine VIF State - re-test required')
|
||||
msg='Cannot determine VIF State - re-test required')
|
||||
self.test_cases["bridge_vifs"] = "error"
|
||||
|
||||
print("Profiles Created")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
from UnitTestBase import *
|
||||
|
||||
from sta_connect2 import StaConnect2
|
||||
class RunTest:
|
||||
|
||||
def __init__(self, lanforge_ip, lanforge_port, lanforge_prefix):
|
||||
@@ -13,19 +13,19 @@ class RunTest:
|
||||
self.lanforge_port = lanforge_port
|
||||
self.lanforge_prefix = lanforge_prefix
|
||||
|
||||
def Single_Client_Connectivity(self, port, radio, ssid_name, ssid_psk, security,
|
||||
station, test_case, rid, client, logger):
|
||||
def Single_Client_Connectivity(self, upstream_port="eth1", radio="wiphy0", ssid="TestAP", passkey="ssid_psk", security="open",
|
||||
station_name="sta0000", test_case=None, rid=None, client=None, logger=None):
|
||||
'''SINGLE CLIENT CONNECTIVITY using test_connect2.py'''
|
||||
self.staConnect = StaConnect2(self.lanforge_ip, self.lanforge_port, debug_=False)
|
||||
self.staConnect.sta_mode = 0
|
||||
self.staConnect.upstream_resource = 1
|
||||
self.staConnect.upstream_port = port
|
||||
self.staConnect.upstream_port = upstream_port
|
||||
self.staConnect.radio = radio
|
||||
self.staConnect.resource = 1
|
||||
self.staConnect.dut_ssid = ssid_name
|
||||
self.staConnect.dut_passwd = ssid_psk
|
||||
self.staConnect.dut_ssid = ssid
|
||||
self.staConnect.dut_passwd = passkey
|
||||
self.staConnect.dut_security = security
|
||||
self.staConnect.station_names = station
|
||||
self.staConnect.station_names = station_name
|
||||
self.staConnect.sta_prefix = self.lanforge_prefix
|
||||
self.staConnect.runtime_secs = 10
|
||||
self.staConnect.bringup_time_sec = 60
|
||||
@@ -43,14 +43,14 @@ class RunTest:
|
||||
# result = 'pass'
|
||||
print("Single Client Connectivity :", self.staConnect.passes)
|
||||
if self.staConnect.passes() == True:
|
||||
print("Single client connection to", ssid_name, "successful. Test Passed")
|
||||
print("Single client connection to", self.staConnect.dut_ssid, "successful. Test Passed")
|
||||
client.update_testrail(case_id=test_case, run_id=rid, status_id=1, msg='Client connectivity passed')
|
||||
logger.info("Client connectivity to " + ssid_name + " Passed")
|
||||
logger.info("Client connectivity to " + self.staConnect.dut_ssid + " Passed")
|
||||
return ("passed")
|
||||
else:
|
||||
client.update_testrail(case_id=test_case, run_id=rid, status_id=5, msg='Client connectivity failed')
|
||||
print("Single client connection to", ssid_name, "unsuccessful. Test Failed")
|
||||
logger.warning("Client connectivity to " + ssid_name + " FAILED")
|
||||
print("Single client connection to", self.staConnect.dut_ssid, "unsuccessful. Test Failed")
|
||||
logger.warning("Client connectivity to " + self.staConnect.dut_ssid + " FAILED")
|
||||
return ("failed")
|
||||
|
||||
def Single_Client_EAP(self, port, sta_list, ssid_name, radio, security, eap_type,
|
||||
|
||||
@@ -6,7 +6,17 @@
|
||||
|
||||
if [ -d ../wlan-lanforge-scripts ]
|
||||
then
|
||||
rm -fr lanforge/lanforge-scripts
|
||||
rm -fr libs/lanforge/lanforge-scripts
|
||||
|
||||
cp -ar ../wlan-lanforge-scripts lanforge/lanforge-scripts
|
||||
cp -ar ../wlan-lanforge-scripts libs/lanforge/lanforge-scripts
|
||||
fi
|
||||
if [ -d tests/logs ]
|
||||
then
|
||||
rm -fr tests/logs
|
||||
mkdir tests/logs
|
||||
fi
|
||||
if [ -d tests/reports ]
|
||||
then
|
||||
rm -fr tests/reports
|
||||
mkdir tests/reports
|
||||
fi
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,22 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
|
||||
import sys
|
||||
for folder in 'py-json', 'py-scripts':
|
||||
if folder not in sys.path:
|
||||
sys.path.append(f'../libs/lanforge/lanforge-scripts/{folder}')
|
||||
|
||||
sys.path.append(f'../libs/lanforge')
|
||||
sys.path.append(f'../libs/testrails')
|
||||
sys.path.append(f'../libs/apnos')
|
||||
sys.path.append(f'../libs/cloudsdk')
|
||||
sys.path.append(f'../libs')
|
||||
sys.path.append(f'../tests/test_utility/')
|
||||
|
||||
import base64
|
||||
import urllib.request
|
||||
from bs4 import BeautifulSoup
|
||||
@@ -13,7 +30,7 @@ from scp import SCPClient
|
||||
import os
|
||||
import pexpect
|
||||
from pexpect import pxssh
|
||||
import sys
|
||||
|
||||
import paramiko
|
||||
from scp import SCPClient
|
||||
import pprint
|
||||
@@ -29,6 +46,11 @@ from datetime import date
|
||||
from shutil import copyfile
|
||||
import argparse
|
||||
from unittest.mock import Mock
|
||||
from lf_tests import *
|
||||
from ap_plus_sdk import *
|
||||
from lab_ap_info import *
|
||||
from JfrogHelper import *
|
||||
from reporting import Reporting
|
||||
|
||||
# For finding files
|
||||
# https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory
|
||||
@@ -44,20 +66,6 @@ import glob
|
||||
# On local machine:
|
||||
#./query_ssids.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 7220 --ap-jumphost-password secret --ap-jumphost-tty /dev/ttyAP1
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
|
||||
import sys
|
||||
for folder in 'py-json','py-scripts':
|
||||
if folder not in sys.path:
|
||||
sys.path.append(f'../lanforge/lanforge-scripts/{folder}')
|
||||
|
||||
sys.path.append(f'../libs/lanforge')
|
||||
sys.path.append(f'../libs/testrails')
|
||||
sys.path.append(f'../libs/apnos')
|
||||
sys.path.append(f'../libs/cloudsdk')
|
||||
sys.path.append(f'../libs')
|
||||
|
||||
|
||||
import testrail_api
|
||||
@@ -74,6 +82,7 @@ import eap_connect
|
||||
from eap_connect import EAPConnect
|
||||
import cloudsdk
|
||||
from cloudsdk import CloudSDK
|
||||
from cloudsdk import CreateAPProfiles
|
||||
import ap_ssh
|
||||
from ap_ssh import *
|
||||
|
||||
@@ -88,7 +97,7 @@ from lab_ap_info import radius_info
|
||||
|
||||
class UnitTestBase:
|
||||
|
||||
def __init__(self, log_name, args):
|
||||
def __init__(self, log_name, args, reporting):
|
||||
|
||||
self.parser = argparse.ArgumentParser(description="Sanity Testing on Firmware Build", parents=[args])
|
||||
|
||||
@@ -222,7 +231,7 @@ class UnitTestBase:
|
||||
self.build = self.command_line_args.build_id
|
||||
|
||||
self.logger = logging.getLogger(log_name)
|
||||
self.hdlr = logging.FileHandler(self.local_dir + "/log_name.log")
|
||||
self.hdlr = logging.FileHandler(reporting.report_path + "/test_run.log")
|
||||
self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
|
||||
self.hdlr.setFormatter(self.formatter)
|
||||
self.logger.addHandler(self.hdlr)
|
||||
|
||||
52
tests/test_utility/reporting.py
Normal file
52
tests/test_utility/reporting.py
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
import os
|
||||
from datetime import date, datetime
|
||||
from shutil import copyfile
|
||||
import json
|
||||
|
||||
class Reporting:
|
||||
|
||||
def __init__(self, reports_root="../reports/"):
|
||||
|
||||
self.reports_root = reports_root
|
||||
self.report_id = self.create_report_id()
|
||||
self.report_path = self.reports_root + self.report_id
|
||||
self.templates_root = os.path.abspath(self.reports_root+"../templates")
|
||||
try:
|
||||
os.mkdir(self.report_path)
|
||||
print("Successfully created the directory %s " % self.report_path)
|
||||
except OSError:
|
||||
print("Creation of the directory %s failed" % self.report_path)
|
||||
|
||||
try:
|
||||
copyfile(self.templates_root + "/report_template.php", self.report_path + '/report.php')
|
||||
except:
|
||||
print("No report template created. Report data will still be saved. Continuing with tests...")
|
||||
|
||||
|
||||
def create_report_id(self):
|
||||
today = str(date.today())
|
||||
now = str(datetime.now()).split(" ")[1].split(".")[0].replace(":","-")
|
||||
id = today + "-" + now
|
||||
return id
|
||||
|
||||
def update_json_report(self, report_data):
|
||||
try:
|
||||
with open(self.report_path + '/report_data.json', 'w') as report_json_file:
|
||||
json.dump(report_data, report_json_file)
|
||||
report_json_file.close()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def update_report_instance(self):
|
||||
pass
|
||||
|
||||
def cleanup_report_instance(self):
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
Reporting()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/python3 -u
|
||||
|
||||
# Example to set profile on NOLA-12 testbed:
|
||||
#./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8823 --ap-jumphost-password pumpkin77 \
|
||||
# ./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8823 --ap-jumphost-password pumpkin77 \
|
||||
# --ap-jumphost-tty /dev/ttyAP1 --testbed "NOLA-12" --lanforge-ip-address localhost --lanforge-port-number 8822 \
|
||||
# --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build --skip-radius
|
||||
|
||||
# Example to set profile on NOLA-01 testbed
|
||||
#./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8803 \
|
||||
# ./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8803 \
|
||||
# --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --testbed "NOLA-01" --lanforge-ip-address localhost \
|
||||
# --lanforge-port-number 8802 --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc.cicd.lab.wlan.tip.build \
|
||||
# --skip-radius
|
||||
@@ -18,274 +18,216 @@ sys.path.append(f'../tests')
|
||||
from UnitTestBase import *
|
||||
from cloudsdk import CreateAPProfiles
|
||||
|
||||
parser = argparse.ArgumentParser(description="SDK Set Profile", add_help=False)
|
||||
parser.add_argument("--default-ap-profile", type=str,
|
||||
help="Default AP profile to use as basis for creating new ones, typically: TipWlan-2-Radios or TipWlan-3-Radios",
|
||||
required=True)
|
||||
parser.add_argument("--skip-radius", dest="skip_radius", action='store_true',
|
||||
help="Should we skip the RADIUS configs or not")
|
||||
parser.add_argument("--skip-wpa", dest="skip_wpa", action='store_true',
|
||||
help="Should we skip the WPA ssid or not")
|
||||
parser.add_argument("--skip-wpa2", dest="skip_wpa2", action='store_true',
|
||||
help="Should we skip the WPA2 ssid or not")
|
||||
parser.set_defaults(skip_radius=False)
|
||||
parser.set_defaults(skip_wpa=False)
|
||||
parser.set_defaults(skip_wpa2=False)
|
||||
parser.add_argument("--skip-profiles", dest="skip_profiles", action='store_true',
|
||||
help="Should we skip creating new ssid profiles?")
|
||||
parser.set_defaults(skip_profiles=False)
|
||||
|
||||
parser.add_argument("--psk-5g-wpa2", type=str,
|
||||
help="Allow over-riding the 5g-wpa2 PSK value.")
|
||||
parser.add_argument("--psk-5g-wpa", type=str,
|
||||
help="Allow over-riding the 5g-wpa PSK value.")
|
||||
parser.add_argument("--psk-2g-wpa2", type=str,
|
||||
help="Allow over-riding the 2g-wpa2 PSK value.")
|
||||
parser.add_argument("--psk-2g-wpa", type=str,
|
||||
help="Allow over-riding the 2g-wpa PSK value.")
|
||||
|
||||
parser.add_argument("--ssid-5g-wpa2", type=str,
|
||||
help="Allow over-riding the 5g-wpa2 SSID value.")
|
||||
parser.add_argument("--ssid-5g-wpa", type=str,
|
||||
help="Allow over-riding the 5g-wpa SSID value.")
|
||||
parser.add_argument("--ssid-2g-wpa2", type=str,
|
||||
help="Allow over-riding the 2g-wpa2 SSID value.")
|
||||
parser.add_argument("--ssid-2g-wpa", type=str,
|
||||
help="Allow over-riding the 2g-wpa SSID value.")
|
||||
|
||||
base = UnitTestBase("skd-set-profile", parser)
|
||||
|
||||
command_line_args = base.command_line_args
|
||||
|
||||
# cmd line takes precedence over env-vars.
|
||||
cloudSDK_url = command_line_args.sdk_base_url # was os.getenv('CLOUD_SDK_URL')
|
||||
local_dir = command_line_args.local_dir # was os.getenv('SANITY_LOG_DIR')
|
||||
report_path = command_line_args.report_path # was os.getenv('SANITY_REPORT_DIR')
|
||||
report_template = command_line_args.report_template # was os.getenv('REPORT_TEMPLATE')
|
||||
|
||||
## TestRail Information
|
||||
tr_user = command_line_args.testrail_user_id # was os.getenv('TR_USER')
|
||||
tr_pw = command_line_args.testrail_user_password # was os.getenv('TR_PWD')
|
||||
milestoneId = command_line_args.milestone # was os.getenv('MILESTONE')
|
||||
projectId = command_line_args.testrail_project # was os.getenv('PROJECT_ID')
|
||||
testRunPrefix = command_line_args.testrail_run_prefix # os.getenv('TEST_RUN_PREFIX')
|
||||
|
||||
##Jfrog credentials
|
||||
jfrog_user = command_line_args.jfrog_user_id # was os.getenv('JFROG_USER')
|
||||
jfrog_pwd = command_line_args.jfrog_user_password # was os.getenv('JFROG_PWD')
|
||||
|
||||
##EAP Credentials
|
||||
identity = command_line_args.eap_id # was os.getenv('EAP_IDENTITY')
|
||||
ttls_password = command_line_args.ttls_password # was os.getenv('EAP_PWD')
|
||||
|
||||
## AP Credentials
|
||||
ap_username = command_line_args.ap_username # was os.getenv('AP_USER')
|
||||
|
||||
##LANForge Information
|
||||
lanforge_ip = command_line_args.lanforge_ip_address
|
||||
lanforge_port = command_line_args.lanforge_port_number
|
||||
lanforge_prefix = command_line_args.lanforge_prefix
|
||||
lanforge_2g_radio = command_line_args.lanforge_2g_radio
|
||||
lanforge_5g_radio = command_line_args.lanforge_5g_radio
|
||||
|
||||
build = command_line_args.build_id
|
||||
|
||||
logger = base.logger
|
||||
hdlr = base.hdlr
|
||||
|
||||
if command_line_args.testbed == None:
|
||||
print("ERROR: Must specify --testbed argument for this test.")
|
||||
sys.exit(1)
|
||||
|
||||
client: TestRail_Client = TestRail_Client(command_line_args)
|
||||
|
||||
###Get Cloud Bearer Token
|
||||
cloud: CloudSDK = CloudSDK(command_line_args)
|
||||
bearer = cloud.get_bearer(cloudSDK_url, cloud_type)
|
||||
|
||||
cloud.assert_bad_response = True
|
||||
|
||||
model_id = command_line_args.model
|
||||
equipment_id = command_line_args.equipment_id
|
||||
|
||||
print("equipment-id: %s"%(equipment_id))
|
||||
|
||||
if equipment_id == "-1":
|
||||
eq_id = ap_ssh_ovsh_nodec(command_line_args, 'id')
|
||||
print("EQ Id: %s"%(eq_id))
|
||||
|
||||
# Now, query equipment to find something that matches.
|
||||
eq = cloud.get_customer_equipment(cloudSDK_url, bearer, customer_id)
|
||||
for item in eq:
|
||||
for e in item['items']:
|
||||
print(e['id'], " ", e['inventoryId'])
|
||||
if e['inventoryId'].endswith("_%s"%(eq_id)):
|
||||
print("Found equipment ID: %s inventoryId: %s"%(e['id'], e['inventoryId']))
|
||||
equipment_id = str(e['id'])
|
||||
|
||||
if equipment_id == -1:
|
||||
print("ERROR: Could not find equipment-id.")
|
||||
sys.exit(1)
|
||||
|
||||
###Get Current AP Firmware and upgrade
|
||||
try:
|
||||
ap_cli_info = ssh_cli_active_fw(command_line_args)
|
||||
ap_cli_fw = ap_cli_info['active_fw']
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
logging.error(logging.traceback.format_exc())
|
||||
ap_cli_info = "ERROR"
|
||||
print("FAILED: Cannot Reach AP CLI.");
|
||||
sys.exit(1)
|
||||
|
||||
fw_model = ap_cli_fw.partition("-")[0]
|
||||
print('Current Active AP FW from CLI:', ap_cli_fw)
|
||||
###Find Latest FW for Current AP Model and Get FW ID
|
||||
|
||||
############################################################################
|
||||
#################### Create Report #########################################
|
||||
############################################################################
|
||||
|
||||
# Create Report Folder for Today
|
||||
today = str(date.today())
|
||||
try:
|
||||
os.mkdir(report_path + today)
|
||||
except OSError:
|
||||
print("Creation of the directory %s failed" % report_path)
|
||||
else:
|
||||
print("Successfully created the directory %s " % report_path)
|
||||
|
||||
logger.info('Report data can be found here: ' + report_path + today)
|
||||
|
||||
|
||||
##Get Bearer Token to make sure its valid (long tests can require re-auth)
|
||||
bearer = cloud.get_bearer(cloudSDK_url, cloud_type)
|
||||
|
||||
radius_name = "%s-%s-%s"%(command_line_args.testbed, fw_model, "Radius")
|
||||
|
||||
prof_5g_eap_name = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_EAP")
|
||||
prof_5g_wpa2_name = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA2")
|
||||
prof_5g_wpa_name = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA")
|
||||
prof_2g_eap_name = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_EAP")
|
||||
prof_2g_wpa2_name = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA2")
|
||||
prof_2g_wpa_name = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA")
|
||||
|
||||
prof_5g_eap_name_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_EAP_NAT")
|
||||
prof_5g_wpa2_name_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA2_NAT")
|
||||
prof_5g_wpa_name_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA_NAT")
|
||||
prof_2g_eap_name_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_EAP_NAT")
|
||||
prof_2g_wpa2_name_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA2_NAT")
|
||||
prof_2g_wpa_name_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA_NAT")
|
||||
|
||||
prof_5g_eap_name_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_EAP_VLAN")
|
||||
prof_5g_wpa2_name_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA2_VLAN")
|
||||
prof_5g_wpa_name_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA_VLAN")
|
||||
prof_2g_eap_name_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_EAP_VLAN")
|
||||
prof_2g_wpa2_name_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA2_VLAN")
|
||||
prof_2g_wpa_name_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA_VLAN")
|
||||
def main():
|
||||
|
||||
|
||||
|
||||
prof_names = [prof_5g_wpa2_name, prof_5g_wpa_name, prof_2g_wpa2_name, prof_2g_wpa_name,
|
||||
prof_5g_wpa2_name_nat, prof_5g_wpa_name_nat, prof_2g_wpa2_name_nat, prof_2g_wpa_name_nat,
|
||||
prof_5g_wpa2_name_vlan, prof_5g_wpa_name_vlan, prof_2g_wpa2_name_vlan, prof_2g_wpa_name_vlan]
|
||||
parser = argparse.ArgumentParser(description="SDK Set Profile", add_help=False)
|
||||
parser.add_argument("--default-ap-profile", type=str,
|
||||
help="Default AP profile to use as basis for creating new ones, typically: TipWlan-2-Radios or TipWlan-3-Radios",
|
||||
required=True)
|
||||
parser.add_argument("--skip-radius", dest="skip_radius", action='store_true',
|
||||
help="Should we skip the RADIUS configs or not")
|
||||
parser.add_argument("--skip-wpa", dest="skip_wpa", action='store_true',
|
||||
help="Should we skip the WPA ssid or not")
|
||||
parser.add_argument("--skip-wpa2", dest="skip_wpa2", action='store_true',
|
||||
help="Should we skip the WPA2 ssid or not")
|
||||
parser.set_defaults(skip_radius=False)
|
||||
parser.set_defaults(skip_wpa=False)
|
||||
parser.set_defaults(skip_wpa2=False)
|
||||
parser.add_argument("--skip-profiles", dest="skip_profiles", action='store_true',
|
||||
help="Should we skip creating new ssid profiles?")
|
||||
parser.set_defaults(skip_profiles=False)
|
||||
|
||||
prof_names_eap = [prof_5g_eap_name, prof_2g_eap_name,
|
||||
prof_5g_eap_name_nat, prof_2g_eap_name_nat,
|
||||
prof_5g_eap_name_vlan, prof_2g_eap_name_vlan]
|
||||
parser.add_argument("--psk-5g-wpa2", type=str,
|
||||
help="Allow over-riding the 5g-wpa2 PSK value.")
|
||||
parser.add_argument("--psk-5g-wpa", type=str,
|
||||
help="Allow over-riding the 5g-wpa PSK value.")
|
||||
parser.add_argument("--psk-2g-wpa2", type=str,
|
||||
help="Allow over-riding the 2g-wpa2 PSK value.")
|
||||
parser.add_argument("--psk-2g-wpa", type=str,
|
||||
help="Allow over-riding the 2g-wpa PSK value.")
|
||||
|
||||
# TOOD: Allow configuring this on cmd line
|
||||
ssid_5g_eap = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_EAP")
|
||||
ssid_5g_wpa2 = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA2")
|
||||
ssid_5g_wpa = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA")
|
||||
ssid_2g_eap = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_EAP")
|
||||
ssid_2g_wpa2 = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA2")
|
||||
ssid_2g_wpa = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA")
|
||||
|
||||
ssid_5g_eap_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_EAP_NAT")
|
||||
ssid_5g_wpa2_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA2_NAT")
|
||||
ssid_5g_wpa_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA_NAT")
|
||||
ssid_2g_eap_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_EAP_NAT")
|
||||
ssid_2g_wpa2_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA2_NAT")
|
||||
ssid_2g_wpa_nat = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA_NAT")
|
||||
|
||||
ssid_5g_eap_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_EAP_VLAN")
|
||||
ssid_5g_wpa2_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA2_VLAN")
|
||||
ssid_5g_wpa_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "5G_WPA_VLAN")
|
||||
ssid_2g_eap_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_EAP_VLAN")
|
||||
ssid_2g_wpa2_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA2_VLAN")
|
||||
ssid_2g_wpa_vlan = "%s-%s-%s"%(command_line_args.testbed, fw_model, "2G_WPA_VLAN")
|
||||
|
||||
psk_5g_wpa2 = "%s-%s"%(fw_model, "5G_WPA2")
|
||||
psk_5g_wpa = "%s-%s"%(fw_model, "5G_WPA")
|
||||
psk_2g_wpa2 = "%s-%s"%(fw_model, "2G_WPA2")
|
||||
psk_2g_wpa = "%s-%s"%(fw_model, "2G_WPA")
|
||||
|
||||
psk_5g_wpa2_nat = "%s-%s"%(fw_model, "5G_WPA2_NAT")
|
||||
psk_5g_wpa_nat = "%s-%s"%(fw_model, "5G_WPA_NAT")
|
||||
psk_2g_wpa2_nat = "%s-%s"%(fw_model, "2G_WPA2_NAT")
|
||||
psk_2g_wpa_nat = "%s-%s"%(fw_model, "2G_WPA_NAT")
|
||||
|
||||
psk_5g_wpa2_vlan = "%s-%s"%(fw_model, "5G_WPA2_VLAN")
|
||||
psk_5g_wpa_vlan = "%s-%s"%(fw_model, "5G_WPA_VLAN")
|
||||
psk_2g_wpa2_vlan = "%s-%s"%(fw_model, "2G_WPA2_VLAN")
|
||||
psk_2g_wpa_vlan = "%s-%s"%(fw_model, "2G_WPA_VLAN")
|
||||
|
||||
# Allow cmd-line to override
|
||||
if command_line_args.psk_5g_wpa2:
|
||||
psk_5g_wpa2 = command_line_args.psk_5g_wpa2
|
||||
if command_line_args.psk_5g_wpa:
|
||||
psk_5g_wpa = command_line_args.psk_5g_wpa
|
||||
if command_line_args.psk_2g_wpa2:
|
||||
psk_2g_wpa2 = command_line_args.psk_2g_wpa2
|
||||
if command_line_args.psk_2g_wpa:
|
||||
psk_2g_wpa = command_line_args.psk_2g_wpa
|
||||
|
||||
if command_line_args.ssid_5g_wpa2:
|
||||
ssid_5g_wpa2 = command_line_args.ssid_5g_wpa2
|
||||
if command_line_args.ssid_5g_wpa:
|
||||
ssid_5g_wpa = command_line_args.ssid_5g_wpa
|
||||
if command_line_args.ssid_2g_wpa2:
|
||||
ssid_2g_wpa2 = command_line_args.ssid_2g_wpa2
|
||||
if command_line_args.ssid_2g_wpa:
|
||||
ssid_2g_wpa = command_line_args.ssid_2g_wpa
|
||||
parser.add_argument("--ssid-5g-wpa2", type=str,
|
||||
help="Allow over-riding the 5g-wpa2 SSID value.")
|
||||
parser.add_argument("--ssid-5g-wpa", type=str,
|
||||
help="Allow over-riding the 5g-wpa SSID value.")
|
||||
parser.add_argument("--ssid-2g-wpa2", type=str,
|
||||
help="Allow over-riding the 2g-wpa2 SSID value.")
|
||||
parser.add_argument("--ssid-2g-wpa", type=str,
|
||||
help="Allow over-riding the 2g-wpa SSID value.")
|
||||
|
||||
|
||||
|
||||
print("creating Profiles")
|
||||
ssid_template = "TipWlan-Cloud-Wifi"
|
||||
|
||||
# Data Structure to Give to CreateAPProfiles.create_ap_profiles()
|
||||
ssid_profile_data = {
|
||||
"ssid_template" : ssid_template,
|
||||
|
||||
"2G" :
|
||||
{
|
||||
"eap": {"info" : [ssid_2g_eap ,prof_2g_eap_name, prof_2g_eap_name_nat, prof_2g_eap_name_vlan], "psk" :[]},
|
||||
"wpa": {"info" : [ssid_2g_wpa, prof_2g_wpa_name, prof_2g_wpa_name_nat, prof_2g_wpa_name_vlan], "psk" : [psk_2g_wpa, psk_2g_wpa_nat, psk_2g_wpa_vlan]},
|
||||
"wpa2": {"info" : [ssid_2g_wpa2, prof_2g_wpa2_name, prof_2g_wpa2_name_nat, prof_2g_wpa2_name_vlan], "psk" : [psk_2g_wpa2, psk_2g_wpa2_nat, psk_2g_wpa2_vlan]},
|
||||
},
|
||||
|
||||
"5G" :
|
||||
{
|
||||
"eap": {"info" : [ssid_5g_eap, prof_5g_eap_name, prof_5g_eap_name_nat, prof_5g_eap_name_vlan], "psk" : []},
|
||||
"wpa": {"info" : [ssid_5g_wpa, prof_5g_wpa_name, prof_5g_wpa_name_nat, prof_5g_wpa_name_vlan], "psk" : [psk_5g_wpa, psk_5g_wpa_nat, psk_5g_wpa_vlan]},
|
||||
"wpa2":{"info" : [ssid_5g_wpa2, prof_5g_wpa2_name, prof_5g_wpa2_name_nat, prof_5g_wpa_name_vlan], "psk" : [psk_2g_wpa2, psk_5g_wpa2_nat, psk_5g_wpa2_vlan]}
|
||||
}
|
||||
}
|
||||
|
||||
obj = CreateAPProfiles(command_line_args, cloud=cloud, client= client)
|
||||
|
||||
if not command_line_args.skip_profiles:
|
||||
if not command_line_args.skip_radius:
|
||||
obj.create_radius_profile(radius_name, rid, key)
|
||||
obj.create_ssid_profiles(ssid_profile_data= ssid_profile_data, skip_wpa2=command_line_args.skip_wpa2,
|
||||
skip_wpa=command_line_args.skip_wpa, skip_eap=command_line_args.skip_radius)
|
||||
|
||||
print("Create AP with equipment-id: ", equipment_id)
|
||||
obj.create_ap_bridge_profile(eq_id=equipment_id, fw_model=fw_model)
|
||||
obj.validate_changes()
|
||||
|
||||
print("Profiles Created")
|
||||
|
||||
|
||||
|
||||
|
||||
base = UnitTestBase("skd-set-profile", parser)
|
||||
|
||||
command_line_args = base.command_line_args
|
||||
|
||||
# cmd line takes precedence over env-vars.
|
||||
cloudSDK_url = command_line_args.sdk_base_url # was os.getenv('CLOUD_SDK_URL')
|
||||
local_dir = command_line_args.local_dir # was os.getenv('SANITY_LOG_DIR')
|
||||
report_path = command_line_args.report_path # was os.getenv('SANITY_REPORT_DIR')
|
||||
report_template = command_line_args.report_template # was os.getenv('REPORT_TEMPLATE')
|
||||
|
||||
## TestRail Information
|
||||
tr_user = command_line_args.testrail_user_id # was os.getenv('TR_USER')
|
||||
tr_pw = command_line_args.testrail_user_password # was os.getenv('TR_PWD')
|
||||
milestoneId = command_line_args.milestone # was os.getenv('MILESTONE')
|
||||
projectId = command_line_args.testrail_project # was os.getenv('PROJECT_ID')
|
||||
testRunPrefix = command_line_args.testrail_run_prefix # os.getenv('TEST_RUN_PREFIX')
|
||||
|
||||
##Jfrog credentials
|
||||
jfrog_user = command_line_args.jfrog_user_id # was os.getenv('JFROG_USER')
|
||||
jfrog_pwd = command_line_args.jfrog_user_password # was os.getenv('JFROG_PWD')
|
||||
|
||||
##EAP Credentials
|
||||
identity = command_line_args.eap_id # was os.getenv('EAP_IDENTITY')
|
||||
ttls_password = command_line_args.ttls_password # was os.getenv('EAP_PWD')
|
||||
|
||||
## AP Credentials
|
||||
ap_username = command_line_args.ap_username # was os.getenv('AP_USER')
|
||||
|
||||
##LANForge Information
|
||||
lanforge_ip = command_line_args.lanforge_ip_address
|
||||
lanforge_port = command_line_args.lanforge_port_number
|
||||
lanforge_prefix = command_line_args.lanforge_prefix
|
||||
lanforge_2g_radio = command_line_args.lanforge_2g_radio
|
||||
lanforge_5g_radio = command_line_args.lanforge_5g_radio
|
||||
|
||||
build = command_line_args.build_id
|
||||
|
||||
logger = base.logger
|
||||
hdlr = base.hdlr
|
||||
|
||||
if command_line_args.testbed == None:
|
||||
print("ERROR: Must specify --testbed argument for this test.")
|
||||
sys.exit(1)
|
||||
|
||||
client: TestRail_Client = TestRail_Client(command_line_args)
|
||||
|
||||
###Get Cloud Bearer Token
|
||||
cloud: CloudSDK = CloudSDK(command_line_args)
|
||||
bearer = cloud.get_bearer(cloudSDK_url, cloud_type)
|
||||
|
||||
cloud.assert_bad_response = True
|
||||
|
||||
model_id = command_line_args.model
|
||||
equipment_id = command_line_args.equipment_id
|
||||
|
||||
print("equipment-id: %s" % (equipment_id))
|
||||
|
||||
if equipment_id == "-1":
|
||||
eq_id = ap_ssh_ovsh_nodec(command_line_args, 'id')
|
||||
print("EQ Id: %s" % (eq_id))
|
||||
|
||||
# Now, query equipment to find something that matches.
|
||||
eq = cloud.get_customer_equipment(cloudSDK_url, bearer, customer_id)
|
||||
for item in eq:
|
||||
for e in item['items']:
|
||||
print(e['id'], " ", e['inventoryId'])
|
||||
if e['inventoryId'].endswith("_%s" % (eq_id)):
|
||||
print("Found equipment ID: %s inventoryId: %s" % (e['id'], e['inventoryId']))
|
||||
equipment_id = str(e['id'])
|
||||
|
||||
if equipment_id == -1:
|
||||
print("ERROR: Could not find equipment-id.")
|
||||
sys.exit(1)
|
||||
|
||||
###Get Current AP Firmware and upgrade
|
||||
try:
|
||||
ap_cli_info = ssh_cli_active_fw(command_line_args)
|
||||
ap_cli_fw = ap_cli_info['active_fw']
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
logging.error(logging.traceback.format_exc())
|
||||
ap_cli_info = "ERROR"
|
||||
print("FAILED: Cannot Reach AP CLI.");
|
||||
sys.exit(1)
|
||||
|
||||
fw_model = ap_cli_fw.partition("-")[0]
|
||||
|
||||
|
||||
print('Current Active AP FW from CLI:', ap_cli_fw)
|
||||
|
||||
###Find Latest FW for Current AP Model and Get FW ID
|
||||
|
||||
############################################################################
|
||||
#################### Create Report #########################################
|
||||
############################################################################
|
||||
|
||||
# Create Report Folder for Today
|
||||
today = str(date.today())
|
||||
try:
|
||||
os.mkdir(report_path + today)
|
||||
except OSError:
|
||||
print("Creation of the directory %s failed" % report_path)
|
||||
else:
|
||||
print("Successfully created the directory %s " % report_path)
|
||||
|
||||
logger.info('Report data can be found here: ' + report_path + today)
|
||||
|
||||
##Get Bearer Token to make sure its valid (long tests can require re-auth)
|
||||
bearer = cloud.get_bearer(cloudSDK_url, cloud_type)
|
||||
radius_name = "%s-%s-%s" % (command_line_args.testbed, fw_model, "Radius")
|
||||
obj = CreateAPProfiles(command_line_args, cloud=cloud, client=client, fw_model=fw_model)
|
||||
|
||||
|
||||
# Allow cmd-line to override
|
||||
if command_line_args.psk_5g_wpa2:
|
||||
obj.psk_data["5g"]["wpa2"]["name"] = command_line_args.psk_5g_wpa2
|
||||
obj.psk_data["5g"]["wpa2"]["nat"] = command_line_args.psk_5g_wpa2
|
||||
obj.psk_data["5g"]["wpa2"]["vlan"] = command_line_args.psk_5g_wpa2
|
||||
if command_line_args.psk_5g_wpa:
|
||||
obj.psk_data["5g"]["wpa"]["name"] = command_line_args.psk_5g_wpa
|
||||
obj.psk_data["5g"]["wpa"]["nat"] = command_line_args.psk_5g_wpa
|
||||
obj.psk_data["5g"]["wpa"]["vlan"] = command_line_args.psk_5g_wpa
|
||||
if command_line_args.psk_2g_wpa2:
|
||||
obj.psk_data["2g"]["wpa2"]["name"] = command_line_args.psk_2g_wpa2
|
||||
obj.psk_data["2g"]["wpa2"]["nat"] = command_line_args.psk_2g_wpa2
|
||||
obj.psk_data["2g"]["wpa2"]["vlan"] =command_line_args.psk_2g_wpa2
|
||||
if command_line_args.psk_2g_wpa:
|
||||
obj.psk_data["2g"]["wpa"]["name"] = command_line_args.psk_2g_wpa
|
||||
obj.psk_data["2g"]["wpa"]["nat"] = command_line_args.psk_2g_wpa
|
||||
obj.psk_data["2g"]["wpa"]["nat"] = command_line_args.psk_2g_wpa
|
||||
if command_line_args.ssid_5g_wpa2:
|
||||
obj.ssid_data["5g"]["wpa2"]["name"] = command_line_args.ssid_5g_wpa2
|
||||
obj.ssid_data["5g"]["wpa2"]["nat"] = command_line_args.ssid_5g_wpa2
|
||||
obj.ssid_data["5g"]["wpa2"]["vlan"] = command_line_args.ssid_5g_wpa2
|
||||
if command_line_args.ssid_5g_wpa:
|
||||
obj.ssid_data["5g"]["wpa"]["name"] = command_line_args.ssid_5g_wpa
|
||||
obj.ssid_data["5g"]["wpa"]["nat"] = command_line_args.ssid_5g_wpa
|
||||
obj.ssid_data["5g"]["wpa"]["vlan"] = command_line_args.ssid_5g_wpa
|
||||
if command_line_args.ssid_2g_wpa2:
|
||||
obj.ssid_data["2g"]["wpa2"]["name"] = command_line_args.ssid_2g_wpa2
|
||||
obj.ssid_data["2g"]["wpa2"]["nat"] = command_line_args.ssid_2g_wpa2
|
||||
obj.ssid_data["2g"]["wpa2"]["vlan"] = command_line_args.ssid_2g_wpa2
|
||||
if command_line_args.ssid_2g_wpa:
|
||||
obj.ssid_data["2g"]["wpa"]["name"] = command_line_args.ssid_2g_wpa
|
||||
obj.ssid_data["2g"]["wpa"]["nat"] = command_line_args.ssid_2g_wpa
|
||||
obj.ssid_data["2g"]["wpa"]["vlan"] = command_line_args.ssid_2g_wpa
|
||||
|
||||
print("creating Profiles")
|
||||
ssid_template = "TipWlan-Cloud-Wifi"
|
||||
|
||||
|
||||
|
||||
if not command_line_args.skip_profiles:
|
||||
if not command_line_args.skip_radius:
|
||||
obj.create_radius_profile(radius_name, rid, key)
|
||||
obj.create_ssid_profiles(ssid_template=ssid_template, skip_wpa2=command_line_args.skip_wpa2,
|
||||
skip_wpa=command_line_args.skip_wpa, skip_eap=command_line_args.skip_radius)
|
||||
|
||||
print("Create AP with equipment-id: ", equipment_id)
|
||||
obj.create_ap_bridge_profile(eq_id=equipment_id, fw_model=fw_model)
|
||||
obj.validate_changes()
|
||||
|
||||
print("Profiles Created")
|
||||
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user