mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-02 20:07:57 +00:00
updated library names and paths
Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
@@ -9,26 +9,21 @@ sys.path.append(
|
|||||||
os.path.realpath(__file__)
|
os.path.realpath(__file__)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if "libs" not in sys.path:
|
||||||
|
sys.path.append(f'../libs')
|
||||||
|
|
||||||
if 'cloudsdk' not in sys.path:
|
from apnos.apnos import APNOS
|
||||||
sys.path.append(f'../libs/cloudsdk')
|
from controller.controller import Controller
|
||||||
if 'apnos' not in sys.path:
|
from controller.controller import ProfileUtility
|
||||||
sys.path.append(f'../libs/apnos')
|
from controller.controller import FirmwareUtility
|
||||||
if 'testrails' not in sys.path:
|
|
||||||
sys.path.append(f'../libs/testrails')
|
|
||||||
|
|
||||||
from apnos import APNOS
|
|
||||||
from cloudsdk import CloudSDK
|
|
||||||
from cloudsdk import ProfileUtility
|
|
||||||
from cloudsdk import FirmwareUtility
|
|
||||||
import pytest
|
import pytest
|
||||||
import logging
|
import logging
|
||||||
from configuration import RADIUS_SERVER_DATA
|
from configuration import RADIUS_SERVER_DATA
|
||||||
from configuration import TEST_CASES
|
from configuration import TEST_CASES
|
||||||
from configuration import CONFIGURATION
|
from configuration import CONFIGURATION
|
||||||
from configuration import FIRMWARE
|
from configuration import FIRMWARE
|
||||||
from testrail_api import APIClient
|
from testrails.testrail_api import APIClient
|
||||||
from reporting import Reporting
|
from testrails.reporting import Reporting
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
@@ -110,14 +105,12 @@ Instantiate Objects for Test session
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def instantiate_cloudsdk(request, testbed):
|
def instantiate_controller(request, testbed):
|
||||||
try:
|
try:
|
||||||
sdk_client = CloudSDK(testbed=CONFIGURATION[testbed]["controller"]["url"],
|
sdk_client = Controller(controller_data=CONFIGURATION[testbed]["controller"])
|
||||||
customer_id=2)
|
|
||||||
|
|
||||||
def teardown_session():
|
def teardown_session():
|
||||||
print("\nTest session Completed")
|
print("\nTest session Completed")
|
||||||
sdk_client.disconnect_cloudsdk()
|
sdk_client.disconnect_Controller()
|
||||||
|
|
||||||
request.addfinalizer(teardown_session)
|
request.addfinalizer(teardown_session)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -137,8 +130,8 @@ def instantiate_testrail(request):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def instantiate_firmware(instantiate_cloudsdk, instantiate_jFrog):
|
def instantiate_firmware(instantiate_controller, instantiate_jFrog):
|
||||||
firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_cloudsdk)
|
firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_controller)
|
||||||
yield firmware_client
|
yield firmware_client
|
||||||
|
|
||||||
|
|
||||||
@@ -153,14 +146,12 @@ def instantiate_project(request, instantiate_testrail, testbed, get_latest_firmw
|
|||||||
rid = "skip testrails"
|
rid = "skip testrails"
|
||||||
else:
|
else:
|
||||||
projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
|
projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
|
||||||
test_run_name = testbed + "_" + str(
|
test_run_name = "TIP_" + testbed + "_" + str(
|
||||||
datetime.date.today()) + "_" + get_latest_firmware
|
datetime.date.today()) + "_" + get_latest_firmware
|
||||||
instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
|
instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
|
||||||
milestone_id=request.config.getini("milestone"),
|
milestone_id=request.config.getini("milestone"),
|
||||||
description="Automated Nightly Sanity test run for new firmware build")
|
description="Automated Nightly Sanity test run for new firmware build")
|
||||||
rid = instantiate_testrail.get_run_id(
|
rid = instantiate_testrail.get_run_id(test_run_name=test_run_name)
|
||||||
test_run_name=request.config.getini("tr_prefix") + testbed + "_" + str(
|
|
||||||
datetime.date.today()) + "_" + get_latest_firmware)
|
|
||||||
yield rid
|
yield rid
|
||||||
|
|
||||||
|
|
||||||
@@ -181,18 +172,18 @@ def test_cases():
|
|||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def test_access_point(testbed):
|
def test_access_point(testbed):
|
||||||
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0])
|
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point_tests'][0])
|
||||||
status = ap_ssh.get_manager_state()
|
status = ap_ssh.get_manager_state()
|
||||||
if "ACTIVE" not in status:
|
if "ACTIVE" not in status:
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0])
|
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point_tests'][0])
|
||||||
status = ap_ssh.get_manager_state()
|
status = ap_ssh.get_manager_state()
|
||||||
yield status
|
yield status
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def setup_profile_data(testbed):
|
def setup_profile_data(testbed):
|
||||||
model = CONFIGURATION[testbed]["access_point"][0]["model"]
|
model = CONFIGURATION[testbed]["access_point_tests"][0]["model"]
|
||||||
profile_data = {}
|
profile_data = {}
|
||||||
for mode in "BRIDGE", "NAT", "VLAN":
|
for mode in "BRIDGE", "NAT", "VLAN":
|
||||||
profile_data[mode] = {}
|
profile_data[mode] = {}
|
||||||
@@ -247,7 +238,7 @@ def get_markers(request, get_security_flags):
|
|||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def get_latest_firmware(testbed, instantiate_firmware):
|
def get_latest_firmware(testbed, instantiate_firmware):
|
||||||
try:
|
try:
|
||||||
latest_firmware = instantiate_firmware.get_latest_fw_version(CONFIGURATION[testbed]["access_point"][0]["model"])
|
latest_firmware = instantiate_firmware.get_latest_fw_version(CONFIGURATION[testbed]["access_point_tests"][0]["model"])
|
||||||
except:
|
except:
|
||||||
latest_firmware = False
|
latest_firmware = False
|
||||||
yield latest_firmware
|
yield latest_firmware
|
||||||
@@ -256,7 +247,7 @@ def get_latest_firmware(testbed, instantiate_firmware):
|
|||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def check_ap_firmware_ssh(testbed):
|
def check_ap_firmware_ssh(testbed):
|
||||||
try:
|
try:
|
||||||
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0])
|
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point_tests'][0])
|
||||||
active_fw = ap_ssh.get_active_firmware()
|
active_fw = ap_ssh.get_active_firmware()
|
||||||
print(active_fw)
|
print(active_fw)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user