Wifi 10974 (#707)

* Added pytest fail if config exception happening

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added get_lf_logs

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Modified error message and added get_lf_logs

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Removed get_lf_logs

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added get_lf_logs

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Removed get_lf_logs

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added retry logic in config push and Added teardown lf logs if config push failing

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Adjusted teardown logic for collect_logs_lf

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added sleep

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
jitendracandela
2022-10-05 01:47:59 +05:30
committed by GitHub
parent 1d064983ab
commit fb4dfe98c7
5 changed files with 54 additions and 18 deletions

View File

@@ -313,6 +313,7 @@ class ChamberView:
time.sleep(2)
self.CreateChamberview.show_text_blob(None, None, True) # Show changes on GUI
self.CreateChamberview.sync_cv()
time.sleep(5)
return self.CreateChamberview, self.scenario_name
def add_vlan(self, vlan_ids=[]):

View File

@@ -42,7 +42,7 @@ class TestDFSChannel52Bw80(object):
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@pytest.mark.dfs_channel_52_bw_80
def test_dfs_channel_52_bw_80(self, get_ap_logs, lf_test, lf_tools, station_names_fiveg, dfs_start):
def test_dfs_channel_52_bw_80(self, get_ap_logs, lf_test, lf_tools, station_names_fiveg, dfs_start, get_lf_logs):
lf_tools.reset_scenario()
profile_data = setup_params_general1["ssid_modes"]["wpa2_personal"][0]
ssid_name = profile_data["ssid_name"]
@@ -130,7 +130,7 @@ class TestDFSChannel100Bw80(object):
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@pytest.mark.dfs_channel_100_bw_80
def test_dfs_channel_100_bw_80(self, get_ap_logs, lf_test, lf_tools, station_names_fiveg, dfs_start):
def test_dfs_channel_100_bw_80(self, get_ap_logs, lf_test, lf_tools, station_names_fiveg, dfs_start, get_lf_logs):
lf_tools.reset_scenario()
profile_data = setup_params_general2["ssid_modes"]["wpa2_personal"][0]
ssid_name = profile_data["ssid_name"]
@@ -810,7 +810,7 @@ class TestDFSChannel132Bw80(object):
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@pytest.mark.dfs_channel_132_bw_80
def test_dfs_channel_132_bw_80(self, get_ap_logs, lf_test, lf_tools, station_names_fiveg, dfs_start):
def test_dfs_channel_132_bw_80(self, get_ap_logs, lf_test, lf_tools, station_names_fiveg, dfs_start, get_lf_logs):
lf_tools.reset_scenario()
profile_data = setup_params_general11["ssid_modes"]["wpa2_personal"][0]
ssid_name = profile_data["ssid_name"]

View File

@@ -50,7 +50,7 @@ class TestVlanConfigFivegRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2169")
def test_station_ip_wpa_ssid_5g(self, lf_test, lf_tools,
station_names_fiveg,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa, fiveg
pytest -m valid_client_ip_wpa_fiveg
@@ -107,7 +107,7 @@ class TestVlanConfigFivegRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2157")
def test_station_ip_wpa2_ssid_5g(self, lf_test, lf_tools,
station_names_fiveg,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa2, fiveg
pytest -m valid_client_ip_wpa2_fiveg
@@ -156,7 +156,7 @@ class TestVlanConfigFivegRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2174")
def test_disable_vlan_wpa2_ssid_5g(self, lf_test, lf_tools,
station_names_fiveg,
test_cases, get_configuration):
test_cases, get_configuration, get_lf_logs):
"""
Client connectivity using vlan, wpa2, fiveg
pytest -m disable_vlan_fiveg
@@ -214,7 +214,7 @@ class TestVlanConfigFivegRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2161")
def test_station_ip_open_ssid_5g(self, lf_test, lf_tools,
station_names_fiveg,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, open, fiveg
pytest -m valid_client_ip_open_fiveg
@@ -269,7 +269,7 @@ class TestVlanConfigFivegRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2167")
def test_station_ip_wpa_wpa2_personal_ssid_5g(self, lf_test,
lf_tools, station_names_fiveg,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa, wpa2, fiveg
pytest -m test_station_ip_wpa_wpa2_ssid_5g
@@ -326,7 +326,7 @@ class TestVlanConfigFivegRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2172")
def test_enable_vlan_wpa2_ssid_5g(self, lf_test, lf_tools,
station_names_fiveg,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa2, fiveg
pytest -m enable_vlan_fiveg

View File

@@ -47,7 +47,7 @@ class TestVlanConfigTwogRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2168")
def test_station_ip_wpa_ssid_2g(self, lf_test, lf_tools,
station_names_twog,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa, twog
pytest -m valid_client_ip_twog_wpa
@@ -101,7 +101,7 @@ class TestVlanConfigTwogRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2156")
def test_station_ip_wpa2_ssid_2g(self, lf_test, lf_tools,
station_names_twog,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa2, twog
pytest -m valid_client_ip_twog_wpa2
@@ -148,7 +148,7 @@ class TestVlanConfigTwogRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2158")
def test_disable_vlan_wpa2_ssid_2g(self, lf_test, lf_tools,
station_names_twog,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa2, twog
pytest -m disable_vlan_twog
@@ -206,7 +206,7 @@ class TestVlanConfigTwogRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2160")
def test_station_ip_open_ssid_2g(self, lf_test, lf_tools,
station_names_twog,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, open, twog
pytest -m valid_client_ip_twog_open
@@ -261,7 +261,7 @@ class TestVlanConfigTwogRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2166")
def test_station_ip_wpa_wpa2_personal_ssid_2g(self, lf_test,
lf_tools, station_names_twog,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa, wpa2, twog
pytest -m test_station_ip_twog_wpa_wpa2
@@ -318,7 +318,7 @@ class TestVlanConfigTwogRadio(object):
url="https://telecominfraproject.atlassian.net/browse/WIFI-2172")
def test_enable_vlan_wpa2_ssid_2g(self, lf_test, lf_tools,
station_names_twog,
test_cases, get_configuration, get_ap_logs):
test_cases, get_configuration, get_ap_logs, get_lf_logs):
"""
Client connectivity using vlan, wpa2, twog
pytest -m enable_vlan_twog

View File

@@ -39,6 +39,7 @@ from controller.controller_2x.controller import ProvUtils
from configuration import CONFIGURATION
from configuration import RADIUS_SERVER_DATA
from configuration import RADIUS_ACCOUNTING_DATA
from lanforge.scp_util import SCP_File
class Fixtures_2x:
@@ -701,7 +702,7 @@ class Fixtures_2x:
allure.attach(name="ucode /usr/share/ucentral/sysinfo.uc ", body=str(output))
time_1 = time.time()
push_config_exception_variable = False
# Apply config
try:
ap_logs = ap_ssh.get_logread()
@@ -711,9 +712,22 @@ class Fixtures_2x:
#print(instantiate_profile_obj.base_profile_config)
except Exception as e:
ap_logs = ap_ssh.get_logread()
allure.attach(body=ap_logs, name="Failure while pushing- AP Logs: ")
allure.attach(body=str(e), name="Exception data after config push: ")
allure.attach(body=ap_logs, name="1st time Failure while pushing- AP Logs: ")
allure.attach(body=str(e), name="1st time Exception data after config push: ")
print(e)
time.sleep(30)
print("Second time applying config")
try:
instantiate_profile_obj.push_config(serial_number=get_equipment_ref[0])
except Exception as e:
push_config_exception_variable = True
ap_logs = ap_ssh.get_logread()
allure.attach(body=ap_logs, name="2nd time Failure while pushing- AP Logs: ")
allure.attach(body=str(e), name="2nd time Exception data after config push: ")
print(e)
config = json.loads(str(instantiate_profile_obj.base_profile_config).replace(" ", "").replace("'", '"').replace("True", "true"))
@@ -852,6 +866,27 @@ class Fixtures_2x:
print("\nTeardown")
request.addfinalizer(teardown_session)
def collect_logs_lf():
ip = get_configuration["traffic_generator"]["details"]["ip"]
port = get_configuration["traffic_generator"]["details"]["ssh_port"]
log_0 = "/home/lanforge/lanforge_log_0.txt"
log_1 = "/home/lanforge/lanforge_log_1.txt"
obj = SCP_File(ip=ip, port=port, username="root", password="lanforge", remote_path=log_0,
local_path=".")
obj.pull_file()
allure.attach.file(source="lanforge_log_0.txt",
name="lanforge_log_0")
obj = SCP_File(ip=ip, port=port, username="root", password="lanforge", remote_path=log_1,
local_path=".")
obj.pull_file()
allure.attach.file(source="lanforge_log_1.txt",
name="lanforge_log_1")
request.addfinalizer(collect_logs_lf)
if push_config_exception_variable:
pytest.fail("Command Timed Out")
return test_cases
def setup_mesh_profile(self, request, param, get_apnos, get_configuration, setup_controller, instantiate_profile,