2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2018 Nokia. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.onap.vid.mso;
23 import io.joshworks.restclient.http.HttpResponse;
24 import io.joshworks.restclient.http.mapper.ObjectMapper;
25 import lombok.SneakyThrows;
26 import org.onap.vid.aai.util.CustomJacksonJaxBJsonProvider;
27 import org.onap.vid.changeManagement.RequestDetailsWrapper;
28 import org.onap.vid.mso.rest.RequestDetails;
31 * Created by pickjonathan on 21/06/2017.
33 public interface MsoInterface {
36 * This function will post MSO service with information about how to instantiate the requested service
37 * @param requestDetails The details about the service as they come from the web.
38 * @return MsoResponseWrapper containing information about the service instantiation
39 * --> success : see JSON at resources folder mso_create_instance_response.
40 * --> failure : would return 200 with failure data.
43 MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint);
45 //For VoLTE E2E services
46 MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint);
47 MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String endpoint);
50 * will create a virtual network function using MSO service.
51 * @param requestDetails - information about the vnf to create
52 * @return - the response body recived from MSO
55 MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint);
57 MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint);
60 * @param requestDetails
65 MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String path);
69 * @param requestDetails
73 MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint);
75 MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String endpoint);
77 MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint);
79 MsoResponseWrapper unassignSvcInstance(RequestDetails requestDetails, String endpoint);
81 MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint);
83 MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint);
85 MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint);
87 MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint);
89 MsoResponseWrapper getOrchestrationRequest(String endpoint);
91 MsoResponseWrapper getOrchestrationRequestsForDashboard(String t , String sourceId , String endpoint , RestObject restObject);
93 MsoResponseWrapper getManualTasksByRequestId(String t , String sourceId , String endpoint , RestObject restObject);
95 MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject);
97 MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint);
99 MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint);
101 MsoResponseWrapper deleteConfiguration(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmc_endpoint);
103 MsoResponseWrapper setConfigurationActiveStatus(RequestDetails requestDetails, String endpoint);
105 MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails requestDetails, String endpoint);
107 void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject);
109 MsoResponseWrapperInterface changeManagementUpdate(RequestDetailsWrapper requestDetails, String endpoint);
111 MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String endpoint);
113 MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath);
115 <T> HttpResponse<T> get(String path, Class<T> responseClass);
117 <T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper,
118 Class<T> responseClass);
120 static ObjectMapper objectMapper() {
121 return new ObjectMapper() {
122 CustomJacksonJaxBJsonProvider mapper = new CustomJacksonJaxBJsonProvider();
126 public <T> T readValue(String s, Class<T> aClass) {
127 return mapper.getMapper().readValue(s, aClass);
132 public String writeValue(Object o) {
133 return mapper.getMapper().writeValueAsString(o);