]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: remotehost: Add send_file()
authorJanusz Dziedzic <janusz.dziedzic@gmail.com>
Sun, 12 Jan 2020 22:02:21 +0000 (23:02 +0100)
committerJouni Malinen <j@w1.fi>
Sun, 23 Feb 2020 13:48:46 +0000 (15:48 +0200)
Some hostapd test cases use configuration files, e.g., ACLs in BSS
configuration. When executing remote tests (udp), we have to first send
these configuration files to the appropriate remote device. The new
send_file() helper can be used for that.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
tests/hwsim/hostapd.py
tests/hwsim/remotehost.py

index 7a52ebea3bfa30ddbf24b32d6e4ffe67a92bd98f..3e5e68fa203049a084a3890f927818e5a86b0003 100644 (file)
@@ -135,6 +135,9 @@ class HostapdGlobal:
         self.ctrl.terminate()
         self.ctrl = None
 
+    def send_file(self, src, dst):
+        self.host.send_file(src, dst)
+
 class Hostapd:
     def __init__(self, ifname, bssidx=0, hostname=None, port=8877):
         self.hostname = hostname
@@ -524,6 +527,9 @@ class Hostapd:
     def note(self, txt):
         self.request("NOTE " + txt)
 
+    def send_file(self, src, dst):
+        self.host.send_file(src, dst)
+
 def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30,
            global_ctrl_override=None, driver=False):
         if isinstance(apdev, dict):
@@ -747,3 +753,7 @@ def ht40_minus_params(channel="1", ssid=None, country=None):
 def cmd_execute(apdev, cmd, shell=False):
     hapd_global = HostapdGlobal(apdev)
     return hapd_global.cmd_execute(cmd, shell=shell)
+
+def send_file(apdev, src, dst):
+    hapd_global = HostapdGlobal(apdev)
+    return hapd_global.send_file(src, dst)
index 50f46c3109146f7a4df3e71ea6eb2d73eee2ef51..8e121538aaddac04a5fe5d1e3b32aeba3dff18dd 100644 (file)
@@ -106,3 +106,9 @@ class Host():
                 self.local_execute(["scp", self.user + "@[" + self.host + "]:" + log, local_log_dir])
             self.execute(["rm", log])
         del self.logs[:]
+
+    def send_file(self, src, dst):
+        if self.host is None:
+            return
+        self.local_execute(["scp", src,
+                            self.user + "@[" + self.host + "]:" + dst])