Wei-Yu Chen | ad55cb8 | 2022-02-15 20:07:01 +0800 | [diff] [blame^] | 1 | # SPDX-FileCopyrightText: 2020 The Magma Authors. |
| 2 | # SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org> |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
Wei-Yu Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 5 | |
| 6 | from typing import Type |
| 7 | |
| 8 | from devices.baicells import BaicellsHandler |
| 9 | from devices.baicells_old import BaicellsOldHandler |
| 10 | from devices.baicells_qafa import BaicellsQAFAHandler |
| 11 | from devices.baicells_qafb import BaicellsQAFBHandler |
| 12 | from devices.baicells_rts import BaicellsRTSHandler |
| 13 | from devices.device_utils import EnodebDeviceName |
| 14 | from devices.experimental.cavium import CaviumHandler |
| 15 | from devices.freedomfi_one import FreedomFiOneHandler |
| 16 | from state_machines.enb_acs import EnodebAcsStateMachine |
| 17 | |
| 18 | # This exists only to break a circular dependency. Otherwise there's no |
| 19 | # point of having these names for the devices |
| 20 | |
| 21 | |
| 22 | DEVICE_HANDLER_BY_NAME = { |
| 23 | EnodebDeviceName.BAICELLS: BaicellsHandler, |
| 24 | EnodebDeviceName.BAICELLS_OLD: BaicellsOldHandler, |
| 25 | EnodebDeviceName.BAICELLS_QAFA: BaicellsQAFAHandler, |
| 26 | EnodebDeviceName.BAICELLS_QAFB: BaicellsQAFBHandler, |
| 27 | EnodebDeviceName.BAICELLS_RTS: BaicellsRTSHandler, |
| 28 | EnodebDeviceName.CAVIUM: CaviumHandler, |
| 29 | EnodebDeviceName.FREEDOMFI_ONE: FreedomFiOneHandler, |
| 30 | } |
| 31 | |
| 32 | |
| 33 | def get_device_handler_from_name( |
| 34 | name: EnodebDeviceName, |
| 35 | ) -> Type[EnodebAcsStateMachine]: |
| 36 | return DEVICE_HANDLER_BY_NAME[name] |