Add tests for multicast packet injection
Added a suite of tests that inject a variety of multicast packets
such as ARP, RA, DHCP offer, DNS and measure the corresponding
power.
Test: Done
Bug: b/65563975
Change-Id: I9260b24544feeb5e0a555f3acb58e3ec110b67db
(cherry picked from commit 1be5a5d37ecc449888713677f22cd7a537dee2ac)
diff --git a/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py b/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py
index f932a0b..abc2563 100644
--- a/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py
+++ b/acts/framework/acts/test_utils/wifi/wifi_power_test_utils.py
@@ -55,6 +55,8 @@
FORCE_DIALER_STOP = "am force-stop com.google.android.dialer"
IPERF_TIMEOUT = 180
THRESHOLD_TOLERANCE = 0.2
+GET_FROM_PHONE = 'get_from_dut'
+GET_FROM_AP = 'get_from_ap'
def dut_rockbottom(ad):
@@ -493,3 +495,66 @@
return if_list[0]
return None
+
+
+def create_pkt_config(test_class):
+ """Creates the config for generating multicast packets
+
+ Args:
+ test_class: object with all networking paramters
+
+ Returns:
+ Dictionary with the multicast packet config
+ """
+ addr_type = (scapy.IPV6_ADDR_LINKLOCAL
+ if test_class.ipv6_src_type == 'LINK_LOCAL' else
+ scapy.IPV6_ADDR_GLOBAL)
+
+ mac_dst = test_class.mac_dst
+ if GET_FROM_PHONE in test_class.mac_dst:
+ mac_dst = get_phone_mac(test_class.dut)
+
+ ipv4_dst = test_class.ipv4_dst
+ if GET_FROM_PHONE in test_class.ipv4_dst:
+ ipv4_dst = get_phone_ip(test_class.dut)
+
+ ipv6_dst = test_class.ipv6_dst
+ if GET_FROM_PHONE in test_class.ipv6_dst:
+ ipv6_dst = get_phone_ipv6(test_class.dut)
+
+ ipv4_gw = test_class.ipv4_gwt
+ if GET_FROM_AP in test_class.ipv4_gwt:
+ ipv4_gw = test_class.access_point.ssh_settings.hostname
+
+ pkt_gen_config = {
+ 'interf': test_class.pkt_sender.interface,
+ 'subnet_mask': test_class.sub_mask,
+ 'src_mac': test_class.mac_src,
+ 'dst_mac': mac_dst,
+ 'src_ipv4': test_class.ipv4_src,
+ 'dst_ipv4': ipv4_dst,
+ 'src_ipv6': test_class.ipv6_src,
+ 'src_ipv6_type': addr_type,
+ 'dst_ipv6': ipv6_dst,
+ 'gw_ipv4': ipv4_gw
+ }
+ return pkt_gen_config
+
+
+def create_monsoon_info(test_class):
+ """Creates the config dictionary for monsoon
+
+ Args:
+ test_class: object with all the parameters
+
+ Returns:
+ Dictionary with the monsoon packet config
+ """
+ mon_info = {
+ 'dut': test_class.mon,
+ 'freq': test_class.mon_freq,
+ 'duration': test_class.mon_duration,
+ 'offset': test_class.mon_offset,
+ 'data_path': test_class.mon_data_path
+ }
+ return mon_info