Holger Hans Peter Freyther | 48c83a8 | 2019-02-27 08:27:46 +0000 | [diff] [blame] | 1 | # 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 | |
| 20 | from abc import ABCMeta, abstractmethod |
Pau Espin Pedrol | e1a58bd | 2020-04-10 20:46:07 +0200 | [diff] [blame] | 21 | from ..core import log |
Holger Hans Peter Freyther | 48c83a8 | 2019-02-27 08:27:46 +0000 | [diff] [blame] | 22 | |
| 23 | class 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 Puschmann | 22ec00a | 2020-03-24 09:58:06 +0100 | [diff] [blame] | 37 | def apn_ipaddr(self): |
| 38 | return self._conf.get('apn_ipaddr', 'dynamic') |
| 39 | |
Holger Hans Peter Freyther | 48c83a8 | 2019-02-27 08:27:46 +0000 | [diff] [blame] | 40 | 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 Freyther | 10501cc | 2019-02-25 03:20:16 +0000 | [diff] [blame] | 52 | pass |