2 # -*- coding: utf-8 -*-
3 # SPDX-License-Identifier: Apache-2.0
4 """Oran Enrichment Service module."""
6 from oransdk.configuration import settings
7 from onapsdk.onap_service import OnapService
9 class EnrichmentService(OnapService):
10 """Enrichment Service library."""
12 base_url = settings.EMS_URL
13 header = {"Content-Type": "application/json"}
16 def check_status(cls) -> str:
18 Get the status of the EnrichmentService component.
21 the status of the EnrichmentService component
24 url = f"{cls.base_url}/status"
25 status = cls.send_message('GET',
31 def get_eitypes(cls) -> str:
39 url = f"{cls.base_url}/data-producer/v1/info-types"
40 eitypes = cls.send_message('GET',
41 'Get all the EiTypes',
47 def get_eitype_individual(cls, eitype_name) -> str:
49 Get individual EiType.
52 eitype_name: the EiType name
55 the details of the EiType
58 url = f"{cls.base_url}/data-producer/v1/info-types/{eitype_name}"
59 eitype = cls.send_message('GET',
60 'Get individual EiType',
66 def get_eiproducers(cls) -> str:
68 Get all the EiProducers.
71 the list of EiProducers
74 url = f"{cls.base_url}/data-producer/v1/info-producers"
75 eitypes = cls.send_message('GET',
76 'Get all the EiProducers',
82 def get_eiproducer_individual(cls, producer) -> str:
84 Get individual EiProducer.
87 type: the EiProducer name
90 the details of the EiProducer
93 url = f"{cls.base_url}/data-producer/v1/info-producers/{producer}"
94 eiproducer = cls.send_message('GET',
95 'Get individual EiProducer',
101 def get_eiproducer_status(cls, producer) -> str:
103 Get the status of EiProducer.
106 type: the EiProducer name
109 the status of the EiProducer
112 url = f"{cls.base_url}/data-producer/v1/info-producers/{producer}/status"
113 status = cls.send_message('GET',
114 'Get the status of EiProducer',
120 def get_eijobs(cls) -> str:
128 url = f"{cls.base_url}/A1-EI/v1/eijobs"
129 eijobs = cls.send_message('GET',
130 'Get all the EiJobs',
136 def get_eijob_individual(cls, job) -> str:
138 Get individual EiJob.
144 the details of the EiJob
147 url = f"{cls.base_url}/A1-EI/v1/eijobs/{job}"
148 eijob = cls.send_message('GET',
149 'Get individual EiJob',
155 def create_eitype(cls,
162 type: the EiType name
163 type_data: the EiType data to create, in binary format
166 url = f"{cls.base_url}/data-producer/v1/info-types/{type_name}"
167 cls.send_message('PUT',
174 def create_eiproducer(cls,
176 producer_data) -> None:
181 producer: the EiProducer name
182 producer_data: the EiProducer data to create, in binary format
185 url = f"{cls.base_url}/data-producer/v1/info-producers/{producer}"
186 cls.send_message('PUT',
193 def create_eijob(cls,
201 job_data: the EiJob data to create, in binary format
204 url = f"{cls.base_url}/A1-EI/v1/eijobs/{job}"
205 cls.send_message('PUT',