blob: 0260296455e199a59d65c2e5c0285381c2754525 [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
21from . import log
22
23class Pcu(log.Origin, metaclass=ABCMeta):
24 """PCU Abstract Base Class."""
25 suite_run = None
26 run_dir = None
27 bts = None
28
29##############
30# PROTECTED
31##############
32
33 def __init__(self, suite_run, bts, conf, name):
34 """Base constructor. Must be called by subclass."""
35 super().__init__(log.C_RUN, name)
36 self.suite_run = suite_run
37 self.bts = bts
38 self.conf = conf
39
40###################
41# PUBLIC (test API included)
42###################
43
44 @abstractmethod
Pau Espin Pedrolb1526b92018-05-22 20:32:30 +020045 def start(self, keepalive=False):
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010046 """Start the PCU. Must be implemented by subclass."""
47 pass
48
Pau Espin Pedrol651cdc92018-03-08 20:53:13 +010049#------------------------------------------------------------------------------
50
51class PcuDummy(Pcu):
52 """PCU for BTS without proper PCU control"""
53
54 def __init__(self, suite_run, bts, conf):
55 super().__init__(suite_run, bts, conf, 'PcuDummy')
56
Pau Espin Pedrolb1526b92018-05-22 20:32:30 +020057 def start(self, keepalive=False):
Pau Espin Pedrol651cdc92018-03-08 20:53:13 +010058 pass
59
Pau Espin Pedrol150abb42018-03-08 17:27:35 +010060# vim: expandtab tabstop=4 shiftwidth=4