Wei-Yu Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2020 The Magma Authors. |
| 3 | |
| 4 | This source code is licensed under the BSD-style license found in the |
| 5 | LICENSE file in the root directory of this source tree. |
| 6 | |
| 7 | Unless required by applicable law or agreed to in writing, software |
| 8 | distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | See the License for the specific language governing permissions and |
| 11 | limitations under the License. |
| 12 | """ |
| 13 | |
| 14 | from lte.protos.mconfig import mconfigs_pb2 |
| 15 | from devices.device_utils import EnodebDeviceName |
| 16 | |
| 17 | |
| 18 | class EnodebConfigBuilder: |
| 19 | @classmethod |
| 20 | def get_mconfig( |
| 21 | cls, |
| 22 | device: EnodebDeviceName = EnodebDeviceName.BAICELLS, |
| 23 | ) -> mconfigs_pb2.EnodebD: |
| 24 | mconfig = mconfigs_pb2.EnodebD() |
| 25 | mconfig.bandwidth_mhz = 20 |
| 26 | # This earfcndl is actually unused, remove later |
| 27 | mconfig.earfcndl = 44490 |
| 28 | mconfig.log_level = 1 |
| 29 | mconfig.plmnid_list = "00101" |
| 30 | mconfig.pci = 260 |
| 31 | mconfig.allow_enodeb_transmit = False |
| 32 | mconfig.tac = 1 |
| 33 | if device is EnodebDeviceName.BAICELLS_QAFB: |
| 34 | # fdd config |
| 35 | mconfig.fdd_config.earfcndl = 9211 |
| 36 | elif device is EnodebDeviceName.CAVIUM: |
| 37 | # fdd config |
| 38 | mconfig.fdd_config.earfcndl = 2405 |
| 39 | else: |
| 40 | # tdd config |
| 41 | mconfig.tdd_config.earfcndl = 39150 |
| 42 | mconfig.tdd_config.subframe_assignment = 2 |
| 43 | mconfig.tdd_config.special_subframe_pattern = 7 |
| 44 | |
| 45 | return mconfig |
| 46 | |
| 47 | @classmethod |
| 48 | def get_multi_enb_mconfig( |
| 49 | cls, |
| 50 | ) -> mconfigs_pb2.EnodebD: |
| 51 | mconfig = mconfigs_pb2.EnodebD() |
| 52 | mconfig.bandwidth_mhz = 20 |
| 53 | mconfig.special_subframe_pattern = 7 |
| 54 | # This earfcndl is actually unused, remove later |
| 55 | mconfig.earfcndl = 44490 |
| 56 | mconfig.log_level = 1 |
| 57 | mconfig.plmnid_list = "00101" |
| 58 | mconfig.pci = 260 |
| 59 | mconfig.allow_enodeb_transmit = False |
| 60 | mconfig.subframe_assignment = 2 |
| 61 | mconfig.tac = 1 |
| 62 | |
| 63 | # tdd config, unused because of multi-enb config |
| 64 | mconfig.tdd_config.earfcndl = 39150 |
| 65 | mconfig.tdd_config.subframe_assignment = 2 |
| 66 | mconfig.tdd_config.special_subframe_pattern = 7 |
| 67 | |
| 68 | id1 = '120200002618AGP0003' |
| 69 | #enb_conf_1 = mconfigs_pb2.EnodebD.EnodebConfig() |
| 70 | mconfig.enb_configs_by_serial[id1]\ |
| 71 | .earfcndl = 39151 |
| 72 | mconfig.enb_configs_by_serial[id1]\ |
| 73 | .subframe_assignment = 2 |
| 74 | mconfig.enb_configs_by_serial[id1]\ |
| 75 | .special_subframe_pattern = 7 |
| 76 | mconfig.enb_configs_by_serial[id1]\ |
| 77 | .pci = 259 |
| 78 | mconfig.enb_configs_by_serial[id1]\ |
| 79 | .bandwidth_mhz = 20 |
| 80 | mconfig.enb_configs_by_serial[id1] \ |
| 81 | .tac = 1 |
| 82 | mconfig.enb_configs_by_serial[id1] \ |
| 83 | .cell_id = 0 |
| 84 | mconfig.enb_configs_by_serial[id1]\ |
| 85 | .transmit_enabled = True |
| 86 | mconfig.enb_configs_by_serial[id1]\ |
| 87 | .device_class = 'Baicells Band 40' |
| 88 | |
| 89 | id2 = '120200002618AGP0004' |
| 90 | #enb_conf_2 = mconfigs_pb2.EnodebD.EnodebConfig() |
| 91 | mconfig.enb_configs_by_serial[id2]\ |
| 92 | .earfcndl = 39151 |
| 93 | mconfig.enb_configs_by_serial[id2]\ |
| 94 | .subframe_assignment = 2 |
| 95 | mconfig.enb_configs_by_serial[id2]\ |
| 96 | .special_subframe_pattern = 7 |
| 97 | mconfig.enb_configs_by_serial[id2]\ |
| 98 | .pci = 261 |
| 99 | mconfig.enb_configs_by_serial[id2] \ |
| 100 | .bandwidth_mhz = 20 |
| 101 | mconfig.enb_configs_by_serial[id2] \ |
| 102 | .tac = 1 |
| 103 | mconfig.enb_configs_by_serial[id2] \ |
| 104 | .cell_id = 0 |
| 105 | mconfig.enb_configs_by_serial[id2]\ |
| 106 | .transmit_enabled = True |
| 107 | mconfig.enb_configs_by_serial[id2]\ |
| 108 | .device_class = 'Baicells Band 40' |
| 109 | |
| 110 | return mconfig |
| 111 | |
| 112 | @classmethod |
| 113 | def get_service_config(cls): |
| 114 | return { |
| 115 | "tr069": { |
| 116 | "interface": "eth1", |
| 117 | "port": 48080, |
| 118 | "perf_mgmt_port": 8081, |
| 119 | "public_ip": "192.88.99.142", |
| 120 | }, |
| 121 | "reboot_enodeb_on_mme_disconnected": True, |
| 122 | "s1_interface": "eth1", |
| 123 | } |