WIFI-5837 Added supplicant and lanforge logs to all sanity test cases

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-11-29 20:03:41 +05:30
parent c666b942ec
commit 34367bd8b1
11 changed files with 227 additions and 165 deletions

View File

@@ -22,6 +22,8 @@ for folder in 'py-json', 'py-scripts':
sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity")
sys.path.append(f'../libs')
sys.path.append(f'../tools')
from tools.scp_util import SCP_File
sys.path.append(f'../libs/lanforge/')
from sta_connect2 import StaConnect2
import time
@@ -50,6 +52,7 @@ class RunTest:
def __init__(self, lanforge_data=None, local_report_path="../reports/", influx_params=None, debug=False):
self.lanforge_ip = lanforge_data["ip"]
self.lanforge_port = lanforge_data["port"]
self.lanforge_ssh_port = lanforge_data["ssh_port"]
self.twog_radios = lanforge_data["2.4G-Radio"]
self.fiveg_radios = lanforge_data["5G-Radio"]
self.ax_radios = lanforge_data["AX-Radio"]
@@ -129,6 +132,13 @@ class RunTest:
print("test result: " + result)
pytest.exit("Test Failed: Debug True")
self.staConnect.cleanup()
supplicqant = "/home/lanforge/wifi/wpa_supplicant_log_" + self.staConnect.radio.split(".")[2] + ".txt"
obj = SCP_File(ip=self.lanforge_ip, port=self.lanforge_ssh_port, username="root", password="lanforge",
remote_path=supplicqant,
local_path=".")
obj.pull_file()
allure.attach.file(source="wpa_supplicant_log_" + self.staConnect.radio.split(".")[2] + ".txt",
name="supplicant_log")
for result in run_results:
print("test result: " + result)
result = True
@@ -215,6 +225,13 @@ class RunTest:
# print(e)
self.eap_connect.stop()
supplicqant = "/home/lanforge/wifi/wpa_supplicant_log_" + self.eap_connect.radio.split(".")[2] + ".txt"
obj = SCP_File(ip=self.lanforge_ip, port=self.lanforge_ssh_port, username="root", password="lanforge",
remote_path=supplicqant,
local_path=".")
obj.pull_file()
allure.attach.file(source="wpa_supplicant_log_" + self.eap_connect.radio.split(".")[2] + ".txt",
name="supplicant_log")
if not self.eap_connect.passes():
if self.debug:
print("test result: " + self.eap_connect.passes())

55
libs/lanforge/scp_util.py Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python3
import argparse
import paramiko
from scp import SCPClient
class SCP_File:
def __init__(self, ip="localhost", port=22, username="lanforge", password="lanforge", remote_path="/home/lanforge/",
local_path="."):
self.ip = ip
self.port = port
self.remote_path = remote_path
self.local_path = local_path
self.username = username
self.password = password
def pull_file(self):
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=self.ip, username=self.username, password=self.password, port=self.port, allow_agent=False,
look_for_keys=False)
# ssh.close()
with SCPClient(ssh.get_transport()) as scp:
scp.get(remote_path=self.remote_path, local_path=self.local_path, recursive=True)
scp.close()
def main():
parser = argparse.ArgumentParser(prog="lf_utils",
formatter_class=argparse.RawTextHelpFormatter,
allow_abbrev=True,
epilog="About lf_tools.py",
description="Tools for LANforge System")
parser.add_argument('--host', type=str, help=' --host : IP Address f LANforge System', default="localhost")
parser.add_argument('--port', type=int, help='--passwd of dut', default=22)
parser.add_argument('--username', type=str, help='--username to use on LANforge', default="lanforge")
parser.add_argument('--password', type=str, help='--password to use on LANforge', default="lanforge")
parser.add_argument('--remote_path', type=str, help='--password to the given username',
default="/home/lanforge/lf_kinstall.pl")
parser.add_argument('--local_path', type=str, help='--action to perform'
'reboot | run_cmd', default=".")
args = parser.parse_args()
lf_tools = SCP_File(ip=args.host, port=args.port,
username=args.username, password=args.password,
remote_path=args.remote_path, local_path=args.local_path)
lf_tools.pull_file()
if __name__ == '__main__':
main()

View File

@@ -42,7 +42,6 @@ from LANforge.LFUtils import *
if 'py-json' not in sys.path:
sys.path.append('../py-scripts')
from apnos.apnos import APNOS
from controller.controller_1x.controller import Controller
from controller.controller_1x.controller import FirmwareUtility
import pytest
from lanforge.lf_tests import RunTest
@@ -50,11 +49,10 @@ from cv_test_manager import cv_test
from configuration import CONFIGURATION
from configuration import RADIUS_SERVER_DATA
from configuration import RADIUS_ACCOUNTING_DATA
from lanforge.scp_util import SCP_File
from testrails.testrail_api import APIClient
from testrails.reporting import Reporting
from lf_tools import ChamberView
from sta_connect2 import StaConnect2
from os import path
from typing import Any, Callable, Optional
@@ -683,19 +681,21 @@ def get_ap_logs(request, get_apnos, get_configuration):
@pytest.fixture(scope="function")
def get_lf_logs(request, get_apnos, get_configuration):
S = 9
instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))
for ap in get_configuration['access_point']:
ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x")
ap_ssh.run_generic_command(cmd="logger start testcase: " + instance_name)
ip = get_configuration["traffic_generator"]["details"]["ip"]
port = get_configuration["traffic_generator"]["details"]["ssh_port"]
def collect_logs():
for ap in get_configuration['access_point']:
ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x")
ap_ssh.run_generic_command(cmd="logger stop testcase: " + instance_name)
ap_logs = ap_ssh.get_logread(start_ref="start testcase: " + instance_name,
stop_ref="stop testcase: " + instance_name)
allure.attach(name='logread', body=str(ap_logs))
pass
def collect_logs_lf():
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)
request.addfinalizer(collect_logs_lf)

View File

@@ -46,7 +46,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa_enterprise
@pytest.mark.twog
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -73,7 +73,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_wpa_enterprise_5g(self, station_names_fiveg, get_ap_logs,
def test_wpa_enterprise_5g(self, station_names_fiveg, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 5g
@@ -98,7 +98,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -126,7 +126,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -154,7 +154,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -181,7 +181,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -239,7 +239,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.twog
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -267,7 +267,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.fiveg
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -295,7 +295,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.twog
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -322,7 +322,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, exit_on_fail,
test_cases, radius_info):

View File

@@ -50,7 +50,8 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.twog
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2809", name="JIRA LINK")
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, setup_profiles, lf_test, update_report,
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, setup_profiles, lf_test,
update_report,
station_names_twog,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -76,7 +77,7 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.fiveg
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2801", name="JIRA LINK")
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, test_cases, station_names_fiveg,
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, test_cases, station_names_fiveg, get_lf_logs,
update_report):
"""Client Connectivity open ssid 5G
pytest -m "client_connectivity and bridge and general and open and fiveg"
@@ -103,7 +104,7 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2801", name="JIRA LINK")
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report,
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_logs,
lf_test, test_cases, station_names_twog):
"""Client Connectivity wpa ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa and twog"
@@ -129,7 +130,8 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, update_report, test_cases, station_names_fiveg):
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, update_report, get_lf_logs,
test_cases, station_names_fiveg):
"""Client Connectivity wpa ssid 5G
pytest -m "client_connectivity and bridge and general and wpa and fiveg"
"""
@@ -154,7 +156,8 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, lf_test, update_report, test_cases,
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases,
station_names_twog):
"""Client Connectivity wpa2_personal ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa2_personal and twog"
@@ -181,7 +184,7 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, update_report, test_cases,
station_names_fiveg,
station_names_fiveg, get_lf_logs,
lf_test):
"""Client Connectivity wpa2_personal ssid 5G
pytest -m "client_connectivity and bridge and general and wpa2_personal and fiveg"
@@ -270,7 +273,8 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.wpa3_personal
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, lf_test, test_cases,
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg,
lf_test, test_cases, get_lf_logs,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa3_personal and fiveg"
@@ -296,7 +300,7 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -323,7 +327,7 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, lf_test,
test_cases,
test_cases, get_lf_logs,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa3_personal_mixed and fiveg"
@@ -349,7 +353,7 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.twog
@allure.story('wpa wpa2 personal mixed 2.4 GHZ Band')
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -376,7 +380,8 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.fiveg
@allure.story('wpa wpa2 personal mixed 5 GHZ Band')
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, lf_test, test_cases,
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, get_lf_logs,
lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa_wpa2_personal_mixed and fiveg"

View File

@@ -34,7 +34,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.twog
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0]
@@ -59,7 +59,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1]
@@ -85,7 +85,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0]
@@ -111,7 +111,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1]
@@ -136,7 +136,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0]
@@ -160,7 +160,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, get_ap_logs,
def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1]
@@ -210,7 +210,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.twog
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][0]
@@ -235,7 +235,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.fiveg
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1]
@@ -260,7 +260,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.twog
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][0]
@@ -284,8 +284,8 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs,
station_names_fiveg, setup_profiles, lf_test,
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, exit_on_fail,
test_cases, radius_info):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][1]

View File

@@ -48,7 +48,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self, get_vif_state, get_ap_logs,
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
station_names_twog,
test_cases):
@@ -77,7 +77,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self, get_vif_state, get_ap_logs,
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, test_cases, station_names_fiveg,
update_report):
"""Client Connectivity open ssid 5G
@@ -104,7 +104,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report,
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_logs,
lf_test, test_cases, station_names_twog):
"""Client Connectivity wpa ssid 2.4G
pytest -m "client_connectivity and NAT and general and wpa and twog"
@@ -129,7 +129,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases, station_names_fiveg):
"""Client Connectivity wpa ssid 5G
pytest -m "client_connectivity and NAT and general and wpa and fiveg"
@@ -155,7 +155,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases,
station_names_twog):
"""Client Connectivity wpa2_personal ssid 2.4G
@@ -182,7 +182,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
update_report, test_cases,
station_names_fiveg,
lf_test):
@@ -245,7 +245,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa3_personal
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases):
@@ -272,7 +272,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa3_personal
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G
@@ -300,7 +300,7 @@ class TestNATModeConnectivitySuiteB(object):
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs,
station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -326,7 +326,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa3_personal_mixed
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test,
test_cases,
update_report):
@@ -353,7 +353,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.twog
@allure.story('wpa wpa2 personal mixed 2.4 GHZ Band')
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles,
lf_test,
update_report,
@@ -382,7 +382,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.fiveg
@allure.story('wpa wpa2 personal mixed 5 GHZ Band')
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G

View File

@@ -28,13 +28,13 @@ setup_params_enterprise = {
indirect=True,
scope="class"
)
@pytest.mark.uc_sanity
@pytest.mark.uc_sanityo
@pytest.mark.usefixtures("setup_profiles")
class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.twog
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -60,7 +60,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -87,7 +87,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -114,7 +114,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -140,7 +140,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -165,7 +165,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -216,7 +216,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.twog
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -244,7 +244,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.fiveg
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
station_names_fiveg, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1]
ssid_name = profile_data["ssid_name"]
@@ -268,7 +268,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.twog
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles,
lf_test,
update_report, test_cases, radius_info, exit_on_fail):
@@ -293,7 +293,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles,
lf_test,
update_report, exit_on_fail,

View File

@@ -28,7 +28,7 @@ setup_params_general = {
}
@pytest.mark.uc_sanity
@pytest.mark.uc_sanityo
@pytest.mark.suiteA
@allure.feature("vlan MODE CLIENT CONNECTIVITY")
@pytest.mark.parametrize(
@@ -46,8 +46,8 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self, get_vif_state, get_ap_logs,
setup_profiles, lf_test, update_report,
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
station_names_twog,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -72,8 +72,8 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self, get_vif_state, get_ap_logs,
lf_test, test_cases, station_names_fiveg,
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, test_cases, station_names_fiveg,
update_report):
"""Client Connectivity open ssid 5G
pytest -m "client_connectivity and vlan and general and open and fiveg"
@@ -100,7 +100,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs,
update_report,
update_report, get_lf_logs,
lf_test, test_cases, station_names_twog):
"""Client Connectivity wpa ssid 2.4G
pytest -m "client_connectivity and vlan and general and wpa and twog"
@@ -126,7 +126,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases, station_names_fiveg):
"""Client Connectivity wpa ssid 5G
pytest -m "client_connectivity and vlan and general and wpa and fiveg"
@@ -152,8 +152,8 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
lf_test, update_report, test_cases,
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases,
station_names_twog):
"""Client Connectivity wpa2_personal ssid 2.4G
pytest -m "client_connectivity and vlan and general and wpa2_personal and twog"
@@ -179,8 +179,8 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
update_report, test_cases,
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
update_report, test_cases,
station_names_fiveg,
lf_test):
"""Client Connectivity wpa2_personal ssid 5G
@@ -243,8 +243,8 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.wpa3_personal
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs,
station_names_twog, setup_profiles, lf_test,
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -271,8 +271,8 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.wpa3_personal
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs,
station_names_fiveg, lf_test, test_cases,
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and vlan and general and wpa3_personal and fiveg"
@@ -298,8 +298,8 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs,
station_names_twog, setup_profiles,
lf_test,
station_names_twog, setup_profiles,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -326,8 +326,8 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs,
station_names_fiveg, lf_test,
test_cases,
station_names_fiveg, lf_test,
test_cases, get_lf_logs,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and vlan and general and wpa3_personal_mixed and fiveg"
@@ -353,8 +353,8 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.twog
@allure.story('wpa wpa2 personal mixed 2.4 GHZ Band')
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
station_names_twog, setup_profiles,
lf_test,
station_names_twog, setup_profiles,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -381,8 +381,8 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.fiveg
@allure.story('wpa wpa2 personal mixed 5 GHZ Band')
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
station_names_fiveg, lf_test, test_cases,
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and vlan and general and wpa_wpa2_personal_mixed and fiveg"

View File

@@ -1,70 +0,0 @@
#!/usr/bin/python3.9
"""
lf_tools : Tools for LANforge
reboot, run_cmd, etc
./lf_tools --host 10.28.3.8 --port 22 --username root --password lanforge --action reboot
./lf_tools --host 10.28.3.8 --port 22 --username root --password lanforge --action run_cmd --cmd ls
"""
import argparse
import paramiko
class LFTools:
def __init__(self, host="", port=22, username="root", password="lanforge"):
self.host = host
self.port = port
self.username = username
self.password = password
def ssh_cli_connect(self):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print("Connecting to LANforge: %s@%s:%s" % (
self.username, self.host, self.port))
client.connect(self.host, username=self.username, password=self.password,
port=self.port, timeout=10, allow_agent=False, banner_timeout=200)
return client
def run_cmd(self, cmd):
client = self.ssh_cli_connect()
stdin, stdout, stderr = client.exec_command(cmd)
output = "Output: " + str(stdout.read())
error = "Error: " + str(stderr.read())
client.close()
return output, error
def run_action(self, action, cmd):
if action == "reboot":
output, error = self.run_cmd("reboot")
print(output, error)
elif action == "run_cmd":
output, error = self.run_cmd(cmd)
print(output, error)
else:
print("Invalid Action")
def main():
parser = argparse.ArgumentParser(prog="lf_utils",
formatter_class=argparse.RawTextHelpFormatter,
allow_abbrev=True,
epilog="About lf_tools.py",
description="Tools for LANforge System")
parser.add_argument('--host', type=str, help=' --host : IP Address f LANforge System', default="localhost")
parser.add_argument('--port', type=int, help='--passwd of dut', default=22)
parser.add_argument('--username', type=str, help='--username to use on LANforge', default="root")
parser.add_argument('--password', type=str, help='--password to the given username', default="lanforge")
parser.add_argument('--action', type=str, help='--action to perform'
'reboot | run_cmd', default="run_cmd")
parser.add_argument('--cmd', type=str, help='--cmd : used when action is "run_cmd"', default="pwd")
args = parser.parse_args()
lf_tools = LFTools(host=args.host, port=args.port, username=args.username, password=args.password)
lf_tools.run_action(args.action, args.cmd)
if __name__ == '__main__':
main()

55
tools/scp_util.py Normal file → Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python3
import argparse
import paramiko
from scp import SCPClient
class SCP_File:
def __init__(self, ip="localhost", port=22, username="lanforge", password="lanforge", remote_path="/home/lanforge/",
local_path="."):
self.ip = ip
self.port = port
self.remote_path = remote_path
self.local_path = local_path
self.username = username
self.password = password
def pull_file(self):
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=self.ip, username=self.username, password=self.password, port=self.port, allow_agent=False,
look_for_keys=False)
# ssh.close()
with SCPClient(ssh.get_transport()) as scp:
scp.get(remote_path=self.remote_path, local_path=self.local_path, recursive=True)
scp.close()
def main():
parser = argparse.ArgumentParser(prog="lf_utils",
formatter_class=argparse.RawTextHelpFormatter,
allow_abbrev=True,
epilog="About lf_tools.py",
description="Tools for LANforge System")
parser.add_argument('--host', type=str, help=' --host : IP Address f LANforge System', default="localhost")
parser.add_argument('--port', type=int, help='--passwd of dut', default=22)
parser.add_argument('--username', type=str, help='--username to use on LANforge', default="lanforge")
parser.add_argument('--password', type=str, help='--password to use on LANforge', default="lanforge")
parser.add_argument('--remote_path', type=str, help='--password to the given username',
default="/home/lanforge/lf_kinstall.pl")
parser.add_argument('--local_path', type=str, help='--action to perform'
'reboot | run_cmd', default=".")
args = parser.parse_args()
lf_tools = SCP_File(ip=args.host, port=args.port,
username=args.username, password=args.password,
remote_path=args.remote_path, local_path=args.local_path)
lf_tools.pull_file()
if __name__ == '__main__':
main()