3 # ============LICENSE_START=======================================================
4 # ORAN SMO PACKAGE - PYTHONSDK TESTS
5 # ================================================================================
6 # Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
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
13 # http://www.apache.org/licenses/LICENSE-2.0
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 # ===================================================================
24 """Oran Enrichment Service module."""
26 from onapsdk.onap_service import OnapService
27 from oransdk.configuration import settings
29 class EnrichmentService(OnapService):
30 """Enrichment Service library."""
32 base_url = settings.EMS_URL
33 header = {"Content-Type": "application/json"}
36 def check_status(cls) -> str:
38 Get the status of the EnrichmentService component.
41 the status of the EnrichmentService component
44 url = f"{cls.base_url}/status"
45 status = cls.send_message('GET',
51 def get_eitypes(cls) -> str:
59 url = f"{cls.base_url}/data-producer/v1/info-types"
60 eitypes = cls.send_message('GET',
61 'Get all the EiTypes',
67 def get_eitype_individual(cls, eitype_name) -> str:
69 Get individual EiType.
72 eitype_name: the EiType name
75 the details of the EiType
78 url = f"{cls.base_url}/data-producer/v1/info-types/{eitype_name}"
79 eitype = cls.send_message('GET',
80 'Get individual EiType',
86 def get_eiproducers(cls) -> str:
88 Get all the EiProducers.
91 the list of EiProducers
94 url = f"{cls.base_url}/data-producer/v1/info-producers"
95 eitypes = cls.send_message('GET',
96 'Get all the EiProducers',
102 def get_eiproducer_individual(cls, producer) -> str:
104 Get individual EiProducer.
107 type: the EiProducer name
110 the details of the EiProducer
113 url = f"{cls.base_url}/data-producer/v1/info-producers/{producer}"
114 eiproducer = cls.send_message('GET',
115 'Get individual EiProducer',
121 def get_eiproducer_status(cls, producer) -> str:
123 Get the status of EiProducer.
126 type: the EiProducer name
129 the status of the EiProducer
132 url = f"{cls.base_url}/data-producer/v1/info-producers/{producer}/status"
133 status = cls.send_message('GET',
134 'Get the status of EiProducer',
140 def get_eijobs(cls) -> str:
148 url = f"{cls.base_url}/A1-EI/v1/eijobs"
149 eijobs = cls.send_message('GET',
150 'Get all the EiJobs',
156 def get_eijob_individual(cls, job) -> str:
158 Get individual EiJob.
164 the details of the EiJob
167 url = f"{cls.base_url}/A1-EI/v1/eijobs/{job}"
168 eijob = cls.send_message('GET',
169 'Get individual EiJob',
175 def create_eitype(cls,
182 type: the EiType name
183 type_data: the EiType data to create, in binary format
186 url = f"{cls.base_url}/data-producer/v1/info-types/{type_name}"
187 cls.send_message('PUT',
194 def create_eiproducer(cls,
196 producer_data) -> None:
201 producer: the EiProducer name
202 producer_data: the EiProducer data to create, in binary format
205 url = f"{cls.base_url}/data-producer/v1/info-producers/{producer}"
206 cls.send_message('PUT',
213 def create_eijob(cls,
221 job_data: the EiJob data to create, in binary format
224 url = f"{cls.base_url}/A1-EI/v1/eijobs/{job}"
225 cls.send_message('PUT',