blob: ed94d492380a7a4b9d3e0097475a696b0361d25e [file] [log] [blame]
Pau Espin Pedrol150abb42018-03-08 17:27:35 +01001# 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
20from abc import ABCMeta, abstractmethod
Pau Espin Pedrole1a58bd2020-04-10 20:46:07 +020021from ..core import log
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010022
23class Pcu(log.Origin, metaclass=ABCMeta):
24 """PCU Abstract Base Class."""
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010025
26##############
27# PROTECTED
28##############
29
Pau Espin Pedrola442cb82020-05-05 12:54:37 +020030 def __init__(self, testenv, bts, conf, name):
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010031 """Base constructor. Must be called by subclass."""
32 super().__init__(log.C_RUN, name)
Pau Espin Pedrola442cb82020-05-05 12:54:37 +020033 self.testenv = testenv
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010034 self.bts = bts
35 self.conf = conf
36
Pau Espin Pedrol29b71322020-04-06 18:14:29 +020037########################
38# PUBLIC - INTERNAL API
39########################
40
41 def egprs_enabled(self):
42 return self.bts.egprs_enabled()
43
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010044###################
45# PUBLIC (test API included)
46###################
47
48 @abstractmethod
Pau Espin Pedrolb1526b92018-05-22 20:32:30 +020049 def start(self, keepalive=False):
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010050 """Start the PCU. Must be implemented by subclass."""
51 pass
52
Pau Espin Pedrol651cdc92018-03-08 20:53:13 +010053#------------------------------------------------------------------------------
54
55class PcuDummy(Pcu):
56 """PCU for BTS without proper PCU control"""
57
Pau Espin Pedrola442cb82020-05-05 12:54:37 +020058 def __init__(self, testenv, bts, conf):
59 super().__init__(testenv, bts, conf, 'PcuDummy')
Pau Espin Pedrol651cdc92018-03-08 20:53:13 +010060
Pau Espin Pedrolb1526b92018-05-22 20:32:30 +020061 def start(self, keepalive=False):
Pau Espin Pedrol651cdc92018-03-08 20:53:13 +010062 pass
63
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010064# vim: expandtab tabstop=4 shiftwidth=4