diff options
Diffstat (limited to 'vid-app-common/src/main/java/org/openecomp/vid/mso')
27 files changed, 0 insertions, 3706 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoBusinessLogic.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoBusinessLogic.java deleted file mode 100644 index f6847e45..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoBusinessLogic.java +++ /dev/null @@ -1,416 +0,0 @@ -package org.openecomp.vid.mso; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.vid.controller.MsoController; -import org.openecomp.vid.mso.rest.*; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import static org.openecomp.vid.controller.MsoController.SVC_INSTANCE_ID; -import static org.openecomp.vid.controller.MsoController.REQUEST_TYPE; -import static org.openecomp.vid.controller.MsoController.VNF_INSTANCE_ID; - -/** - * Created by pickjonathan on 19/06/2017. - */ -public class MsoBusinessLogic { - - /** - * The Mso REST client - * This should be replaced with mso client factory. - */ - private MsoInterface msoClientInterface; - - /** - * The logger. - */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoController.class); - - /** - * The Constant dateFormat. - */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - public MsoBusinessLogic() { - msoClientInterface = MsoRestInterfaceFactory.getInstance(); - } - - // this function should get params from tosca and send them to instance at mso, then return success response. - public MsoResponseWrapper createSvcInstance(RequestDetails msoRequest) throws Exception { - String methodName = "createSvcInstance "; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_SVC_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - return msoClientInterface.createSvcInstance(msoRequest, endpoint); - } - - public MsoResponseWrapper createVnf(RequestDetails requestDetails, String serviceInstanceId) throws Exception { - String methodName = "createVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - return msoClientInterface.createVnf(requestDetails, vnf_endpoint); - } - - public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String serviceInstanceId) throws Exception { - String methodName = "createNwInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_NETWORK_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String nw_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - return msoClientInterface.createNwInstance(requestDetails, nw_endpoint); - } - - public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) throws Exception { - String methodName = "createVolumeGroupInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - vnf_endpoint = vnf_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId); - - return msoClientInterface.createVolumeGroupInstance(requestDetails, vnf_endpoint); - } - - public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) throws Exception{ - String methodName = "createVfModuleInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String partial_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - String vf_module_endpoint = partial_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId); - - return msoClientInterface.createVfModuleInstance(requestDetails, vf_module_endpoint); - } - - public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String serviceInstanceId) throws Exception{ - String methodName = "deleteSvcInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_SVC_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String svc_endpoint = endpoint + "/" + serviceInstanceId; - - return msoClientInterface.deleteSvcInstance(requestDetails, svc_endpoint); - } - - public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) throws Exception{ - String methodName = "deleteVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE); - } catch (Exception exception) { - throw exception; - } - String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - vnf_endpoint = vnf_endpoint + '/' + vnfInstanceId; - - return msoClientInterface.deleteVnf(requestDetails, vnf_endpoint); - } - - public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId, String vfModuleId) throws Exception{ - String methodName = "deleteVfModule"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String vf__modules_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId).replaceFirst(VNF_INSTANCE_ID, vnfInstanceId); - - String delete_vf_endpoint = vf__modules_endpoint + '/' + vfModuleId; - - return msoClientInterface.deleteVfModule(requestDetails, delete_vf_endpoint); - } - - public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId, String volumeGroupId)throws Exception{ - String methodName = "deleteVolumeGroupInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String svc_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - String vnf_endpoint = svc_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId); - String delete_volume_group_endpoint = vnf_endpoint + "/" + volumeGroupId; - - return msoClientInterface.deleteVolumeGroupInstance(requestDetails, delete_volume_group_endpoint); - } - - public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String serviceInstanceId, String networkInstanceId) throws Exception{ - String methodName = "deleteNwInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_NETWORK_INSTANCE); - } catch (Exception exception) { - throw exception; - } - - String svc_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - String delete_nw_endpoint = svc_endpoint + "/" + networkInstanceId; - - return msoClientInterface.deleteNwInstance(requestDetails, delete_nw_endpoint); - } - - public MsoResponseWrapper getOrchestrationRequest(String requestId)throws Exception{ - String methodName = "getOrchestrationRequest"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - MsoResponseWrapper w = null; - try { - String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ); - String path = p + "/" + requestId; - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - - msoClientInterface.getOrchestrationRequest(str, "", path, restObjStr); - - return MsoUtil.wrapResponse(restObjStr); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - public MsoResponseWrapper getOrchestrationRequests(String filterString)throws Exception{ - String methodName = "getOrchestrationRequest"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - MsoResponseWrapper w = null; - try { - String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS); - String path = p + filterString; - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - - msoClientInterface.getOrchestrationRequest(str, "", path, restObjStr); - - return MsoUtil.wrapResponse(restObjStr); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - public List<Request> getOrchestrationRequestsForDashboard()throws Exception{ - String methodName = "getOrchestrationRequestsForDashboard"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - String path = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS); - path += "filter=modelType:EQUALS:vnf"; - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - - MsoResponseWrapper msoResponseWrapper = msoClientInterface.getOrchestrationRequestsForDashboard(str, "", path, restObjStr); - List<RequestWrapper> allOrchestrationRequests = deserializeOrchestrationRequestsJson(msoResponseWrapper.getEntity()); - - List<Request> filteredOrchestrationRequests = new ArrayList<>(); - for (RequestWrapper currentRequest:allOrchestrationRequests){ - if ((currentRequest.getRequest() != null) && (currentRequest.getRequest().getRequestScope() == Request.RequestScope.VNF) && ((currentRequest.getRequest().getRequestType() == - Request.RequestType.REPLACE_INSTANCE)||(currentRequest.getRequest().getRequestType() == - Request.RequestType.UPDATE_INSTANCE) )) { - filteredOrchestrationRequests.add(currentRequest.getRequest()); - } - } - return filteredOrchestrationRequests; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - - } - - private List<RequestWrapper> deserializeOrchestrationRequestsJson(String orchestrationRequestsJson) throws Exception { - String methodName = "deserializeOrchestrationRequestsJson"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true); - RequestList requestList = mapper.readValue(orchestrationRequestsJson , RequestList.class); - return requestList.getRequestList(); - } - - - public List<Task> getManualTasksByRequestId(String originalRequestId)throws Exception{ - String methodName = "getManualTasksByRequestId"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_MAN_TASKS); - String path = p + "?originalRequestId=" + originalRequestId; - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - - MsoResponseWrapper msoResponseWrapper = msoClientInterface.getManualTasksByRequestId(str, "", path, restObjStr); - return deserializeManualTasksJson(msoResponseWrapper.getEntity()); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - private List<Task> deserializeManualTasksJson(String manualTasksJson) throws Exception{ - String methodName = "deserializeManualTasksJson"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - ObjectMapper mapper = new ObjectMapper(); - TaskList taskList = mapper.readValue(manualTasksJson , TaskList.class); - return taskList.getTaskList(); - } - - - public MsoResponseWrapper completeManualTask(RequestDetails requestDetails , String taskId)throws Exception{ - String methodName = "completeManualTask"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - MsoResponseWrapper w = null; - try { - String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_MAN_TASKS); - String path = p + "/" + taskId + "/complete"; - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - - msoClientInterface.completeManualTask(requestDetails , str, "", path, restObjStr); - - return MsoUtil.wrapResponse(restObjStr); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - public MsoResponseWrapper activateServiceInstance(RequestDetails requestDetails , String serviceInstanceId)throws Exception{ - String methodName = "activateServiceInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - try { - String path ="/" + serviceInstanceId + "/activate"; - - RestObject<String> restObjStr = new RestObject<>(); - String str = ""; - restObjStr.set(str); - - msoClientInterface.activateServiceInstance(requestDetails , str, "", path, restObjStr); - - return MsoUtil.wrapResponse(restObjStr); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - - - - private String validateEndpointPath(String endpointEnvVariable) throws Exception { - String endpoint = SystemProperties.getProperty(endpointEnvVariable); - if (endpoint == null || endpoint.isEmpty()) { - throw new Exception(endpointEnvVariable + " env variable is not defined"); - } - return endpoint; - } - - public MsoResponseWrapper updateVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) throws Exception { - String methodName = "updateVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE); - } catch (Exception exception) { - throw exception; - } - String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - vnf_endpoint = vnf_endpoint + '/' + vnfInstanceId; - return msoClientInterface.updateVnf(requestDetails, vnf_endpoint); - } - - public MsoResponseWrapper replaceVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) throws Exception { - String methodName = "replaceVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - String endpoint; - try { - endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE); - } catch (Exception exception) { - throw exception; - } - String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId); - vnf_endpoint = vnf_endpoint.replace(VNF_INSTANCE_ID, vnfInstanceId); - vnf_endpoint = vnf_endpoint.replace(REQUEST_TYPE, "replace"); //No Constants file, TODO: once you create - add it. - return msoClientInterface.replaceVnf(requestDetails, vnf_endpoint); - } - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoClientFactory.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoClientFactory.java deleted file mode 100644 index fb0ead44..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoClientFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.vid.mso; - -import org.openecomp.vid.mso.rest.MsoRestClientNew; - -/** - * A factory for creating MsoRestInterface objects. - */ -public class MsoClientFactory { - - /** - * MSO client factory that creates the right client according to env. - * @return - */ - public static MsoInterface getInstance() { - return new MsoRestClientNew(); - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoInterface.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoInterface.java deleted file mode 100644 index cdeb1bbd..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoInterface.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.openecomp.vid.mso; - -import org.openecomp.vid.mso.rest.Request; -import org.openecomp.vid.mso.rest.RequestDetails; -import org.openecomp.vid.mso.rest.Task; - -import java.util.List; - -/** - * Created by pickjonathan on 21/06/2017. - */ -public interface MsoInterface { - - /** - * This function will post MSO service with information about how to instantiate the requested service - * @param requestDetails The details about the service as they come from the web. - * @return MsoResponseWrapper containing information about the service instantiation - * --> success : see JSON at resources folder mso_create_instance_response. - * --> failure : would return 200 with failure data. - * @throws Exception - */ - MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception; - - /** - * will create a virtual network function using MSO service. - * @param requestDetails - information about the vnf to create - * @return - the response body recived from MSO - * @throws Exception - */ - MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) throws Exception; - - MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) throws Exception; - /** - * - * @param requestDetails - * @param path - * @return - * @throws Exception - */ - MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String path) throws Exception; - - /** - * - * @param requestDetails - * @return - * @throws Exception - */ - MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) throws Exception; - - MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception; - - MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) throws Exception; - - MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) throws Exception; - - MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) throws Exception; - - MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) throws Exception; - - void getOrchestrationRequest(String t, String sourceId, String endpoint, RestObject restObject) throws Exception; - - MsoResponseWrapper getOrchestrationRequestsForDashboard(String t , String sourceId , String endpoint , RestObject restObject) throws Exception; - - MsoResponseWrapper getManualTasksByRequestId(String t , String sourceId , String endpoint , RestObject restObject) throws Exception; - - MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) throws Exception; - - MsoResponseWrapper updateVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint) throws Exception; - - MsoResponseWrapper replaceVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint) throws Exception; - - - void activateServiceInstance(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject) throws Exception; - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoLocalClient.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoLocalClient.java deleted file mode 100644 index 0179400d..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoLocalClient.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.openecomp.vid.mso; - -import org.apache.commons.io.IOUtils; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.vid.changeManagement.ChangeManagementRequest; -import org.openecomp.vid.controller.VidController; -import org.openecomp.vid.mso.rest.RequestDetails; - -import javax.ws.rs.client.Client; -import javax.ws.rs.core.MultivaluedHashMap; -import java.io.InputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; - -/** - * Created by pickjonathan on 20/06/2017. - */ -public class MsoLocalClient implements MsoRestInterfaceIfc { - - /** - * The logger. - */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoLocalClient.class); - - /** - * The Constant dateFormat. - */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - /** - * The client. - */ - private static Client client = null; - - /** - * The common headers. - */ - private MultivaluedHashMap<String, Object> commonHeaders; - - /** - * Instantiates a new mso rest interface. - */ - public MsoLocalClient() { - super(); - } - - public void initMsoClient() { - final String methodname = "initRestClient()"; - } - - @Override - public <T> void Get(T t, String sourceId, String path, RestObject<T> restObject) throws Exception { - - } - - @Override - public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception { - - } - - @Override - public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception { - initMsoClient(); - - final InputStream asdcServicesFile = MsoLocalClient.class.getClassLoader().getResourceAsStream("mso_create_instance_response.json"); - - t = (T) IOUtils.toString(asdcServicesFile); - restObject.setStatusCode(200); - restObject.set(t); - } - - @Override - public void logRequest(RequestDetails r) { - - } - - @Override - public <T> void Put(T t, ChangeManagementRequest r, String sourceID, String path, RestObject<T> restObject) - throws Exception { - - - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoLocalClientNew.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoLocalClientNew.java deleted file mode 100644 index 1b15df72..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoLocalClientNew.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.openecomp.vid.mso; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.NotImplementedException; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.vid.mso.rest.*; - -import java.io.InputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * Created by pickjonathan on 21/06/2017. - */ -public class MsoLocalClientNew implements MsoInterface { - - - /** - * The logger. - */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoLocalClient.class); - - /** - * The Constant dateFormat. - */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - - @Override - public MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception { - - String methodName = "createSvcInstance "; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - MsoResponseWrapper w = createInstance(requestDetails, ""); - - return w; - } - - public MsoResponseWrapper createInstance(RequestDetails request, String path) throws Exception { - String methodName = "createInstance"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - RestObject<String> restObjStr = new RestObject<String>(); - - String str = new String(); - - restObjStr.set(str); - - final InputStream asdcServicesFile = MsoLocalClient.class.getClassLoader().getResourceAsStream("mso_create_instance_response.json"); - - restObjStr.setStatusCode(200); - restObjStr.set(IOUtils.toString(asdcServicesFile)); - - MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr); - - return w; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - @Override - public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String path) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) throws Exception { - return null; - } - - @Override - public void getOrchestrationRequest(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { } - - @Override - public MsoResponseWrapper getOrchestrationRequestsForDashboard(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { - String methodName = "getOrchestrationRequestsForDashboard"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - - final InputStream asdcServicesFile = MsoLocalClient.class.getClassLoader().getResourceAsStream("mso_get_orchestration_requests.json"); - - restObject.setStatusCode(200); - restObject.set(IOUtils.toString(asdcServicesFile)); - - MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); - - return w; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - public void activateServiceInstance(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject) throws Exception{ - String methodName = "activateServiceInstance"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - - final InputStream asdcServicesFile = MsoLocalClient.class.getClassLoader().getResourceAsStream("mso_activate_service_instance.json"); - - restObject.setStatusCode(200); - restObject.set(IOUtils.toString(asdcServicesFile)); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - - @Override - public MsoResponseWrapper getManualTasksByRequestId(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { - String methodName = "getManualTasksByRequestId"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - - final InputStream asdcServicesFile = MsoLocalClient.class.getClassLoader().getResourceAsStream("mso_get_manual_task_by_request_id.json"); - - restObject.setStatusCode(200); - restObject.set(IOUtils.toString(asdcServicesFile)); - - MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); - - return w; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - @Override - public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) throws Exception { - String methodName = "getManualTasksByRequestId"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - - final InputStream asdcServicesFile = MsoLocalClient.class.getClassLoader().getResourceAsStream("mso_complete_manual_task.json"); - - restObject.setStatusCode(200); - restObject.set(IOUtils.toString(asdcServicesFile)); - - MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); - - return w; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - @Override - public MsoResponseWrapper replaceVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint) throws Exception { - throw new NotImplementedException("Function was not implemented at this point."); - } - - - - @Override - public MsoResponseWrapper updateVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, - String vnf_endpoint) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoProperties.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoProperties.java deleted file mode 100755 index 0eed0e1d..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoProperties.java +++ /dev/null @@ -1,105 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-/**
- * The Class MsoProperties.
- */
-public class MsoProperties extends SystemProperties {
-
- /** The Constant MSO_SERVER_URL. */
- //VID Properties related to MSO
- public static final String MSO_SERVER_URL = "mso.server.url";
-
- /** The Constant MSO_DME2_SERVER_URL. */
- public static final String MSO_DME2_SERVER_URL = "mso.dme2.server.url";
-
- /** The Constant MSO_DME2_CLIENT_TIMEOUT. */
- public static final String MSO_DME2_CLIENT_TIMEOUT = "mso.dme2.client.timeout";
-
- /** The Constant MSO_DME2_CLIENT_READ_TIMEOUT. */
- public static final String MSO_DME2_CLIENT_READ_TIMEOUT = "mso.dme2.client.read.timeout";
-
- /** The Constant MSO_SERVER_URL_DEFAULT. */
- public static final String MSO_SERVER_URL_DEFAULT= "";
-
- /** The Constant MSO_POLLING_INTERVAL_MSECS. */
- // number of msecs to wait between polling requests
- public static final String MSO_POLLING_INTERVAL_MSECS = "mso.polling.interval.msecs";
-
- /** The Constant MSO_POLLING_INTERVAL_MSECS_DEFAULT. */
- public static final String MSO_POLLING_INTERVAL_MSECS_DEFAULT = "60000";
-
- /** The Constant MSO_DME2_ENABLED. */
- public static final String MSO_DME2_ENABLED = "mso.dme2.enabled";
-
- /** The Constant MSO_MAX_POLLS. */
- public static final String MSO_MAX_POLLS = "mso.max.polls";
-
- /** The Constant MSO_MAX_POLLS_DEFAULT. */
- public static final String MSO_MAX_POLLS_DEFAULT = "10"; //10
-
- /** The Constant MSO_USER_NAME. */
- public static final String MSO_USER_NAME = "mso.user.name"; //m03346
-
- /** The Constant MSO_PASSWORD. */
- public static final String MSO_PASSWORD = "mso.password.x";
-
- /** The Constant MSO_REST_API_SVC_INSTANCE. */
- public static final String MSO_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance"; // /serviceInstances/v2
-
- /** The Constant MSO_REST_API_VNF_INSTANCE. */
- public static final String MSO_REST_API_VNF_INSTANCE = "mso.restapi.vnf.instance"; // /serviceInstances/v2/{service_instance_id}/vnfs
-
- /** The Constant MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE. */
- public static final String MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE = "mso.restapi.vnf.changemanagement.instance"; // /serviceInstances/v2/{service_instance_id}/vnfs/{request_type}
-
- /** The Constant MSO_REST_API_NETWORK_INSTANCE. */
- public static final String MSO_REST_API_NETWORK_INSTANCE = "mso.restapi.network.instance"; // /serviceInstances/v2/{serviceInstanceId}/networks
-
- /** The Constant MSO_REST_API_GET_ORC_REQ. */
- public static final String MSO_REST_API_GET_ORC_REQ = "mso.restapi.get.orc.req";
-
- /** The Constant MSO_REST_API_GET_ORC_REQS. */
- public static final String MSO_REST_API_GET_ORC_REQS = "mso.restapi.get.orc.reqs";
-
- /** The Constant MSO_REST_API_GET_MAN_TASK. */
- public static final String MSO_REST_API_GET_MAN_TASKS = "mso.restapi.get.man.tasks";
-
- /** The Constant MSO_REST_API_VF_MODULE_INSTANCE. */
- public static final String MSO_REST_API_VF_MODULE_INSTANCE = "mso.restapi.vf.module.instance";
-
- /** The Constant MSO_REST_API_VOLUME_GROUP_INSTANCE. */
- public static final String MSO_REST_API_VOLUME_GROUP_INSTANCE = "mso.restapi.volume.group.instance"; //serviceInstances/v2/{serviceInstanceId}/volumeGroups
-
- /** The logger. */
- public EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoProperties.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java deleted file mode 100755 index d5a4a87e..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java +++ /dev/null @@ -1,107 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-/**
- * This wrapper encapsulates the MSO response in the format expected by the pages.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "status",
- "entity"
-})
-
-public class MsoResponseWrapper {
-
- /** The status. */
- @JsonProperty("status")
- private int status;
-
- /** The entity. */
- @JsonProperty("entity")
- private String entity;
-
- /**
- * Gets the entity.
- *
- * @return the entity
- */
- @JsonProperty("entity")
- public String getEntity() {
- return entity;
- }
-
- /**
- * Gets the status.
- *
- * @return the status
- */
- @JsonProperty("status")
- public int getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param v the new status
- */
- @JsonProperty("status")
- public void setStatus(int v) {
- this.status = v;
- }
-
- /**
- * Sets the entity.
- *
- * @param v the new entity
- */
- @JsonProperty("entity")
- public void setEntity(String v) {
- this.entity = v;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /**
- * Gets the response.
- *
- * @return the response
- */
- public String getResponse () {
-
- StringBuilder b = new StringBuilder ("{ \"status\": ");
- b.append(getStatus()).append(", \"entity\": " ).append(this.getEntity()).append("}");
- return (b.toString());
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInt.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInt.java deleted file mode 100755 index b9f2dbcc..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInt.java +++ /dev/null @@ -1,71 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * The Class MsoRestInt.
- */
-public class MsoRestInt {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestInterface.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The request date format. */
- public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z");
-
- /**
- * Instantiates a new mso rest int.
- */
- public MsoRestInt() {
- requestDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
- }
-
- /**
- * Log request.
- *
- * @param r the r
- */
- public void logRequest ( org.openecomp.vid.mso.rest.RequestDetails r ) {
- String methodName = "logRequest";
- ObjectMapper mapper = new ObjectMapper();
- String r_json_str = "";
- if ( r != null ) {
- r_json_str = r.toString();
- try {
- r_json_str = mapper.writeValueAsString(r);
- }
- catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse request as json");
- }
- }
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Request=(" + r_json_str + ")");
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java deleted file mode 100755 index 5b331e90..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java +++ /dev/null @@ -1,352 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Collections;
-import java.util.Date;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-import org.apache.commons.codec.binary.Base64;
-import org.eclipse.jetty.util.security.Password;
-import org.openecomp.vid.changeManagement.ChangeManagementRequest;
-import org.openecomp.vid.client.HttpBasicClient;
-import org.openecomp.vid.client.HttpsBasicClient;
-import org.openecomp.vid.mso.rest.RequestDetails;
-
-/**
- * The Class MsoRestInterface.
- */
-public class MsoRestInterface extends MsoRestInt implements MsoRestInterfaceIfc {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestInterface.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The client. */
- private static Client client = null;
-
- /** The common headers. */
- private MultivaluedHashMap<String, Object> commonHeaders;
-
- /**
- * Instantiates a new mso rest interface.
- */
- public MsoRestInterface() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#initRestClient()
- */
- public void initMsoClient()
- {
- final String methodname = "initRestClient()";
-
- final String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);
- final String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);
- final String mso_url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL);
- final String decrypted_password = Password.deobfuscate(password);
-
- String authString = username + ":" + decrypted_password;
-
- byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
- String authStringEnc = new String(authEncBytes);
-
- commonHeaders = new MultivaluedHashMap<String, Object> ();
- commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc)));
- //Pass calling application identifier to SO
- commonHeaders.put("X-FromAppId",
- Collections.singletonList(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)));
-
- boolean use_ssl = true;
- if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) {
- if ( mso_url.startsWith("https")) {
- use_ssl = true;
- }
- else {
- use_ssl = false;
- }
- }
- if (client == null) {
-
- try {
- if ( use_ssl ) {
- //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username
- // + " password=" + password);
- client = HttpsBasicClient.getClient();
- }
- else {
- //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username
- // + " password=" + password);
- client = HttpBasicClient.getClient();
- }
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " Unable to get the SSL client");
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Get(java.lang.Object, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
- */
- @SuppressWarnings("unchecked")
- public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception {
- String methodName = "Get";
-
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
-
- String url="";
- restObject.set(t);
-
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
-
- initMsoClient();
-
- final Response cres = client.target(url)
- .request()
- .accept("application/json")
- .headers(commonHeaders)
- .get();
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if (status == 200) {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " REST api was successfull!");
-
- } else {
- throw new Exception(methodName + " with status="+ status + ", url= " + url );
- }
-
- logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );
-
- return;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Delete(java.lang.Object, org.openecomp.vid.mso.rest.RequestDetails, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
- */
- @SuppressWarnings("unchecked")
- public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) {
-
- String methodName = "Delete";
- String url="";
- Response cres = null;
-
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
- logRequest (r);
-
- try {
- initMsoClient();
-
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + " methodName sending request to: " + url);
-
- cres = client.target(url)
- .request()
- .accept("application/json")
- .headers(commonHeaders)
- //.entity(r)
- .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke();
- // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON));
- //.delete(Entity.entity(r, MediaType.APPLICATION_JSON));
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if (status == 404) { // resource not found
- String msg = "Resource does not exist...: " + cres.getStatus();
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
- } else if (status == 200 || status == 204){
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
- } else if (status == 202) {
- String msg = "Delete in progress: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
- }
- else {
- String msg = "Deleting Resource failed: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
- }
-
- try {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
- catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
- + e.getMessage());
- }
-
- }
- catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
- throw e;
-
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Post(java.lang.Object, org.openecomp.vid.mso.rest.RequestDetails, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
- */
- @SuppressWarnings("unchecked")
- public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception {
-
- String methodName = "Post";
- String url="";
-
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- logRequest (r);
- try {
-
- initMsoClient();
-
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
- // Change the content length
- final Response cres = client.target(url)
- .request()
- .accept("application/json")
- .headers(commonHeaders)
- //.header("content-length", 201)
- //.header("X-FromAppId", sourceID)
- .post(Entity.entity(r, MediaType.APPLICATION_JSON));
-
- try {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
- catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
- + e.getMessage());
- }
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if ( status >= 200 && status <= 299 ) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
-
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with status="+status+", url="+url);
- }
-
- } catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
- throw e;
-
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Put(java.lang.Object, org.openecomp.vid.mso.rest.RequestDetails, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
- */
- @SuppressWarnings("unchecked")
- public <T> void Put(T t, ChangeManagementRequest r, String sourceID, String path, RestObject<T> restObject) throws Exception {
-
- String methodName = "Put";
- String url="";
-
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
-
-// logRequest (r);
- try {
-
- initMsoClient();
-
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
- // Change the content length
- final Response cres = client.target(url)
- .request()
- .accept("application/json")
- .headers(commonHeaders)
- //.header("content-length", 201)
- //.header("X-FromAppId", sourceID)
- .put(Entity.entity(r, MediaType.APPLICATION_JSON));
-
- try {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
- catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
- + e.getMessage());
- }
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if ( status >= 200 && status <= 299 ) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
-
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with status="+status+", url="+url);
- }
-
- } catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
- throw e;
-
- }
- }
-
-
- /**
- * Gets the single instance of MsoRestInterface.
- *
- * @param <T> the generic type
- * @param clazz the clazz
- * @return single instance of MsoRestInterface
- * @throws IllegalAccessException the illegal access exception
- * @throws InstantiationException the instantiation exception
- */
- public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException
- {
- return clazz.newInstance();
- }
-
-
-
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java deleted file mode 100755 index ab12c7b1..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.vid.mso.rest.MsoRestClientNew;
-
-/**
- * A factory for creating MsoRestInterface objects.
- */
-public class MsoRestInterfaceFactory {
-
- /**
- * Gets the single instance of MsoRestInterfaceFactory.
- *
- * @return single instance of MsoRestInterfaceFactory
- */
- public static MsoInterface getInstance() {
- String msoPropertyName = "mso.client.type";
- if (SystemProperties.containsProperty(msoPropertyName) &&
- SystemProperties.getProperty(msoPropertyName).equals("LOCAL")) {
- return new MsoLocalClientNew();
- } else
- return new MsoRestClientNew();
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java deleted file mode 100755 index 4ff13edd..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java +++ /dev/null @@ -1,92 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-
-import org.openecomp.vid.changeManagement.ChangeManagementRequest;
-import org.openecomp.vid.mso.rest.RequestDetails;
-
-/**
- * The Interface MsoRestInterfaceIfc.
- */
-public interface MsoRestInterfaceIfc {
-
- /**
- * Inits the rest client.
- */
- public void initMsoClient();
-
- /**
- * Gets the.
- *
- * @param <T> the generic type
- * @param t the t
- * @param sourceId the source id
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception;
-
- /**
- * Delete.
- *
- * @param <T> the generic type
- * @param t the t
- * @param r the r
- * @param sourceID the source ID
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception;
-
- /**
- * Post.
- *
- * @param <T> the generic type
- * @param t the t
- * @param r the r
- * @param sourceID the source ID
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception;
-
- /**
- * Put.
- *
- * @param <T> the generic type
- * @param t the t
- * @param r the r
- * @param sourceID the source ID
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- public <T> void Put(T t, ChangeManagementRequest r, String sourceID, String path, RestObject<T> restObject) throws Exception ;
- /***
- * Log request.
- *
- * @param r the r
- */
- public void logRequest ( RequestDetails r );
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoUtil.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoUtil.java deleted file mode 100755 index 2c0148bb..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoUtil.java +++ /dev/null @@ -1,125 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.glassfish.jersey.client.ClientResponse;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.vid.controller.MsoController;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * The Class MsoUtil.
- */
-public class MsoUtil {
-
- /** The logger. */
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * Wrap response.
- *
- * @param body the body
- * @param statusCode the status code
- * @return the mso response wrapper
- */
- public static MsoResponseWrapper wrapResponse ( String body, int statusCode ) {
-
- MsoResponseWrapper w = new MsoResponseWrapper();
- w.setStatus (statusCode);
- w.setEntity(body);
-
- return w;
- }
-
- /**
- * Wrap response.
- *
- * @param cres the cres
- * @return the mso response wrapper
- */
- public static MsoResponseWrapper wrapResponse (ClientResponse cres) {
- String resp_str = "";
- if ( cres != null ) {
- resp_str = cres.readEntity(String.class);
- }
- int statuscode = cres.getStatus();
- MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, statuscode );
- return (w);
- }
-
- /**
- * Wrap response.
- *
- * @param rs the rs
- * @return the mso response wrapper
- */
- public static MsoResponseWrapper wrapResponse (RestObject<String> rs) {
- String resp_str = "";
- int status = 0;
- if ( rs != null ) {
- resp_str = rs.get();
- status = rs.getStatusCode();
- }
- MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, status );
- return (w);
- }
-
- /**
- * Convert pojo to string.
- *
- * @param <T> the generic type
- * @param t the t
- * @return the string
- * @throws JsonProcessingException the json processing exception
- */
- public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException {
-
- String methodName = "convertPojoToString";
- ObjectMapper mapper = new ObjectMapper();
- String r_json_str = "";
- if ( t != null ) {
- try {
- r_json_str = mapper.writeValueAsString(t);
- }
- catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json");
- }
- }
- return (r_json_str);
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/RestMsoImplementation.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/RestMsoImplementation.java deleted file mode 100644 index ba0fdfaa..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/RestMsoImplementation.java +++ /dev/null @@ -1,326 +0,0 @@ -package org.openecomp.vid.mso; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.commons.codec.binary.Base64; -import org.eclipse.jetty.util.security.Password; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.vid.changeManagement.MsoRequestDetails; -import org.openecomp.vid.client.HttpBasicClient; -import org.openecomp.vid.client.HttpsBasicClient; -import org.openecomp.vid.mso.rest.RequestDetails; -import org.openecomp.vid.mso.rest.RestInterface; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.Response; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Date; - -/** - * Created by pickjonathan on 26/06/2017. - */ -public class RestMsoImplementation implements RestInterface { - - /** - * The logger. - */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMsoImplementation.class); - - /** - * The Constant dateFormat. - */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - /** The client. */ - private static Client client = null; - - /** The common headers. */ - private MultivaluedHashMap<String, Object> commonHeaders; - /** - * Instantiates a new mso rest interface. - */ - - @Override - public void initMsoClient() - { - final String methodname = "initRestClient()"; - - final String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME); - final String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD); - final String mso_url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL); - final String decrypted_password = Password.deobfuscate(password); - - String authString = username + ":" + decrypted_password; - - byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); - String authStringEnc = new String(authEncBytes); - - commonHeaders = new MultivaluedHashMap<String, Object>(); - commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc))); - - boolean use_ssl = true; - if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) { - if ( mso_url.startsWith("https")) { - use_ssl = true; - } - else { - use_ssl = false; - } - } - if (client == null) { - - try { - if ( use_ssl ) { - //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username - // + " password=" + password); - client = HttpsBasicClient.getClient(); - } - else { - //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username - // + " password=" + password); - client = HttpBasicClient.getClient(); - } - } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " Unable to get the SSL client"); - } - } - } - - public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception { - String methodName = "Get"; - - logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start"); - - String url=""; - restObject.set(t); - - url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url); - - initMsoClient(); - - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - .get(); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if (status == 200 || status == 202) { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " REST api was successfull!"); - - } else { - throw new Exception(methodName + " with status="+ status + ", url= " + url ); - } - - logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status ); - - return; - } - - @Override - public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) { - - String methodName = "Delete"; - String url=""; - Response cres = null; - - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start"); - logRequest (r); - - try { - initMsoClient(); - - url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + " methodName sending request to: " + url); - - cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.entity(r) - .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke(); - // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)); - //.delete(Entity.entity(r, MediaType.APPLICATION_JSON)); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if (status == 404) { // resource not found - String msg = "Resource does not exist...: " + cres.getStatus(); - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg); - } else if (status == 200 || status == 204){ - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted"); - } else if (status == 202) { - String msg = "Delete in progress: " + status; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg); - } - else { - String msg = "Deleting Resource failed: " + status; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg); - } - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e=" - + e.getMessage()); - } - - } - catch (Exception e) - { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString()); - throw e; - - } - } - - @Override - public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception { - String methodName = "Post"; - String url=""; - - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start"); - - logRequest (r); - try { - - initMsoClient(); - - url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url); - // Change the content length - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.header("content-length", 201) - //.header("X-FromAppId", sourceID) - .post(Entity.entity(r, MediaType.APPLICATION_JSON)); - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e=" - + e.getMessage()); - } - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if ( status >= 200 && status <= 299 ) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!"); - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!"); - - } else { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with status="+status+", url="+url); - } - - } catch (Exception e) - { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString()); - throw e; - - } - } - - @Override - public void logRequest(RequestDetails r) { - String methodName = "logRequest"; - ObjectMapper mapper = new ObjectMapper(); - String r_json_str = ""; - if ( r != null ) { - r_json_str = r.toString(); - try { - r_json_str = mapper.writeValueAsString(r); - } - catch ( com.fasterxml.jackson.core.JsonProcessingException j ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse request as json"); - } - } - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Request=(" + r_json_str + ")"); - } - - @Override - public void logRequest(org.openecomp.vid.changeManagement.RequestDetails r) { - String methodName = "logRequest"; - ObjectMapper mapper = new ObjectMapper(); - String r_json_str = ""; - if ( r != null ) { - r_json_str = r.toString(); - try { - r_json_str = mapper.writeValueAsString(r); - } - catch ( com.fasterxml.jackson.core.JsonProcessingException j ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse request as json"); - } - } - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Request=(" + r_json_str + ")"); - } - - @Override - public <T> void Put(T t, org.openecomp.vid.changeManagement.RequestDetailsWrapper r, String sourceID, String path, RestObject<T> restObject) throws Exception { - - String methodName = "Put"; - String url=""; - - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start"); - -// logRequest (r); - try { - - initMsoClient(); - - url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path; - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url); - // Change the content length - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.header("content-length", 201) - //.header("X-FromAppId", sourceID) - .put(Entity.entity(r, MediaType.APPLICATION_JSON)); - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e=" - + e.getMessage()); - } - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if ( status >= 200 && status <= 299 ) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!"); - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!"); - - } else { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with status="+status+", url="+url); - } - - } catch (Exception e) - { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString()); - throw e; - - } - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/RestObject.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/RestObject.java deleted file mode 100755 index 881409e1..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/RestObject.java +++ /dev/null @@ -1,68 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso;
-
-/**
- * The Class RestObject.
- *
- * @param <T> the generic type
- */
-public class RestObject<T> {
-
- /**
- * Generic version of the RestObject class.
- *
- */
- // T stands for "Type"
- private T t;
-
- /** The status code. */
- private int statusCode= 0;
-
- /**
- * Sets the.
- *
- * @param t the t
- */
- public void set(T t) { this.t = t; }
-
- /**
- * Gets the.
- *
- * @return the t
- */
- public T get() { return t; }
-
- /**
- * Sets the status code.
- *
- * @param v the new status code
- */
- public void setStatusCode(int v) { this.statusCode = v; }
-
- /**
- * Gets the status code.
- *
- * @return the status code
- */
- public int getStatusCode() { return this.statusCode; }
-}
-
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java deleted file mode 100755 index 1395f9ae..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java +++ /dev/null @@ -1,123 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso.rest;
-
-//import java.util.HashMap;
-//import java.util.Map;
-//import javax.annotation.Generated;
-
-import org.openecomp.vid.domain.mso.InstanceIds;
-import org.openecomp.vid.domain.mso.RequestStatus;
-//import com.fasterxml.jackson.annotation.JsonAnyGetter;
-//import com.fasterxml.jackson.annotation.JsonAnySetter;
-//import com.fasterxml.jackson.annotation.JsonCreator;
-//import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-//import com.fasterxml.jackson.annotation.JsonValue;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * request structure.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-
-public class AsyncRequestStatus extends org.openecomp.vid.domain.mso.AsyncRequestStatus {
-
-
- /** The instance ids. */
- private InstanceIds instanceIds;
-
- /** The request status. */
- private RequestStatus requestStatus;
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#getInstanceIds()
- */
- public InstanceIds getInstanceIds() {
- return instanceIds;
- }
-
- /**
- * Sets the instance ids.
- *
- * @param instanceIds the new instance ids
- */
- public void setInstanceIds(InstanceIds instanceIds) {
- this.instanceIds = instanceIds;
- }
-
-
- /**
- * (Required).
- *
- * @return The requestStatus
- */
- @JsonProperty("requestStatus")
- public RequestStatus getRequestStatus() {
- return requestStatus;
- }
-
- /**
- * (Required).
- *
- * @param requestStatus The requestStatus
- */
- @JsonProperty("requestStatus")
- public void setRequestStatus(RequestStatus requestStatus) {
- this.requestStatus = requestStatus;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#hashCode()
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getCorrelator()).append(getFinishTime()).append(instanceIds).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode();
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof AsyncRequestStatus) == false) {
- return false;
- }
- AsyncRequestStatus rhs = ((AsyncRequestStatus) other);
- return new EqualsBuilder().append(getCorrelator(), rhs.getCorrelator()).append(getFinishTime(), rhs.getFinishTime()).append(instanceIds, rhs.instanceIds).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals();
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/MsoBusinessLogicNew.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/MsoBusinessLogicNew.java deleted file mode 100644 index 1afb2df2..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/MsoBusinessLogicNew.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.vid.mso.MsoClientFactory; -import org.openecomp.vid.mso.MsoInterface; -import org.openecomp.vid.mso.MsoResponseWrapper; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * Created by pickjonathan on 21/06/2017. - * This class was created only for testing the new logic. - * It is not used by any of the controllers binded to the ui. - * This can be deleted in the future in order to keep a cleaner project. - * If deleting please dont forget to delete the controllers, factory and all involved in the assert test. - */ -public class MsoBusinessLogicNew { - - /** - * \ - * The MSO Client - */ - private MsoInterface msoClient; - - private MsoInterface msoRestTempClient; - - /** - * The logger. - */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoBusinessLogicNew.class); - - /** - * The Constant dateFormat. - */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - public MsoBusinessLogicNew() { - msoClient = MsoClientFactory.getInstance(); - msoRestTempClient = new MsoRestClientNew(); - } - - public MsoResponseWrapper createSvcInstance(RequestDetails msoRequest) throws Exception { - String methodName = "createSvcInstance "; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - -// String endpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE); -// -// MsoResponseWrapper w = createInstance(msoRequest, p); - - MsoResponseWrapper w = msoClient.createSvcInstance(msoRequest, ""); - - return w; - } - - - public MsoResponseWrapper createSvcInstanceRest(RequestDetails msoRequest) throws Exception { - String methodName = "createSvcInstance "; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - - MsoResponseWrapper w = msoRestTempClient.createSvcInstance(msoRequest, ""); - - return w; - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/MsoRestClientNew.java deleted file mode 100644 index 1beeafb1..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/MsoRestClientNew.java +++ /dev/null @@ -1,333 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.vid.changeManagement.MsoRequestDetails; -import org.openecomp.vid.changeManagement.RequestDetailsWrapper; -import org.openecomp.vid.mso.*; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - - -/** - * Created by pickjonathan on 21/06/2017. - */ -public class MsoRestClientNew extends RestMsoImplementation implements MsoInterface { - - /** - * The logger. - */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestClientNew.class); - - /** - * The Constant dateFormat. - */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - private final String ORIGINAL_REQUEST_ID = "originalRequestId"; - - - @Override - public MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "createSvcInstance "; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return createInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) throws Exception { - - String methodName = "createVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return createInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) throws Exception { - - String methodName = "createNwInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return createInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "createVolumeGroupInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return createInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "createVfModuleInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return createInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "deleteSvcInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return deleteInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "deleteVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return deleteInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "deleteVfModule"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return deleteInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "deleteVolumeGroupInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return deleteInstance(requestDetails, endpoint); - } - - @Override - public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "deleteNwInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return deleteInstance(requestDetails, endpoint); - } - - @Override - public void getOrchestrationRequest(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { - Get(t, sourceId, endpoint, restObject); - } - - public void getManualTasks(String t, String sourceId, String endpoint, RestObject restObject) throws Exception { - Get(t, sourceId, endpoint, restObject); - } - - - public MsoResponseWrapper createInstance(RequestDetails request, String path) throws Exception { - String methodName = "createInstance"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - RestObject<String> restObjStr = new RestObject<String>(); - - String str = new String(); - - restObjStr.set(str); - - Post(str, request, "", path, restObjStr); - MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr); - - return w; - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - - /** - * Delete instance. - * - * @param request the request - * @param path the path - * @return the mso response wrapper - * @throws Exception the exception - */ - public MsoResponseWrapper deleteInstance(RequestDetails request, String path) throws Exception { - String methodName = "deleteInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]"); - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - Delete(str, request, "", path, restObjStr); - MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr); - - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); - return w; - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - - } - - public MsoResponseWrapper getOrchestrationRequestsForDashboard(String t, String sourceId, String endpoint, RestObject restObject) throws Exception{ - String methodName = "getOrchestrationRequestsForDashboard"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - getOrchestrationRequest(t, sourceId, endpoint, restObject); - MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); - - return w; - - } catch (Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - public MsoResponseWrapper getManualTasksByRequestId(String t , String sourceId , String endpoint , RestObject restObject) throws Exception{ - String methodName = "getManualTasksByRequestId"; - logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - getManualTasks(t , sourceId , endpoint , restObject); - MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); - - return MsoUtil.wrapResponse(restObject); - - } catch (Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - - - @Override - public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) throws Exception { - String methodName = "completeManualTask"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Complete "); - try { - - Post(t, requestDetails , sourceId, endpoint, restObject); - MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); - - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); - return w; - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - - @Override - public MsoResponseWrapper replaceVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "replaceVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - return replaceInstance(requestDetails, endpoint); - } - - public MsoResponseWrapper replaceInstance(org.openecomp.vid.changeManagement.RequestDetails request, String path) throws Exception { - String methodName = "replaceInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Replace VNF, path =[" + path + "]"); - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper(); - requestDetailsWrapper.requestDetails = new MsoRequestDetails(request); - - Post(str, request, "", path, restObjStr); - MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(restObjStr); - int status = msoResponseWrapperObject.getStatus(); - if (status == 202){ - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + - ",post succeeded, msoResponseWrapperObject response:" + msoResponseWrapperObject.getResponse()); - } - else { - logger.error(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + - ": post failed, msoResponseWrapperObject status" + status + ", response:" + msoResponseWrapperObject.getResponse()); - - // TODO - } - return msoResponseWrapperObject; - - } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - - } - - @Override - public MsoResponseWrapper updateVnf(org.openecomp.vid.changeManagement.RequestDetails requestDetails, String endpoint) throws Exception { - String methodName = "updateVnf"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - RequestDetailsWrapper wrapper = new RequestDetailsWrapper(); - wrapper.requestDetails = new MsoRequestDetails(requestDetails);; - return updateInstance(requestDetails, endpoint); - } - - public MsoResponseWrapper updateInstance(org.openecomp.vid.changeManagement.RequestDetails request, String path) throws Exception { - String methodName = "updateInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start"); - - try { - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]"); - - RestObject<String> restObjStr = new RestObject<String>(); - String str = new String(); - restObjStr.set(str); - RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper(); - requestDetailsWrapper.requestDetails = new MsoRequestDetails(request); - - - - Put(str, requestDetailsWrapper, "", path, restObjStr); - MsoResponseWrapper w = MsoUtil.wrapResponse(restObjStr); - - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse()); - return w; - - } catch (Exception e) { - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - - } - - public void activateServiceInstance(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject) throws Exception{ - String methodName = "activateServiceInstance"; - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start "); - try { - - Post(t, requestDetails , sourceId, endpoint, restObject); - MsoResponseWrapper w = MsoUtil.wrapResponse(restObject); - - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w =" + w.getResponse()); - - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString()); - throw e; - } - } - -}
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java deleted file mode 100755 index b68f7c13..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java +++ /dev/null @@ -1,125 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.Generated;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * modelInfo and optional instanceId and instanceName for a model related to the modelInfo being operated on.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({
- "instanceName",
- "instanceId",
- "modelInfo"
-})
-public class RelatedInstance extends org.openecomp.vid.domain.mso.RelatedInstance{
-
-
- /** The model info. */
- @JsonProperty("modelInfo")
- private org.openecomp.vid.domain.mso.ModelInfo modelInfo;
-
- /** The additional properties. */
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * (Required).
- *
- * @return The modelInfo
- */
- @JsonProperty("modelInfo")
- public org.openecomp.vid.domain.mso.ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- * (Required).
- *
- * @param modelInfo The modelInfo
- */
- @JsonProperty("modelInfo")
- public void setModelInfo(org.openecomp.vid.domain.mso.ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedInstance#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedInstance#getAdditionalProperties()
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedInstance#setAdditionalProperty(java.lang.String, java.lang.Object)
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedInstance#hashCode()
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getInstanceName()).append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedInstance#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RelatedInstance) == false) {
- return false;
- }
- RelatedInstance rhs = ((RelatedInstance) other);
- return new EqualsBuilder().append(getInstanceName(), rhs.getInstanceName()).append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.getModelInfo()).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java deleted file mode 100755 index 427d71dd..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java +++ /dev/null @@ -1,125 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * modelInfo and optional instance id for a model related to the modelInfo being operated on.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "instanceId",
- "modelInfo"
-})
-public class RelatedModel extends org.openecomp.vid.domain.mso.RelatedModel {
-
- /** (Required). */
- @JsonProperty("modelInfo")
- private org.openecomp.vid.domain.mso.ModelInfo modelInfo;
-
-// /** The related model object instance list. */
-// @JsonProperty("instanceId")
-// private org.openecomp.vid.domain.mso.InstanceIds instanceId;
-
- /** The additional properties. */
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * (Required).
- *
- * @return The modelInfo
- */
- @JsonProperty("modelInfo")
- public org.openecomp.vid.domain.mso.ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- * (Required).
- *
- * @param modelInfo The modelInfo
- */
- @JsonProperty("modelInfo")
- public void setModelInfo(org.openecomp.vid.domain.mso.ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedModel#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedModel#getAdditionalProperties()
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedModel#setAdditionalProperty(java.lang.String, java.lang.Object)
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedModel#hashCode()
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RelatedModel#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RelatedModel) == false) {
- return false;
- }
- RelatedModel rhs = ((RelatedModel) other);
- return new EqualsBuilder().append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.modelInfo).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Request.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Request.java deleted file mode 100755 index c8f7b8ba..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Request.java +++ /dev/null @@ -1,140 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso.rest;
-
-//import java.util.HashMap;
-//import java.util.Map;
-//import javax.annotation.Generated;
-
-import org.openecomp.vid.domain.mso.InstanceIds;
-import org.openecomp.vid.domain.mso.RequestStatus;
-//import com.fasterxml.jackson.annotation.JsonAnyGetter;
-//import com.fasterxml.jackson.annotation.JsonAnySetter;
-//import com.fasterxml.jackson.annotation.JsonCreator;
-//import com.fasterxml.jackson.annotation.JsonIgnore;
-//import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-//import com.fasterxml.jackson.annotation.JsonValue;
-import org.apache.commons.lang.builder.EqualsBuilder;
-//import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * request structure.
- */
-public class Request extends org.openecomp.vid.domain.mso.Request {
-
-
- /** The instance ids. */
- private InstanceIds instanceIds;
-
- /** The request details. */
- private RequestDetails requestDetails;
-
- /** The request status. */
- private RequestStatus requestStatus;
-
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.Request#getInstanceIds()
- */
- @JsonProperty("instanceIds")
- public InstanceIds getInstanceIds() {
- return instanceIds;
- }
-
- /**
- * Sets the instance ids.
- *
- * @param instanceIds The instanceIds
- */
- @JsonProperty("instanceIds")
- public void setInstanceIds(InstanceIds instanceIds) {
- this.instanceIds = instanceIds;
- }
-
- /**
- * (Required).
- *
- * @return The requestDetails
- */
- @JsonProperty("requestDetails")
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
-
- /**
- * (Required).
- *
- * @param requestDetails The requestDetails
- */
- @JsonProperty("requestDetails")
- public void setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- }
-
-
- /**
- * Gets the request status.
- *
- * @return The requestStatus
- */
- @JsonProperty("requestStatus")
- public RequestStatus getRequestStatus() {
- return requestStatus;
- }
-
- /**
- * Sets the request status.
- *
- * @param requestStatus The requestStatus
- */
- @JsonProperty("requestStatus")
- public void setRequestStatus(RequestStatus requestStatus) {
- this.requestStatus = requestStatus;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.Request#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.Request#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof Request) == false) {
- return false;
- }
- Request rhs = ((Request) other);
- return new EqualsBuilder().append(getFinishTime(), rhs.getFinishTime()).append(getInstanceIds(), rhs.getInstanceIds()).append(getRequestDetails(), rhs.getRequestDetails()).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals();
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java deleted file mode 100755 index 0cf697e0..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java +++ /dev/null @@ -1,232 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
-//import javax.annotation.Generated;
-
-import org.openecomp.vid.domain.mso.CloudConfiguration;
-import org.openecomp.vid.domain.mso.ModelInfo;
-import org.openecomp.vid.domain.mso.RequestInfo;
-import org.openecomp.vid.domain.mso.RequestParameters;
-import org.openecomp.vid.domain.mso.SubscriberInfo;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * aggregates the context, configuraiton and detailed parameters associated with the request into a single structure.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "cloudConfiguration",
- "modelInfo",
- "relatedModelList",
- "requestInfo",
- "subscriberInfo",
- "requestParameters"
-})
-public class RequestDetails extends org.openecomp.vid.domain.mso.RequestDetails {
-
- /** The cloud configuration. */
- @JsonProperty("cloudConfiguration")
- private CloudConfiguration cloudConfiguration;
-
- /** The model info. */
- @JsonProperty("modelInfo")
- private ModelInfo modelInfo;
-
- /** The related model list. */
- @JsonProperty("relatedModelList")
- private List<RelatedModel> relatedInstanceList;
-
- /** The request info. */
- @JsonProperty("requestInfo")
- private RequestInfo requestInfo;
-
- /** The subscriber info. */
- @JsonProperty("subscriberInfo")
- private SubscriberInfo subscriberInfo;
-
- /** The request parameters. */
- @JsonProperty("requestParameters")
- private RequestParameters requestParameters;
-
- /** The additional properties. */
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * Gets the cloud configuration.
- *
- * @return The cloudConfiguration
- */
- @JsonProperty("cloudConfiguration")
- public CloudConfiguration getCloudConfiguration() {
- return cloudConfiguration;
- }
-
- /**
- * Sets the cloud configuration.
- *
- * @param cloudConfiguration The cloudConfiguration
- */
- @JsonProperty("cloudConfiguration")
- public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
- this.cloudConfiguration = cloudConfiguration;
- }
-
- /**
- * Gets the model info.
- *
- * @return The modelInfo
- */
- @JsonProperty("modelInfo")
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- * Sets the model info.
- *
- * @param modelInfo The modelInfo
- */
- @JsonProperty("modelInfo")
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
- /**
- * Gets the related instance list.
- *
- * @return The relatedInstanceList
- */
- @JsonProperty("relatedInstanceList")
- public List<RelatedModel> getRelatedInstanceList() {
- return relatedInstanceList;
- }
-
- /**
- * Sets the related model list.
- *
- * @param relatedInstanceList The relatedInstanceList
- */
- @JsonProperty("relatedInstanceList")
- public void setRelatedInstanceList( List<RelatedModel> relatedInstanceList) {
- this.relatedInstanceList = relatedInstanceList;
- }
-
- /**
- * Gets the request info.
- *
- * @return The requestInfo
- */
- @JsonProperty("requestInfo")
- public RequestInfo getRequestInfo() {
- return requestInfo;
- }
-
- /**
- * Sets the request info.
- *
- * @param requestInfo The requestInfo
- */
- @JsonProperty("requestInfo")
- public void setRequestInfo(RequestInfo requestInfo) {
- this.requestInfo = requestInfo;
- }
-
- /**
- * Gets the subscriber info.
- *
- * @return The subscriberInfo
- */
- @JsonProperty("subscriberInfo")
- public SubscriberInfo getSubscriberInfo() {
- return subscriberInfo;
- }
-
- /**
- * Sets the subscriber info.
- *
- * @param subscriberInfo The subscriberInfo
- */
- @JsonProperty("subscriberInfo")
- public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
- this.subscriberInfo = subscriberInfo;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RequestDetails#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RequestDetails#getAdditionalProperties()
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RequestDetails#setAdditionalProperty(java.lang.String, java.lang.Object)
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RequestDetails#hashCode()
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(cloudConfiguration).append(modelInfo).append(relatedInstanceList).append(requestInfo).append(getRequestParameters()).append(subscriberInfo).append(additionalProperties).toHashCode();
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.domain.mso.RequestDetails#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RequestDetails) == false) {
- return false;
- }
- RequestDetails rhs = ((RequestDetails) other);
- return new EqualsBuilder().append(cloudConfiguration, rhs.cloudConfiguration).append(modelInfo, rhs.modelInfo).append(relatedInstanceList, rhs.relatedInstanceList).append(requestInfo, rhs.requestInfo).append(getRequestParameters(), rhs.getRequestParameters()).append(subscriberInfo, rhs.subscriberInfo).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestList.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestList.java deleted file mode 100755 index 8a57c74b..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestList.java +++ /dev/null @@ -1,137 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-//import com.fasterxml.jackson.annotation.JsonInclude;
-//import com.fasterxml.jackson.annotation.JsonProperty;
-//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import java.util.List;
-
-/**
- * List of relatedModel structures that are related to a modelInfo being operated on.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({
- "finishTime",
- "instanceIds",
- "requestDetails",
- "requestId",
- "requestScope",
- "requestStatus",
- "requestType",
- "startTime"
-})
-
-public class RequestList {
-
- /** The request list. */
- private List<RequestWrapper> requestList;
-
- /** The additional properties. */
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- * (Required).
- *
- * @return The RelatedModel List
- */
- public List<RequestWrapper> getRequestList() {
- return requestList;
- }
-
- /**
- * Sets the request list.
- *
- * @param l the new request list
- */
- public void setRequestList(List<RequestWrapper> l) {
- this.requestList = l;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /**
- * Gets the additional properties.
- *
- * @return the additional properties
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /**
- * Sets the additional property.
- *
- * @param name the name
- * @param value the value
- */
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getRequestList()).append(additionalProperties).toHashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RequestList) == false) {
- return false;
- }
- RequestList rhs = ((RequestList) other);
- return new EqualsBuilder().append(getRequestList(), rhs.getRequestList()).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestWrapper.java deleted file mode 100644 index b0e9fa12..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestWrapper.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * request wrapper structure. - */ -public class RequestWrapper { - - - /** The request. */ - private Request request; - - - /** - * Gets the request. - * - * @return The requestDetails - */ - @JsonProperty("request") - public Request getRequest() { - return request; - } - - /** - * Sets the request. - * - * @param request The request - */ - @JsonProperty - public void setRequest(Request request) { - this.request = request; - } - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Response.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Response.java deleted file mode 100644 index ee3a8bfe..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Response.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Response { - - /** The status. */ - private int status; - - /** The entity. */ - private RequestList entity; - - /** - * Gets the status. - * - * @return The status - */ - @JsonProperty("status") - public int getStatus() { - return status; - } - - /** - * Sets the status. - * - * @param status The status - */ - @JsonProperty("status") - public void setStatus(int status) { - this.status = status; - } - - /** - * Gets the entity. - * - * @return The entity - */ - @JsonProperty("entity") - public RequestList getEntity() { - return entity; - } - - /** - * Sets the entity. - * - * @param entity The entity - */ - @JsonProperty("entity") - public void setEntity(RequestList entity) { - this.entity = entity; - } - - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RestInterface.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RestInterface.java deleted file mode 100644 index 1e273358..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RestInterface.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import org.openecomp.vid.mso.RestObject; - -/** - * Created by pickjonathan on 26/06/2017. - */ -public interface RestInterface { - - /** - * Inits the rest client. - */ - public void initMsoClient(); - - /** - * Gets the. - * - * @param <T> the generic type - * @param t the t - * @param sourceId the source id - * @param path the path - * @param restObject the rest object - * @throws Exception the exception - */ - public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception; - - /** - * Delete. - * - * @param <T> the generic type - * @param t the t - * @param r the r - * @param sourceID the source ID - * @param path the path - * @param restObject the rest object - * @throws Exception the exception - */ - public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception; - - /** - * Post. - * - * @param <T> the generic type - * @param t the t - * @param r the r - * @param sourceID the source ID - * @param path the path - * @param restObject the rest object - * @throws Exception the exception - */ - public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception; - - /** - * Put. - * - * @param <T> the generic type - * @param t the t - * @param r the r - * @param sourceID the source ID - * @param path the path - * @param restObject the rest object - * @throws Exception the exception - */ - public <T> void Put(T t, org.openecomp.vid.changeManagement.RequestDetailsWrapper r, String sourceID, String path, RestObject<T> restObject) throws Exception; - - - /*** - * Log request. - * - * @param r the r - */ - public void logRequest ( RequestDetails r ); - /*** - * Log request. - * - * @param r the r - */ - public void logRequest(org.openecomp.vid.changeManagement.RequestDetails r); - - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Task.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Task.java deleted file mode 100644 index 8d72890f..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Task.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import java.util.List; - -public class Task { - - private String taskId; - private String type; - private String nfRole; - private String subscriptionServiceType; - private String originalRequestId; - private String originalRequestorId; - private String errorSource; - private String errorCode; - private String errorMessage; - private String buildingBlockName; - private String buildingBlockStep; - private List<String> validResponses; - - - public String getTaskId() { - return taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getNfRole() { - return nfRole; - } - - public void setNfRole(String nfRole) { - this.nfRole = nfRole; - } - - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - - public void setSubscriptionServiceType(String subscriptionServiceType) { - this.subscriptionServiceType = subscriptionServiceType; - } - - public String getOriginalRequestId() { - return originalRequestId; - } - - public void setOriginalRequestId(String originalRequestId) { - this.originalRequestId = originalRequestId; - } - - public String getOriginalRequestorId() { - return originalRequestorId; - } - - public void setOriginalRequestorId(String originalRequestorId) { - this.originalRequestorId = originalRequestorId; - } - - public String getErrorSource() { - return errorSource; - } - - public void setErrorSource(String errorSource) { - this.errorSource = errorSource; - } - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public String getBuildingBlockName() { - return buildingBlockName; - } - - public void setBuildingBlockName(String buildingBlockName) { - this.buildingBlockName = buildingBlockName; - } - - public String getBuildingBlockStep() { - return buildingBlockStep; - } - - public void setBuildingBlockStep(String buildingBlockStep) { - this.buildingBlockStep = buildingBlockStep; - } - - public List<String> getValidResponses() { - return validResponses; - } - - public void setValidResponses(List<String> validResponses) { - this.validResponses = validResponses; - } - - - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/TaskList.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/TaskList.java deleted file mode 100644 index 7232364a..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/TaskList.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.openecomp.vid.mso.rest; - -import java.util.List; - -public class TaskList { - - public List<Task> getTaskList() { - return taskList; - } - - public void setTaskList(List<Task> taskList) { - this.taskList = taskList; - } - - private List<Task> taskList; -} |