Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 1 | # osmo_gsm_tester: specifics pcu base abstract class |
| 2 | # |
| 3 | # Copyright (C) 2018 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 | |
| 20 | from abc import ABCMeta, abstractmethod |
Pau Espin Pedrol | e1a58bd | 2020-04-10 20:46:07 +0200 | [diff] [blame] | 21 | from ..core import log |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 22 | |
| 23 | class Pcu(log.Origin, metaclass=ABCMeta): |
| 24 | """PCU Abstract Base Class.""" |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 25 | |
| 26 | ############## |
| 27 | # PROTECTED |
| 28 | ############## |
| 29 | |
Pau Espin Pedrol | a442cb8 | 2020-05-05 12:54:37 +0200 | [diff] [blame] | 30 | def __init__(self, testenv, bts, conf, name): |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 31 | """Base constructor. Must be called by subclass.""" |
| 32 | super().__init__(log.C_RUN, name) |
Pau Espin Pedrol | a442cb8 | 2020-05-05 12:54:37 +0200 | [diff] [blame] | 33 | self.testenv = testenv |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 34 | self.bts = bts |
| 35 | self.conf = conf |
| 36 | |
Pau Espin Pedrol | 29b7132 | 2020-04-06 18:14:29 +0200 | [diff] [blame] | 37 | ######################## |
| 38 | # PUBLIC - INTERNAL API |
| 39 | ######################## |
| 40 | |
| 41 | def egprs_enabled(self): |
| 42 | return self.bts.egprs_enabled() |
| 43 | |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 44 | ################### |
| 45 | # PUBLIC (test API included) |
| 46 | ################### |
| 47 | |
| 48 | @abstractmethod |
Pau Espin Pedrol | b1526b9 | 2018-05-22 20:32:30 +0200 | [diff] [blame] | 49 | def start(self, keepalive=False): |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 50 | """Start the PCU. Must be implemented by subclass.""" |
| 51 | pass |
| 52 | |
Pau Espin Pedrol | 651cdc9 | 2018-03-08 20:53:13 +0100 | [diff] [blame] | 53 | #------------------------------------------------------------------------------ |
| 54 | |
| 55 | class PcuDummy(Pcu): |
| 56 | """PCU for BTS without proper PCU control""" |
| 57 | |
Pau Espin Pedrol | a442cb8 | 2020-05-05 12:54:37 +0200 | [diff] [blame] | 58 | def __init__(self, testenv, bts, conf): |
| 59 | super().__init__(testenv, bts, conf, 'PcuDummy') |
Pau Espin Pedrol | 651cdc9 | 2018-03-08 20:53:13 +0100 | [diff] [blame] | 60 | |
Pau Espin Pedrol | b1526b9 | 2018-05-22 20:32:30 +0200 | [diff] [blame] | 61 | def start(self, keepalive=False): |
Pau Espin Pedrol | 651cdc9 | 2018-03-08 20:53:13 +0100 | [diff] [blame] | 62 | pass |
| 63 | |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 64 | # vim: expandtab tabstop=4 shiftwidth=4 |