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 |
| 21 | from . import log |
| 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 | |
| 30 | def __init__(self, suite_run, bts, conf, name): |
| 31 | """Base constructor. Must be called by subclass.""" |
| 32 | super().__init__(log.C_RUN, name) |
| 33 | self.suite_run = suite_run |
| 34 | self.bts = bts |
| 35 | self.conf = conf |
| 36 | |
| 37 | ################### |
| 38 | # PUBLIC (test API included) |
| 39 | ################### |
| 40 | |
| 41 | @abstractmethod |
Pau Espin Pedrol | b1526b9 | 2018-05-22 20:32:30 +0200 | [diff] [blame] | 42 | def start(self, keepalive=False): |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 43 | """Start the PCU. Must be implemented by subclass.""" |
| 44 | pass |
| 45 | |
Pau Espin Pedrol | 651cdc9 | 2018-03-08 20:53:13 +0100 | [diff] [blame] | 46 | #------------------------------------------------------------------------------ |
| 47 | |
| 48 | class PcuDummy(Pcu): |
| 49 | """PCU for BTS without proper PCU control""" |
| 50 | |
| 51 | def __init__(self, suite_run, bts, conf): |
| 52 | super().__init__(suite_run, bts, conf, 'PcuDummy') |
| 53 | |
Pau Espin Pedrol | b1526b9 | 2018-05-22 20:32:30 +0200 | [diff] [blame] | 54 | def start(self, keepalive=False): |
Pau Espin Pedrol | 651cdc9 | 2018-03-08 20:53:13 +0100 | [diff] [blame] | 55 | pass |
| 56 | |
Pau Espin Pedrol | 150abb4 | 2018-03-08 17:27:35 +0100 | [diff] [blame] | 57 | # vim: expandtab tabstop=4 shiftwidth=4 |