mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2026-01-27 10:23:37 +00:00
Added skip pcap (#524)
Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
@@ -68,7 +68,7 @@ Realm = realm.Realm
|
||||
class RunTest:
|
||||
|
||||
def __init__(self, configuration_data=None, local_report_path="../reports/", influx_params=None, run_lf=False,
|
||||
debug=False):
|
||||
debug=False, skip_pcap=False):
|
||||
if "type" in configuration_data['traffic_generator'].keys():
|
||||
if lanforge_data["type"] == "mesh":
|
||||
self.lanforge_ip = lanforge_data["ip"]
|
||||
@@ -108,6 +108,7 @@ class RunTest:
|
||||
self.ax_prefix = configuration_data['traffic_generator']['details']["AX-Station-Name"]
|
||||
self.debug = debug
|
||||
self.run_lf = run_lf
|
||||
self.skip_pcap = skip_pcap
|
||||
if self.run_lf:
|
||||
self.ssid_data = configuration_data['access_point'][0]['ssid']
|
||||
self.lf_ssh_port = configuration_data['traffic_generator']['details']["ssh_port"]
|
||||
@@ -166,10 +167,11 @@ class RunTest:
|
||||
result = self.check_ssid_available_scan_result(scan_ssid_data=self.data_scan_ssid, ssid=ssid)
|
||||
print("ssid available:-", result)
|
||||
if not result and ssid_channel:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
time.sleep(30)
|
||||
self.stop_sniffer()
|
||||
if not self.skip_pcap:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
time.sleep(30)
|
||||
self.stop_sniffer()
|
||||
print("ssid not available in scan result")
|
||||
return "FAIL", "ssid not available in scan result"
|
||||
self.staConnect.resource = 1
|
||||
@@ -193,8 +195,9 @@ class RunTest:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
if ssid_channel:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
if not self.skip_pcap:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
self.staConnect.start()
|
||||
print("napping %f sec" % self.staConnect.runtime_secs)
|
||||
time.sleep(self.staConnect.runtime_secs)
|
||||
@@ -264,7 +267,8 @@ class RunTest:
|
||||
result = "FAIL"
|
||||
time.sleep(3)
|
||||
if ssid_channel:
|
||||
self.stop_sniffer()
|
||||
if not self.skip_pcap:
|
||||
self.stop_sniffer()
|
||||
self.set_radio_channel(radio=self.staConnect.radio, channel="AUTO")
|
||||
return result, description
|
||||
|
||||
@@ -315,10 +319,11 @@ class RunTest:
|
||||
result = self.check_ssid_available_scan_result(scan_ssid_data=self.data_scan_ssid, ssid=ssid)
|
||||
print("ssid available:-", result)
|
||||
if not result and ssid_channel:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
time.sleep(30)
|
||||
self.stop_sniffer()
|
||||
if not self.skip_pcap:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
time.sleep(30)
|
||||
self.stop_sniffer()
|
||||
print("ssid not available in scan result")
|
||||
return "FAIL", "ssid not available in scan result"
|
||||
if eap == "TTLS":
|
||||
@@ -358,8 +363,9 @@ class RunTest:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
if ssid_channel:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
if not self.skip_pcap:
|
||||
print("sniff radio", self.ax_radios[0].split(".")[2])
|
||||
self.start_sniffer(radio_channel=ssid_channel, radio=self.ax_radios[0].split(".")[2], duration=30)
|
||||
self.eap_connect.start(station_name, True, True)
|
||||
if d_vlan:
|
||||
self.station_ip = {}
|
||||
@@ -428,7 +434,8 @@ class RunTest:
|
||||
else:
|
||||
result = "FAIL"
|
||||
if ssid_channel:
|
||||
self.stop_sniffer()
|
||||
if not self.skip_pcap:
|
||||
self.stop_sniffer()
|
||||
self.set_radio_channel(radio=self.eap_connect.radio, channel="AUTO")
|
||||
return result, description
|
||||
|
||||
|
||||
@@ -148,6 +148,12 @@ def pytest_addoption(parser):
|
||||
default=False,
|
||||
help="skip cloud controller and AP, run only lanforge tests on a ssid preconfigured"
|
||||
)
|
||||
parser.addoption(
|
||||
"--skip-pcap",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="skip packet capture for sanity"
|
||||
)
|
||||
parser.addoption(
|
||||
"--device",
|
||||
default="iPhone-11",
|
||||
@@ -221,6 +227,11 @@ def run_lf(request):
|
||||
var = request.config.getoption("--run-lf")
|
||||
yield var
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def skip_pcap(request):
|
||||
"""yields the --skip-pcap option for skipping the packet capture for sanity"""
|
||||
var = request.config.getoption("--skip-pcap")
|
||||
yield var
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def should_upgrade_firmware(request):
|
||||
@@ -646,14 +657,14 @@ def lf_tools(get_configuration, testbed, skip_lf, run_lf, get_ap_version):
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def lf_test(get_configuration, setup_influx, request, skip_lf, run_lf):
|
||||
def lf_test(get_configuration, setup_influx, request, skip_lf, run_lf, skip_pcap):
|
||||
if not skip_lf:
|
||||
if request.config.getoption("--exit-on-fail"):
|
||||
obj = RunTest(configuration_data=get_configuration, influx_params=setup_influx,
|
||||
debug=True, run_lf=run_lf)
|
||||
debug=True, run_lf=run_lf, skip_pcap=skip_pcap)
|
||||
if request.config.getoption("--exit-on-fail") is False:
|
||||
obj = RunTest(configuration_data=get_configuration, influx_params=setup_influx,
|
||||
debug=False, run_lf=run_lf)
|
||||
debug=False, run_lf=run_lf, skip_pcap=skip_pcap)
|
||||
yield obj
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user