Change in osmo-gsm-tester[master]: virtual: Make mass tests be able to activate themselves

Holger Freyther gerrit-no-reply at lists.osmocom.org
Tue Apr 30 21:13:54 UTC 2019


Holger Freyther has uploaded this change for review. ( https://gerrit.osmocom.org/13827


Change subject: virtual: Make mass tests be able to activate themselves
......................................................................

virtual: Make mass tests be able to activate themselves

We will need to enable/disable generation of lua script code
depending on the subscriber and mass test.

Change-Id: Ide4d788543d910356efe9f61e789b3975f7bc558
---
M src/osmo_gsm_tester/ms_driver.py
M src/osmo_ms_driver/location_update_test.py
M src/osmo_ms_driver/starter.py
M src/osmo_ms_driver/test_support.py
4 files changed, 37 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/27/13827/1

diff --git a/src/osmo_gsm_tester/ms_driver.py b/src/osmo_gsm_tester/ms_driver.py
index 355a03e..34915f7 100644
--- a/src/osmo_gsm_tester/ms_driver.py
+++ b/src/osmo_gsm_tester/ms_driver.py
@@ -122,7 +122,7 @@
         for sub in self._subscribers:
             self._starter.subscriber_add(sub)
 
-        self._executor.configure(len(self._subscribers))
+        self._executor.configure(self._subscribers, self._starter.mobiles())
         self._configured = True
 
     def run_test(self):
diff --git a/src/osmo_ms_driver/location_update_test.py b/src/osmo_ms_driver/location_update_test.py
index 1a33f09..73f4d8c 100644
--- a/src/osmo_ms_driver/location_update_test.py
+++ b/src/osmo_ms_driver/location_update_test.py
@@ -60,9 +60,13 @@
         super().__init__(name, event_server, results)
         self._event_server.register(self.handle_msg)
 
-    def configure(self, num_subscribers):
-        self._num_subscribers = num_subscribers
-        self._outstanding = num_subscribers
+    def configure(self, subscribers, mobiles):
+        # Enable the LU test script in each mobile
+        for mobile in mobiles:
+            mobile.setitem('run_lu_test', True)
+
+        self._num_subscribers = len(subscribers)
+        self._outstanding = self._num_subscribers
 
     def handle_msg(self, _data, addr, time):
         data = json.loads(_data.decode())
diff --git a/src/osmo_ms_driver/starter.py b/src/osmo_ms_driver/starter.py
index 61d3bb0..3a13034 100644
--- a/src/osmo_ms_driver/starter.py
+++ b/src/osmo_ms_driver/starter.py
@@ -85,23 +85,32 @@
         self._ki = subscriber.ki()
         self._omob_proc = None
 
+        lua_support = os.path.join(os.path.dirname(__file__), 'lua')
+        self._cfg = {
+            'test': {
+                'event_path': self._ev_server_path,
+                'lua_support': lua_support,
+            }
+        }
+
     def imsi(self):
         return self._imsi
 
     def ki(self):
         return self._ki
 
+    def setitem(self, key, value):
+        """
+        Sets `key` to `value` inside the test dictionary.
+
+        Used by testcases to pass per MS settings into the lua script
+        generator.
+        """
+        self._cfg['test'][key] = value
+
     def write_lua_cfg(self):
-        lua_support = os.path.join(os.path.dirname(__file__), 'lua')
-        cfg = {
-            'test': {
-                'event_path': self._ev_server_path,
-                'lua_support': lua_support,
-                'run_lu_test': True,
-            }
-        }
         lua_cfg_file = os.path.join(self._tmp_dir, "lua_" + self._name_number + ".lua")
-        lua_script = template.render(self._lua_template, cfg)
+        lua_script = template.render(self._lua_template, self._cfg)
         with open(lua_cfg_file, 'w') as w:
             w.write(lua_script)
         return lua_cfg_file
@@ -140,6 +149,10 @@
         if self._omob_proc:
             self._omob_proc.terminate()
 
+    def mobiles(self):
+        """Returns the list of mobiles configured."""
+        return self._mobiles
+
 
 class MobileTestStarter(log.Origin):
     """
diff --git a/src/osmo_ms_driver/test_support.py b/src/osmo_ms_driver/test_support.py
index f7910dd..97f1313 100644
--- a/src/osmo_ms_driver/test_support.py
+++ b/src/osmo_ms_driver/test_support.py
@@ -76,8 +76,13 @@
         self._event_server = event_server
         self._results = results
 
-    def configure(self, num_subscribers):
-        """Configures the test given the (number) of subscribers."""
+    def configure(self, subscribers, mobiles):
+        """
+        Configures the test given the subscribers.
+
+        The subscriber at index _i_ belongs to the mobile at the
+        same index. subscribers[i] == mobiles[i].subscriber().
+        """
         pass
 
     def before_start(self):

-- 
To view, visit https://gerrit.osmocom.org/13827
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide4d788543d910356efe9f61e789b3975f7bc558
Gerrit-Change-Number: 13827
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Freyther <holger at freyther.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190430/12147c3c/attachment-0001.html>


More information about the gerrit-log mailing list