diff mbox

[v2,01/17] tests: pass apdev to remove_bss()

Message ID 1460007495-17921-1-git-send-email-janusz.dziedzic@tieto.com
State Accepted
Headers show

Commit Message

Janusz.Dziedzic@tieto.com April 7, 2016, 5:37 a.m. UTC
We need this for remote host support.
From apdev we can get apdev['hostname']
and apdev['port'].

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 tests/hwsim/hostapd.py         | 13 +++++++++++--
 tests/hwsim/test_ap_dynamic.py | 40 ++++++++++++++++++++--------------------
 2 files changed, 31 insertions(+), 22 deletions(-)

Comments

Jouni Malinen April 24, 2016, 5:51 p.m. UTC | #1
Thanks, I applied patches 1..12 with number of fixes and cleanup. Patch
13 would add number of new host.execute() calls with a single string
including all the arguments. As noted previously, that is not really a
good interface especially for the local execution case and maybe even
the remote one will obviously change to something else than a single
string to ssh. In other words, patches 13..17 would need to be rebased
on top of the change to make host.execute() use a list of arguments to
form the command.
Janusz.Dziedzic@tieto.com April 25, 2016, 4:39 a.m. UTC | #2
On 24 April 2016 at 19:51, Jouni Malinen <j@w1.fi> wrote:
> Thanks, I applied patches 1..12 with number of fixes and cleanup. Patch
> 13 would add number of new host.execute() calls with a single string
> including all the arguments. As noted previously, that is not really a
> good interface especially for the local execution case and maybe even
> the remote one will obviously change to something else than a single
> string to ssh. In other words, patches 13..17 would need to be rebased
> on top of the change to make host.execute() use a list of arguments to
> form the command.
>
Thanks!!

I already have patch for passing cmd list instead of one string in my
tree, will rebase and send again.

BR
Janusz


> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox

Patch

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 47a3262..6becb8e 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -408,8 +408,17 @@  def add_iface(ifname, confname, hostname=None, port=8878):
     if not hapd.ping():
         raise Exception("Could not ping hostapd")
 
-def remove_bss(ifname, hostname=None, port=8878):
-    logger.info("Removing BSS " + ifname)
+def remove_bss(apdev, ifname=None):
+    if ifname == None:
+        ifname = apdev['ifname']
+    try:
+        hostname = apdev['hostname']
+        port = apdev['port']
+        logger.info("Removing BSS " + hostname + "/" + port + " " + ifname)
+    except:
+        logger.info("Removing BSS " + ifname)
+        hostname = None
+        port = 8878
     hapd_global = HostapdGlobal(hostname=hostname, port=port)
     hapd_global.remove(ifname)
 
diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index de1c4d9..0ba0bae 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -104,19 +104,19 @@  def _test_ap_bss_add_remove(dev, apdev):
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove the last BSS and re-add it")
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, True, False ])
     hostapd.add_bss('phy3', ifname3, 'bss-3.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove the middle BSS and re-add it")
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, True ])
     hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove the first BSS and re-add it and other BSSs")
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
     hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
     hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
@@ -124,9 +124,9 @@  def _test_ap_bss_add_remove(dev, apdev):
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove two BSSes and re-add them")
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, True ])
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, False, False ])
     hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
     multi_check(dev, [ True, True, False ])
@@ -134,11 +134,11 @@  def _test_ap_bss_add_remove(dev, apdev):
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove three BSSes in and re-add them")
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, True, False ])
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, False ])
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
     hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
     multi_check(dev, [ True, False, False ])
@@ -160,18 +160,18 @@  def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
     hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
     hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
     multi_check(dev, [ True, True ], scan_opt=False)
-    hostapd.remove_bss(ifname2)
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname2)
+    hostapd.remove_bss(apdev[0], ifname1)
 
     hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
     hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False ], scan_opt=False)
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
 
     hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
     hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False ])
 
 def test_ap_multi_bss_config(dev, apdev):
@@ -186,17 +186,17 @@  def test_ap_multi_bss_config(dev, apdev):
     hapd = hostapd.Hostapd(ifname1)
     hapd.enable()
     multi_check(dev, [ True, True, True ])
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, True ])
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, False, False ])
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
 
     hostapd.add_iface(ifname1, 'multi-bss.conf')
     hapd = hostapd.Hostapd(ifname1)
     hapd.enable()
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
 
 def invalid_ap(hapd_global, ifname):
@@ -415,7 +415,7 @@  def test_ap_bss_add_reuse_existing(dev, apdev):
     subprocess.check_call(["iw", "dev", ifname1, "interface", "add", ifname2,
                            "type", "__ap"])
     hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     subprocess.check_call(["iw", "dev", ifname2, "del"])
 
 def hapd_bss_out_of_mem(hapd, phy, confname, count, func):
@@ -447,8 +447,8 @@  def test_ap_bss_add_out_of_memory(dev, apdev):
                         1, 'ieee802_11_build_ap_params')
 
     hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
-    hostapd.remove_bss(ifname2)
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname2)
+    hostapd.remove_bss(apdev[0], ifname1)
 
 def test_ap_multi_bss(dev, apdev):
     """Multiple BSSes with hostapd"""