This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Holger Freyther gerrit-no-reply at lists.osmocom.orgHolger Freyther has uploaded this change for review. ( https://gerrit.osmocom.org/10686 Change subject: Create a "ms_driver" stub for the testsuite ...................................................................... Create a "ms_driver" stub for the testsuite All config parameters are hardcoded for now and it should push subscribers into the test (which should be a base class but not a specific test). Change-Id: I586b6d532c6e6395b4e6f2cf2128372237d05a7d --- A src/osmo_gsm_tester/ms_driver.py M src/osmo_gsm_tester/suite.py 2 files changed, 126 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/86/10686/1 diff --git a/src/osmo_gsm_tester/ms_driver.py b/src/osmo_gsm_tester/ms_driver.py new file mode 100644 index 0000000..d7b4d89 --- /dev/null +++ b/src/osmo_gsm_tester/ms_driver.py @@ -0,0 +1,122 @@ +# ms_driver: Launch OsmocomBB mobile's virtually connected to a BTS +# +# Copyright (C) 2018 by Holger Hans Peter Freyther +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +from collections import namedtuple +from datetime import timedelta +from . import log +from osmo_ms_driver.cdf import cdfs +from osmo_ms_driver.event_server import EventServer +from osmo_ms_driver.simple_loop import SimpleLoop +from osmo_ms_driver.location_update_test import MassUpdateLocationTest + +import os.path +import tempfile + +class Subscriber(log.Origin): + def __init__(self, imsi, ki): + super().__init__(log.C_RUN, 'subscriber') + self._imsi = imsi + self._ki = ki + self._auth_algo = "comp128v1" + self._msisdn = None + + def msisdn(self): + return self._msisdn + + def set_msisdn(self, msisdn): + self._msisdn = msisdn + + def imsi(self): + return self._imsi + + def ki(self): + return self._ki + + def auth_algo(self): + return self._auth_algo + +class MsDriver(log.Origin): + + def __init__(self, suite_run): + super().__init__(log.C_RUN, 'ms-driver') + self._suite_run = suite_run + + # TODO: take config out of the test scenario + self._num_ms = 10 + self._time_start = timedelta(seconds=60) + self._time_step = timedelta(milliseconds=100) + self._test_duration = timedelta(seconds=120) + self._cdf = cdfs["ease_in_out"](self._time_start, self._time_step) + self._loop = SimpleLoop() + self._suite_run.remember_to_stop(self) + self._test_case = None + + def prepare(self): + """ + Prepares the subscribers, tests and registration server. Needs to be + called after the complete configuration of this driver. + """ + # TODO: That needs some re-factoring + tmp_dir = tempfile.mkdtemp(suffix="osmo-ms-driver") + log.log("Going to store files in ", tmp_dir=tmp_dir) + event_server_path = os.path.join(tmp_dir, "osmo_ms_driver.unix") + + self._ev_server = EventServer("ev_server", event_server_path) + self._ev_server.listen(self._loop) + self._test_case = MassUpdateLocationTest("mass", self._num_ms, self._cdf, self._ev_server, tmp_dir) + self._suite_run.remember_to_stop(self) + + # TODO: We should pass subscribers down to the test and not get it from + # there. + self._subs = [Subscriber(imsi=mob.imsi(), ki=mob.ki()) for mob in self._test_case.mobiles()] + + + def ms_subscribers(self): + """ + Returns a list of 'subscribers' that were configured in the + current scenario. + """ + if not hasattr(self, '_subs'): + self.prepare() + return self._subs + + def run_test(self): + """ + Runs the configured tests by starting the configured amount of mobile + devices according to their schedule. Returns once all tests succeeded + or the configured timeout has passed. + """ + if not hasattr(self, '_subs'): + self.prepare() + self._test_case.run_test(self._loop, self._test_duration) + + def print_stats(self): + """ + Prints statistics about the test run. + """ + self._test_case.print_stats() + + def terminate(self): + """ + Stops the testcase and all launched processes. Called by the + suite. + """ + if not self._test_case: + return + self._test_case.stop_all() + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py index fa86f96..161660a 100644 --- a/src/osmo_gsm_tester/suite.py +++ b/src/osmo_gsm_tester/suite.py @@ -23,7 +23,7 @@ import pprint from . import config, log, template, util, resource, schema, test from .event_loop import MainLoop -from . import osmo_nitb, osmo_hlr, osmo_mgcpgw, osmo_mgw, osmo_msc, osmo_bsc, osmo_stp, osmo_ggsn, osmo_sgsn, modem, esme, osmocon +from . import osmo_nitb, osmo_hlr, osmo_mgcpgw, osmo_mgw, osmo_msc, osmo_bsc, osmo_stp, osmo_ggsn, osmo_sgsn, modem, esme, osmocon, ms_driver class Timeout(Exception): pass @@ -307,6 +307,9 @@ ip_address = self.ip_address() return osmo_stp.OsmoStp(self, ip_address) + def ms_driver(self): + return ms_driver.MsDriver(self) + def bts(self, specifics=None): bts = bts_obj(self, self.reserved_resources.get(resource.R_BTS, specifics=specifics)) bts.set_lac(self.lac()) -- To view, visit https://gerrit.osmocom.org/10686 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: I586b6d532c6e6395b4e6f2cf2128372237d05a7d Gerrit-Change-Number: 10686 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/20180829/5786be9e/attachment.htm>