Add odu tests and enable k8s oru test
[it/dep.git] / smo-install / test / pythonsdk / src / orantests / smo / smo.py
1 #!/usr/bin/env python3
2 ###
3 # ============LICENSE_START=======================================================
4 # ORAN SMO PACKAGE - PYTHONSDK TESTS
5 # ================================================================================
6 # Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
7 #                             reserved.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 # http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END============================================
21 # ===================================================================
22 #
23 ###
24
25 """Smo NonRtric module."""
26 import logging
27 import logging.config
28 from onapsdk.configuration import settings
29 from waiting import wait
30 from smo.onap import Onap
31 from smo.nonrtric import NonRTRic
32
33 logging.config.dictConfig(settings.LOG_CONFIG)
34 logger = logging.getLogger("Smo k8s")
35
36 class Smo():
37     """Check SMo nonrtric k8s deployment."""
38
39     onap = Onap()
40     non_rt_ric = NonRTRic()
41
42     @classmethod
43     def wait_for_smo_to_be_running(cls):
44         """Check and wait for the SMo to be running."""
45         wait(lambda: cls.onap.is_onap_up() and cls.non_rt_ric.is_nonrtric_up(), sleep_seconds=settings.SMO_CHECK_RETRY, timeout_seconds=settings.SMO_CHECK_TIMEOUT, waiting_for="SMO to be ready")