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 lte.protos.mconfig import mconfigs_pb2 |
| 7 | from devices.device_utils import EnodebDeviceName |
| 8 | |
| 9 | |
| 10 | class EnodebConfigBuilder: |
| 11 | @classmethod |
| 12 | def get_mconfig( |
| 13 | cls, |
| 14 | device: EnodebDeviceName = EnodebDeviceName.BAICELLS, |
| 15 | ) -> mconfigs_pb2.EnodebD: |
| 16 | mconfig = mconfigs_pb2.EnodebD() |
| 17 | mconfig.bandwidth_mhz = 20 |
| 18 | # This earfcndl is actually unused, remove later |
| 19 | mconfig.earfcndl = 44490 |
| 20 | mconfig.log_level = 1 |
| 21 | mconfig.plmnid_list = "00101" |
| 22 | mconfig.pci = 260 |
| 23 | mconfig.allow_enodeb_transmit = False |
| 24 | mconfig.tac = 1 |
| 25 | if device is EnodebDeviceName.BAICELLS_QAFB: |
| 26 | # fdd config |
| 27 | mconfig.fdd_config.earfcndl = 9211 |
| 28 | elif device is EnodebDeviceName.CAVIUM: |
| 29 | # fdd config |
| 30 | mconfig.fdd_config.earfcndl = 2405 |
| 31 | else: |
| 32 | # tdd config |
| 33 | mconfig.tdd_config.earfcndl = 39150 |
| 34 | mconfig.tdd_config.subframe_assignment = 2 |
| 35 | mconfig.tdd_config.special_subframe_pattern = 7 |
| 36 | |
| 37 | return mconfig |
| 38 | |
| 39 | @classmethod |
| 40 | def get_multi_enb_mconfig( |
| 41 | cls, |
| 42 | ) -> mconfigs_pb2.EnodebD: |
| 43 | mconfig = mconfigs_pb2.EnodebD() |
| 44 | mconfig.bandwidth_mhz = 20 |
| 45 | mconfig.special_subframe_pattern = 7 |
| 46 | # This earfcndl is actually unused, remove later |
| 47 | mconfig.earfcndl = 44490 |
| 48 | mconfig.log_level = 1 |
| 49 | mconfig.plmnid_list = "00101" |
| 50 | mconfig.pci = 260 |
| 51 | mconfig.allow_enodeb_transmit = False |
| 52 | mconfig.subframe_assignment = 2 |
| 53 | mconfig.tac = 1 |
| 54 | |
| 55 | # tdd config, unused because of multi-enb config |
| 56 | mconfig.tdd_config.earfcndl = 39150 |
| 57 | mconfig.tdd_config.subframe_assignment = 2 |
| 58 | mconfig.tdd_config.special_subframe_pattern = 7 |
| 59 | |
| 60 | id1 = '120200002618AGP0003' |
| 61 | #enb_conf_1 = mconfigs_pb2.EnodebD.EnodebConfig() |
| 62 | mconfig.enb_configs_by_serial[id1]\ |
| 63 | .earfcndl = 39151 |
| 64 | mconfig.enb_configs_by_serial[id1]\ |
| 65 | .subframe_assignment = 2 |
| 66 | mconfig.enb_configs_by_serial[id1]\ |
| 67 | .special_subframe_pattern = 7 |
| 68 | mconfig.enb_configs_by_serial[id1]\ |
| 69 | .pci = 259 |
| 70 | mconfig.enb_configs_by_serial[id1]\ |
| 71 | .bandwidth_mhz = 20 |
| 72 | mconfig.enb_configs_by_serial[id1] \ |
| 73 | .tac = 1 |
| 74 | mconfig.enb_configs_by_serial[id1] \ |
| 75 | .cell_id = 0 |
| 76 | mconfig.enb_configs_by_serial[id1]\ |
| 77 | .transmit_enabled = True |
| 78 | mconfig.enb_configs_by_serial[id1]\ |
| 79 | .device_class = 'Baicells Band 40' |
| 80 | |
| 81 | id2 = '120200002618AGP0004' |
| 82 | #enb_conf_2 = mconfigs_pb2.EnodebD.EnodebConfig() |
| 83 | mconfig.enb_configs_by_serial[id2]\ |
| 84 | .earfcndl = 39151 |
| 85 | mconfig.enb_configs_by_serial[id2]\ |
| 86 | .subframe_assignment = 2 |
| 87 | mconfig.enb_configs_by_serial[id2]\ |
| 88 | .special_subframe_pattern = 7 |
| 89 | mconfig.enb_configs_by_serial[id2]\ |
| 90 | .pci = 261 |
| 91 | mconfig.enb_configs_by_serial[id2] \ |
| 92 | .bandwidth_mhz = 20 |
| 93 | mconfig.enb_configs_by_serial[id2] \ |
| 94 | .tac = 1 |
| 95 | mconfig.enb_configs_by_serial[id2] \ |
| 96 | .cell_id = 0 |
| 97 | mconfig.enb_configs_by_serial[id2]\ |
| 98 | .transmit_enabled = True |
| 99 | mconfig.enb_configs_by_serial[id2]\ |
| 100 | .device_class = 'Baicells Band 40' |
| 101 | |
| 102 | return mconfig |
| 103 | |
| 104 | @classmethod |
| 105 | def get_service_config(cls): |
| 106 | return { |
| 107 | "tr069": { |
| 108 | "interface": "eth1", |
| 109 | "port": 48080, |
| 110 | "perf_mgmt_port": 8081, |
| 111 | "public_ip": "192.88.99.142", |
| 112 | }, |
| 113 | "reboot_enodeb_on_mme_disconnected": True, |
| 114 | "s1_interface": "eth1", |
| 115 | } |