Init commit for standalone enodebd
Change-Id: I88eeef5135dd7ba8551ddd9fb6a0695f5325337b
diff --git a/tests/test_utils/config_builder.py b/tests/test_utils/config_builder.py
new file mode 100644
index 0000000..f662b9f
--- /dev/null
+++ b/tests/test_utils/config_builder.py
@@ -0,0 +1,123 @@
+"""
+Copyright 2020 The Magma Authors.
+
+This source code is licensed under the BSD-style license found in the
+LICENSE file in the root directory of this source tree.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from lte.protos.mconfig import mconfigs_pb2
+from devices.device_utils import EnodebDeviceName
+
+
+class EnodebConfigBuilder:
+ @classmethod
+ def get_mconfig(
+ cls,
+ device: EnodebDeviceName = EnodebDeviceName.BAICELLS,
+ ) -> mconfigs_pb2.EnodebD:
+ mconfig = mconfigs_pb2.EnodebD()
+ mconfig.bandwidth_mhz = 20
+ # This earfcndl is actually unused, remove later
+ mconfig.earfcndl = 44490
+ mconfig.log_level = 1
+ mconfig.plmnid_list = "00101"
+ mconfig.pci = 260
+ mconfig.allow_enodeb_transmit = False
+ mconfig.tac = 1
+ if device is EnodebDeviceName.BAICELLS_QAFB:
+ # fdd config
+ mconfig.fdd_config.earfcndl = 9211
+ elif device is EnodebDeviceName.CAVIUM:
+ # fdd config
+ mconfig.fdd_config.earfcndl = 2405
+ else:
+ # tdd config
+ mconfig.tdd_config.earfcndl = 39150
+ mconfig.tdd_config.subframe_assignment = 2
+ mconfig.tdd_config.special_subframe_pattern = 7
+
+ return mconfig
+
+ @classmethod
+ def get_multi_enb_mconfig(
+ cls,
+ ) -> mconfigs_pb2.EnodebD:
+ mconfig = mconfigs_pb2.EnodebD()
+ mconfig.bandwidth_mhz = 20
+ mconfig.special_subframe_pattern = 7
+ # This earfcndl is actually unused, remove later
+ mconfig.earfcndl = 44490
+ mconfig.log_level = 1
+ mconfig.plmnid_list = "00101"
+ mconfig.pci = 260
+ mconfig.allow_enodeb_transmit = False
+ mconfig.subframe_assignment = 2
+ mconfig.tac = 1
+
+ # tdd config, unused because of multi-enb config
+ mconfig.tdd_config.earfcndl = 39150
+ mconfig.tdd_config.subframe_assignment = 2
+ mconfig.tdd_config.special_subframe_pattern = 7
+
+ id1 = '120200002618AGP0003'
+ #enb_conf_1 = mconfigs_pb2.EnodebD.EnodebConfig()
+ mconfig.enb_configs_by_serial[id1]\
+ .earfcndl = 39151
+ mconfig.enb_configs_by_serial[id1]\
+ .subframe_assignment = 2
+ mconfig.enb_configs_by_serial[id1]\
+ .special_subframe_pattern = 7
+ mconfig.enb_configs_by_serial[id1]\
+ .pci = 259
+ mconfig.enb_configs_by_serial[id1]\
+ .bandwidth_mhz = 20
+ mconfig.enb_configs_by_serial[id1] \
+ .tac = 1
+ mconfig.enb_configs_by_serial[id1] \
+ .cell_id = 0
+ mconfig.enb_configs_by_serial[id1]\
+ .transmit_enabled = True
+ mconfig.enb_configs_by_serial[id1]\
+ .device_class = 'Baicells Band 40'
+
+ id2 = '120200002618AGP0004'
+ #enb_conf_2 = mconfigs_pb2.EnodebD.EnodebConfig()
+ mconfig.enb_configs_by_serial[id2]\
+ .earfcndl = 39151
+ mconfig.enb_configs_by_serial[id2]\
+ .subframe_assignment = 2
+ mconfig.enb_configs_by_serial[id2]\
+ .special_subframe_pattern = 7
+ mconfig.enb_configs_by_serial[id2]\
+ .pci = 261
+ mconfig.enb_configs_by_serial[id2] \
+ .bandwidth_mhz = 20
+ mconfig.enb_configs_by_serial[id2] \
+ .tac = 1
+ mconfig.enb_configs_by_serial[id2] \
+ .cell_id = 0
+ mconfig.enb_configs_by_serial[id2]\
+ .transmit_enabled = True
+ mconfig.enb_configs_by_serial[id2]\
+ .device_class = 'Baicells Band 40'
+
+ return mconfig
+
+ @classmethod
+ def get_service_config(cls):
+ return {
+ "tr069": {
+ "interface": "eth1",
+ "port": 48080,
+ "perf_mgmt_port": 8081,
+ "public_ip": "192.88.99.142",
+ },
+ "reboot_enodeb_on_mme_disconnected": True,
+ "s1_interface": "eth1",
+ }
diff --git a/tests/test_utils/enb_acs_builder.py b/tests/test_utils/enb_acs_builder.py
new file mode 100644
index 0000000..75f55be
--- /dev/null
+++ b/tests/test_utils/enb_acs_builder.py
@@ -0,0 +1,92 @@
+"""
+Copyright 2020 The Magma Authors.
+
+This source code is licensed under the BSD-style license found in the
+LICENSE file in the root directory of this source tree.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import asyncio
+from typing import Dict
+from unittest import mock
+
+from lte.protos.mconfig import mconfigs_pb2
+from common.service import MagmaService
+from devices.device_map import get_device_handler_from_name
+from devices.device_utils import EnodebDeviceName
+from state_machines.enb_acs import EnodebAcsStateMachine
+from state_machines.enb_acs_manager import StateMachineManager
+from tests.test_utils.config_builder import EnodebConfigBuilder
+
+
+class EnodebAcsStateMachineBuilder:
+ @classmethod
+ def build_acs_manager(
+ cls,
+ device: EnodebDeviceName = EnodebDeviceName.BAICELLS,
+ ) -> StateMachineManager:
+ service = cls.build_magma_service(device)
+ return StateMachineManager(service)
+
+ @classmethod
+ def build_multi_enb_acs_manager(
+ cls,
+ ) -> StateMachineManager:
+ service = cls.build_multi_enb_magma_service()
+ return StateMachineManager(service)
+
+ @classmethod
+ def build_multi_enb_acs_state_machine(
+ cls,
+ device: EnodebDeviceName = EnodebDeviceName.BAICELLS,
+ ) -> EnodebAcsStateMachine:
+ # Build the state_machine
+ service = cls.build_multi_enb_magma_service()
+ handler_class = get_device_handler_from_name(device)
+ acs_state_machine = handler_class(service)
+ return acs_state_machine
+
+ @classmethod
+ def build_acs_state_machine(
+ cls,
+ device: EnodebDeviceName = EnodebDeviceName.BAICELLS,
+ ) -> EnodebAcsStateMachine:
+ # Build the state_machine
+ service = cls.build_magma_service(device)
+ handler_class = get_device_handler_from_name(device)
+ acs_state_machine = handler_class(service)
+ return acs_state_machine
+
+ @classmethod
+ def build_magma_service(
+ cls,
+ device: EnodebDeviceName = EnodebDeviceName.BAICELLS,
+ mconfig: mconfigs_pb2.EnodebD = None,
+ service_config: Dict = None,
+ ) -> MagmaService:
+ event_loop = asyncio.get_event_loop()
+ if not mconfig:
+ mconfig = EnodebConfigBuilder.get_mconfig(device)
+ if not service_config:
+ service_config = EnodebConfigBuilder.get_service_config()
+ with mock.patch('magma.common.service.MagmaService') as MockService:
+ MockService.config = service_config
+ MockService.mconfig = mconfig
+ MockService.loop = event_loop
+ return MockService
+
+ @classmethod
+ def build_multi_enb_magma_service(cls) -> MagmaService:
+ event_loop = asyncio.get_event_loop()
+ mconfig = EnodebConfigBuilder.get_multi_enb_mconfig()
+ service_config = EnodebConfigBuilder.get_service_config()
+ with mock.patch('magma.common.service.MagmaService') as MockService:
+ MockService.config = service_config
+ MockService.mconfig = mconfig
+ MockService.loop = event_loop
+ return MockService
diff --git a/tests/test_utils/enodeb_handler.py b/tests/test_utils/enodeb_handler.py
new file mode 100644
index 0000000..ef2b11f
--- /dev/null
+++ b/tests/test_utils/enodeb_handler.py
@@ -0,0 +1,39 @@
+"""
+Copyright 2020 The Magma Authors.
+
+This source code is licensed under the BSD-style license found in the
+LICENSE file in the root directory of this source tree.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from unittest import TestCase, mock
+
+import magma.enodebd.tests.test_utils.mock_functions as enb_mock
+
+
+class EnodebHandlerTestCase(TestCase):
+ """
+ Sets up test class with a set of patches needed for eNodeB handlers
+ """
+
+ def setUp(self):
+ self.patches = {
+ enb_mock.GET_IP_FROM_IF_PATH:
+ mock.Mock(side_effect=enb_mock.mock_get_ip_from_if),
+ enb_mock.LOAD_SERVICE_MCONFIG_PATH:
+ mock.Mock(
+ side_effect=enb_mock.mock_load_service_mconfig_as_json,
+ ),
+ }
+ self.applied_patches = [
+ mock.patch(patch, data) for patch, data in
+ self.patches.items()
+ ]
+ for patch in self.applied_patches:
+ patch.start()
+ self.addCleanup(mock.patch.stopall)
diff --git a/tests/test_utils/mock_functions.py b/tests/test_utils/mock_functions.py
new file mode 100644
index 0000000..59fb0c7
--- /dev/null
+++ b/tests/test_utils/mock_functions.py
@@ -0,0 +1,31 @@
+"""
+Copyright 2020 The Magma Authors.
+
+This source code is licensed under the BSD-style license found in the
+LICENSE file in the root directory of this source tree.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from typing import Any
+
+GET_IP_FROM_IF_PATH = \
+ 'magma.enodebd.device_config.configuration_init.get_ip_from_if'
+
+LOAD_SERVICE_MCONFIG_PATH = \
+ 'magma.enodebd.device_config.configuration_init.load_service_mconfig_as_json'
+
+
+def mock_get_ip_from_if(
+ _iface_name: str,
+ _preference: Any = None,
+) -> str:
+ return '192.168.60.142'
+
+
+def mock_load_service_mconfig_as_json(_service_name: str) -> Any:
+ return {}
diff --git a/tests/test_utils/spyne_builder.py b/tests/test_utils/spyne_builder.py
new file mode 100644
index 0000000..0717aad
--- /dev/null
+++ b/tests/test_utils/spyne_builder.py
@@ -0,0 +1,26 @@
+"""
+Copyright 2020 The Magma Authors.
+
+This source code is licensed under the BSD-style license found in the
+LICENSE file in the root directory of this source tree.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from unittest import mock
+
+from spyne.server.wsgi import WsgiMethodContext
+
+
+def get_spyne_context_with_ip(
+ req_ip: str = "192.168.60.145",
+) -> WsgiMethodContext:
+ with mock.patch('spyne.server.wsgi.WsgiApplication') as MockTransport:
+ MockTransport.req_env = {"REMOTE_ADDR": req_ip}
+ with mock.patch('spyne.server.wsgi.WsgiMethodContext') as MockContext:
+ MockContext.transport = MockTransport
+ return MockContext
diff --git a/tests/test_utils/tr069_msg_builder.py b/tests/test_utils/tr069_msg_builder.py
new file mode 100644
index 0000000..3dc0f64
--- /dev/null
+++ b/tests/test_utils/tr069_msg_builder.py
@@ -0,0 +1,1000 @@
+"""
+Copyright 2020 The Magma Authors.
+
+This source code is licensed under the BSD-style license found in the
+LICENSE file in the root directory of this source tree.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from typing import Any, List, Optional
+
+from tr069 import models
+
+
+class Tr069MessageBuilder:
+ @classmethod
+ def get_parameter_value_struct(
+ cls,
+ name: str,
+ val_type: str,
+ data: Any,
+ ) -> models.ParameterValueStruct:
+ param_value = models.ParameterValueStruct()
+ param_value.Name = name
+ value = models.anySimpleType()
+ value.type = val_type
+ value.Data = data
+ param_value.Value = value
+ return param_value
+
+ @classmethod
+ def get_fault(cls) -> models.Fault:
+ msg = models.Fault()
+ msg.FaultCode = 0
+ msg.FaultString = 'Some sort of fault'
+ return msg
+
+ @classmethod
+ def get_reboot_inform(cls) -> models.Inform:
+ msg = cls.get_inform()
+ events = []
+
+ event_boot = models.EventStruct()
+ event_boot.EventCode = '1 BOOT'
+ events.append(event_boot)
+
+ event_reboot = models.EventStruct()
+ event_reboot.EventCode = 'M Reboot'
+ events.append(event_reboot)
+
+ msg.Event.EventStruct = events
+ return msg
+
+ @classmethod
+ def get_qafb_inform(
+ cls,
+ oui: str = '48BF74',
+ sw_version: str = 'BaiBS_QAFB_1.6.4',
+ enb_serial: str = '1202000181186TB0006',
+ event_codes: Optional[List[str]] = None,
+ ) -> models.Inform:
+ if event_codes is None:
+ event_codes = []
+ msg = models.Inform()
+
+ # DeviceId
+ device_id = models.DeviceIdStruct()
+ device_id.Manufacturer = 'Unused'
+ device_id.OUI = oui
+ device_id.ProductClass = 'Unused'
+ device_id.SerialNumber = enb_serial
+ msg.DeviceId = device_id
+
+ # Event
+ msg.Event = models.EventList()
+ event_list = []
+ for code in event_codes:
+ event = models.EventStruct()
+ event.EventCode = code
+ event.CommandKey = ''
+ event_list.append(event)
+ msg.Event.EventStruct = event_list
+
+ # ParameterList
+ val_list = []
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.DeviceInfo.HardwareVersion',
+ val_type='string',
+ data='VER.C',
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.DeviceInfo.ManufacturerOUI',
+ val_type='string',
+ data=oui,
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.DeviceInfo.SoftwareVersion',
+ val_type='string',
+ data=sw_version,
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.DeviceInfo.SerialNumber',
+ val_type='string',
+ data=enb_serial,
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.ManagementServer.ConnectionRequestURL',
+ val_type='string',
+ data='http://192.168.60.248:7547/25dbc91d31276f0cb03391160531ecae',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = val_list
+
+ return msg
+
+ pass
+
+ @classmethod
+ def get_inform(
+ cls,
+ oui: str = '48BF74',
+ sw_version: str = 'BaiBS_RTS_3.1.6',
+ enb_serial: str = '120200002618AGP0003',
+ event_codes: Optional[List[str]] = None,
+ ) -> models.Inform:
+ if event_codes is None:
+ event_codes = []
+ msg = models.Inform()
+
+ # DeviceId
+ device_id = models.DeviceIdStruct()
+ device_id.Manufacturer = 'Unused'
+ device_id.OUI = oui
+ device_id.ProductClass = 'Unused'
+ device_id.SerialNumber = enb_serial
+ msg.DeviceId = device_id
+
+ # Event
+ msg.Event = models.EventList()
+ event_list = []
+ for code in event_codes:
+ event = models.EventStruct()
+ event.EventCode = code
+ event.CommandKey = ''
+ event_list.append(event)
+ msg.Event.EventStruct = event_list
+
+ # ParameterList
+ val_list = []
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.HardwareVersion',
+ val_type='string',
+ data='VER.C',
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.ManufacturerOUI',
+ val_type='string',
+ data=oui,
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.SoftwareVersion',
+ val_type='string',
+ data=sw_version,
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.SerialNumber',
+ val_type='string',
+ data=enb_serial,
+ ),
+ )
+ val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.ManagementServer.ConnectionRequestURL',
+ val_type='string',
+ data='http://192.168.60.248:7547/25dbc91d31276f0cb03391160531ecae',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = val_list
+
+ return msg
+
+ @classmethod
+ def get_qafb_read_only_param_values_response(
+ cls,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.1.LTE.X_QUALCOMM_FAPControl.OpState',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.1.LTE.X_QUALCOMM_FAPControl.OpState',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.1.LTE.X_QUALCOMM_FAPControl.OpState',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.FAP.GPS.latitude',
+ val_type='int',
+ data='0',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.FAP.GPS.longitude',
+ val_type='int',
+ data='0',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_read_only_param_values_response(
+ cls,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.OpState',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.RFTxStatus',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.X_BAICELLS_COM_GPS_Status',
+ val_type='boolean',
+ data='0',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.X_BAICELLS_COM_1588_Status',
+ val_type='boolean',
+ data='0',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.X_BAICELLS_COM_MME_Status',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.FAP.GPS.LockedLatitude',
+ val_type='int',
+ data='0',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.FAP.GPS.LockedLongitude',
+ val_type='int',
+ data='0',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_cavium_param_values_response(
+ cls,
+ admin_state: bool = False,
+ earfcndl: int = 2405,
+ num_plmns: int = 0,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.DLBandwidth',
+ val_type='string',
+ data='20',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.FreqBandIndicator',
+ val_type='string',
+ data='5',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.ManagementServer.PeriodicInformInterval',
+ val_type='int',
+ data='5',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.CellRestriction.CellReservedForOperatorUse',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.ULBandwidth',
+ val_type='string',
+ data='n100',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.Common.CellIdentity',
+ val_type='int',
+ data='138777000',
+ ),
+ )
+ # MME IP
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.Gateway.S1SigLinkServerList',
+ val_type='string',
+ data='"192.168.60.142"',
+ ),
+ )
+ # perf mgmt enable
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.PerfMgmt.Config.1.Enable',
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.CellRestriction.CellBarred',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.PerfMgmt.Config.1.PeriodicUploadInterval',
+ val_type='int',
+ data='600',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.AdminState',
+ val_type='boolean',
+ data=admin_state,
+ ),
+ )
+ # Perf mgmt upload url
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.PerfMgmt.Config.1.URL',
+ val_type='string',
+ data='http://192.168.60.142:8081/',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.TAC',
+ val_type='int',
+ data='1',
+ ),
+ )
+ # PCI
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.PhyCellID',
+ val_type='int',
+ data='260',
+ ),
+ )
+ # MME port
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.Gateway.S1SigLinkPort',
+ val_type='int',
+ data='36412',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.IPsec.Enable',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.EARFCNDL',
+ val_type='int',
+ data='2405',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.EARFCNUL',
+ val_type='int',
+ data='20405',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.Capabilities.LTE.DuplexMode',
+ val_type='string',
+ data='FDDMode',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.Capabilities.LTE.BandsSupported',
+ val_type='string',
+ data='5',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.ManagementServer.PeriodicInformEnable',
+ val_type='int',
+ data='5',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNListNumberOfEntries',
+ val_type='int',
+ data=str(num_plmns),
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_regular_param_values_response(
+ cls,
+ admin_state: bool = False,
+ earfcndl: int = 39250,
+ exclude_num_plmns: bool = False,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.DLBandwidth',
+ val_type='string',
+ data='n100',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.FreqBandIndicator',
+ val_type='string',
+ data='40',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.ManagementServer.PeriodicInformInterval',
+ val_type='int',
+ data='5',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.CellRestriction.CellReservedForOperatorUse',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.ULBandwidth',
+ val_type='string',
+ data='20',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.X_BAICELLS_COM_LTE.EARFCNDLInUse',
+ val_type='string',
+ data=earfcndl,
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.PHY.TDDFrame.SpecialSubframePatterns',
+ val_type='int',
+ data='7',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.Common.CellIdentity',
+ val_type='int',
+ data='138777000',
+ ),
+ )
+ # MME IP
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.Gateway.S1SigLinkServerList',
+ val_type='string',
+ data='"192.168.60.142"',
+ ),
+ )
+ if not exclude_num_plmns:
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNListNumberOfEntries',
+ val_type='int',
+ data='1',
+ ),
+ )
+ # perf mgmt enable
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.FAP.PerfMgmt.Config.1.Enable',
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.CellRestriction.CellBarred',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.FAP.PerfMgmt.Config.1.PeriodicUploadInterval',
+ val_type='int',
+ data='300',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.AdminState',
+ val_type='boolean',
+ data=admin_state,
+ ),
+ )
+ # Local gateway enable
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.DeviceInfo.X_BAICELLS_COM_LTE_LGW_Switch',
+ val_type='boolean',
+ data='0',
+ ),
+ )
+ # Perf mgmt upload url
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.FAP.PerfMgmt.Config.1.URL',
+ val_type='string',
+ data='http://192.168.60.142:8081/',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.TAC',
+ val_type='int',
+ data='1',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.Gateway.X_BAICELLS_COM_MmePool.Enable',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.PHY.TDDFrame.SubFrameAssignment',
+ val_type='int',
+ data='2',
+ ),
+ )
+ # PCI
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.RAN.RF.PhyCellID',
+ val_type='int',
+ data='260',
+ ),
+ )
+ # MME port
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.FAPControl.LTE.Gateway.S1SigLinkPort',
+ val_type='int',
+ data='36412',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.Ipsec.IPSEC_ENABLE',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.X_BAICELLS_COM_LTE.EARFCNULInUse',
+ val_type='int',
+ data='39150',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.Capabilities.LTE.DuplexMode',
+ val_type='string',
+ data='TDDMode',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.Capabilities.LTE.BandsSupported',
+ val_type='string',
+ data='40',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.ManagementServer.PeriodicInformEnable',
+ val_type='int',
+ data='5',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_qafb_regular_param_values_response(
+ cls,
+ admin_state: bool = False,
+ earfcndl: int = 39250,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.RF.DLBandwidth',
+ val_type='string',
+ data='20',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.RF.FreqBandIndicator',
+ val_type='string',
+ data='40',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.ManagementServer.PeriodicInformInterval',
+ val_type='int',
+ data='5',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.CellRestriction.CellReservedForOperatorUse',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.RF.ULBandwidth',
+ val_type='string',
+ data='20',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.RF.ULBandwidth',
+ val_type='int',
+ data='1',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.X_BAICELLS_COM_LTE.EARFCNDLInUse',
+ val_type='string',
+ data=earfcndl,
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.PHY.TDDFrame.SpecialSubframePatterns',
+ val_type='int',
+ data='7',
+ ),
+ )
+ # MME IP
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.FAPControl.LTE.Gateway.S1SigLinkServerList',
+ val_type='string',
+ data='"192.168.60.142"',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.EPC.PLMNListNumberOfEntries',
+ val_type='int',
+ data='1',
+ ),
+ )
+ # perf mgmt enable
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.FAP.PerfMgmt.Config.1.Enable',
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.CellRestriction.CellBarred',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.FAP.PerfMgmt.Config.1.PeriodicUploadInterval',
+ val_type='int',
+ data='300',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.FAPControl.LTE.AdminState',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ # Local gateway enable
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.DeviceInfo.X_BAICELLS_COM_LTE_LGW_Switch',
+ val_type='boolean',
+ data='0',
+ ),
+ )
+ # Perf mgmt upload url
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.FAP.PerfMgmt.Config.1.URL',
+ val_type='string',
+ data='http://192.168.60.142:8081/',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.EPC.TAC',
+ val_type='int',
+ data='1',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.FAPControl.LTE.Gateway.X_BAICELLS_COM_MmePool.Enable',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.PHY.TDDFrame.SubFrameAssignment',
+ val_type='int',
+ data='2',
+ ),
+ )
+ # PCI
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.RAN.RF.PhyCellID',
+ val_type='int',
+ data='260',
+ ),
+ )
+ # MME port
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.FAPControl.LTE.Gateway.S1SigLinkPort',
+ val_type='int',
+ data='36412',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='boardconf.ipsec.ipsecConfig.onBoot',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.X_BAICELLS_COM_LTE.EARFCNULInUse',
+ val_type='int',
+ data='9212',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='boardconf.status.eepromInfo.div_multiple',
+ val_type='string',
+ data='02',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='boardconf.status.eepromInfo.work_mode',
+ val_type='string',
+ data='1C000400',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.ManagementServer.PeriodicInformEnable',
+ val_type='int',
+ data='5',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_cavium_object_param_values_response(
+ cls,
+ num_plmns: int,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ for i in range(1, num_plmns + 1):
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.%d.IsPrimary' % i,
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.%d.CellReservedForOperatorUse' % i,
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.%d.PLMNID' % i,
+ val_type='string',
+ data='00101',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.%d.Enable' % i,
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_object_param_values_response(
+ cls,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.IsPrimary',
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.CellReservedForOperatorUse',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.PLMNID',
+ val_type='string',
+ data='00101',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='Device.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.Enable',
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_qafb_object_param_values_response(
+ cls,
+ ) -> models.GetParameterValuesResponse:
+ msg = models.GetParameterValuesResponse()
+ param_val_list = []
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.IsPrimary',
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.CellReservedForOperatorUse',
+ val_type='boolean',
+ data='false',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.PLMNID',
+ val_type='string',
+ data='00101',
+ ),
+ )
+ param_val_list.append(
+ cls.get_parameter_value_struct(
+ name='InternetGatewayDevice.Services.FAPService.1.CellConfig.LTE.EPC.PLMNList.1.Enable',
+ val_type='boolean',
+ data='true',
+ ),
+ )
+ msg.ParameterList = models.ParameterValueList()
+ msg.ParameterList.ParameterValueStruct = param_val_list
+ return msg
+
+ @classmethod
+ def get_reboot_response(cls) -> models.RebootResponse:
+ return models.RebootResponse()