blob: 3dcea7b2ad5edab332657c7b3a6680ac186e438a [file] [log] [blame]
Holger Hans Peter Freyther48c83a82019-02-27 08:27:46 +00001# osmo_gsm_tester: Base class for Mobile Stations (MS)
2#
3# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH
4#
5# Author: Neels Hofmeyr <neels@hofmeyr.de>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20from abc import ABCMeta, abstractmethod
Pau Espin Pedrole1a58bd2020-04-10 20:46:07 +020021from ..core import log
Holger Hans Peter Freyther48c83a82019-02-27 08:27:46 +000022
23class MS(log.Origin, metaclass=ABCMeta):
24 """Base for everything about mobile/modem and SIMs."""
25
26 def __init__(self, name, conf):
27 super().__init__(log.C_TST, name)
28 self._conf = conf
29 self.msisdn = None
30
31 def imsi(self):
32 return self._conf.get('imsi')
33
34 def ki(self):
35 return self._conf.get('ki')
36
Andre Puschmann22ec00a2020-03-24 09:58:06 +010037 def apn_ipaddr(self):
38 return self._conf.get('apn_ipaddr', 'dynamic')
39
Holger Hans Peter Freyther48c83a82019-02-27 08:27:46 +000040 def auth_algo(self):
41 return self._conf.get('auth_algo', None)
42
43 def set_msisdn(self, msisdn):
44 self.msisdn = msisdn
45
46 def msisdn(self):
47 return self.msisdn
48
49 @abstractmethod
50 def cleanup(self):
51 """Cleans up resources allocated."""
Holger Hans Peter Freyther10501cc2019-02-25 03:20:16 +000052 pass