3 # ============LICENSE_START=======================================================
4 # ORAN SMO PACKAGE - PYTHONSDK TESTS
5 # ================================================================================
6 # Copyright (C) 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 """Onap MSB module."""
25 from onapsdk.configuration import settings
26 from onapsdk.onap_service import OnapService
27 from onapsdk.utils.headers_creator import headers_msb_creator
29 class OranMsb(OnapService):
32 base_url = f"{settings.MSB_URL}/api/msdiscover/v1/services"
33 headers = headers_msb_creator(OnapService.headers)
35 def get_services(self) -> dict:
37 Get MSB instance services.
40 the list of instance services
43 status = self.send_message_json('GET',
49 def create_service(self, service_data) -> None:
51 Create an instance service.
54 service_data: the service to be created
57 self.send_message('POST', 'Create Instance Service', self.base_url, data=service_data, headers=self.headers)
59 def delete_service(self, service_name, version) -> None:
61 Delete an instance service.
64 service_name: the service to be deleted
67 url = f"{self.base_url}/{service_name}/version/{version}?namespace="
68 self.send_message('DELETE', 'Delete Instance Service', url, headers=self.headers)