[DO NOT MERGE]Change network_const value to tuple to pervent b/183076328. am: 4f773746d6
Original change: https://android-review.googlesource.com/c/platform/tools/test/connectivity/+/1648027
Bug: 183076328
Change-Id: Iaf8cea35cc5f747e24dd81487f74e362beba91bb
Merged-In: Iaf8cea35cc5f747e24dd81487f74e362beba91bb
(cherry picked from commit 758e8173c2cb0d008f71f924b9fc61e983be4383)
(cherry picked from commit 55350a4ebeda4f638ef2b26a57c97f223756bd45)
(cherry picked from commit d3d894f52fc86da814311c4a90d22c02aafbd000)
diff --git a/acts/framework/acts/controllers/openwrt_lib/network_const.py b/acts/framework/acts/controllers/openwrt_lib/network_const.py
index 76dd34b..d9cc8fc 100644
--- a/acts/framework/acts/controllers/openwrt_lib/network_const.py
+++ b/acts/framework/acts/controllers/openwrt_lib/network_const.py
@@ -44,7 +44,7 @@
# parmas for lx2tpd
-XL2TPD_CONF_GLOBAL = [
+XL2TPD_CONF_GLOBAL = (
"[global]",
"ipsec saref = no",
"debug tunnel = no",
@@ -54,9 +54,9 @@
"access control = no",
"rand source = dev",
"port = 1701",
-]
+)
-XL2TPD_CONF_INS = [
+XL2TPD_CONF_INS = (
"[lns default]",
"require authentication = yes",
"pass peer = yes",
@@ -64,9 +64,9 @@
"length bit = yes",
"refuse pap = yes",
"refuse chap = yes",
-]
+)
-XL2TPD_OPTION = [
+XL2TPD_OPTION = (
"require-mschap-v2",
"refuse-mschap",
"ms-dns 8.8.8.8",
@@ -87,17 +87,17 @@
"lcp-echo-interval 30",
"lcp-echo-failure 4",
"nomppe"
-]
+)
# iptable rules for vpn_pptp
-FIREWALL_RULES_FOR_PPTP = [
+FIREWALL_RULES_FOR_PPTP = (
"iptables -A input_rule -i ppp+ -j ACCEPT",
"iptables -A output_rule -o ppp+ -j ACCEPT",
"iptables -A forwarding_rule -i ppp+ -j ACCEPT"
-]
+)
# iptable rules for vpn_l2tp
-FIREWALL_RULES_FOR_L2TP = [
+FIREWALL_RULES_FOR_L2TP = (
"iptables -I INPUT -m policy --dir in --pol ipsec --proto esp -j ACCEPT",
"iptables -I FORWARD -m policy --dir in --pol ipsec --proto esp -j ACCEPT",
"iptables -I FORWARD -m policy --dir out --pol ipsec --proto esp -j ACCEPT",
@@ -111,7 +111,7 @@
"iptables -A INPUT -p udp --dport 500 -j ACCEPT",
"iptables -A INPUT -p udp --dport 4500 -j ACCEPT",
"iptables -A INPUT -p udp -m policy --dir in --pol ipsec -m udp --dport 1701 -j ACCEPT"
-]
+)
# Object for vpn profile
diff --git a/acts/framework/acts/controllers/openwrt_lib/network_settings.py b/acts/framework/acts/controllers/openwrt_lib/network_settings.py
index aa98441..7cd9cde 100644
--- a/acts/framework/acts/controllers/openwrt_lib/network_settings.py
+++ b/acts/framework/acts/controllers/openwrt_lib/network_settings.py
@@ -476,7 +476,7 @@
def setup_xl2tpd(self, ip_range=20):
"""Setup xl2tpd config."""
net_id, host_id = self.l2tp.address.rsplit(".", 1)
- xl2tpd_conf = network_const.XL2TPD_CONF_GLOBAL
+ xl2tpd_conf = list(network_const.XL2TPD_CONF_GLOBAL)
xl2tpd_conf.append("auth file = %s" % PPP_CHAP_SECRET_PATH)
xl2tpd_conf.extend(network_const.XL2TPD_CONF_INS)
xl2tpd_conf.append("ip range = %s.%s-%s.%s" %
@@ -487,7 +487,7 @@
xl2tpd_conf.append("pppoptfile = %s" % XL2TPD_OPTION_CONFIG_PATH)
self.create_config_file("\n".join(xl2tpd_conf), XL2TPD_CONFIG_PATH)
- xl2tpd_option = network_const.XL2TPD_OPTION
+ xl2tpd_option = list(network_const.XL2TPD_OPTION)
xl2tpd_option.append("name %s" % self.l2tp.name)
self.create_config_file("\n".join(xl2tpd_option),
XL2TPD_OPTION_CONFIG_PATH)
@@ -578,7 +578,7 @@
self.ssh.run("uci set firewall.@rule[-1].src='wan'")
self.ssh.run("uci set firewall.@rule[-1].proto='47'")
- iptable_rules = network_const.FIREWALL_RULES_FOR_PPTP
+ iptable_rules = list(network_const.FIREWALL_RULES_FOR_PPTP)
self.add_custom_firewall_rules(iptable_rules)
self.service_manager.need_restart(SERVICE_FIREWALL)
@@ -621,7 +621,7 @@
self.ssh.run("uci set firewall.@rule[-1].proto='ah'")
net_id = self.l2tp.address.rsplit(".", 1)[0]
- iptable_rules = network_const.FIREWALL_RULES_FOR_L2TP
+ iptable_rules = list(network_const.FIREWALL_RULES_FOR_L2TP)
iptable_rules.append("iptables -A FORWARD -s %s.0/24"
" -j ACCEPT" % net_id)
iptable_rules.append("iptables -t nat -A POSTROUTING"