[PATCH 03/50] tests: Use python3 compatible dict operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f dict -w -n

Signed-off-by: Masashi Honma <masashi.honma@xxxxxxxxx>
---
 tests/hwsim/hostapd.py          |  2 +-
 tests/hwsim/run-tests.py        |  2 +-
 tests/hwsim/test_ap_ft.py       | 44 ++++++++++++++++-----------------
 tests/hwsim/test_ap_hs20.py     |  2 +-
 tests/hwsim/test_pmksa_cache.py |  4 +--
 tests/hwsim/test_radius.py      |  2 +-
 tests/hwsim/test_scan.py        | 14 +++++------
 tests/hwsim/wpasupplicant.py    |  2 +-
 tests/remote/run-tests.py       |  4 +--
 9 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 773b0faa3..9deab15aa 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -413,7 +413,7 @@ def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30,
         for field in fields:
             if field in params:
                 hapd.set(field, params[field])
-        for f,v in params.items():
+        for f,v in list(params.items()):
             if f in fields:
                 continue
             if isinstance(v, list):
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index efcdc130a..7e5edc7ff 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -194,7 +194,7 @@ def main():
             logger.debug("Import test cases from " + t)
             mod = __import__(m.group(1))
             test_modules.append(mod.__name__.replace('test_', '', 1))
-            for key,val in mod.__dict__.iteritems():
+            for key,val in mod.__dict__.items():
                 if key.startswith("test_"):
                     tests.append(val)
     test_names = list(set([t.__name__.replace('test_', '', 1) for t in tests]))
diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 2de21d498..c1c46655e 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -924,7 +924,7 @@ def generic_ap_ft_eap(dev, apdev, vlan=False, cui=False, over_ds=False,
     params["ieee8021x"] = "1"
     if vlan:
         params["dynamic_vlan"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd = hostapd.add_ap(apdev[0], params)
     key_mgmt = hapd.get_config()['key_mgmt']
     if key_mgmt.split(' ')[0] != "FT-EAP":
@@ -934,7 +934,7 @@ def generic_ap_ft_eap(dev, apdev, vlan=False, cui=False, over_ds=False,
     params["ieee8021x"] = "1"
     if vlan:
         params["dynamic_vlan"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True,
@@ -1025,7 +1025,7 @@ def generic_ap_ft_eap_pull(dev, apdev, vlan=False):
     params["pmk_r1_push"] = "0"
     if vlan:
         params["dynamic_vlan"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd = hostapd.add_ap(apdev[0], params)
     key_mgmt = hapd.get_config()['key_mgmt']
     if key_mgmt.split(' ')[0] != "FT-EAP":
@@ -1036,7 +1036,7 @@ def generic_ap_ft_eap_pull(dev, apdev, vlan=False):
     params["pmk_r1_push"] = "0"
     if vlan:
         params["dynamic_vlan"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True,
@@ -1063,7 +1063,7 @@ def test_ap_ft_eap_pull_wildcard(dev, apdev):
     params["r1kh"] = "00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
     params["ft_psk_generate_local"] = "1"
     params["eap_server"] = "0"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd = hostapd.add_ap(apdev[0], params)
     params = ft_params2(ssid=ssid, passphrase=passphrase, discovery=True)
     params['wpa_key_mgmt'] = "WPA-EAP FT-EAP"
@@ -1073,7 +1073,7 @@ def test_ap_ft_eap_pull_wildcard(dev, apdev):
     params["r1kh"] = "00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
     params["ft_psk_generate_local"] = "1"
     params["eap_server"] = "0"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True)
@@ -1172,13 +1172,13 @@ def test_ap_ft_mismatching_rrb_key_push_eap(dev, apdev):
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd0 = hostapd.add_ap(apdev[0], params)
     params = ft_params2_incorrect_rrb_key(ssid=ssid, passphrase=passphrase)
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
@@ -1194,13 +1194,13 @@ def test_ap_ft_mismatching_rrb_key_pull_eap(dev, apdev):
     params["pmk_r1_push"] = "0"
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd0 = hostapd.add_ap(apdev[0], params)
     params = ft_params2_incorrect_rrb_key(ssid=ssid, passphrase=passphrase)
     params["pmk_r1_push"] = "0"
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
@@ -1217,7 +1217,7 @@ def test_ap_ft_mismatching_r0kh_id_pull_eap(dev, apdev):
     params["nas_identifier"] = "nas0.w1.fi"
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hostapd.add_ap(apdev[0], params)
     dev[0].connect(ssid, key_mgmt="FT-EAP", proto="WPA2", ieee80211w="1",
                    eap="GPSK", identity="gpsk user",
@@ -1228,7 +1228,7 @@ def test_ap_ft_mismatching_r0kh_id_pull_eap(dev, apdev):
     params["pmk_r1_push"] = "0"
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hostapd.add_ap(apdev[1], params)
 
     dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
@@ -1244,13 +1244,13 @@ def test_ap_ft_mismatching_rrb_r0kh_push_eap(dev, apdev):
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd0 = hostapd.add_ap(apdev[0], params)
     params = ft_params2_r0kh_mismatch(ssid=ssid, passphrase=passphrase)
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
@@ -1266,13 +1266,13 @@ def test_ap_ft_mismatching_rrb_r0kh_pull_eap(dev, apdev):
     params["pmk_r1_push"] = "0"
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd0 = hostapd.add_ap(apdev[0], params)
     params = ft_params2(ssid=ssid, passphrase=passphrase)
     params["pmk_r1_push"] = "0"
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
@@ -2269,7 +2269,7 @@ def test_ap_ft_internal_rrb_check(dev, apdev):
     params = ft_params1(ssid=ssid, passphrase=passphrase)
     params['wpa_key_mgmt'] = "FT-EAP"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd = hostapd.add_ap(apdev[0], params)
     key_mgmt = hapd.get_config()['key_mgmt']
     if key_mgmt.split(' ')[0] != "FT-EAP":
@@ -2586,7 +2586,7 @@ def test_ap_ft_eap_ap_config_change(dev, apdev):
     params["r0kh"] = "ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
     params["r1kh"] = "00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
     params["eap_server"] = "0"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd = hostapd.add_ap(apdev[0], params)
 
     dev[0].connect(ssid, key_mgmt="FT-EAP WPA-EAP", proto="WPA2",
@@ -2617,13 +2617,13 @@ def test_ap_ft_eap_sha384(dev, apdev):
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP-SHA384"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd0 = hostapd.add_ap(apdev[0], params)
     params = ft_params2(ssid=ssid, passphrase=passphrase)
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP-SHA384"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, eap=True,
@@ -2639,13 +2639,13 @@ def test_ap_ft_eap_sha384_over_ds(dev, apdev):
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP-SHA384"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd0 = hostapd.add_ap(apdev[0], params)
     params = ft_params2(ssid=ssid, passphrase=passphrase)
     params["ieee80211w"] = "2";
     params['wpa_key_mgmt'] = "FT-EAP-SHA384"
     params["ieee8021x"] = "1"
-    params = dict(radius.items() + params.items())
+    params = dict(list(radius.items()) + list(params.items()))
     hapd1 = hostapd.add_ap(apdev[1], params)
 
     run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py
index 97d9dd6d2..ef08f6533 100644
--- a/tests/hwsim/test_ap_hs20.py
+++ b/tests/hwsim/test_ap_hs20.py
@@ -6120,7 +6120,7 @@ def test_ap_hs20_terms_and_conditions_coa(dev, apdev):
                                Vendor_Specific=vsa)
     reply = srv.SendPacket(req)
     logger.debug("RADIUS response from hostapd")
-    for i in reply.keys():
+    for i in list(reply.keys()):
         logger.debug("%s: %s" % (i, reply[i]))
     if reply.code != pyrad.packet.CoAACK:
         raise Exception("CoA-Request failed")
diff --git a/tests/hwsim/test_pmksa_cache.py b/tests/hwsim/test_pmksa_cache.py
index a1178264c..9353ae1dd 100644
--- a/tests/hwsim/test_pmksa_cache.py
+++ b/tests/hwsim/test_pmksa_cache.py
@@ -429,7 +429,7 @@ def generic_pmksa_cache_preauth(dev, apdev, extraparams, identity, databridge,
     try:
         params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
         params['bridge'] = 'ap-br0'
-        for key, value in extraparams[0].iteritems():
+        for key, value in extraparams[0].items():
             params[key] = value
 
         hapd = hostapd.add_ap(apdev[0], params)
@@ -445,7 +445,7 @@ def generic_pmksa_cache_preauth(dev, apdev, extraparams, identity, databridge,
         params['bridge'] = 'ap-br0'
         params['rsn_preauth'] = '1'
         params['rsn_preauth_interfaces'] = databridge
-        for key, value in extraparams[1].iteritems():
+        for key, value in extraparams[1].items():
             params[key] = value
         hostapd.add_ap(apdev[1], params)
         bssid1 = apdev[1]['bssid']
diff --git a/tests/hwsim/test_radius.py b/tests/hwsim/test_radius.py
index 04d4e14e3..2f5bc95ed 100644
--- a/tests/hwsim/test_radius.py
+++ b/tests/hwsim/test_radius.py
@@ -362,7 +362,7 @@ def _test_radius_acct_ipaddr(dev, apdev):
 def send_and_check_reply(srv, req, code, error_cause=0):
     reply = srv.SendPacket(req)
     logger.debug("RADIUS response from hostapd")
-    for i in reply.keys():
+    for i in list(reply.keys()):
         logger.debug("%s: %s" % (i, reply[i]))
     if reply.code != code:
         raise Exception("Unexpected response code")
diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py
index fc5ebbe9a..adb36f980 100644
--- a/tests/hwsim/test_scan.py
+++ b/tests/hwsim/test_scan.py
@@ -1326,9 +1326,9 @@ def test_scan_ies(dev, apdev):
     if not bss or 'beacon_ie' not in bss:
         raise Exception("beacon_ie not present")
     ie = parse_ie(bss['ie'])
-    logger.info("ie: " + str(ie.keys()))
+    logger.info("ie: " + str(list(ie.keys())))
     beacon_ie = parse_ie(bss['beacon_ie'])
-    logger.info("beacon_ie: " + str(ie.keys()))
+    logger.info("beacon_ie: " + str(list(ie.keys())))
     if bss['ie'] == bss['beacon_ie']:
         raise Exception("Both ie and beacon_ie show same data")
 
@@ -1684,7 +1684,7 @@ def test_scan_multi_bssid_check_ie(dev, apdev):
         raise Exception("beacon_ie not present in trans_bss")
 
     beacon_ie = parse_ie(trans_bss['beacon_ie'])
-    logger.info("trans_bss beacon_ie: " + str(beacon_ie.keys()))
+    logger.info("trans_bss beacon_ie: " + str(list(beacon_ie.keys())))
 
     bssid = bssid[0:16] + '1'
     nontrans_bss1 = dev[0].get_bss(bssid)
@@ -1695,12 +1695,12 @@ def test_scan_multi_bssid_check_ie(dev, apdev):
         raise Exception("beacon_ie not present in nontrans_bss1")
 
     nontx_beacon_ie = parse_ie(nontrans_bss1['beacon_ie'])
-    logger.info("nontrans_bss1 beacon_ie: " + str(nontx_beacon_ie.keys()))
+    logger.info("nontrans_bss1 beacon_ie: " + str(list(nontx_beacon_ie.keys())))
 
-    if 71 in beacon_ie.keys():
-        ie_list = beacon_ie.keys()
+    if 71 in list(beacon_ie.keys()):
+        ie_list = list(beacon_ie.keys())
         ie_list.remove(71)
-        if ie_list != nontx_beacon_ie.keys():
+        if ie_list != list(nontx_beacon_ie.keys()):
             raise Exception("check IE failed")
 
 def elem_fms1():
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index a7d54b84e..fed9a5eff 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -958,7 +958,7 @@ class WpaSupplicant:
             "mean_data_rate": 1500,
         }
         cmd = "WMM_AC_ADDTS %s tsid=%d up=%d" % (direction, tsid, up)
-        for (key, value) in params.iteritems():
+        for (key, value) in params.items():
             cmd += " %s=%d" % (key, value)
         if extra:
             cmd += " " + extra
diff --git a/tests/remote/run-tests.py b/tests/remote/run-tests.py
index 3b8bd5867..284205018 100755
--- a/tests/remote/run-tests.py
+++ b/tests/remote/run-tests.py
@@ -161,7 +161,7 @@ def main():
         if m:
             mod = __import__(m.group(1))
             test_modules.append(mod.__name__.replace('test_', '', 1))
-            for key,val in mod.__dict__.iteritems():
+            for key,val in mod.__dict__.items():
                 if key.startswith("test_"):
                     tests.append(val)
     test_names = list(set([t.__name__.replace('test_', '', 1) for t in tests]))
@@ -173,7 +173,7 @@ def main():
         if m:
             mod = __import__(m.group(1))
             test_modules.append(mod.__name__.replace('test_', '', 1))
-            for key,val in mod.__dict__.iteritems():
+            for key,val in mod.__dict__.items():
                 if key.startswith("test_"):
                     hwsim_tests.append(val)
 
-- 
2.17.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux