blob: f6b77225d3083de0074dde40fe31d8fa1b29420d [file] [log] [blame]
Pau Espin Pedrol786a6bc2020-03-30 13:51:21 +02001# osmo_gsm_tester: base classes to share code among eNodeB subclasses.
2#
3# Copyright (C) 2020 by sysmocom - s.f.m.c. GmbH
4#
5# Author: Pau Espin Pedrol <pespin@sysmocom.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
21from . import log
22
23
24class eNodeB(log.Origin, metaclass=ABCMeta):
25
26##############
27# PROTECTED
28##############
29 def __init__(self, suite_run, conf, name):
30 super().__init__(log.C_RUN, '%s' % name)
31 self._conf = conf
32 self._addr = conf.get('addr', None)
33 if self._addr is None:
34 raise log.Error('addr not set')
35 self.set_name('%s_%s' % (name, self._addr))
36
37########################
38# PUBLIC - INTERNAL API
39########################
40 def cleanup(self):
41 'Nothing to do by default. Subclass can override if required.'
42 pass
43
44###################
45# PUBLIC (test API included)
46###################
47 @abstractmethod
48 def start(self, epc):
49 'Starts ENB, it will connect to "epc"'
50 pass
51
52 @abstractmethod
53 def ue_add(self, ue):
54 pass
55
56 @abstractmethod
57 def running(self):
58 pass
59
60 @abstractmethod
61 def ue_max_rate(self, downlink=True):
62 pass
63
64 def addr(self):
65 return self._addr
66
67# vim: expandtab tabstop=4 shiftwidth=4