blob: 198c4d3f9757736f474f81acdb3a1f81d0b4a498 [file] [log] [blame]
Wei-Yu Chen49950b92021-11-08 19:19:18 +08001"""
2Copyright 2020 The Magma Authors.
3
4This source code is licensed under the BSD-style license found in the
5LICENSE file in the root directory of this source tree.
6
7Unless required by applicable law or agreed to in writing, software
8distributed under the License is distributed on an "AS IS" BASIS,
9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10See the License for the specific language governing permissions and
11limitations under the License.
12"""
13
14from typing import Type
15
16from devices.baicells import BaicellsHandler
17from devices.baicells_old import BaicellsOldHandler
18from devices.baicells_qafa import BaicellsQAFAHandler
19from devices.baicells_qafb import BaicellsQAFBHandler
20from devices.baicells_rts import BaicellsRTSHandler
21from devices.device_utils import EnodebDeviceName
22from devices.experimental.cavium import CaviumHandler
23from devices.freedomfi_one import FreedomFiOneHandler
24from state_machines.enb_acs import EnodebAcsStateMachine
25
26# This exists only to break a circular dependency. Otherwise there's no
27# point of having these names for the devices
28
29
30DEVICE_HANDLER_BY_NAME = {
31 EnodebDeviceName.BAICELLS: BaicellsHandler,
32 EnodebDeviceName.BAICELLS_OLD: BaicellsOldHandler,
33 EnodebDeviceName.BAICELLS_QAFA: BaicellsQAFAHandler,
34 EnodebDeviceName.BAICELLS_QAFB: BaicellsQAFBHandler,
35 EnodebDeviceName.BAICELLS_RTS: BaicellsRTSHandler,
36 EnodebDeviceName.CAVIUM: CaviumHandler,
37 EnodebDeviceName.FREEDOMFI_ONE: FreedomFiOneHandler,
38}
39
40
41def get_device_handler_from_name(
42 name: EnodebDeviceName,
43) -> Type[EnodebAcsStateMachine]:
44 return DEVICE_HANDLER_BY_NAME[name]