Sanity fixes

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-06-20 16:08:16 +05:30
parent dc7a6735b2
commit d8e60b4a17
10 changed files with 59 additions and 31 deletions

View File

@@ -282,10 +282,10 @@ class RunTest:
duration=duration, duration=duration,
dut=dut_name, dut=dut_name,
station="1.1." + station_name[0], station="1.1." + station_name[0],
raw_lines=['pkts: Custom;60;142;256;512;1024;MTU', raw_lines=[['pkts: Custom;60;142;256;512;1024;MTU'],
'directions: DUT Transmit;DUT Receive', ['directions: DUT Transmit;DUT Receive'],
'traffic_types: UDP;TCP', "show_3s: 1", ['traffic_types: UDP;TCP'], ["show_3s: 1"],
"show_ll_graphs: 1", "show_log: 1"], ["show_ll_graphs: 1"], ["show_log: 1"]],
) )
self.dataplane_obj.setup() self.dataplane_obj.setup()
self.dataplane_obj.run() self.dataplane_obj.run()

View File

@@ -25,10 +25,10 @@ CONFIGURATION = {
"name": "lanforge", "name": "lanforge",
"details": { "details": {
"ip": "localhost", # localhost, "ip": "localhost", # localhost,
"port": 8802, # 8802, "port": 8801, # 8802,
"ssh_port": 8804, "ssh_port": 8802,
"2.4G-Radio": ["wiphy4"], "2.4G-Radio": ["wiphy0", "wiphy4"],
"5G-Radio": ["wiphy5"], "5G-Radio": ["wiphy0", "wiphy5"],
"AX-Radio": ["wiphy0", "wiphy1", "wiphy2", "wiphy3"], "AX-Radio": ["wiphy0", "wiphy1", "wiphy2", "wiphy3"],
"upstream": "1.1.eth2", "upstream": "1.1.eth2",
"upstream_subnet": "10.28.2.1/24", "upstream_subnet": "10.28.2.1/24",
@@ -67,8 +67,8 @@ CONFIGURATION = {
"ip": "localhost", "ip": "localhost",
"port": 8801, "port": 8801,
"ssh_port": 8802, "ssh_port": 8802,
"2.4G-Radio": ["wiphy4"], "2.4G-Radio": ["wiphy0", "wiphy4"],
"5G-Radio": ["wiphy5"], "5G-Radio": ["wiphy0", "wiphy5"],
"AX-Radio": ["wiphy0", "wiphy1", "wiphy2", "wiphy3"], "AX-Radio": ["wiphy0", "wiphy1", "wiphy2", "wiphy3"],
"upstream": "1.1.eth2", "upstream": "1.1.eth2",
"upstream_subnet": "10.28.2.1/24", "upstream_subnet": "10.28.2.1/24",

View File

@@ -7,9 +7,10 @@ import os
import time import time
import allure import allure
import logging import logging
if "logs" not in os.listdir(): if "logs" not in os.listdir():
os.mkdir("logs/") os.mkdir("logs/")
logging.basicConfig(level=logging.INFO, filename="logs/"+'{:%Y-%m-%d-%H-%M-%S}.log'.format(datetime.datetime.now())) logging.basicConfig(level=logging.INFO, filename="logs/" + '{:%Y-%m-%d-%H-%M-%S}.log'.format(datetime.datetime.now()))
sys.path.append( sys.path.append(
os.path.dirname( os.path.dirname(
os.path.realpath(__file__) os.path.realpath(__file__)
@@ -290,11 +291,21 @@ def upload_firmware(should_upload_firmware, instantiate_firmware):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware, def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware,
should_upgrade_firmware, should_upload_firmware): should_upgrade_firmware, should_upload_firmware, get_apnos, get_configuration):
"""yields the status of upgrade of firmware. waits for 300 sec after each upgrade request""" """yields the status of upgrade of firmware. waits for 300 sec after each upgrade request"""
print(should_upgrade_firmware, should_upload_firmware) print(should_upgrade_firmware, should_upload_firmware)
status_list = [] status_list = []
if get_latest_firmware != check_ap_firmware_cloud: active_fw_list = []
try:
for access_point in get_configuration['access_point']:
ap_ssh = get_apnos(access_point)
active_fw = ap_ssh.get_active_firmware()
active_fw_list.append(active_fw)
except Exception as e:
print(e)
active_fw_list = []
print(active_fw_list, get_latest_firmware)
if get_latest_firmware != active_fw_list:
if request.config.getoption("--skip-upgrade"): if request.config.getoption("--skip-upgrade"):
status = "skip-upgrade" status = "skip-upgrade"
status_list.append(status) status_list.append(status)
@@ -308,7 +319,8 @@ def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_f
else: else:
if should_upgrade_firmware: if should_upgrade_firmware:
for i in range(0, len(instantiate_firmware)): for i in range(0, len(instantiate_firmware)):
status = instantiate_firmware[i].upgrade_fw(equipment_id=get_equipment_id[i], force_upload=False, status = instantiate_firmware[i].upgrade_fw(equipment_id=get_equipment_id[i],
force_upload=should_upload_firmware,
force_upgrade=should_upgrade_firmware) force_upgrade=should_upgrade_firmware)
allure.attach(name="Firmware Upgrade Request", body=str(status)) allure.attach(name="Firmware Upgrade Request", body=str(status))
status_list.append(status) status_list.append(status)
@@ -346,6 +358,7 @@ def check_ap_firmware_ssh(get_configuration):
def setup_test_run(setup_controller, upgrade_firmware, get_configuration, get_equipment_id, get_latest_firmware, def setup_test_run(setup_controller, upgrade_firmware, get_configuration, get_equipment_id, get_latest_firmware,
get_apnos): get_apnos):
"""used to upgrade the firmware on AP and should be called on each test case on a module level""" """used to upgrade the firmware on AP and should be called on each test case on a module level"""
active_fw_list = [] active_fw_list = []
try: try:
for access_point in get_configuration['access_point']: for access_point in get_configuration['access_point']:
@@ -355,6 +368,7 @@ def setup_test_run(setup_controller, upgrade_firmware, get_configuration, get_eq
except Exception as e: except Exception as e:
print(e) print(e)
active_fw_list = [] active_fw_list = []
print(active_fw_list, get_latest_firmware)
if active_fw_list == get_latest_firmware: if active_fw_list == get_latest_firmware:
yield True yield True
else: else:
@@ -492,7 +506,6 @@ def traffic_generator_connectivity(testbed, get_configuration):
yield True yield True
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def create_lanforge_chamberview_dut(get_configuration, testbed): def create_lanforge_chamberview_dut(get_configuration, testbed):
""" Create a DUT on LANforge""" """ Create a DUT on LANforge"""
@@ -561,3 +574,6 @@ def setup_influx(request, testbed, get_configuration):
"influx_tag": [testbed, get_configuration["access_point"][0]["model"]], "influx_tag": [testbed, get_configuration["access_point"][0]["model"]],
} }
yield influx_params yield influx_params

View File

@@ -653,7 +653,9 @@ def num_stations(request):
@pytest.fixture(scope="class") @pytest.fixture(scope="class")
def get_vif_state(get_apnos, get_configuration): def get_vif_state(get_apnos, get_configuration):
ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/")
vif_config = list(ap_ssh.get_vif_config_ssids())
vif_state = list(ap_ssh.get_vif_state_ssids()) vif_state = list(ap_ssh.get_vif_state_ssids())
vif_state.sort() vif_state.sort()
vif_config.sort()
allure.attach(name="vif_state", body=str(vif_state)) allure.attach(name="vif_state", body=str(vif_state))
yield vif_state yield vif_state

View File

@@ -59,7 +59,7 @@ class TestDataplaneThroughputBridge(object):
if station: if station:
dp_obj = lf_test.dataplane(station_name=station_names_twog, mode=mode, dp_obj = lf_test.dataplane(station_name=station_names_twog, mode=mode,
instance_name="TIP_PERF_DPT_WPA2_2G", instance_name="TIP_DPT_DPT_WPA2_2G_BRIDGE",
vlan_id=vlan, dut_name=dut_name) vlan_id=vlan, dut_name=dut_name)
report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/" + report_name + '/') entries = os.listdir("../reports/" + report_name + '/')
@@ -99,7 +99,7 @@ class TestDataplaneThroughputBridge(object):
station_name=station_names_fiveg, vlan_id=vlan) station_name=station_names_fiveg, vlan_id=vlan)
if station: if station:
dp_obj = lf_test.dataplane(station_name=station_names_fiveg, mode=mode, instance_name="TIP_PERF_DPT_WPA2_5G", dp_obj = lf_test.dataplane(station_name=station_names_fiveg, mode=mode, instance_name="TIP_DPT_DPT_WPA2_5G_BRIDGE",
vlan_id=vlan, dut_name=dut_name) vlan_id=vlan, dut_name=dut_name)
report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/"+report_name + '/') entries = os.listdir("../reports/"+report_name + '/')

View File

@@ -59,7 +59,7 @@ class TestDataplaneThroughputNAT(object):
if station: if station:
dp_obj = lf_test.dataplane(station_name=station_names_twog, mode=mode, dp_obj = lf_test.dataplane(station_name=station_names_twog, mode=mode,
instance_name="TIP_PERF_DPT_WPA2_2G", instance_name="TIP_DPT_DPT_WPA2_2G_NAT",
vlan_id=vlan, dut_name=dut_name) vlan_id=vlan, dut_name=dut_name)
report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/" + report_name + '/') entries = os.listdir("../reports/" + report_name + '/')
@@ -99,7 +99,7 @@ class TestDataplaneThroughputNAT(object):
station_name=station_names_fiveg, vlan_id=vlan) station_name=station_names_fiveg, vlan_id=vlan)
if station: if station:
dp_obj = lf_test.dataplane(station_name=station_names_fiveg, mode=mode, instance_name="TIP_PERF_DPT_WPA2_5G", dp_obj = lf_test.dataplane(station_name=station_names_fiveg, mode=mode, instance_name="TIP_DPT_DPT_WPA2_5G_NAT",
vlan_id=vlan, dut_name=dut_name) vlan_id=vlan, dut_name=dut_name)
report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/"+report_name + '/') entries = os.listdir("../reports/"+report_name + '/')

View File

@@ -59,7 +59,7 @@ class TestDataplaneThroughputVLAN(object):
if station: if station:
dp_obj = lf_test.dataplane(station_name=station_names_twog, mode=mode, dp_obj = lf_test.dataplane(station_name=station_names_twog, mode=mode,
instance_name="TIP_PERF_DPT_WPA2_2G", instance_name="TIP_DPT_DPT_WPA2_2G_VLAN",
vlan_id=vlan, dut_name=dut_name) vlan_id=vlan, dut_name=dut_name)
report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/" + report_name + '/') entries = os.listdir("../reports/" + report_name + '/')
@@ -99,8 +99,8 @@ class TestDataplaneThroughputVLAN(object):
station_name=station_names_fiveg, vlan_id=vlan) station_name=station_names_fiveg, vlan_id=vlan)
if station: if station:
dp_obj = lf_test.dataplane(station_name=station_names_fiveg, mode=mode, instance_name="TIP_PERF_DPT_WPA2_5G", dp_obj = lf_test.dataplane(station_name=station_names_fiveg, mode=mode,
vlan_id=vlan, dut_name=dut_name) instance_name="TIP_DPT_DPT_WPA2_5G_VLAN", vlan_id=vlan, dut_name=dut_name)
report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] report_name = dp_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/"+report_name + '/') entries = os.listdir("../reports/"+report_name + '/')
pdf = False pdf = False

View File

@@ -6,7 +6,7 @@
import allure import allure
import pytest import pytest
pytestmark = [pytest.mark.firmware, pytest.mark.sanity, pytest.mark.sanity_light] pytestmark = [pytest.mark.firmware, pytest.mark.sanity, pytest.mark.sanity_light, pytest.mark.usefixtures("setup_test_run")]
@allure.testcase("firmware upgrade from Cloud") @allure.testcase("firmware upgrade from Cloud")
@@ -43,8 +43,12 @@ class TestFirmware(object):
assert PASS assert PASS
@pytest.mark.check_active_firmware_cloud @pytest.mark.check_active_firmware_cloud
def test_active_version_cloud(self, get_latest_firmware, check_ap_firmware_cloud, update_report, test_cases): def test_active_version_cloud(self, get_latest_firmware, get_equipment_id, setup_controller,
if get_latest_firmware != check_ap_firmware_cloud: update_report, test_cases):
ap_fw_list = []
for i in get_equipment_id:
ap_fw_list.append(setup_controller.get_ap_firmware_old_method(equipment_id=i))
if get_latest_firmware != ap_fw_list:
update_report.update_testrail(case_id=test_cases["cloud_fw"], update_report.update_testrail(case_id=test_cases["cloud_fw"],
status_id=5, status_id=5,
msg='CLOUDSDK reporting incorrect firmware version.') msg='CLOUDSDK reporting incorrect firmware version.')
@@ -53,10 +57,11 @@ class TestFirmware(object):
status_id=1, status_id=1,
msg='CLOUDSDK reporting correct firmware version.') msg='CLOUDSDK reporting correct firmware version.')
assert get_latest_firmware == check_ap_firmware_cloud assert get_latest_firmware == ap_fw_list
@pytest.mark.firmware_ap @pytest.mark.firmware_ap
def test_ap_firmware(get_configuration, get_apnos, get_latest_firmware, update_report, def test_ap_firmware(get_configuration, get_apnos, get_latest_firmware, update_report,
test_cases): test_cases):
"""yields the active version of firmware on ap""" """yields the active version of firmware on ap"""
@@ -79,3 +84,7 @@ def test_ap_firmware(get_configuration, get_apnos, get_latest_firmware, update_r
msg='Cannot reach AP after upgrade to check CLI - re-test required') msg='Cannot reach AP after upgrade to check CLI - re-test required')
assert active_fw_list == get_latest_firmware assert active_fw_list == get_latest_firmware
@pytest.mark.shivam
def test_abc(setup_controller):
assert True

View File

@@ -3,7 +3,8 @@ import pytest
mode = "NAT" mode = "NAT"
pytestmark = [pytest.mark.client_connectivity, pytest.mark.usefixtures("setup_test_run"), pytest.mark.nat, pytest.mark.enterprise, pytest.mark.ttls, pytestmark = [pytest.mark.client_connectivity, pytest.mark.usefixtures("setup_test_run"), pytest.mark.nat,
pytest.mark.enterprise, pytest.mark.ttls,
pytest.mark.sanity] pytest.mark.sanity]
setup_params_enterprise = { setup_params_enterprise = {
@@ -397,9 +398,8 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed @pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg @pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, def test_wpa3_enterprise_mixed_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test,
update_report, exit_on_fail, update_report, exit_on_fail, test_cases, radius_info):
test_cases, radius_info):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][1] profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][1]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
security = "wpa3" security = "wpa3"

View File

@@ -3,7 +3,8 @@ import pytest
mode = "VLAN" mode = "VLAN"
pytestmark = [pytest.mark.client_connectivity, pytest.mark.usefixtures("setup_test_run"), pytest.mark.vlan, pytest.mark.enterprise, pytest.mark.ttls, pytestmark = [pytest.mark.client_connectivity, pytest.mark.usefixtures("setup_test_run"), pytest.mark.vlan,
pytest.mark.enterprise, pytest.mark.ttls,
pytest.mark.sanity] pytest.mark.sanity]
setup_params_enterprise = { setup_params_enterprise = {