Loading src/tests/ofc22/tests/test_functional_bootstrap.py +23 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ import logging, time from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, Empty from common.proto.context_pb2 import ContextId, DeviceOperationalStatusEnum, Empty from common.proto.monitoring_pb2 import KpiDescriptorList from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario from common.tools.object_factory.Context import json_context_id Loading Loading @@ -46,6 +46,27 @@ def test_scenario_bootstrap( assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 def test_scenario_devices_enabled( context_client : ContextClient, # pylint: disable=redefined-outer-name ) -> None: """ This test validates that the devices are enabled. """ DEVICE_OP_STATUS_ENABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED num_devices = -1 num_devices_enabled, num_retry = 0, 0 while (num_devices != num_devices_enabled) and (num_retry < 10): time.sleep(1.0) response = context_client.ListDevices(Empty()) num_devices = len(response.devices) num_devices_enabled = 0 for device in response.devices: if device.device_operational_status != DEVICE_OP_STATUS_ENABLED: continue num_devices_enabled += 1 LOGGER.info('Num Devices enabled: {:d}/{:d}'.format(num_devices_enabled, num_devices)) num_retry += 1 assert num_devices_enabled == num_devices def test_scenario_kpis_created( context_client : ContextClient, # pylint: disable=redefined-outer-name Loading @@ -67,7 +88,7 @@ def test_scenario_kpis_created( LOGGER.info('Num KPIs expected: {:d}'.format(num_kpis_expected)) num_kpis_created, num_retry = 0, 0 while (num_kpis_created != num_kpis_expected) and (num_retry < 5): while (num_kpis_created != num_kpis_expected) and (num_retry < 10): response: KpiDescriptorList = monitoring_client.GetKpiDescriptorList(Empty()) num_kpis_created = len(response.kpi_descriptor_list) LOGGER.info('Num KPIs created: {:d}'.format(num_kpis_created)) Loading Loading
src/tests/ofc22/tests/test_functional_bootstrap.py +23 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ import logging, time from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, Empty from common.proto.context_pb2 import ContextId, DeviceOperationalStatusEnum, Empty from common.proto.monitoring_pb2 import KpiDescriptorList from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario from common.tools.object_factory.Context import json_context_id Loading Loading @@ -46,6 +46,27 @@ def test_scenario_bootstrap( assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 def test_scenario_devices_enabled( context_client : ContextClient, # pylint: disable=redefined-outer-name ) -> None: """ This test validates that the devices are enabled. """ DEVICE_OP_STATUS_ENABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED num_devices = -1 num_devices_enabled, num_retry = 0, 0 while (num_devices != num_devices_enabled) and (num_retry < 10): time.sleep(1.0) response = context_client.ListDevices(Empty()) num_devices = len(response.devices) num_devices_enabled = 0 for device in response.devices: if device.device_operational_status != DEVICE_OP_STATUS_ENABLED: continue num_devices_enabled += 1 LOGGER.info('Num Devices enabled: {:d}/{:d}'.format(num_devices_enabled, num_devices)) num_retry += 1 assert num_devices_enabled == num_devices def test_scenario_kpis_created( context_client : ContextClient, # pylint: disable=redefined-outer-name Loading @@ -67,7 +88,7 @@ def test_scenario_kpis_created( LOGGER.info('Num KPIs expected: {:d}'.format(num_kpis_expected)) num_kpis_created, num_retry = 0, 0 while (num_kpis_created != num_kpis_expected) and (num_retry < 5): while (num_kpis_created != num_kpis_expected) and (num_retry < 10): response: KpiDescriptorList = monitoring_client.GetKpiDescriptorList(Empty()) num_kpis_created = len(response.kpi_descriptor_list) LOGGER.info('Num KPIs created: {:d}'.format(num_kpis_created)) Loading