X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=it%2Fdep.git;a=blobdiff_plain;f=smo-install%2Ftest%2Fpythonsdk%2Fsrc%2Forantests%2Fnetwork_slicing%2Fconftest.py;fp=smo-install%2Ftest%2Fpythonsdk%2Fsrc%2Forantests%2Fnetwork_slicing%2Fconftest.py;h=c580f56e0a749c872b1af40a658bb2f0a0e87d7c;hp=0000000000000000000000000000000000000000;hb=a54a96ba117b4b30c8f88e88f973ea18ddd8687c;hpb=bc6231f7d4d44ab5f269683c42eb90c2ce4ec9a6 diff --git a/smo-install/test/pythonsdk/src/orantests/network_slicing/conftest.py b/smo-install/test/pythonsdk/src/orantests/network_slicing/conftest.py new file mode 100644 index 00000000..c580f56e --- /dev/null +++ b/smo-install/test/pythonsdk/src/orantests/network_slicing/conftest.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +### +# ============LICENSE_START======================================================= +# ORAN SMO PACKAGE - PYTHONSDK TESTS +# ================================================================================ +# Copyright (C) 2022 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. +# ============LICENSE_END============================================ +# =================================================================== +# +### +"""Module called by pytest.""" +import logging +import logging.config +from onapsdk.configuration import settings +from waiting import wait +from preparation.ns_simulators import NsSimulators +from oransdk.utils.healthcheck import HealthCheck + +logging.config.dictConfig(settings.LOG_CONFIG) +logger = logging.getLogger("Test Session setup") + +ns_sims = NsSimulators() + +###### Entry points of PYTEST Session +def pytest_sessionstart(): + """Pytest calls it when starting a test session.""" + logger.info("Check and wait for SMO to be running") + wait(lambda: HealthCheck.is_onap_up(18), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="SMO to be ready") + logger.info("Check and wait for for Policy to be running") + wait(lambda: HealthCheck.policy_component_ready(), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="Policy to be ready") + logger.info("Check and wait for for SDNC to be running") + wait(lambda: HealthCheck.sdnc_component_ready(), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="SDNC to be ready") + logger.info("Check and wait for for SDC to be running") + wait(lambda: HealthCheck.sdc_component_ready(), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="SDC to be ready") + logger.info("Check and wait for for AAI to be running") + wait(lambda: HealthCheck.aai_component_ready(), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="AAI to be ready") + logger.info("Check and wait for for SO to be running") + wait(lambda: HealthCheck.so_component_ready(), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="SO to be ready") + logger.info("Check and wait for for MSB to be running") + wait(lambda: HealthCheck.msb_component_ready(), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="MSB to be ready") + logger.info("Check and wait for for OOF to be running") + wait(lambda: HealthCheck.oof_component_ready(), sleep_seconds=settings.DEFAULT_CHECK_RETRY, timeout_seconds=settings.DEFAULT_CHECK_TIMEOUT, waiting_for="OOF to be ready") + + ## Just kill any simulators that could already be running + ns_sims.stop_and_wait_ns_simulators() + + ###### END of FIRST start, now we can start the sims for the real tests. + logger.info("Tests session setup is ready")