Merge "Move get_if_addr6 to the packet_sender controller"
diff --git a/acts/framework/acts/controllers/packet_sender.py b/acts/framework/acts/controllers/packet_sender.py
index e037e29..0c491fa 100644
--- a/acts/framework/acts/controllers/packet_sender.py
+++ b/acts/framework/acts/controllers/packet_sender.py
@@ -22,7 +22,7 @@
import time
import acts.signals
-from acts.test_utils.wifi import wifi_power_test_utils as wputils
+
# http://www.secdev.org/projects/scapy/
# On ubuntu, sudo pip3 install scapy
import scapy.all as scapy
@@ -439,7 +439,7 @@
self.dst_ipv6 = config_params['dst_ipv6']
self.src_ipv6_type = config_params['src_ipv6_type']
if config_params['src_ipv6'] == GET_FROM_LOCAL_INTERFACE:
- self.src_ipv6 = wputils.get_if_addr6(interf, self.src_ipv6_type)
+ self.src_ipv6 = get_if_addr6(interf, self.src_ipv6_type)
else:
self.src_ipv6 = config_params['src_ipv6']
@@ -503,7 +503,7 @@
self.src_ipv6_type = config_params['src_ipv6_type']
if config_params['src_ipv6'] == GET_FROM_LOCAL_INTERFACE:
- self.src_ipv6 = wputils.get_if_addr6(interf, self.src_ipv6_type)
+ self.src_ipv6 = get_if_addr6(interf, self.src_ipv6_type)
else:
self.src_ipv6 = config_params['src_ipv6']
@@ -581,7 +581,7 @@
self.dst_ipv6 = config_params['dst_ipv6']
self.src_ipv6_type = config_params['src_ipv6_type']
if config_params['src_ipv6'] == GET_FROM_LOCAL_INTERFACE:
- self.src_ipv6 = wputils.get_if_addr6(interf, self.src_ipv6_type)
+ self.src_ipv6 = get_if_addr6(interf, self.src_ipv6_type)
else:
self.src_ipv6 = config_params['src_ipv6']
@@ -702,7 +702,7 @@
self.src_ipv6_type = config_params['src_ipv6_type']
if config_params['src_ipv6'] == GET_FROM_LOCAL_INTERFACE:
- self.src_ipv6 = wputils.get_if_addr6(interf, self.src_ipv6_type)
+ self.src_ipv6 = get_if_addr6(interf, self.src_ipv6_type)
else:
self.src_ipv6 = config_params['src_ipv6']
@@ -910,3 +910,26 @@
# Append and create packet
self.packet = self._pad_frame(ethernet / llc / snap)
return self.packet
+
+
+def get_if_addr6(intf, address_type):
+ """Returns the Ipv6 address from a given local interface.
+
+ Returns the desired IPv6 address from the interface 'intf' in human
+ readable form. The address type is indicated by the IPv6 constants like
+ IPV6_ADDR_LINKLOCAL, IPV6_ADDR_GLOBAL, etc. If no address is found,
+ None is returned.
+
+ Args:
+ intf: desired interface name
+ address_type: addrees typle like LINKLOCAL or GLOBAL
+
+ Returns:
+ Ipv6 address of the specified interface in human readable format
+ """
+ for if_list in scapy.in6_getifaddr():
+ if if_list[2] == intf and if_list[1] == address_type:
+ return if_list[0]
+
+ return None
+
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 ea25312..6e6ca85 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
@@ -213,28 +213,6 @@
return IPv6
-def get_if_addr6(intf, address_type):
- """Returns the Ipv6 address from a given local interface.
-
- Returns the desired IPv6 address from the interface 'intf' in human
- readable form. The address type is indicated by the IPv6 constants like
- IPV6_ADDR_LINKLOCAL, IPV6_ADDR_GLOBAL, etc. If no address is found,
- None is returned.
-
- Args:
- intf: desired interface name
- address_type: addrees typle like LINKLOCAL or GLOBAL
-
- Returns:
- Ipv6 address of the specified interface in human readable format
- """
- for if_list in scapy.in6_getifaddr():
- if if_list[2] == intf and if_list[1] == address_type:
- return if_list[0]
-
- return None
-
-
def wait_for_dhcp(interface_name):
"""Wait the DHCP address assigned to desired interface.