[PATCH 4/6] tests: mesh: use common utility function to clear regdomain

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

 



Using clear_regdom_dev() instead of open coding the logic
saves a few lines here and there.

Signed-off-by: Thomas Pedersen <thomas@xxxxxxxxxxxx>
---
 tests/hwsim/test_wpas_mesh.py | 49 ++++++-----------------------------
 1 file changed, 8 insertions(+), 41 deletions(-)

diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index baea71501f0b..e93647ed129c 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -403,19 +403,12 @@ def set_reg(dev, country):
             if "alpha2=" + country in ev:
                 break
 
-def clear_reg_setting(dev):
-    dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
-    dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
-    subprocess.call(['iw', 'reg', 'set', '00'])
-    dev[0].flush_scan_cache()
-    dev[1].flush_scan_cache()
-
 def test_mesh_secure_ocv_mix_legacy(dev, apdev):
     """Mesh network with a VHT STA and a legacy STA under OCV"""
     try:
         run_mesh_secure_ocv_mix_legacy(dev, apdev)
     finally:
-        clear_reg_setting(dev)
+        clear_regdom_dev(dev)
 
 def run_mesh_secure_ocv_mix_legacy(dev, apdev):
     check_mesh_support(dev[0], secure=True)
@@ -441,7 +434,7 @@ def test_mesh_secure_ocv_mix_ht(dev, apdev):
     try:
         run_mesh_secure_ocv_mix_ht(dev, apdev)
     finally:
-        clear_reg_setting(dev)
+        clear_regdom_dev(dev)
 
 def run_mesh_secure_ocv_mix_ht(dev, apdev):
     check_mesh_support(dev[0], secure=True)
@@ -906,11 +899,7 @@ def test_wpas_mesh_open_5ghz(dev, apdev):
     try:
         _test_wpas_mesh_open_5ghz(dev, apdev)
     finally:
-        dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
-        dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
-        subprocess.call(['iw', 'reg', 'set', '00'])
-        dev[0].flush_scan_cache()
-        dev[1].flush_scan_cache()
+        clear_regdom_dev(dev)
 
 def _test_wpas_mesh_open_5ghz(dev, apdev):
     check_mesh_support(dev[0])
@@ -989,13 +978,7 @@ def test_wpas_mesh_open_ht40(dev, apdev):
     try:
         _test_wpas_mesh_open_ht40(dev, apdev)
     finally:
-        dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
-        dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
-        dev[2].request("MESH_GROUP_REMOVE " + dev[2].ifname)
-        subprocess.call(['iw', 'reg', 'set', '00'])
-        dev[0].flush_scan_cache()
-        dev[1].flush_scan_cache()
-        dev[2].flush_scan_cache()
+        clear_regdom_dev(dev, 3)
 
 def _test_wpas_mesh_open_ht40(dev, apdev):
     check_mesh_support(dev[0])
@@ -1037,11 +1020,7 @@ def test_wpas_mesh_open_vht40(dev, apdev):
     try:
         _test_wpas_mesh_open_vht40(dev, apdev)
     finally:
-        dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
-        dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
-        subprocess.call(['iw', 'reg', 'set', '00'])
-        dev[0].flush_scan_cache()
-        dev[1].flush_scan_cache()
+        clear_regdom_dev(dev)
 
 def _test_wpas_mesh_open_vht40(dev, apdev):
     check_mesh_support(dev[0])
@@ -1089,11 +1068,7 @@ def test_wpas_mesh_open_vht20(dev, apdev):
     try:
         _test_wpas_mesh_open_vht20(dev, apdev)
     finally:
-        dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
-        dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
-        subprocess.call(['iw', 'reg', 'set', '00'])
-        dev[0].flush_scan_cache()
-        dev[1].flush_scan_cache()
+        clear_regdom_dev(dev)
 
 def _test_wpas_mesh_open_vht20(dev, apdev):
     check_mesh_support(dev[0])
@@ -1133,11 +1108,7 @@ def test_wpas_mesh_open_vht_80p80(dev, apdev):
     try:
         _test_wpas_mesh_open_vht_80p80(dev, apdev)
     finally:
-        dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
-        dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
-        subprocess.call(['iw', 'reg', 'set', '00'])
-        dev[0].flush_scan_cache()
-        dev[1].flush_scan_cache()
+        clear_regdom_dev(dev)
 
 def _test_wpas_mesh_open_vht_80p80(dev, apdev):
     check_mesh_support(dev[0])
@@ -1181,11 +1152,7 @@ def test_mesh_open_vht_160(dev, apdev):
     try:
         _test_mesh_open_vht_160(dev, apdev)
     finally:
-        dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
-        dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
-        subprocess.call(['iw', 'reg', 'set', '00'])
-        dev[0].flush_scan_cache()
-        dev[1].flush_scan_cache()
+        clear_regdom_dev(dev)
 
 def _test_mesh_open_vht_160(dev, apdev):
     check_mesh_support(dev[0])
-- 
2.20.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