Skip to contentSkip to conversation

auto-t: add copy_to_ap utility

PATCH In review James Prestwood 2 participants 4 messages Nov 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 auto-t: add copy_to_ap utility

---
 autotests/util/iwd.py | 8 ++++++++
 1 file changed, 8 insertions(+)
autotests/util/iwd.py +8 -0
index 3ffd9f23..775fc6a5 100755
@@ -1036,6 +1036,7 @@ class IWD(AsyncOpAbstract):
     def clear_storage(storage_dir=IWD_STORAGE_DIR):
         os.system('rm -rf ' + storage_dir + '/*')
         os.system('rm -rf ' + storage_dir + '/hotspot/*')
+        os.system('rm -rf ' + storage_dir + '/ap/*')
 
     @staticmethod
     def create_in_storage(file_name, file_content):
@@ -1063,6 +1064,13 @@ class IWD(AsyncOpAbstract):
 
         shutil.copy(source, IWD_STORAGE_DIR + "/hotspot")
 
+    @staticmethod
+    def copy_to_ap(source):
+        if not os.path.exists(IWD_STORAGE_DIR + "/ap"):
+            os.mkdir(IWD_STORAGE_DIR + "/ap")
+
+        IWD.copy_to_storage(source, IWD_STORAGE_DIR + '/ap/')
+
     @staticmethod
     def remove_from_storage(file_name):
         os.system('rm -rf ' + IWD_STORAGE_DIR + '/\'' + file_name + '\'')
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/3 auto-t: simplify copy_to_hotspot

Since copy_to_storage can take an arbitrary destination path now we can reuse that instead of duplicating code.

---
 autotests/util/iwd.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
autotests/util/iwd.py +1 -5
index 775fc6a5..d7235f2d 100755
@@ -1055,14 +1055,10 @@ class IWD(AsyncOpAbstract):
 
     @staticmethod
     def copy_to_hotspot(source):
-        import shutil
-
-        assert not os.path.isabs(source)
-
         if not os.path.exists(IWD_STORAGE_DIR + "/hotspot"):
             os.mkdir(IWD_STORAGE_DIR + "/hotspot")
 
-        shutil.copy(source, IWD_STORAGE_DIR + "/hotspot")
+        IWD.copy_to_storage(source, IWD_STORAGE_DIR + "/hotspot")
 
     @staticmethod
     def copy_to_ap(source):
Signature · 1 line
2.26.2
#2 lore raw

PATCH 3/3 auto-t: add profile based DHCP test

In reply to James Prestwood
---
 autotests/testAP/dhcp/APConfig.ap    | 10 ++++
 autotests/testAP/dhcp_config_test.py | 79 ++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 autotests/testAP/dhcp/APConfig.ap
 create mode 100644 autotests/testAP/dhcp_config_test.py
autotests/testAP/dhcp/APConfig.ap new file +10 -0
new file mode 100644
index 00000000..4e99dbde
@@ -0,0 +1,10 @@
+[Security]
+Passphrase=password123
+
+[IPv4]
+Address=192.168.1.1
+Gateway=192.168.1.1
+Netmask=255.255.255.0
+DNSList=192.168.1.1,192.168.1.2
+LeaseTime=10
+IPRange=192.168.1.3,192.168.1.100
autotests/testAP/dhcp_config_test.py new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.26.2