Fix/add use cases under SMO package
[it/dep.git] / smo-install / test / pythonsdk / src / orantests / network_slicing / preparation / aai_preparation.py
1 #!/usr/bin/env python3
2 ###
3 # ============LICENSE_START===================================================
4 # ORAN SMO PACKAGE - PYTHONSDK TESTS
5 # ================================================================================
6 #  Copyright (C) 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 #
21 # SPDX-License-Identifier: Apache-2.0
22 # ============LICENSE_END=====================================================
23 #
24 ###
25 """Configure AAI for Network Slicing option2 test."""
26 import logging
27 import logging.config
28
29 from onapsdk.aai.business.customer import Customer
30 from onapsdk.configuration import settings
31
32 logging.config.dictConfig(settings.LOG_CONFIG)
33 logger = logging.getLogger("####################### Start AAI Preparation")
34
35 class AaiPreparation():
36     """Can be used to prepare AAI for Network Slicing usecase option2."""
37
38     @classmethod
39     def prepare_aai(cls):
40         """Prepare AAI for network slicing use case."""
41         logger.info("####################### Start to prepare AAI")
42         aai = Customer("5GCustomer", "5GCustomer", "INFRA")
43         aai.create("5GCustomer", "5GCustomer", "INFRA")
44         aai.subscribe_service("5G")
45
46     @classmethod
47     def cleanup_aai(cls):
48         """Clean up AAI settings."""
49         logger.info("####################### Start to clean up AAI settings")
50         aai = Customer.get_by_global_customer_id("5GCustomer")
51         aai.delete()