Adding framework support for multi ap support

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-05-11 14:15:12 +05:30
parent e21c57a796
commit bbefdf1056
34 changed files with 1696 additions and 1562 deletions

View File

@@ -13,6 +13,7 @@ Currently Having Methods:
import paramiko
from scp import SCPClient
import os
import allure
class APNOS:
@@ -39,7 +40,7 @@ class APNOS:
if str(stdout.read()).__contains__("False"):
print("Copying openwrt_ctl serial control Script...")
with SCPClient(client.get_transport()) as scp:
scp.put(pwd+'openwrt_ctl.py', '~/cicd-git/openwrt_ctl.py') # Copy my_file.txt to the server
scp.put(pwd + 'openwrt_ctl.py', '~/cicd-git/openwrt_ctl.py') # Copy my_file.txt to the server
cmd = '[ -f ~/cicd-git/openwrt_ctl.py ] && echo "True" || echo "False"'
stdin, stdout, stderr = client.exec_command(cmd)
var = str(stdout.read())
@@ -79,6 +80,8 @@ class APNOS:
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read()
allure.attach(body=str("VIF Config: " + str(vif_config) + "\n" + "VIF State: " + str(vif_state)),
name="SSID Profiles in VIF Config and VIF State: ")
client.close()
return output

View File

@@ -5,6 +5,7 @@ make sure pexpect is installed:
$ sudo yum install python3-pexpect
You might need to install pexpect-serial using pip:
$ pip3 install serial
$ pip3 install pexpect-serial
./openwrt_ctl.py -l stdout -u root -p TIP -s serial --tty ttyUSB0

View File

@@ -93,7 +93,7 @@ class Controller(ConfigureController):
self.api_client.configuration.api_key_prefix = {
"Authorization": "Bearer " + self.bearer._access_token
}
self.api_client.configuration.refresh_api_key_hook = self.get_bearer_token()
self.api_client.configuration.refresh_api_key_hook = self.refresh_instance
self.ping_response = self.portal_ping()
self.default_profiles = {}
# print(self.bearer)
@@ -122,7 +122,7 @@ class Controller(ConfigureController):
self.api_client.configuration.api_key_prefix = {
"Authorization": "Bearer " + self.bearer._access_token
}
self.api_client.configuration.refresh_api_key_hook = self.get_bearer_token()
self.api_client.configuration.refresh_api_key_hook = self.refresh_instance
self.ping_response = self.portal_ping()
self.default_profiles = {}
# print(self.bearer)
@@ -451,21 +451,16 @@ class ProfileUtility:
method call: used to create a ssid profile with the given parameters
"""
def create_open_ssid_profile(self, two4g=True, fiveg=True, profile_data=None):
def create_open_ssid_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = self.default_profiles['ssid']
default_profile._details['appliedRadios'] = []
if two4g is True:
default_profile._details['appliedRadios'].append("is2dot4GHz")
if fiveg is True:
default_profile._details['appliedRadios'].append("is5GHzU")
default_profile._details['appliedRadios'].append("is5GHz")
default_profile._details['appliedRadios'].append("is5GHzL")
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['vlanId'] = profile_data['vlan']
default_profile._details['forwardMode'] = profile_data['mode']
default_profile._details['secureMode'] = 'open'
profile = self.profile_client.create_profile(body=default_profile)
@@ -473,22 +468,17 @@ class ProfileUtility:
self.profile_creation_ids['ssid'].append(profile_id)
self.profile_ids.append(profile_id)
except Exception as e:
print(e)
profile = "error"
return profile
def create_wpa_ssid_profile(self, two4g=True, fiveg=True, profile_data=None):
def create_wpa_ssid_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = self.default_profiles['ssid']
default_profile._details['appliedRadios'] = []
if two4g is True:
default_profile._details['appliedRadios'].append("is2dot4GHz")
if fiveg is True:
default_profile._details['appliedRadios'].append("is5GHzU")
default_profile._details['appliedRadios'].append("is5GHz")
default_profile._details['appliedRadios'].append("is5GHzL")
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']
@@ -500,21 +490,17 @@ class ProfileUtility:
self.profile_creation_ids['ssid'].append(profile_id)
self.profile_ids.append(profile_id)
except Exception as e:
print(e)
profile = False
return profile
def create_wpa2_personal_ssid_profile(self, two4g=True, fiveg=True, profile_data=None):
def create_wpa2_personal_ssid_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = self.default_profiles['ssid']
default_profile._details['appliedRadios'] = []
if two4g is True:
default_profile._details['appliedRadios'].append("is2dot4GHz")
if fiveg is True:
default_profile._details['appliedRadios'].append("is5GHzU")
default_profile._details['appliedRadios'].append("is5GHz")
default_profile._details['appliedRadios'].append("is5GHzL")
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']
@@ -526,43 +512,39 @@ class ProfileUtility:
self.profile_creation_ids['ssid'].append(profile_id)
self.profile_ids.append(profile_id)
except Exception as e:
print(e)
profile = False
return profile
def create_wpa3_personal_ssid_profile(self, two4g=True, fiveg=True, profile_data=None):
if profile_data is None:
return False
default_profile = self.default_profiles['ssid']
default_profile._details['appliedRadios'] = []
if two4g is True:
default_profile._details['appliedRadios'].append("is2dot4GHz")
if fiveg is True:
default_profile._details['appliedRadios'].append("is5GHzU")
default_profile._details['appliedRadios'].append("is5GHz")
default_profile._details['appliedRadios'].append("is5GHzL")
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['keyStr'] = profile_data['security_key']
default_profile._details['forwardMode'] = profile_data['mode']
default_profile._details['secureMode'] = 'wpa3OnlyPSK'
profile_id = self.profile_client.create_profile(body=default_profile)._id
self.profile_creation_ids['ssid'].append(profile_id)
self.profile_ids.append(profile_id)
return True
def create_wpa2_enterprise_ssid_profile(self, two4g=True, fiveg=True, profile_data=None):
def create_wpa3_personal_ssid_profile(self, profile_data=None):
try:
if profile_data is None:
return False
default_profile = self.default_profiles['ssid']
default_profile._details['appliedRadios'] = []
if two4g is True:
default_profile._details['appliedRadios'].append("is2dot4GHz")
if fiveg is True:
default_profile._details['appliedRadios'].append("is5GHzU")
default_profile._details['appliedRadios'].append("is5GHz")
default_profile._details['appliedRadios'].append("is5GHzL")
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['keyStr'] = profile_data['security_key']
default_profile._details['forwardMode'] = profile_data['mode']
default_profile._details['secureMode'] = 'wpa3OnlyPSK'
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)
except Exception as e:
print(e)
profile = False
return profile
def create_wpa2_enterprise_ssid_profile(self, profile_data=None):
try:
if profile_data 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']
@@ -579,29 +561,27 @@ class ProfileUtility:
profile = False
return profile
def create_wpa3_enterprise_ssid_profile(self, two4g=True, fiveg=True, profile_data=None):
if profile_data is None:
return False
default_profile = self.default_profiles['ssid']
default_profile._details['appliedRadios'] = []
if two4g is True:
default_profile._details['appliedRadios'].append("is2dot4GHz")
if fiveg is True:
default_profile._details['appliedRadios'].append("is5GHzU")
default_profile._details['appliedRadios'].append("is5GHz")
default_profile._details['appliedRadios'].append("is5GHzL")
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['keyStr'] = profile_data['security_key']
default_profile._details['forwardMode'] = profile_data['mode']
default_profile._details['secureMode'] = 'wpa3OnlyRadius'
default_profile._details["radiusServiceId"] = self.profile_creation_ids["radius"][0]
default_profile._child_profile_ids = self.profile_creation_ids["radius"]
profile_id = self.profile_client.create_profile(body=default_profile)._id
self.profile_creation_ids['ssid'].append(profile_id)
self.profile_ids.append(profile_id)
return True
def create_wpa3_enterprise_ssid_profile(self, profile_data=None):
try:
if profile_data 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'] = 'wpa3OnlyEAP'
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)
except Exception as e:
print(e)
profile = False
return profile
"""
method call: used to create a ap profile that contains the given ssid profiles
@@ -728,17 +708,17 @@ class JFrogUtility:
def get_build(self, model=None, version=None):
jfrog_url = self.jfrog_url + "/" + model + "/" + self.branch + "/"
auth = str(
base64.b64encode(
bytes('%s:%s' % (self.user, self.password), 'utf-8')
),
'ascii'
).strip()
headers = {'Authorization': 'Basic ' + auth}
# auth = str(
# base64.b64encode(
# bytes('%s:%s' % (self.user, self.password), 'utf-8')
# ),
# 'ascii'
# ).strip()
# headers = {'Authorization': 'Basic ' + auth}
''' FIND THE LATEST FILE NAME'''
print(jfrog_url)
req = urllib.request.Request(jfrog_url, headers=headers)
req = urllib.request.Request(jfrog_url)
response = urllib.request.urlopen(req)
# print(response)
html = response.read()
@@ -857,3 +837,16 @@ class FirmwareUtility(JFrogUtility):
firmware_version = False
print("firmware not available: ", firmware_version)
return firmware_version
controller = {
'url': "https://wlan-portal-svc-nola-ext-03.cicd.lab.wlan.tip.build", # API base url for the controller
'username': 'support@example.com',
'password': 'support',
'version': "1.1.0-SNAPSHOT",
'commit_date': "2021-04-27"
}
api = Controller(controller_data=controller)
for i in range(0, 2500):
print(i)
time.sleep(1)
print(api.get_equipment_by_customer_id())
api.disconnect_Controller()

View File

@@ -1,6 +1,7 @@
class Reporting:
def __init__(self):
self.rid = None
pass
def update_testrail(self, case_id=None, run_id=None, status_id=1, msg=None):

View File

@@ -27,6 +27,7 @@ class APIClient:
self.user = tr_user
self.password = tr_pw
self.project = project
self.rid = None
if not base_url.endswith('/'):
base_url += '/'
self.__url = base_url + 'index.php?/api/v2/'
@@ -148,9 +149,10 @@ class APIClient:
break
return run_id
def update_testrail(self, case_id, run_id, status_id, msg):
def update_testrail(self, case_id, status_id, msg):
"Update TestRail for a given run_id and case_id"
update_flag = False
run_id = self.rid
# Get the TestRail client account details
# Update the result in TestRail using send_post function.
# Parameters for add_result_for_case is the combination of runid and case id.

View File

@@ -3,6 +3,7 @@ import datetime
import sys
import os
import time
import allure
sys.path.append(
os.path.dirname(
@@ -11,7 +12,19 @@ sys.path.append(
)
if "libs" not in sys.path:
sys.path.append(f'../libs')
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"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity")
sys.path.append(f'../libs')
sys.path.append(f'../libs/lanforge/')
from LANforge.LFUtils import *
if 'py-json' not in sys.path:
sys.path.append('../py-scripts')
from apnos.apnos import APNOS
from controller.controller import Controller
from controller.controller import ProfileUtility
@@ -24,6 +37,8 @@ from configuration import CONFIGURATION
from configuration import FIRMWARE
from testrails.testrail_api import APIClient
from testrails.reporting import Reporting
import sta_connect2
from sta_connect2 import StaConnect2
def pytest_addoption(parser):
@@ -58,16 +73,10 @@ def pytest_addoption(parser):
)
# this has to be the last argument
# example: --access-points ECW5410 EA8300-EU
parser.addoption(
"--model",
# nargs="+",
default="ecw5410",
help="AP Model which is needed to test"
)
parser.addoption(
"--testbed",
# nargs="+",
default="lab-info",
default="basic-01",
help="AP Model which is needed to test"
)
parser.addoption(
@@ -86,6 +95,8 @@ Test session base fixture
@pytest.fixture(scope="session")
def testbed(request):
var = request.config.getoption("--testbed")
allure.attach(body=str(var),
name="Testbed Selected : ")
yield var
@@ -99,65 +110,87 @@ def should_upgrade_firmware(request):
yield request.config.getoption("--force-upgrade")
"""
Instantiate Objects for Test session
"""
@pytest.fixture(scope="session")
def instantiate_controller(request, testbed):
try:
sdk_client = Controller(controller_data=CONFIGURATION[testbed]["controller"])
def radius_info():
allure.attach(body=str(RADIUS_SERVER_DATA), name="Radius server Info: ")
yield RADIUS_SERVER_DATA
def teardown_session():
# Get Configuration data f
@pytest.fixture(scope="session")
def get_configuration(testbed):
allure.attach(body=str(testbed), name="Testbed Selected: ")
yield CONFIGURATION[testbed]
# APNOS Library
@pytest.fixture(scope="session")
def get_apnos():
yield APNOS
# Controller Fixture
@pytest.fixture(scope="session")
def setup_controller(request, get_configuration):
try:
sdk_client = Controller(controller_data=get_configuration["controller"])
allure.attach(body=str(get_configuration["controller"]), name="Controller Instantiated: ")
def teardown_controller():
print("\nTest session Completed")
allure.attach(body=str(get_configuration["controller"]), name="Controller Teardown: ")
sdk_client.disconnect_Controller()
request.addfinalizer(teardown_session)
request.addfinalizer(teardown_controller)
except Exception as e:
print(e)
allure.attach(body=str(e), name="Controller Instantiation Failed: ")
sdk_client = False
yield sdk_client
@pytest.fixture(scope="session")
def instantiate_testrail(request):
def instantiate_firmware(controller_instance, instantiate_jFrog, get_configuration):
firmware_client_obj = []
for access_point_info in get_configuration['access_point']:
firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=controller_instance,
model=access_point_info["model"],
version=access_point_info["version"])
firmware_client_obj.append(firmware_client)
yield firmware_client_obj
"""
Instantiate Reporting
"""
@pytest.fixture(scope="session")
def instantiate_reporting(request, testbed, get_latest_firmware):
if request.config.getoption("--skip-testrail"):
tr_client = Reporting()
else:
tr_client = APIClient(request.config.getini("tr_url"), request.config.getini("tr_user"),
request.config.getini("tr_pass"), request.config.getini("tr_project_id"))
if request.config.getoption("--skip-testrail"):
tr_client.rid = "skip testrails"
else:
projId = tr_client.get_project_id(project_name=request.config.getini("tr_project_id"))
test_run_name = request.config.getini("tr_prefix") + testbed + "_" + str(
datetime.date.today()) + "_" + get_latest_firmware
tr_client.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
milestone_id=request.config.getini("milestone"),
description="Automated Nightly Sanity test run for new firmware build")
rid = tr_client.get_run_id(test_run_name=test_run_name)
tr_client.rid = rid
yield tr_client
@pytest.fixture(scope="session")
def instantiate_firmware(instantiate_controller, instantiate_jFrog, testbed):
firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_controller,
model=CONFIGURATION[testbed]["access_point"][0]["model"],
version=CONFIGURATION[testbed]["access_point"][0]["version"])
yield firmware_client
@pytest.fixture(scope="session")
def instantiate_jFrog():
yield FIRMWARE["JFROG"]
@pytest.fixture(scope="session")
def instantiate_project(request, instantiate_testrail, testbed, get_latest_firmware):
if request.config.getoption("--skip-testrail"):
rid = "skip testrails"
else:
projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
test_run_name = request.config.getini("tr_prefix") + testbed + "_" + str(
datetime.date.today()) + "_" + get_latest_firmware
instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
milestone_id=request.config.getini("milestone"),
description="Automated Nightly Sanity test run for new firmware build")
rid = instantiate_testrail.get_run_id(test_run_name=test_run_name)
yield rid
@pytest.fixture(scope="session")
def check_lanforge_connectivity(testbed):
# Check port
@@ -225,7 +258,7 @@ def setup_profile_data(testbed):
@pytest.fixture(scope="session")
def get_security_flags():
security = ["open", "wpa", "wpa2_personal", "wpa2_enterprise", "twog", "fiveg", "radius"]
security = ["open", "wpa", "wpa2_personal", "wpa2_enterprise", "wpa3_enterprise", "twog", "fiveg", "radius"]
yield security
@@ -245,6 +278,7 @@ def get_markers(request, get_security_flags):
else:
security_dict[i] = False
# print(security_dict)
allure.attach(body=str(security_dict), name="Test Cases Requires: ")
yield security_dict
@@ -271,5 +305,5 @@ def check_ap_firmware_ssh(testbed):
@pytest.fixture(scope="session")
def radius_info():
yield RADIUS_SERVER_DATA
def client_connectivity():
yield StaConnect2

View File

@@ -0,0 +1,91 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.bridge, pytest.mark.configuration, pytest.mark.basic]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
@allure.feature("BRIDGE MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_general],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestBridgeModeConfiguration(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g_config(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["open_2g"]), 'OPEN SSID 2.4 GHz Creation : ')
assert setup_client_connectivity["open_2g"]
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g_config(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["open_5g"]), 'OPEN SSID 5 GHz Creation : ')
assert setup_client_connectivity["open_5g"]
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g_config(self, setup_client_connectivity):
print(setup_client_connectivity)
allure.attach(str(setup_client_connectivity["wpa_2g"]), 'WPA SSID 2.4 GHz Creation : ')
assert setup_client_connectivity["wpa_2g"]
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g_config(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["wpa_5g"]), 'WPA SSID 5 GHz Creation : ')
assert setup_client_connectivity["wpa_5g"]
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g_config(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["wpa2_personal_2g"]), 'WPA2 Personal SSID 2.4 GHz Creation : ')
assert setup_client_connectivity["wpa2_personal_2g"]
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g_config(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["wpa2_personal_5g"]), 'WPA2 Personal SSID 5 GHz Creation : ')
assert setup_client_connectivity["wpa2_personal_5g"]
@allure.story('equipment AP Configuration')
def test_equipment_ap_profile_configuration(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["equipment_ap"]), 'Equipment AP Profile Creation : ')
assert setup_client_connectivity["equipment_ap"]
@allure.story('Config push from controller to AP')
def test_verify_vif_config(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["vifc"]), 'Profile Push from Controller to AP : ')
assert setup_client_connectivity["vifc"]
@allure.story('Config in VIF State')
def test_verify_vif_state(self, setup_client_connectivity):
allure.attach(str(setup_client_connectivity["vifs"]), 'VIF CONFIG AND VIF STATE ARE SAME : ')
assert setup_client_connectivity["vifs"]

View File

@@ -0,0 +1,124 @@
import time
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.bridge, pytest.mark.basic]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
@allure.feature("BRIDGE MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_general],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestBridgeModeConnectivity(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["open"][0]
print(ssid_data)
assert "setup_client_connectivity"
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["open"][1]
print(ssid_data)
assert "setup_client_connectivity"
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self, request, get_lanforge_data, instantiate_project, instantiate_testrail,
client_connectivity, test_cases):
profile_data = setup_params_general["ssid_modes"]["wpa"][0]
print(profile_data)
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
print(profile_data, get_lanforge_data)
staConnect = client_connectivity(get_lanforge_data["lanforge_ip"],
int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_2dot4g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_bridge"], run_id=instantiate_project,
status_id=1,
msg='2G WPA Client Connectivity Passed successfully - bridge mode' + str(
run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_bridge"], run_id=instantiate_project,
status_id=5,
msg='2G WPA Client Connectivity Failed - bridge mode' + str(
run_results))
assert staConnect.passes()
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa"][1]
print(ssid_data)
assert "setup_client_connectivity"
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
print(ssid_data)
assert "setup_client_connectivity"
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
print(ssid_data)
assert "setup_client_connectivity"

View File

@@ -0,0 +1,55 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.enterprise, pytest.mark.bridge, pytest.mark.configuration]
setup_params_enterprise = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}]},
"rf": {},
"radius": True
}
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_enterprise],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestBridgeModeEnterprise(object):
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self):
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self):
assert "setup_client_connectivity"

View File

@@ -0,0 +1,55 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.enterprise, pytest.mark.bridge]
setup_params_enterprise = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}]},
"rf": {},
"radius": True
}
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_enterprise],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestBridgeModeEnterprise(object):
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self,):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self):
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self):
assert "setup_client_connectivity"

View File

@@ -0,0 +1,344 @@
import time
import pytest
import allure
@pytest.fixture(scope="session")
def setup_vlan():
vlan_id = [100]
allure.attach(body=str(vlan_id), name="VLAN Created: ")
yield vlan_id[0]
@allure.feature("CLIENT CONNECTIVITY SETUP")
@pytest.fixture(scope="package")
def setup_client_connectivity(request, instantiate_controller, testbed, setup_vlan, get_equipment_id,
instantiate_profile, get_markers,
get_security_flags, get_configuration, radius_info, get_apnos):
instantiate_profile = instantiate_profile(sdk_client=instantiate_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
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Equipment-AP-" + parameter['mode'])
profile_data["equipment_ap"] = {"profile_name": testbed + "-Equipment-AP-" + parameter['mode']}
profile_data["ssid"] = {}
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)
# print(profile_name)
# print(profile_data)
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode)
time.sleep(10)
"""
Setting up rf profile
"""
rf_profile_data = {
"name": "RF-Profile-" + testbed + "-" + parameter['mode'] + "-" +
get_configuration[testbed]['access_point'][0]['mode']
}
for i in parameter["rf"]:
rf_profile_data[i] = parameter['rf'][i]
# print(rf_profile_data)
try:
instantiate_profile.delete_profile_by_name(profile_name=rf_profile_data['name'])
instantiate_profile.set_rf_profile(profile_data=rf_profile_data,
mode=get_configuration[testbed]['access_point'][0]['mode'])
allure.attach(body=str(rf_profile_data),
name="RF Profile Created : " + get_configuration[testbed]['access_point'][0]['mode'])
except Exception as e:
print(e)
allure.attach(body=str(e), name="Exception ")
# Radius Profile Creation
if parameter["radius"]:
radius_info = radius_info
radius_info["name"] = testbed + "-Automation-Radius-Profile-" + testbed
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + testbed)
try:
# pass
instantiate_profile.create_radius_profile(radius_info=radius_info)
allure.attach(body=str(radius_info),
name="Radius Profile Created")
test_cases['radius_profile'] = True
except Exception as e:
print(e)
test_cases['radius_profile'] = False
# SSID Profile Creation
print(get_markers)
for mode in profile_data['ssid']:
if mode == "open":
for j in profile_data["ssid"][mode]:
# print(j)
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_open_ssid_profile(profile_data=j)
test_cases["open_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["open_2g"] = 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_open_ssid_profile(profile_data=j)
test_cases["open_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["open_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa":
for j in profile_data["ssid"][mode]:
# print(j)
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_ssid_profile(profile_data=j)
test_cases["wpa_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa_2g"] = 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_ssid_profile(profile_data=j)
test_cases["wpa_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa2_personal":
for j in profile_data["ssid"][mode]:
# print(j)
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_personal_ssid_profile(profile_data=j)
test_cases["wpa2_personal_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_personal_2g"] = 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_personal_ssid_profile(profile_data=j)
test_cases["wpa2_personal_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_personal_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa3_personal":
for j in profile_data["ssid"][mode]:
# print(j)
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_wpa3_personal_ssid_profile(profile_data=j)
test_cases["wpa3_personal_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_personal_2g"] = 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_wpa3_personal_ssid_profile(profile_data=j)
test_cases["wpa3_personal_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_personal_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa2_enterprise":
for j in profile_data["ssid"][mode]:
# print(j)
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_enterprise_ssid_profile(profile_data=j)
test_cases["wpa2_enterprise_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_enterprise_2g"] = 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_enterprise_ssid_profile(profile_data=j)
test_cases["wpa2_enterprise_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_enterprise_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa3_enterprise":
for j in profile_data["ssid"][mode]:
# print(j)
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_wpa3_enterprise_ssid_profile(profile_data=j)
test_cases["wpa3_enterprise_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_enterprise_2g"] = 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_wpa3_enterprise_ssid_profile(profile_data=j)
test_cases["wpa3_enterprise_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_enterprise_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
# Equipment AP Profile Creation
try:
instantiate_profile.set_ap_profile(profile_data=profile_data['equipment_ap'])
test_cases["equipment_ap"] = True
allure.attach(body=str(profile_data['equipment_ap']),
name="Equipment AP Profile Created")
except Exception as e:
print(e)
test_cases["equipment_ap"] = False
allure.attach(body=str(e),
name="Equipment AP Profile Creation Failed")
# Push the Equipment AP Profile to AP
try:
instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
except Exception as e:
print(e)
print("failed to create AP Profile")
ap_ssh = get_apnos(get_configuration[testbed]['access_point'][0], pwd="../libs/apnos/")
ssid_names = []
for i in instantiate_profile.profile_creation_ids["ssid"]:
ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i))
ssid_names.sort()
# This loop will check the VIF Config with cloud profile
vif_config = []
test_cases['vifc'] = False
for i in range(0, 18):
vif_config = list(ap_ssh.get_vif_config_ssids())
vif_config.sort()
print(vif_config)
print(ssid_names)
if ssid_names == vif_config:
test_cases['vifc'] = True
break
time.sleep(10)
allure.attach(body=str("VIF Config: " + str(vif_config) + "\n" + "SSID Pushed from Controller: " + str(ssid_names)),
name="SSID Profiles in VIF Config and Controller: ")
ap_ssh = get_apnos(get_configuration[testbed]['access_point'][0], pwd="../libs/apnos/")
# This loop will check the VIF Config with VIF State
test_cases['vifs'] = False
for i in range(0, 18):
vif_state = list(ap_ssh.get_vif_state_ssids())
vif_state.sort()
vif_config = list(ap_ssh.get_vif_config_ssids())
vif_config.sort()
print(vif_config)
print(vif_state)
if vif_state == vif_config:
test_cases['vifs'] = True
break
time.sleep(10)
allure.attach(body=str("VIF Config: " + str(vif_config) + "\n" + "VIF State: " + str(vif_state)),
name="SSID Profiles in VIF Config and VIF State: ")
print(test_cases)
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"])
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

View File

@@ -0,0 +1,78 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.nat]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
@allure.feature("NAT MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_general],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestNATModeConnectivity(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["open"][0]
assert "setup_client_connectivity"
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["open"][1]
assert "setup_client_connectivity"
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa"][0]
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa"][1]
assert "setup_client_connectivity"
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
assert "setup_client_connectivity"

View File

@@ -0,0 +1,78 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.nat, pytest.mark.configuration]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
@allure.feature("NAT MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_general],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestNATModeConnectivity(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["open"][0]
allure.attach(str(setup_client_connectivity), 'Hello, World')
assert setup_client_connectivity
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["open"][1]
assert setup_client_connectivity
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa"][0]
print(setup_client_connectivity)
assert setup_client_connectivity
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa"][1]
assert setup_client_connectivity
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
print(setup_client_connectivity)
assert setup_client_connectivity
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
assert setup_client_connectivity

View File

@@ -0,0 +1,55 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.enterprise, pytest.mark.nat, pytest.mark.configuration]
setup_params_enterprise = {
"mode": "NAT",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}]},
"rf": {},
"radius": True
}
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_enterprise],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestNATModeEnterprise(object):
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self):
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self):
assert "setup_client_connectivity"

View File

@@ -0,0 +1,55 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.enterprise, pytest.mark.nat]
setup_params_enterprise = {
"mode": "NAT",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}]},
"rf": {},
"radius": True
}
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_enterprise],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestNATModeEnterprise(object):
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self,):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self):
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self):
assert "setup_client_connectivity"

View File

@@ -1,379 +0,0 @@
"""
Test Case Module: Client Connectivity Test
Mode: BRIDGE
"""
import pytest
pytestmark = [pytest.mark.client_connectivity_test, pytest.mark.bridge]
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"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity")
sys.path.append(f'../libs')
sys.path.append(f'../libs/lanforge/')
from LANforge.LFUtils import *
if 'py-json' not in sys.path:
sys.path.append('../py-scripts')
import sta_connect2
from sta_connect2 import StaConnect2
import eap_connect
from eap_connect import EAPConnect
import time
@pytest.mark.sanity
@pytest.mark.client_connectivity
@pytest.mark.wifi5
@pytest.mark.wifi6
@pytest.mark.parametrize(
'setup_profiles, create_profiles',
[(["BRIDGE"], ["BRIDGE"])],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
@pytest.mark.usefixtures("create_profiles")
class TestBridgeModeClientConnectivity(object):
@pytest.mark.wpa
@pytest.mark.twog
def test_client_wpa_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_testrail,
instantiate_project, test_cases):
profile_data = setup_profile_data["BRIDGE"]["WPA"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
print(profile_data, get_lanforge_data)
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_2dot4g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_bridge"], run_id=instantiate_project,
status_id=1,
msg='2G WPA Client Connectivity Passed successfully - bridge mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_bridge"], run_id=instantiate_project,
status_id=5,
msg='2G WPA Client Connectivity Failed - bridge mode' + str(run_results))
assert staConnect.passes()
# C2420
@pytest.mark.wpa
@pytest.mark.fiveg
def test_client_wpa_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, test_cases):
profile_data = setup_profile_data["BRIDGE"]["WPA"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa_bridge"], run_id=instantiate_project,
status_id=1,
msg='5G WPA Client Connectivity Passed successfully - bridge mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa_bridge"], run_id=instantiate_project,
status_id=5,
msg='5G WPA Client Connectivity Failed - bridge mode' + str(run_results))
assert staConnect.passes()
# C2419
@pytest.mark.wpa2_personal
@pytest.mark.twog
def test_client_wpa2_personal_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, test_cases):
profile_data = setup_profile_data["BRIDGE"]["WPA2_P"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_2dot4g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa2"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa2_bridge"], run_id=instantiate_project,
status_id=1,
msg='2G WPA2 Client Connectivity Passed successfully - bridge mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa2_bridge"], run_id=instantiate_project,
status_id=5,
msg='2G WPA2 Client Connectivity Failed - bridge mode' + str(run_results))
assert staConnect.passes()
# C2237
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
def test_client_wpa2_personal_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, test_cases):
profile_data = setup_profile_data["BRIDGE"]["WPA2_P"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa2"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa2_bridge"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 Client Connectivity Passed successfully - bridge mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa2_bridge"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 Client Connectivity Failed - bridge mode' + str(run_results))
assert staConnect.passes()
# C2236
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
@pytest.mark.radius
def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, radius_info, test_cases):
profile_data = setup_profile_data["BRIDGE"]["WPA2_E"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"])
eap_connect.upstream_resource = 1
eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
eap_connect.security = "wpa2"
eap_connect.sta_list = station_names
eap_connect.station_names = station_names
eap_connect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
eap_connect.ssid = profile_data["ssid_name"]
eap_connect.radio = get_lanforge_data["lanforge_2dot4g"]
eap_connect.eap = "TTLS"
eap_connect.identity = radius_info["user"]
eap_connect.ttls_passwd = radius_info["password"]
eap_connect.runtime_secs = 10
eap_connect.setup()
eap_connect.start()
print("napping %f sec" % eap_connect.runtime_secs)
time.sleep(eap_connect.runtime_secs)
eap_connect.stop()
try:
eap_connect.cleanup()
eap_connect.cleanup()
except:
pass
run_results = eap_connect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", eap_connect.passes)
if eap_connect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_eap_bridge"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - '
'bridge mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_eap_bridge"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 ENTERPRISE Client Connectivity Failed - bridge mode' + str(run_results))
assert eap_connect.passes()
# C5214
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
@pytest.mark.radius
def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, radius_info, test_cases):
profile_data = setup_profile_data["BRIDGE"]["WPA2_E"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"])
eap_connect.upstream_resource = 1
eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
eap_connect.security = "wpa2"
eap_connect.sta_list = station_names
eap_connect.station_names = station_names
eap_connect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
eap_connect.ssid = profile_data["ssid_name"]
eap_connect.radio = get_lanforge_data["lanforge_5g"]
eap_connect.eap = "TTLS"
eap_connect.identity = radius_info["user"]
eap_connect.ttls_passwd = radius_info["password"]
eap_connect.runtime_secs = 10
eap_connect.setup()
eap_connect.start()
print("napping %f sec" % eap_connect.runtime_secs)
time.sleep(eap_connect.runtime_secs)
eap_connect.stop()
try:
eap_connect.cleanup()
eap_connect.cleanup()
except:
pass
run_results = eap_connect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", eap_connect.passes)
if eap_connect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_eap_bridge"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - '
'bridge mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_eap_bridge"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 ENTERPRISE Client Connectivity Failed - bridge mode' + str(run_results))
assert eap_connect.passes()
@pytest.mark.modify_ssid
@pytest.mark.parametrize(
'update_ssid',
(["BRIDGE, WPA, 5G, Sanity-updated-5G-WPA-BRIDGE"]),
indirect=True
)
def test_modify_ssid(self, request, update_ssid, get_lanforge_data, setup_profile_data, instantiate_testrail,
instantiate_project, test_cases, instantiate_controller):
profile_data = setup_profile_data["BRIDGE"]["WPA"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["bridge_ssid_update"], run_id=instantiate_project,
status_id=1,
msg='5G WPA Client Connectivity Passed successfully - bridge mode '
'updated ssid' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["bridge_ssid_update"], run_id=instantiate_project,
status_id=5,
msg='5G WPA Client Connectivity Failed - bridge mode updated ssid' + str(run_results))
instantiate_controller.refresh_instance()
assert staConnect.passes()

View File

@@ -1,378 +0,0 @@
"""
Test Case Module: Client Connectivity Test
Mode: NAT
"""
import pytest
import sys
pytestmark = [pytest.mark.client_connectivity_test, pytest.mark.nat]
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"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity")
sys.path.append(f'../libs')
sys.path.append(f'../libs/lanforge/')
from LANforge.LFUtils import *
if 'py-json' not in sys.path:
sys.path.append('../py-scripts')
from sta_connect2 import StaConnect2
from eap_connect import EAPConnect
import time
#
@pytest.mark.sanity
@pytest.mark.nat
@pytest.mark.wifi5
@pytest.mark.wifi6
@pytest.mark.parametrize(
'setup_profiles, create_profiles',
[(["NAT"], ["NAT"])],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
@pytest.mark.usefixtures("create_profiles")
class TestNatModeClientConnectivity(object):
@pytest.mark.wpa
@pytest.mark.twog
def test_client_wpa_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_testrail,
instantiate_project, test_cases):
profile_data = setup_profile_data["NAT"]["WPA"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
print(profile_data, get_lanforge_data)
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_2dot4g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_nat"], run_id=instantiate_project,
status_id=1,
msg='2G WPA Client Connectivity Passed successfully - nat mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_nat"], run_id=instantiate_project,
status_id=5,
msg='2G WPA Client Connectivity Failed - nat mode' + str(run_results))
assert staConnect.passes()
# C2420
@pytest.mark.wpa
@pytest.mark.fiveg
def test_client_wpa_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, test_cases):
profile_data = setup_profile_data["NAT"]["WPA"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa_nat"], run_id=instantiate_project,
status_id=1,
msg='5G WPA Client Connectivity Passed successfully - nat mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa_nat"], run_id=instantiate_project,
status_id=5,
msg='5G WPA Client Connectivity Failed - nat mode' + str(run_results))
assert staConnect.passes()
# C2419
@pytest.mark.wpa2_personal
@pytest.mark.twog
def test_client_wpa2_personal_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, test_cases):
profile_data = setup_profile_data["NAT"]["WPA2_P"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_2dot4g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa2"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa2_nat"], run_id=instantiate_project,
status_id=1,
msg='2G WPA2 Client Connectivity Passed successfully - nat mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa2_nat"], run_id=instantiate_project,
status_id=5,
msg='2G WPA2 Client Connectivity Failed - nat mode' + str(run_results))
assert staConnect.passes()
# C2237
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
def test_client_wpa2_personal_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, test_cases):
profile_data = setup_profile_data["NAT"]["WPA2_P"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa2"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa2_nat"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 Client Connectivity Passed successfully - nat mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa2_nat"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 Client Connectivity Failed - nat mode' + str(run_results))
assert staConnect.passes()
# C2236
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
@pytest.mark.radius
def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, radius_info, test_cases):
profile_data = setup_profile_data["NAT"]["WPA2_E"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"])
eap_connect.upstream_resource = 1
eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
eap_connect.security = "wpa2"
eap_connect.sta_list = station_names
eap_connect.station_names = station_names
eap_connect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
eap_connect.ssid = profile_data["ssid_name"]
eap_connect.radio = get_lanforge_data["lanforge_2dot4g"]
eap_connect.eap = "TTLS"
eap_connect.identity = radius_info["user"]
eap_connect.ttls_passwd = radius_info["password"]
eap_connect.runtime_secs = 10
eap_connect.setup()
eap_connect.start()
print("napping %f sec" % eap_connect.runtime_secs)
time.sleep(eap_connect.runtime_secs)
eap_connect.stop()
try:
eap_connect.cleanup()
eap_connect.cleanup()
except:
pass
run_results = eap_connect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", eap_connect.passes)
if eap_connect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_eap_nat"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - '
'nat mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_eap_nat"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 ENTERPRISE Client Connectivity Failed - nat mode' + str(run_results))
assert eap_connect.passes()
# C5214
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
@pytest.mark.radius
def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, radius_info, test_cases):
profile_data = setup_profile_data["NAT"]["WPA2_E"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"])
eap_connect.upstream_resource = 1
eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
eap_connect.security = "wpa2"
eap_connect.sta_list = station_names
eap_connect.station_names = station_names
eap_connect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
eap_connect.ssid = profile_data["ssid_name"]
eap_connect.radio = get_lanforge_data["lanforge_5g"]
eap_connect.eap = "TTLS"
eap_connect.identity = radius_info["user"]
eap_connect.ttls_passwd = radius_info["password"]
eap_connect.runtime_secs = 10
eap_connect.setup()
eap_connect.start()
print("napping %f sec" % eap_connect.runtime_secs)
time.sleep(eap_connect.runtime_secs)
eap_connect.stop()
try:
eap_connect.cleanup()
eap_connect.cleanup()
except:
pass
run_results = eap_connect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", eap_connect.passes)
if eap_connect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_eap_nat"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - '
'nat mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_eap_nat"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 ENTERPRISE Client Connectivity Failed - nat mode' + str(run_results))
assert eap_connect.passes()
@pytest.mark.modify_ssid
@pytest.mark.parametrize(
'update_ssid',
(["NAT, WPA, 5G, Sanity-updated-5G-WPA-NAT"]),
indirect=True
)
def test_modify_ssid(self, request, update_ssid, get_lanforge_data, setup_profile_data, instantiate_testrail,
instantiate_project, test_cases, instantiate_controller):
profile_data = setup_profile_data["NAT"]["WPA"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["nat_ssid_update"], run_id=instantiate_project,
status_id=1,
msg='5G WPA Client Connectivity Passed successfully - nat mode '
'updated ssid' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["nat_ssid_update"], run_id=instantiate_project,
status_id=5,
msg='5G WPA Client Connectivity Failed - nat mode updated ssid' + str(run_results))
instantiate_controller.refresh_instance()
assert staConnect.passes()

View File

@@ -1,376 +0,0 @@
"""
Test Case Module: Client Connectivity Test
Mode: VLAN
"""
import pytest
import sys
pytestmark = [pytest.mark.client_connectivity_test, pytest.mark.vlan]
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"../lanforge/lanforge-scripts/py-scripts/tip-cicd-something")
sys.path.append(f'../libs')
sys.path.append(f'../libs/lanforge/')
from LANforge.LFUtils import *
if 'py-json' not in sys.path:
sys.path.append('../py-scripts')
from sta_connect2 import StaConnect2
from eap_connect import EAPConnect
import time
@pytest.mark.sanity
@pytest.mark.vlan
@pytest.mark.wifi5
@pytest.mark.wifi6
@pytest.mark.parametrize(
'setup_profiles, create_profiles',
[(["VLAN"], ["VLAN"])],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
@pytest.mark.usefixtures("create_profiles")
class TestVlanModeClientConnectivity(object):
@pytest.mark.wpa
@pytest.mark.twog
def test_client_wpa_2g(self, request, get_lanforge_data, setup_profile_data,
instantiate_testrail, instantiate_project, test_cases):
profile_data = setup_profile_data["VLAN"]["WPA"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
print(profile_data, get_lanforge_data)
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"]
staConnect.radio = get_lanforge_data["lanforge_2dot4g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_vlan"], run_id=instantiate_project,
status_id=1,
msg='2G WPA Client Connectivity Passed successfully - vlan mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa_vlan"], run_id=instantiate_project,
status_id=5,
msg='2G WPA Client Connectivity Failed - vlan mode' + str(run_results))
assert staConnect.passes()
# C2420
@pytest.mark.wpa
@pytest.mark.fiveg
def test_client_wpa_5g(self, request, get_lanforge_data, setup_profile_data,
instantiate_project, instantiate_testrail, test_cases):
profile_data = setup_profile_data["VLAN"]["WPA"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa_vlan"], run_id=instantiate_project,
status_id=1,
msg='5G WPA Client Connectivity Passed successfully - vlan mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa_vlan"], run_id=instantiate_project,
status_id=5,
msg='5G WPA Client Connectivity Failed - vlan mode' + str(run_results))
assert staConnect.passes()
# C2419
@pytest.mark.wpa2_personal
@pytest.mark.twog
def test_client_wpa2_personal_2g(self, request, get_lanforge_data, setup_profile_data,
instantiate_project, instantiate_testrail, test_cases):
profile_data = setup_profile_data["VLAN"]["WPA2_P"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"]
staConnect.radio = get_lanforge_data["lanforge_2dot4g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa2"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa2_vlan"], run_id=instantiate_project,
status_id=1,
msg='2G WPA2 Client Connectivity Passed successfully - vlan mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_wpa2_vlan"], run_id=instantiate_project,
status_id=5,
msg='2G WPA2 Client Connectivity Failed - vlan mode' + str(run_results))
assert staConnect.passes()
# C2237
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
def test_client_wpa2_personal_5g(self, request, get_lanforge_data, setup_profile_data,
instantiate_project, instantiate_testrail, test_cases):
profile_data = setup_profile_data["VLAN"]["WPA2_P"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa2"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa2_vlan"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 Client Connectivity Passed successfully - vlan mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_wpa2_vlan"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 Client Connectivity Failed - vlan mode' + str(run_results))
assert staConnect.passes()
# C2236
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
@pytest.mark.radius
def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, radius_info, test_cases):
profile_data = setup_profile_data["VLAN"]["WPA2_E"]["2G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i))
eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"])
eap_connect.upstream_resource = 1
eap_connect.upstream_port = get_lanforge_data["lanforge_vlan_port"]
eap_connect.security = "wpa2"
eap_connect.sta_list = station_names
eap_connect.station_names = station_names
eap_connect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"]
eap_connect.ssid = profile_data["ssid_name"]
eap_connect.radio = get_lanforge_data["lanforge_2dot4g"]
eap_connect.eap = "TTLS"
eap_connect.identity = radius_info["user"]
eap_connect.ttls_passwd = radius_info["password"]
eap_connect.runtime_secs = 10
eap_connect.setup()
eap_connect.start()
print("napping %f sec" % eap_connect.runtime_secs)
time.sleep(eap_connect.runtime_secs)
eap_connect.stop()
try:
eap_connect.cleanup()
eap_connect.cleanup()
except Exception as e:
print(e)
run_results = eap_connect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", eap_connect.passes)
if eap_connect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["2g_eap_vlan"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - '
'vlan mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["2g_eap_vlan"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 ENTERPRISE Client Connectivity Failed - vlan mode' + str(run_results))
assert eap_connect.passes()
# C5214
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
@pytest.mark.radius
def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
instantiate_testrail, radius_info, test_cases):
profile_data = setup_profile_data["VLAN"]["WPA2_E"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"])
eap_connect.upstream_resource = 1
eap_connect.upstream_port = get_lanforge_data["lanforge_vlan_port"]
eap_connect.security = "wpa2"
eap_connect.sta_list = station_names
eap_connect.station_names = station_names
eap_connect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
eap_connect.ssid = profile_data["ssid_name"]
eap_connect.radio = get_lanforge_data["lanforge_5g"]
eap_connect.eap = "TTLS"
eap_connect.identity = radius_info["user"]
eap_connect.ttls_passwd = radius_info["password"]
eap_connect.runtime_secs = 10
eap_connect.setup()
eap_connect.start()
print("napping %f sec" % eap_connect.runtime_secs)
time.sleep(eap_connect.runtime_secs)
eap_connect.stop()
try:
eap_connect.cleanup()
eap_connect.cleanup()
except Exception as e:
print(e)
run_results = eap_connect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", eap_connect.passes)
if eap_connect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["5g_eap_vlan"], run_id=instantiate_project,
status_id=1,
msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - '
'vlan mode' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["5g_eap_vlan"], run_id=instantiate_project,
status_id=5,
msg='5G WPA2 ENTERPRISE Client Connectivity Failed - vlan mode' + str(run_results))
assert eap_connect.passes()
@pytest.mark.modify_ssid
@pytest.mark.parametrize(
'update_ssid',
(["VLAN, WPA, 5G, Sanity-updated-5G-WPA-VLAN"]),
indirect=True
)
def test_modify_ssid(self, request, update_ssid, get_lanforge_data, setup_profile_data, instantiate_testrail,
instantiate_project, test_cases, instantiate_controller):
profile_data = setup_profile_data["VLAN"]["WPA"]["5G"]
station_names = []
for i in range(0, int(request.config.getini("num_stations"))):
station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i))
staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]),
debug_=False)
staConnect.sta_mode = 0
staConnect.upstream_resource = 1
staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
staConnect.radio = get_lanforge_data["lanforge_5g"]
staConnect.resource = 1
staConnect.dut_ssid = profile_data["ssid_name"]
staConnect.dut_passwd = profile_data["security_key"]
staConnect.dut_security = "wpa"
staConnect.station_names = station_names
staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
staConnect.runtime_secs = 10
staConnect.bringup_time_sec = 60
staConnect.cleanup_on_exit = True
# staConnect.cleanup()
staConnect.setup()
staConnect.start()
print("napping %f sec" % staConnect.runtime_secs)
time.sleep(staConnect.runtime_secs)
staConnect.stop()
staConnect.cleanup()
run_results = staConnect.get_result_list()
for result in run_results:
print("test result: " + result)
# result = 'pass'
print("Single Client Connectivity :", staConnect.passes)
if staConnect.passes():
instantiate_testrail.update_testrail(case_id=test_cases["vlan_ssid_update"], run_id=instantiate_project,
status_id=1,
msg='5G WPA Client Connectivity Passed successfully - vlan mode '
'updated ssid' + str(run_results))
else:
instantiate_testrail.update_testrail(case_id=test_cases["vlan_ssid_update"], run_id=instantiate_project,
status_id=5,
msg='5G WPA Client Connectivity Failed - vlan mode updated ssid' + str(run_results))
instantiate_controller.refresh_instance()
assert staConnect.passes()

View File

@@ -0,0 +1,78 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.vlan]
setup_params_general = {
"mode": "VLAN",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
@allure.feature("VLAN MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_general],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestVLANModeConnectivity(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["open"][0]
assert "setup_client_connectivity"
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["open"][1]
assert "setup_client_connectivity"
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa"][0]
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa"][1]
assert "setup_client_connectivity"
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
assert "setup_client_connectivity"

View File

@@ -0,0 +1,78 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.vlan, pytest.mark.configuration]
setup_params_general = {
"mode": "VLAN",
"ssid_modes": {
"open": [{"ssid_name": "ssid_open_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_open_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}],
"wpa": [{"ssid_name": "ssid_wpa_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}]},
"rf": {},
"radius": False
}
@allure.feature("VLAN MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_general],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestVLANModeConnectivity(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["open"][0]
allure.attach(str(setup_client_connectivity), 'Hello, World')
assert setup_client_connectivity
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["open"][1]
assert setup_client_connectivity
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa"][0]
print(setup_client_connectivity)
assert setup_client_connectivity
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa"][1]
assert setup_client_connectivity
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
print(setup_client_connectivity)
assert setup_client_connectivity
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, setup_client_connectivity):
ssid_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
assert setup_client_connectivity

View File

@@ -0,0 +1,55 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.enterprise, pytest.mark.bridge, pytest.mark.configuration]
setup_params_enterprise = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}]},
"rf": {},
"radius": True
}
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_enterprise],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestBridgeModeEnterprise(object):
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self):
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self):
assert "setup_client_connectivity"

View File

@@ -0,0 +1,55 @@
import pytest
import allure
pytestmark = [pytest.mark.client_connectivity, pytest.mark.enterprise, pytest.mark.bridge]
setup_params_enterprise = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"],
"security_key": "something"}],
"wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["is2dot4GHz"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"]}]},
"rf": {},
"radius": True
}
@pytest.mark.parametrize(
'setup_client_connectivity',
[setup_params_enterprise],
indirect=True,
scope="package"
)
@pytest.mark.usefixtures("setup_client_connectivity")
class TestBridgeModeEnterprise(object):
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self,):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self):
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self):
# print(setup_client_connectivity)
assert "setup_client_connectivity"
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self):
assert "setup_client_connectivity"

View File

@@ -1,86 +1,14 @@
"""
conftest.py : Contains fixtures that are specific to basic testbed environment
Basic Test Scenario : 1 AP, 1 LANforge, 1 Controller Instance
Includes:
Setup:
setup_profiles
create_profiles
Utilities:
update_ssid
Information:
Setup Fixtures: Every Test case Needs to use setup fixtures
Setup Fixtures can be customised for all different levels of execution:
session level
package level
module level
class level
function level
"""
import sys
import os
import time
sys.path.append(
os.path.dirname(
os.path.realpath(__file__)
)
)
if "libs" not in sys.path:
sys.path.append(f'../libs')
from apnos.apnos import APNOS
from controller.controller import Controller
from controller.controller import ProfileUtility
from controller.controller import FirmwareUtility
import pytest
import logging
from configuration import RADIUS_SERVER_DATA
from configuration import TEST_CASES
from configuration import CONFIGURATION
from configuration import FIRMWARE
from testrails.testrail_api import APIClient
from testrails.reporting import Reporting
"""
Basic Setup Collector
"""
import allure
@pytest.fixture(scope="function")
def get_lanforge_data(testbed):
lanforge_data = {}
if CONFIGURATION[testbed]['traffic_generator']['name'] == 'lanforge':
lanforge_data = {
"lanforge_ip": CONFIGURATION[testbed]['traffic_generator']['details']['ip'],
"lanforge-port-number": CONFIGURATION[testbed]['traffic_generator']['details']['port'],
"lanforge_2dot4g": CONFIGURATION[testbed]['traffic_generator']['details']['2.4G-Radio'][0],
"lanforge_5g": CONFIGURATION[testbed]['traffic_generator']['details']['5G-Radio'][0],
"lanforge_2dot4g_prefix": CONFIGURATION[testbed]['traffic_generator']['details']['2.4G-Station-Name'],
"lanforge_5g_prefix": CONFIGURATION[testbed]['traffic_generator']['details']['5G-Station-Name'],
"lanforge_2dot4g_station": CONFIGURATION[testbed]['traffic_generator']['details']['2.4G-Station-Name'],
"lanforge_5g_station": CONFIGURATION[testbed]['traffic_generator']['details']['5G-Station-Name'],
"lanforge_bridge_port": CONFIGURATION[testbed]['traffic_generator']['details']['upstream'],
"lanforge_vlan_port": CONFIGURATION[testbed]['traffic_generator']['details']['upstream'] + ".100",
"vlan": 100
}
yield lanforge_data
@pytest.fixture(scope="module")
def instantiate_profile(instantiate_controller):
try:
profile_object = ProfileUtility(sdk_client=instantiate_controller)
except:
profile_object = False
yield profile_object
@pytest.fixture(scope="session")
def setup_vlan():
vlan_id = [100]
allure.attach(body=str(vlan_id), name="VLAN Created: ")
yield vlan_id[0]
@pytest.fixture(scope="session")
def get_equipment_id(instantiate_controller, testbed):
@@ -88,76 +16,322 @@ def get_equipment_id(instantiate_controller, testbed):
if len(CONFIGURATION[testbed]['access_point']) == 1:
equipment_id = instantiate_controller.get_equipment_id(
serial_number=CONFIGURATION[testbed]['access_point'][0]['serial'])
print(equipment_id)
yield equipment_id
@pytest.fixture(scope="session")
def upload_firmware(should_upload_firmware, instantiate_firmware, get_latest_firmware):
firmware_id = instantiate_firmware.upload_fw_on_cloud(fw_version=get_latest_firmware,
force_upload=should_upload_firmware)
yield firmware_id
@pytest.fixture(scope="function")
def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware,
should_upgrade_firmware):
if get_latest_firmware != check_ap_firmware_cloud:
if request.config.getoption("--skip-upgrade"):
status = "skip-upgrade"
else:
status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
force_upgrade=should_upgrade_firmware)
else:
if should_upgrade_firmware:
status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
force_upgrade=should_upgrade_firmware)
else:
status = "skip-upgrade"
yield status
@pytest.fixture(scope="function")
def check_ap_firmware_cloud(instantiate_controller, get_equipment_id):
yield instantiate_controller.get_ap_firmware_old_method(equipment_id=get_equipment_id)
"""
Profiles Related Fixtures
"""
@pytest.fixture(scope="module")
def get_current_profile_cloud(instantiate_profile):
def instantiate_profile(instantiate_controller):
try:
profile_object = ProfileUtility(sdk_client=instantiate_controller)
except Exception as e:
profile_object = False
yield profile_object
@allure.feature("CLIENT CONNECTIVITY SETUP")
@pytest.fixture(scope="package")
def setup_client_connectivity(request, instantiate_controller, testbed, setup_vlan, get_equipment_id,
instantiate_profile, get_markers,
get_security_flags, get_configuration, radius_info, get_apnos):
instantiate_profile = instantiate_profile(sdk_client=instantiate_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
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Equipment-AP-" + parameter['mode'])
profile_data["equipment_ap"] = {"profile_name": testbed + "-Equipment-AP-" + parameter['mode']}
profile_data["ssid"] = {}
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)
# print(profile_name)
# print(profile_data)
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode)
time.sleep(10)
"""
Setting up rf profile
"""
rf_profile_data = {
"name": "RF-Profile-" + testbed + "-" + parameter['mode'] + "-" +
get_configuration[testbed]['access_point'][0]['mode']
}
for i in parameter["rf"]:
rf_profile_data[i] = parameter['rf'][i]
# print(rf_profile_data)
try:
instantiate_profile.delete_profile_by_name(profile_name=rf_profile_data['name'])
instantiate_profile.set_rf_profile(profile_data=rf_profile_data,
mode=get_configuration[testbed]['access_point'][0]['mode'])
allure.attach(body=str(rf_profile_data),
name="RF Profile Created : " + get_configuration[testbed]['access_point'][0]['mode'])
except Exception as e:
print(e)
allure.attach(body=str(e), name="Exception ")
# Radius Profile Creation
if parameter["radius"]:
radius_info = radius_info
radius_info["name"] = testbed + "-Automation-Radius-Profile-" + testbed
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + testbed)
try:
# pass
instantiate_profile.create_radius_profile(radius_info=radius_info)
allure.attach(body=str(radius_info),
name="Radius Profile Created")
test_cases['radius_profile'] = True
except Exception as e:
print(e)
test_cases['radius_profile'] = False
# SSID Profile Creation
print(get_markers)
for mode in profile_data['ssid']:
if mode == "open":
for j in profile_data["ssid"][mode]:
# print(j)
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_open_ssid_profile(profile_data=j)
test_cases["open_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["open_2g"] = 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_open_ssid_profile(profile_data=j)
test_cases["open_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["open_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa":
for j in profile_data["ssid"][mode]:
# print(j)
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_ssid_profile(profile_data=j)
test_cases["wpa_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa_2g"] = 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_ssid_profile(profile_data=j)
test_cases["wpa_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa2_personal":
for j in profile_data["ssid"][mode]:
# print(j)
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_personal_ssid_profile(profile_data=j)
test_cases["wpa2_personal_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_personal_2g"] = 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_personal_ssid_profile(profile_data=j)
test_cases["wpa2_personal_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_personal_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa3_personal":
for j in profile_data["ssid"][mode]:
# print(j)
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_wpa3_personal_ssid_profile(profile_data=j)
test_cases["wpa3_personal_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_personal_2g"] = 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_wpa3_personal_ssid_profile(profile_data=j)
test_cases["wpa3_personal_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_personal_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa2_enterprise":
for j in profile_data["ssid"][mode]:
# print(j)
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_enterprise_ssid_profile(profile_data=j)
test_cases["wpa2_enterprise_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_enterprise_2g"] = 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_enterprise_ssid_profile(profile_data=j)
test_cases["wpa2_enterprise_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa2_enterprise_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa3_enterprise":
for j in profile_data["ssid"][mode]:
# print(j)
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_wpa3_enterprise_ssid_profile(profile_data=j)
test_cases["wpa3_enterprise_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_enterprise_2g"] = 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_wpa3_enterprise_ssid_profile(profile_data=j)
test_cases["wpa3_enterprise_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa3_enterprise_5g"] = False
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
# Equipment AP Profile Creation
try:
instantiate_profile.set_ap_profile(profile_data=profile_data['equipment_ap'])
test_cases["equipment_ap"] = True
allure.attach(body=str(profile_data['equipment_ap']),
name="Equipment AP Profile Created")
except Exception as e:
print(e)
test_cases["equipment_ap"] = False
allure.attach(body=str(e),
name="Equipment AP Profile Creation Failed")
# Push the Equipment AP Profile to AP
try:
instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
except Exception as e:
print(e)
print("failed to create AP Profile")
ap_ssh = get_apnos(get_configuration[testbed]['access_point'][0], pwd="../libs/apnos/")
ssid_names = []
for i in instantiate_profile.profile_creation_ids["ssid"]:
ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i))
yield ssid_names
ssid_names.sort()
@pytest.fixture(scope="module")
def setup_profiles(request, create_profiles, instantiate_profile, get_equipment_id, get_current_profile_cloud, testbed):
test_cases = {}
mode = str(request.param[0]).lower()
try:
instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
except:
print("failed to create AP Profile")
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0], pwd="../libs/apnos/")
get_current_profile_cloud.sort()
# This loop will check the VIF Config with cloud profile
vif_config = []
test_cases['vifc'] = False
for i in range(0, 18):
vif_config = list(ap_ssh.get_vif_config_ssids())
vif_config.sort()
print(vif_config)
print(get_current_profile_cloud)
if get_current_profile_cloud == vif_config:
test_cases[mode + '_vifc'] = True
print(ssid_names)
if ssid_names == vif_config:
test_cases['vifc'] = True
break
time.sleep(10)
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0], pwd="../libs/apnos/")
allure.attach(body=str("VIF Config: " + str(vif_config) + "\n" + "SSID Pushed from Controller: " + str(ssid_names)),
name="SSID Profiles in VIF Config and Controller: ")
ap_ssh = get_apnos(get_configuration[testbed]['access_point'][0], pwd="../libs/apnos/")
# This loop will check the VIF Config with VIF State
test_cases['vifs'] = False
for i in range(0, 18):
vif_state = list(ap_ssh.get_vif_state_ssids())
vif_state.sort()
@@ -166,164 +340,22 @@ def setup_profiles(request, create_profiles, instantiate_profile, get_equipment_
print(vif_config)
print(vif_state)
if vif_state == vif_config:
test_cases[mode + '_vifs'] = True
test_cases['vifs'] = True
break
time.sleep(10)
#
allure.attach(body=str("VIF Config: " + str(vif_config) + "\n" + "VIF State: " + str(vif_state)),
name="SSID Profiles in VIF Config and VIF State: ")
print(test_cases)
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"])
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
@pytest.fixture(scope="module")
def create_profiles(request, testbed, get_security_flags, get_markers, instantiate_profile, setup_profile_data):
profile_id = {"ssid": [], "rf": None, "radius": None, "equipment_ap": None}
mode = str(request.param[0])
test_cases = {}
if mode not in ["BRIDGE", "NAT", "VLAN"]:
print("Invalid Mode: ", mode)
yield False
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Equipment-AP-" + mode)
for i in setup_profile_data[mode]:
for j in setup_profile_data[mode][i]:
instantiate_profile.delete_profile_by_name(
profile_name=setup_profile_data[mode][i][j]['profile_name'])
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode)
instantiate_profile.get_default_profiles()
profile_data = {
"name": "RF-Profile-" + CONFIGURATION[testbed]['access_point'][0]['mode'] +
CONFIGURATION[testbed]['access_point'][0]['model'] + mode
}
instantiate_profile.delete_profile_by_name(profile_name=profile_data['name'])
instantiate_profile.set_rf_profile(profile_data=profile_data,
mode=CONFIGURATION[testbed]['access_point'][0]['mode'])
# Create RF Profile Here
if get_markers["radius"]:
radius_info = RADIUS_SERVER_DATA
radius_info["name"] = testbed + "-Automation-Radius-Profile-" + mode
try:
instantiate_profile.create_radius_profile(radius_info=radius_info)
test_cases['radius_profile'] = True
except:
test_cases['radius_profile'] = False
for i in get_security_flags:
if get_markers[i] and i == "open":
if get_markers["twog"]:
profile_data = setup_profile_data[mode]["OPEN"]["2G"]
try:
id = instantiate_profile.create_open_ssid_profile(two4g=True, fiveg=False,
profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_2g_open_' + mode.lower()] = True
except:
test_cases['ssid_2g_open_' + mode.lower()] = False
if get_markers["fiveg"]:
profile_data = setup_profile_data[mode]["OPEN"]["5G"]
try:
id = instantiate_profile.create_open_ssid_profile(two4g=False, fiveg=True,
profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_5g_open_' + mode.lower()] = True
except:
test_cases['ssid_5g_open_' + mode.lower()] = False
if get_markers[i] and i == "wpa":
if get_markers["twog"]:
profile_data = setup_profile_data[mode]["WPA"]["2G"]
try:
id = instantiate_profile.create_wpa_ssid_profile(two4g=True, fiveg=False, profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_2g_wpa_' + mode.lower()] = True
except:
test_cases['ssid_5g_wpa_' + mode.lower()] = False
if get_markers["fiveg"]:
profile_data = setup_profile_data[mode]["WPA"]["5G"]
try:
id = instantiate_profile.create_wpa_ssid_profile(two4g=False, fiveg=True, profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_5g_wpa_' + mode.lower()] = True
except:
test_cases['ssid_5g_wpa_' + mode.lower()] = False
if get_markers[i] and i == "wpa2_personal":
if get_markers["twog"]:
profile_data = setup_profile_data[mode]["WPA2_P"]["2G"]
try:
id = instantiate_profile.create_wpa2_personal_ssid_profile(two4g=True, fiveg=False,
profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_2g_wpa2_' + mode.lower()] = True
except:
test_cases['ssid_2g_wpa2_' + mode.lower()] = False
if get_markers["fiveg"]:
profile_data = setup_profile_data[mode]["WPA2_P"]["5G"]
try:
id = instantiate_profile.create_wpa2_personal_ssid_profile(two4g=False, fiveg=True,
profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_5g_wpa2_' + mode.lower()] = True
except:
test_cases['ssid_5g_wpa2_' + mode.lower()] = False
if get_markers[i] and i == "wpa2_enterprise":
if get_markers["twog"]:
profile_data = setup_profile_data[mode]["WPA2_E"]["2G"]
try:
id = instantiate_profile.create_wpa2_enterprise_ssid_profile(two4g=True, fiveg=False,
profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_2g_eap_' + mode.lower()] = True
except:
test_cases['ssid_2g_eap_' + mode.lower()] = False
if get_markers["fiveg"]:
profile_data = setup_profile_data[mode]["WPA2_E"]["5G"]
try:
id = instantiate_profile.create_wpa2_enterprise_ssid_profile(two4g=False, fiveg=True,
profile_data=profile_data)
profile_id["ssid"].append(profile_data['ssid_name'])
test_cases['ssid_5g_eap_' + mode.lower()] = True
except:
test_cases['ssid_5g_eap_' + mode.lower()] = False
# Create Equipment AP Profile Here
profile_data = {
"profile_name": testbed + "-Equipment-AP-" + mode
}
try:
instantiate_profile.set_ap_profile(profile_data=profile_data)
test_cases['ap_' + mode.lower()] = True
except:
test_cases['ap_' + mode.lower()] = False
yield test_cases
@pytest.fixture(scope="function")
def update_ssid(request, instantiate_profile, setup_profile_data):
requested_profile = str(request.param).replace(" ", "").split(",")
profile = setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]
status = instantiate_profile.update_ssid_name(profile_name=profile["profile_name"],
new_profile_name=requested_profile[3])
setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["profile_name"] = \
requested_profile[3]
setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["ssid_name"] = \
requested_profile[3]
time.sleep(90)
yield status
@pytest.fixture(scope="package")
def configure_lanforge(instantiate_dut):
# Scenario build
#
scenario_obj = Class()
yield scenario_obj
@pytest.fixture(scope="package")
def instantiate_dut():
dut_obj = DUT("")
dut_obj.update()
#
yield dut_obj
@pytest.fixture(scope="package")
def setup_vlan(scenario_obj):
scenario_obj.create_vlan()
yield scenario_obj

View File

@@ -4,7 +4,7 @@ norecursedirs = .svn _build tmp*
addopts= --junitxml=test_everything.xml
log_format = %(asctime)s %(levelname)s %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
;norecursedirs=out build
num_stations=1
# Cloud SDK settings

View File

@@ -56,10 +56,10 @@ def test_lanforge_connectivity(check_lanforge_connectivity):
assert "instantiate_cloudsdk"
@pytest.mark.sanity
@pytest.mark.shivam
@pytest.mark.bridge
@pytest.mark.nat
@pytest.mark.vlan
@pytest.mark.test_perfecto_connectivity
def test_perfecto_connectivity(setup_perfecto_devices):
def test_perfecto_connectivity(setup_controller):
assert "instantiate_cloudsdk"