branch rebased and setup changes

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-05-21 14:47:27 +05:30
parent 41474d38ce
commit b112d25561
6 changed files with 121 additions and 289 deletions

Submodule lanforge/lanforge-scripts deleted from de86a454b2

View File

@@ -5,21 +5,6 @@ import os
import time
import allure
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')
sys.path.append(
os.path.dirname(
os.path.realpath(__file__)
@@ -52,13 +37,9 @@ from configuration import CONFIGURATION
from configuration import FIRMWARE
from testrails.testrail_api import APIClient
from testrails.reporting import Reporting
<<<<<<< HEAD
from cv_test_manager import cv_test
=======
import sta_connect2
from sta_connect2 import StaConnect2
>>>>>>> staging-wifi-1960
def pytest_addoption(parser):
parser.addini("tr_url", "Test Rail URL")
@@ -104,41 +85,6 @@ def pytest_addoption(parser):
default=False,
help="Stop using Testrails"
)
parser.addoption(
"--exit-on-fail",
action="store_true",
default=False,
help="use to stop execution if failure"
)
# Perfecto Parameters
parser.addini("perfectoURL", "Cloud URL")
parser.addini("securityToken", "Security Token")
parser.addini("platformName-iOS", "iOS Platform")
parser.addini("platformName-android", "Android Platform")
parser.addini("model-iOS", "iOS Devices")
parser.addini("model-android", "Android Devices")
parser.addini("bundleId-iOS", "iOS Devices")
parser.addini("bundleId-iOS-Settings", "iOS Settings App")
parser.addini("appPackage-android", "Android Devices")
parser.addini("wifi-SSID-5gl-Pwd", "Wifi 5g Password")
parser.addini("wifi-SSID-2g-Pwd", "Wifi 2g Password")
parser.addini("Default-SSID-5gl-perfecto-b", "Wifi 5g AP Name")
parser.addini("Default-SSID-2g-perfecto-b", "Wifi 2g AP Name")
parser.addini("Default-SSID-perfecto-b", "Wifi AP Name")
parser.addini("bundleId-iOS-Ping", "Ping Bundle ID")
parser.addini("browserType-iOS", "Mobile Browser Name")
parser.addini("projectName", "Project Name")
parser.addini("projectVersion", "Project Version")
parser.addini("jobName", "CI Job Name")
parser.addini("jobNumber", "CI Job Number")
parser.addini("reportTags", "Report Tags")
parser.addoption(
"--access-points-perfecto",
# nargs="+",
default=["Perfecto"],
help="list of access points to test"
)
"""
@@ -340,87 +286,6 @@ def update_report(request, testbed, get_configuration):
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(
<<<<<<< HEAD
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):
lanforge_ip = CONFIGURATION[testbed]['traffic_generator']['details']['ip']
lanforge_port = CONFIGURATION[testbed]['traffic_generator']['details']['port']
try:
cv = cv_test(lanforge_ip,lanforge_port)
url_data = cv.get_ports("/")
lanforge_GUI_version = url_data["VersionInfo"]["BuildVersion"]
lanforge_gui_git_version = url_data["VersionInfo"]["GitVersion"]
lanforge_gui_build_date = url_data["VersionInfo"]["BuildDate"]
print(lanforge_GUI_version,lanforge_gui_build_date,lanforge_gui_git_version)
if not (lanforge_GUI_version or lanforge_gui_build_date or lanforge_gui_git_version):
yield False
else:
yield True
except:
yield False
@pytest.fixture(scope="session")
def exit_on_fail(request):
yield request.config.getoption("--exit-on-fail")
@pytest.fixture(scope="session")
def setup_perfecto_devices(request):
yield True
@pytest.fixture(scope="session")
def test_cases():
yield TEST_CASES
@pytest.fixture(scope="session")
def apnos_obj(get_configuration, testbed):
yield APNOS(get_configuration[testbed]['access_point'][0])
@pytest.fixture(scope="session")
def instantiate_access_point(testbed):
APNOS(CONFIGURATION[testbed]['access_point'][0], pwd="../libs/apnos/")
yield True
@pytest.fixture(scope="function")
def access_point_connectivity(apnos_obj, get_configuration, testbed):
ap_conn = {}
config_serial = get_configuration[testbed]['access_point'][0]['serial']
ap_serial = apnos_obj.get_serial_number()
ap_conn["serial"] = True
if ap_serial != config_serial:
ap_conn["serial"] = False
ap_conn["redir"] = False
ap_redir = apnos_obj.get_redirector()
# Compare with something ...
ap_conn["mgr"] = False
status = apnos_obj.get_manager_state()
if "ACTIVE" not in status:
apnos_obj.run_generic_command(cmd="service opensync restart")
time.sleep(30)
status = apnos_obj.get_manager_state()
if "ACTIVE" in status:
ap_conn["mgr"] = True
else:
ap_conn["mgr"] = True
yield ap_conn
=======
datetime.date.today()) + "_" + get_configuration['access_point'][0]['version']
tr_client.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
milestone_id=request.config.getini("milestone"),
@@ -429,7 +294,6 @@ def access_point_connectivity(apnos_obj, get_configuration, testbed):
tr_client.rid = rid
yield tr_client
>>>>>>> staging-wifi-1960
"""
FRAMEWORK MARKER LOGIC
@@ -441,7 +305,7 @@ FRAMEWORK MARKER LOGIC
def get_security_flags():
# Add more classifications as we go
security = ["open", "wpa", "wpa2_personal", "wpa3_personal", "wpa3_personal_mixed",
"wpa2_enterprise", "wpa3_enterprise", "twog", "fiveg", "radius"]
"wpa_wpa2_personal_mixed", "wpa2_enterprise", "wpa3_enterprise", "twog", "fiveg", "radius"]
yield security
@@ -488,15 +352,6 @@ def client_connectivity():
@pytest.fixture(scope="session")
<<<<<<< HEAD
def radius_info():
yield RADIUS_SERVER_DATA
@pytest.fixture(scope="session")
def get_configuration(testbed):
yield CONFIGURATION[testbed]
=======
def get_lanforge_data(get_configuration):
lanforge_data = {}
if get_configuration['traffic_generator']['name'] == 'lanforge':
@@ -514,4 +369,3 @@ def get_lanforge_data(get_configuration):
"vlan": 100
}
yield lanforge_data
>>>>>>> staging-wifi-1960

View File

@@ -1,20 +1,6 @@
import os
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')
sys.path.append(
os.path.dirname(
os.path.realpath(__file__)
@@ -27,51 +13,7 @@ from controller.controller import ProfileUtility
import time
from lanforge.lf_tests import RunTest
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
import allure
from cv_test_manager import cv_test
from create_chamberview import CreateChamberview
from create_chamberview_dut import DUT
"""
Basic Setup Collector
"""
@pytest.fixture(scope="session")
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 Exception as e:
profile_object = False
yield profile_object
@pytest.fixture(scope="session")
@@ -261,6 +203,34 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment
allure.attach(body=str(e),
name="SSID Profile Creation Failed")
if mode == "wpa_wpa2_personal_mixed":
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_wpa2_personal_mixed_ssid_profile(profile_data=j)
test_cases["wpa_wpa2_personal_mixed_2g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa_wpa2_personal_mixed_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_wpa2_personal_mixed_ssid_profile(profile_data=j)
test_cases["wpa_wpa2_personal_mixed_5g"] = True
allure.attach(body=str(creates_profile),
name="SSID Profile Created")
except Exception as e:
print(e)
test_cases["wpa_wpa2_personal_mixed_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)
@@ -404,72 +374,51 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment
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['access_point'][0], pwd="../libs/apnos/")
@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
# 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)
@pytest.fixture(scope="package")
def create_lanforge_chamberview(create_lanforge_chamberview_dut, get_configuration, testbed):
lanforge_data = get_configuration['traffic_generator']['details']
ip = lanforge_data["ip"]
port = lanforge_data["port"]
upstream_port = lanforge_data["upstream"] # eth1
uplink_port = lanforge_data["uplink"] # eth2
upstream_subnet = lanforge_data["upstream_subnet"]
scenario_name = "TIP-" + testbed
upstream_res = upstream_port.split(".")[0] + "." + upstream_port.split(".")[1]
uplink_res = uplink_port.split(".")[0] + "." + uplink_port.split(".")[1]
print(ip)
print(upstream_port, upstream_res, upstream_port.split(".")[2])
# "profile_link 1.1 upstream-dhcp 1 NA NA eth2,AUTO -1 NA"
# "profile_link 1.1 uplink-nat 1 'DUT: upstream LAN 10.28.2.1/24' NA eth1,eth2 -1 NA"
raw_line = [
["profile_link " + upstream_res + " upstream-dhcp 1 NA NA " + upstream_port.split(".")[2] + ",AUTO -1 NA"]
, ["profile_link " + uplink_res + " uplink-nat 1 'DUT: upstream LAN "
+ upstream_subnet + "' NA " + uplink_port.split(".")[2] + " -1 NA"]
]
print(raw_line)
Create_Chamberview = CreateChamberview(ip, port)
Create_Chamberview.clean_cv_scenario()
Create_Chamberview.clean_cv_scenario(type="Network-Connectivity", scenario_name=scenario_name)
Create_Chamberview.setup(create_scenario=scenario_name,
raw_line=raw_line)
Create_Chamberview.build(scenario_name)
Create_Chamberview.show_text_blob(None, None, True) # Show changes on GUI
yield Create_Chamberview
@pytest.fixture(scope="package")
def create_lanforge_chamberview_dut(get_configuration, testbed):
ap_model = get_configuration["access_point"][0]["model"]
version = get_configuration["access_point"][0]["version"]
serial = get_configuration["access_point"][0]["serial"]
# ap_model = get_configuration["access_point"][0]["model"]
lanforge_data = get_configuration['traffic_generator']['details']
ip = lanforge_data["ip"]
port = lanforge_data["port"]
dut = DUT(lfmgr=ip,
port=port,
dut_name=testbed,
sw_version=version,
model_num=ap_model,
serial_num=serial
)
dut.setup()
yield dut
request.addfinalizer(teardown_session)
yield test_cases
@pytest.fixture(scope="session")

View File

@@ -1,7 +1,7 @@
import pytest
pytestmark = [pytest.mark.dataplane_throughput_test, pytest.mark.bridge]
import sys
import allure
for folder in 'py-json', 'py-scripts':
if folder not in sys.path:
sys.path.append(f'../lanforge/lanforge-scripts/{folder}')
@@ -12,23 +12,39 @@ import create_station
from create_station import CreateStation
@pytest.mark.dataplane_throughput_test
@pytest.mark.wifi5
@pytest.mark.wifi6
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
}
@pytest.mark.basic
@allure.feature("BRIDGE MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_profiles, create_profiles',
[(["BRIDGE"], ["BRIDGE"])],
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
@pytest.mark.usefixtures("create_profiles")
class TestDataplaneThroughputBridge(object):
@pytest.mark.wpa
@pytest.mark.shivamt
@pytest.mark.twog
def test_client_wpa_2g(self, get_lanforge_data, setup_profile_data):
profile_data = setup_profile_data["BRIDGE"]["WPA"]["2G"]
def test_client_wpa_2g(self, setup_profiles, get_lanforge_data):
profile_data = setup_params_general["ssid_modes"]["wpa"][0]
lanforge_ip = get_lanforge_data["lanforge_ip"]
lanforge_port = int(get_lanforge_data["lanforge-port-number"])
ssid = profile_data["ssid_name"]
@@ -66,7 +82,7 @@ class TestDataplaneThroughputBridge(object):
duration="15s",
dut="TIP",
station="1.1."+station_name,
raw_lines="pkts: Custom",
raw_lines=['pkts: Custom;60;142;256;512;1024;MTU'],
)
CV_Test.setup()
CV_Test.run()
@@ -75,7 +91,6 @@ class TestDataplaneThroughputBridge(object):
assert PASS
@pytest.mark.wpa
@pytest.mark.fiveg
def test_client_wpa_5g(self, get_lanforge_data, setup_profile_data):
profile_data = setup_profile_data["BRIDGE"]["WPA"]["5G"]

View File

@@ -10,19 +10,34 @@ import lf_dataplane_test
from lf_dataplane_test import DataplaneTest
import create_station
from create_station import CreateStation
import allure
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
}
@pytest.mark.dataplane_throughput_test
@pytest.mark.wifi5
@pytest.mark.wifi6
@pytest.mark.basic
@allure.feature("BRIDGE MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
'setup_profiles, create_profiles',
[(["NAT"], ["NAT"])],
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
@pytest.mark.usefixtures("create_profiles")
class TestDataplaneThroughputNat(object):
@pytest.mark.wpa
@@ -64,7 +79,7 @@ class TestDataplaneThroughputNat(object):
duration="15s",
dut="TIP",
station="1.1." + station_name,
raw_lines="pkts: Custom",
raw_lines=["pkts: Custom"],
)
CV_Test.setup()
CV_Test.run()
@@ -113,7 +128,7 @@ class TestDataplaneThroughputNat(object):
duration="15s",
dut="TIP",
station="1.1."+station_name,
raw_lines="pkts: Custom",
raw_lines=["pkts: Custom"],
)
CV_Test.setup()
CV_Test.run()
@@ -161,7 +176,7 @@ class TestDataplaneThroughputNat(object):
duration="15s",
dut="TIP",
station="1.1." + station_name,
raw_lines="pkts: Custom",
raw_lines=["pkts: Custom"],
)
CV_Test.setup()
CV_Test.run()