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 |
Wei-Yu Chen | b91af85 | 2022-03-15 22:24:49 +0800 | [diff] [blame] | 15 | from devices.sercomm import SercommHandler |
Wei-Yu Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 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, |
Wei-Yu Chen | b91af85 | 2022-03-15 22:24:49 +0800 | [diff] [blame] | 29 | EnodebDeviceName.SERCOMM: SercommHandler, |
Wei-Yu Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | |
| 33 | def get_device_handler_from_name( |
| 34 | name: EnodebDeviceName, |
| 35 | ) -> Type[EnodebAcsStateMachine]: |
| 36 | return DEVICE_HANDLER_BY_NAME[name] |