Fix/add use cases under SMO package
[it/dep.git] / smo-install / test / pythonsdk / src / oransdk / aai / service_design_and_creation.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 # ============LICENSE_END============================================
21 # ===================================================================
22 #
23 ###
24 """Onap AAI model module."""
25 from onapsdk.aai.service_design_and_creation import Model
26 from oransdk.utils.jinja import jinja_env
27
28 class AaiModel(Model):
29     """Model resource class."""
30
31     def create(self,
32                model_name: str,
33                model_version_id: str,
34                invariant_id: str) -> None:
35         """Create Model.
36
37         Args:
38             model_name (str): model name
39             model_version_id (str): model version id
40
41         """
42         self.send_message(
43             "PUT",
44             "Create A&AI service",
45             f"{self.base_url}{self.api_version}/service-design-and-creation/"
46             f"models/model/{invariant_id}",
47             data=jinja_env().get_template("aai_model_create.json.j2")
48             .render(
49                 model_version=self.resource_version,
50                 model_name=model_name,
51                 version_id=model_version_id,
52                 model_invariant_id=invariant_id
53             )
54         )