testing the fms - debug patch

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-09-16 03:43:25 +05:30
parent ea46715d7a
commit 4b1653c89f
6 changed files with 46 additions and 49 deletions

View File

@@ -232,10 +232,10 @@ class FMSUtils:
else:
return {}
def get_firmwares(self, limit="", model="cig_wf188", latestonly="", branch="", commit_id=""):
# 2c3becf
def get_firmwares(self, limit="", model="", latestonly="", branch="", commit_id=""):
deviceType = self.ap_model_lookup(model=model)
params = "limit=" + limit + "&deviceType=" + deviceType + "&latestonly=" + latestonly
response = self.sdk_client.request(service="fms", command="firmwares/", method="GET", params=params, payload="")
@@ -243,6 +243,13 @@ class FMSUtils:
if response.status_code == 200:
data = response.json()
newlist = sorted(data['firmwares'], key=itemgetter('created'))
print("finding a bug", len(newlist))
for i in newlist:
print(i['uri'])
print(i['revision'])
# print(newlist)
self.sdk_client.logout()
pytest.exit("hey")
return newlist
# print(data)
@@ -532,16 +539,17 @@ if __name__ == '__main__':
'password': 'openwifi',
}
obj = Controller(controller_data=controller)
# fms = FMSUtils(sdk_client=obj)
fms = FMSUtils(sdk_client=obj)
fms.get_firmwares()
# fms.get_device_set()
# model = fms.get_latest_fw(model="eap102")
# print(model)
profile = UProfileUtility(sdk_client=obj)
profile.set_mode(mode="BRIDGE")
profile.set_radio_config()
ssid = {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G", "5G"], "security": "psk", "security_key": "something"}
profile.add_ssid(ssid_data=ssid, radius=False)
profile.push_config(serial_number="0000c1018812")
# profile = UProfileUtility(sdk_client=obj)
# profile.set_mode(mode="BRIDGE")
# profile.set_radio_config()
# ssid = {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G", "5G"], "security": "psk", "security_key": "something"}
# profile.add_ssid(ssid_data=ssid, radius=False)
# profile.push_config(serial_number="0000c1018812")
# print(profile.get_ssid_info())
# # print(obj.get_devices())
obj.logout()

View File

@@ -234,7 +234,7 @@ def get_apnos():
@pytest.fixture(scope="session")
def get_equipment_id(request, setup_controller, testbed, get_configuration):
def get_equipment_ref(request, setup_controller, testbed, get_configuration):
""""""
if request.config.getoption("1.x"):
equipment_id_list = []
@@ -248,21 +248,6 @@ def get_equipment_id(request, setup_controller, testbed, get_configuration):
yield equipment_id_list
@pytest.fixture(scope="session")
def instantiate_access_point(testbed, get_apnos, get_configuration):
"""setup the access point connectivity"""
if request.config.getoption("1.x"):
for access_point_info in get_configuration['access_point']:
if access_point_info["jumphost"]:
get_apnos(access_point_info, pwd="../libs/apnos/", sdk="1.x")
else:
pass
else:
get_apnos(access_point_info, pwd="../libs/apnos/")
# Write a code to verify Access Point Connectivity
yield True
# Controller Fixture
@pytest.fixture(scope="session")
def setup_controller(request, get_configuration, test_access_point, add_env_properties, fixtures_ver):

View File

@@ -7,13 +7,14 @@ import pytest
import json
import allure
@allure.feature("SDK REST API")
@allure.feature("SDK REST API")
class TestUcentralSecService(object):
"""
Test the oauth endpoint
WIFI-3447
"""
@pytest.mark.sdk_restapi
def test_secservice_oauth(self, setup_controller):
"""
@@ -49,7 +50,7 @@ class TestUcentralSecService(object):
if resp.status_code != 200:
assert False
services = json.loads(resp.text)
print (services)
print(services)
if 'endpoints' not in services:
assert False
@@ -88,7 +89,7 @@ class TestUcentralSecService(object):
if resp.status_code != 200:
assert False
system = json.loads(resp.text)
print (system)
print(system)
if 'tag' not in system:
assert False
if system['tag'] != 'version':
@@ -110,7 +111,7 @@ class TestUcentralSecService(object):
if resp.status_code != 200:
assert False
system = json.loads(resp.text)
print (system)
print(system)
if 'times' not in system:
assert False
@@ -124,6 +125,3 @@ class TestUcentralSecService(object):
valid_entities += 1
assert (valid_entities == 4)

View File

@@ -32,10 +32,10 @@ class TestFirmware(object):
assert PASS
@pytest.mark.check_active_firmware_cloud
def test_active_version_cloud(self, get_latest_firmware, get_equipment_id, setup_controller,
def test_active_version_cloud(self, get_latest_firmware, get_equipment_ref, setup_controller,
update_report, test_cases):
ap_fw_list = []
for i in get_equipment_id:
for i in get_equipment_ref:
ap_fw_list.append(setup_controller.get_ap_firmware_old_method(equipment_id=i))
assert get_latest_firmware == ap_fw_list

View File

@@ -130,12 +130,12 @@ class Fixtures_2x:
# wait for 300 seconds after firmware upgrade
items = list(range(0, 300))
l = len(items)
self.printProgressBar(0, l, prefix='Progress:', suffix='Complete', length=50)
for i, item in enumerate(items):
# Do stuff...
time.sleep(0.8)
# Update Progress Bar
self.printProgressBar(i + 1, l, prefix='Progress:', suffix='Complete', length=50)
# self.printProgressBar(0, l, prefix='Progress:', suffix='Complete', length=50)
# for i, item in enumerate(items):
# # Do stuff...
# time.sleep(0.8)
# # Update Progress Bar
# self.printProgressBar(i + 1, l, prefix='Progress:', suffix='Complete', length=50)
# check the current AP Revision again
ap_version = ap_ssh.get_ap_version_ucentral()
@@ -503,7 +503,7 @@ class Fixtures_2x:
S = 9
instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))
ap_ssh.run_generic_command(cmd="logger start testcase: " + instance_name)
instantiate_profile_obj.push_config(serial_number=get_equipment_id[0])
instantiate_profile_obj.push_config(serial_number=get_equipment_ref[0])
time_1 = time.time()
config = json.loads(str(instantiate_profile_obj.base_profile_config).replace(" ", "").replace("'", '"'))
config["uuid"] = 0

View File

@@ -21,19 +21,25 @@ class TestResources(object):
"""Test Case Class: Test cases to cover resource Connectivity"""
@pytest.mark.test_cloud_controller
@pytest.mark.uc_sanity
@allure.testcase(name="test_controller_connectivity", url="")
def test_controller_connectivity(self, setup_controller, setup_test_run, update_report, test_cases):
def test_controller_connectivity(self, setup_controller):
"""Test case to verify cloud Controller Connectivity"""
if setup_controller.bearer:
allure.attach(name="Controller Connectivity Success", body="")
else:
allure.attach(name="Controller Connectivity Failed", body="")
pytest.exit("Controller Not Available")
assert setup_controller.bearer
login_response_json = setup_controller.login_resp.json()
response_code = setup_controller.login_resp.status_code
allure.attach(name="Login Response Code", body=str(response_code))
allure.attach(name="Login Response JSON", body=str(login_response_json))
# if setup_controller.bearer:
# allure.attach(name="Controller Connectivity Success", body="")
# else:
# allure.attach(name="Controller Connectivity Failed", body="")
# pytest.exit("Controller Not Available")
# assert setup_controller.bearer
assert response_code == 200
@pytest.mark.test_access_points_connectivity
@allure.testcase(name="test_access_points_connectivity", url="")
def test_access_points_connectivity(self, test_access_point, update_report, test_cases):
def test_access_points_connectivity(self, test_access_point):
"""Test case to verify Access Points Connectivity"""
flag = True
for i in test_access_point: