[WifiP2pSnifferTest] Fix start_pcap script issue
PCAP fixes for WifiP2pSnifferTest and WifiMacRandomizationTest
Cherry picked from git_master
Bug: 138306709
Test: Verified the changes on git_master
wutils.start_pcap takes 3 params but 4 were given
Change-Id: I3cc6ec0332c6e1fa4e5e8c80cc85661df860683e
Merged-In: Ie7c84e0de4a66f0fddbd44fb0b7313be2576a506
diff --git a/acts/tests/google/wifi/WifiMacRandomizationTest.py b/acts/tests/google/wifi/WifiMacRandomizationTest.py
index 09630d7..fa01d45 100755
--- a/acts/tests/google/wifi/WifiMacRandomizationTest.py
+++ b/acts/tests/google/wifi/WifiMacRandomizationTest.py
@@ -272,14 +272,15 @@
@test_tracker_info(uuid="2dd0a05e-a318-45a6-81cd-962e098fa242")
def test_set_mac_randomization_to_none(self):
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
network = self.wpapsk_2g
# Set macRandomizationSetting to RANDOMIZATION_NONE.
network["macRand"] = RANDOMIZATION_NONE
self.connect_to_network_and_verify_mac_randomization(network,
status=RANDOMIZATION_NONE)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_2G][1],
+ hostapd_constants.BAND_2G.upper())
time.sleep(SHORT_TIMEOUT)
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
packets = rdpcap(pcap_fname)
@@ -461,14 +462,15 @@
if not result:
raise ValueError("Failed to configure channel for 2G band")
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
# re-connect to the softAp network after sniffer is started
wutils.connect_to_wifi_network(self.dut_client, self.wpapsk_2g)
wutils.connect_to_wifi_network(self.dut_client, softap)
time.sleep(SHORT_TIMEOUT)
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_2G][1],
+ hostapd_constants.BAND_2G.upper())
packets = rdpcap(pcap_fname)
self.verify_mac_not_found_in_pcap(self.soft_ap_factory_mac, packets)
self.verify_mac_not_found_in_pcap(self.sta_factory_mac, packets)
@@ -520,13 +522,14 @@
"""
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
time.sleep(SHORT_TIMEOUT)
network = self.wpapsk_5g
rand_mac = self.connect_to_network_and_verify_mac_randomization(network)
wutils.send_link_probes(self.dut, 3, 3)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_5G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_5G][1],
+ hostapd_constants.BAND_5G.upper())
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
time.sleep(SHORT_TIMEOUT)
packets = rdpcap(pcap_fname)
@@ -546,11 +549,12 @@
"""
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
wutils.start_wifi_connection_scan(self.dut)
time.sleep(SHORT_TIMEOUT)
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_2G][1],
+ hostapd_constants.BAND_2G.upper())
packets = rdpcap(pcap_fname)
self.verify_mac_not_found_in_pcap(self.sta_factory_mac, packets)
diff --git a/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py b/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py
index a359deb..f9d2b23 100644
--- a/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py
+++ b/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py
@@ -25,7 +25,7 @@
from acts.test_utils.wifi.p2p.WifiP2pBaseTest import WifiP2pBaseTest
from acts.test_utils.wifi.p2p import wifi_p2p_test_utils as wp2putils
from acts.test_utils.wifi.p2p import wifi_p2p_const as p2pconsts
-from acts.controllers.ap_lib import hostapd_constants
+from acts.controllers.ap_lib.hostapd_constants import BAND_2G
from scapy.all import *
WPS_PBC = wp2putils.WifiP2PEnums.WpsInfo.WIFI_WPS_INFO_PBC
@@ -53,7 +53,7 @@
def setup_test(self):
super(WifiP2pSnifferTest, self).setup_test()
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, '2g', self.log_path, self.test_name)
+ self.packet_capture, '2g', self.test_name)
def teardown_test(self):
self.verify_mac_no_leakage()
@@ -62,8 +62,7 @@
def configure_packet_capture(self):
"""Configure packet capture on the social channels."""
self.packet_capture = self.packet_capture[0]
- result = self.packet_capture.configure_monitor_mode(
- hostapd_constants.BAND_2G, 6)
+ result = self.packet_capture.configure_monitor_mode(BAND_2G, 6)
if not result:
raise ValueError("Failed to configure channel for 2G band")
@@ -72,8 +71,8 @@
self.log.info("Stopping packet capture")
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
# Verify factory MAC is not leaked in 2G pcaps
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % (self.pcap_procs[BAND_2G][1],
+ BAND_2G.upper())
packets = rdpcap(pcap_fname)
wutils.verify_mac_not_found_in_pcap(self.dut1_mac, packets)
wutils.verify_mac_not_found_in_pcap(self.dut2_mac, packets)