aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/mso
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/mso')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java18
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java148
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java41
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java30
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapperInterface.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java40
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java237
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/RestObject.java17
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/RestObjectWithRequestInfo.java61
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java142
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java173
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java48
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java279
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java86
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java376
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java123
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java121
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt15
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java84
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java98
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java111
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java71
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java87
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java18
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java27
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatusList.java17
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/InstanceIds.java202
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java186
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java84
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedModel.java125
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java231
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java41
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java23
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java208
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java25
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/SubscriberInfo.java144
40 files changed, 3154 insertions, 604 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
index 0ecb9257e..ef45d5ce5 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
@@ -1,7 +1,8 @@
package org.onap.vid.mso;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
-import org.onap.vid.controllers.OperationalEnvironmentController;
+import org.onap.vid.controller.OperationalEnvironmentController;
+import org.onap.vid.model.SoftDeleteRequest;
import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
@@ -17,9 +18,9 @@ public interface MsoBusinessLogic {
MsoResponseWrapper createSvcInstance(RequestDetails msoRequest);
MsoResponseWrapper createE2eSvcInstance(Object msoRequest);
-
+
MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String serviceInstanceId);
-
+
MsoResponseWrapper createVnf(RequestDetails requestDetails, String serviceInstanceId);
MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String serviceInstanceId);
@@ -102,4 +103,15 @@ public interface MsoBusinessLogic {
RequestDetailsWrapper generateInPlaceMsoRequest(org.onap.vid.changeManagement.RequestDetails requestDetails);
RequestDetailsWrapper generateConfigMsoRequest(org.onap.vid.changeManagement.RequestDetails requestDetails);
+
+ String getActivateFabricConfigurationPath(String serviceInstanceId);
+
+ String getDeactivateAndCloudDeletePath(String serviceInstanceId, String vnfInstanceId, String vfModuleInstanceId);
+
+ RequestDetails buildRequestDetailsForSoftDelete(SoftDeleteRequest softDeleteRequest);
+
+ MsoResponseWrapper2 deactivateAndCloudDelete(String serviceInstanceId, String vnfInstanceId, String vfModuleInstanceId, RequestDetails requestDetails);
+
+ MsoResponseWrapper2 activateFabricConfiguration(String serviceInstanceId, RequestDetails requestDetails);
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index a6226e00e..7fe79b392 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -26,24 +26,22 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.changeManagement.ChangeManagementRequest;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
-import org.onap.vid.controllers.OperationalEnvironmentController;
-import org.onap.vid.domain.mso.RequestInfo;
+import org.onap.vid.controller.OperationalEnvironmentController;
import org.onap.vid.exceptions.GenericUncheckedException;
-import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
-import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
+import org.onap.vid.model.RequestReferencesContainer;
+import org.onap.vid.model.SoftDeleteRequest;
+import org.onap.vid.mso.model.*;
import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
import org.onap.vid.mso.rest.*;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.togglz.core.manager.FeatureManager;
import javax.ws.rs.BadRequestException;
import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -53,7 +51,7 @@ import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toList;
import static org.apache.commons.lang.StringUtils.upperCase;
import static org.onap.vid.changeManagement.ChangeManagementRequest.MsoChangeManagementRequest;
-import static org.onap.vid.controllers.MsoController.*;
+import static org.onap.vid.controller.MsoController.*;
import static org.onap.vid.mso.MsoProperties.*;
import static org.onap.vid.properties.Features.FLAG_UNASSIGN_SERVICE;
import static org.onap.vid.utils.Logging.debugRequestDetails;
@@ -68,16 +66,14 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
.map(requestType -> requestType.toString().toUpperCase())
.collect(collectingAndThen(toList(), Collections::unmodifiableList));
private static final String RESOURCE_TYPE = "resourceType";
- /**
- * The Constant dateFormat.
- */
- private static final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
private static final Pattern SOFTWARE_VERSION_PATTERN = Pattern.compile("^[A-Za-z0-9.\\-]+$");
private static final Pattern NUMBER_PATTERN = Pattern.compile("^[0-9]+$");
private static final String ACTIVATE = "/activate";
private static final String DEACTIVATE = "/deactivate";
private static final String ENABLE_PORT = "/enablePort";
private static final String DISABLE_PORT = "/disablePort";
+ private static final String ACTIVATE_FABRIC_CONFIGURATION = "/activateFabricConfiguration";
+ private static final String DEACTIVATE_AND_CLOUD_DELETE = "/deactivateAndCloudDelete";
private static final String RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT = "operationalEnvironment";
private static final String SOURCE_OPERATIONAL_ENVIRONMENT = "VID";
private static final ObjectMapper objectMapper = new ObjectMapper();
@@ -130,8 +126,8 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE);
- String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
- return msoClientInterface.createVnf(requestDetails, vnf_endpoint);
+ String vnfEndpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ return msoClientInterface.createVnf(requestDetails, vnfEndpoint);
}
@Override
@@ -150,10 +146,10 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
- String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
- vnf_endpoint = vnf_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
+ String vnfEndpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ vnfEndpoint = vnfEndpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
- return msoClientInterface.createVolumeGroupInstance(requestDetails, vnf_endpoint);
+ return msoClientInterface.createVolumeGroupInstance(requestDetails, vnfEndpoint);
}
@Override
@@ -232,10 +228,10 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
logInvocationInDebug("deleteVnf");
String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE);
- String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
- vnf_endpoint = vnf_endpoint + '/' + vnfInstanceId;
+ String vnfEndpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ vnfEndpoint = vnfEndpoint + '/' + vnfInstanceId;
- return msoClientInterface.deleteVnf(requestDetails, vnf_endpoint);
+ return msoClientInterface.deleteVnf(requestDetails, vnfEndpoint);
}
@Override
@@ -255,8 +251,8 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
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;
+ String vnfEndpoint = svc_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
+ String delete_volume_group_endpoint = vnfEndpoint + "/" + volumeGroupId;
return msoClientInterface.deleteVolumeGroupInstance(requestDetails, delete_volume_group_endpoint);
}
@@ -341,7 +337,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
RestObject<String> restObjStr = new RestObject<>();
String str = new String();
restObjStr.set(str);
- MsoResponseWrapper msoResponseWrapper = msoClientInterface.getOrchestrationRequestsForDashboard(str, "", orchestrationReqPath, restObjStr);
+ MsoResponseWrapper msoResponseWrapper = msoClientInterface.getOrchestrationRequest(str, "", orchestrationReqPath, restObjStr, true);
return deserializeOrchestrationRequestsJson(msoResponseWrapper.getEntity());
}
@@ -447,9 +443,9 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
String endpoint;
endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE);
- String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
- vnf_endpoint = vnf_endpoint + '/' + vnfInstanceId;
- return msoClientInterface.updateVnf(requestDetails, vnf_endpoint);
+ String vnfEndpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ vnfEndpoint = vnfEndpoint + '/' + vnfInstanceId;
+ return msoClientInterface.updateVnf(requestDetails, vnfEndpoint);
}
@Override
@@ -457,10 +453,10 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
logInvocationInDebug("replaceVnf");
String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE);
- 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, MsoChangeManagementRequest.REPLACE);
- return msoClientInterface.replaceVnf(requestDetails, vnf_endpoint);
+ String vnfEndpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ vnfEndpoint = vnfEndpoint.replace(VNF_INSTANCE_ID, vnfInstanceId);
+ vnfEndpoint = vnfEndpoint.replace(REQUEST_TYPE, MsoChangeManagementRequest.REPLACE);
+ return msoClientInterface.replaceVnf(requestDetails, vnfEndpoint);
}
public RequestDetailsWrapper generateInPlaceMsoRequest(org.onap.vid.changeManagement.RequestDetails requestDetails) {
@@ -486,27 +482,82 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
}
@Override
+ public String getActivateFabricConfigurationPath(String serviceInstanceId) {
+ String path = validateEndpointPath(MsoProperties.MSO_REST_API_SERVICE_INSTANCE_CREATE);
+ path += "/" + serviceInstanceId + ACTIVATE_FABRIC_CONFIGURATION;
+
+ return path;
+ }
+
+ @Override
+ public String getDeactivateAndCloudDeletePath(String serviceInstanceId, String vnfInstanceId, String vfModuleInstanceId) {
+ String path = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
+ path = path.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
+ path += "/" + vfModuleInstanceId + DEACTIVATE_AND_CLOUD_DELETE;
+
+ return path;
+ }
+
+ @Override
+ public RequestDetails buildRequestDetailsForSoftDelete(SoftDeleteRequest softDeleteRequest) {
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setSource("VID");
+ requestInfo.setRequestorId(softDeleteRequest.getUserId());
+ requestDetails.setRequestInfo(requestInfo);
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId(softDeleteRequest.getTenantId());
+ cloudConfiguration.setLcpCloudRegionId(softDeleteRequest.getLcpCloudRegionId());
+ requestDetails.setCloudConfiguration(cloudConfiguration);
+
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelType("vfModule");
+ requestDetails.setModelInfo(modelInfo);
+
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setTestApi("GR_API");
+ requestDetails.setRequestParameters(requestParameters);
+
+ return requestDetails;
+ }
+
+ @Override
+ public MsoResponseWrapper2 deactivateAndCloudDelete(String serviceInstanceId, String vnfInstanceId, String vfModuleInstanceId, RequestDetails requestDetails) {
+ String path = getDeactivateAndCloudDeletePath(serviceInstanceId, vnfInstanceId, vfModuleInstanceId);
+ return new MsoResponseWrapper2<>(msoClientInterface.post(path, new RequestDetailsWrapper<>(requestDetails), RequestReferencesContainer.class));
+ }
+
+ @Override
+ public MsoResponseWrapper2 activateFabricConfiguration(String serviceInstanceId, RequestDetails requestDetails) {
+ String path = getActivateFabricConfigurationPath(serviceInstanceId);
+ return new MsoResponseWrapper2<>(msoClientInterface.post(path, new RequestDetailsWrapper<>(requestDetails), RequestReferencesContainer.class));
+ }
+
+
+ @Override
public MsoResponseWrapperInterface updateVnfSoftware(org.onap.vid.changeManagement.RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {
logInvocationInDebug("updateVnfSoftware");
- String vnf_endpoint = getChangeManagementEndpoint(serviceInstanceId, vnfInstanceId, MsoChangeManagementRequest.SOFTWARE_UPDATE); //workflow name in mso is different than workflow name in vid UI
+ String vnfEndpoint = getChangeManagementEndpoint(serviceInstanceId, vnfInstanceId, MsoChangeManagementRequest.SOFTWARE_UPDATE); //workflow name in mso is different than workflow name in vid UI
RequestDetailsWrapper finalRequestDetails = generateInPlaceMsoRequest(requestDetails);
- return msoClientInterface.changeManagementUpdate(finalRequestDetails, vnf_endpoint);
+ return msoClientInterface.changeManagementUpdate(finalRequestDetails, vnfEndpoint);
}
@Override
public MsoResponseWrapperInterface updateVnfConfig(org.onap.vid.changeManagement.RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {
logInvocationInDebug("updateVnfConfig");
RequestDetailsWrapper finalRequestDetails = generateConfigMsoRequest(requestDetails);
- String vnf_endpoint = getChangeManagementEndpoint(serviceInstanceId, vnfInstanceId, MsoChangeManagementRequest.CONFIG_UPDATE);
- return msoClientInterface.changeManagementUpdate(finalRequestDetails, vnf_endpoint);
+ String vnfEndpoint = getChangeManagementEndpoint(serviceInstanceId, vnfInstanceId, MsoChangeManagementRequest.CONFIG_UPDATE);
+ return msoClientInterface.changeManagementUpdate(finalRequestDetails, vnfEndpoint);
}
private String getChangeManagementEndpoint(String serviceInstanceId, String vnfInstanceId, String vnfRequestType) {
String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE);
- 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, vnfRequestType);
- return vnf_endpoint;
+ String vnfEndpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ vnfEndpoint = vnfEndpoint.replace(VNF_INSTANCE_ID, vnfInstanceId);
+ vnfEndpoint = vnfEndpoint.replace(REQUEST_TYPE, vnfRequestType);
+ return vnfEndpoint;
}
private Map getChangeManagementPayload(RequestDetails requestDetails, String message) {
@@ -598,8 +649,8 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
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());
+ logger.error(EELFLoggerDelegate.errorLogger, methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + e.toString());
throw e;
}
}
@@ -632,13 +683,13 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
requestInfo.setRequestorId(details.getUserId());
requestDetails.setRequestInfo(requestInfo);
- org.onap.vid.domain.mso.RelatedInstance relatedInstance = new org.onap.vid.domain.mso.RelatedInstance();
+ RelatedInstance relatedInstance = new RelatedInstance();
relatedInstance.setAdditionalProperty(RESOURCE_TYPE, RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT);
relatedInstance.setInstanceId(details.getRelatedInstanceId());
relatedInstance.setInstanceName(details.getRelatedInstanceName());
requestDetails.setAdditionalProperty("relatedInstanceList", Collections.singletonList(ImmutableMap.of("relatedInstance", relatedInstance)));
- org.onap.vid.domain.mso.RequestParameters requestParameters = new org.onap.vid.domain.mso.RequestParameters();
+ RequestParameters requestParameters = new RequestParameters();
requestParameters.setUserParams(null);
requestParameters.setAdditionalProperty("operationalEnvironmentType", "VNF");
requestParameters.setAdditionalProperty("workloadContext", details.getWorkloadContext());
@@ -669,7 +720,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
requestInfo.setRequestorId(details.getUserId());
requestDetails.setRequestInfo(requestInfo);
- org.onap.vid.domain.mso.RequestParameters requestParameters = new org.onap.vid.domain.mso.RequestParameters();
+ RequestParameters requestParameters = new RequestParameters();
requestParameters.setUserParams(null);
requestParameters.setAdditionalProperty("operationalEnvironmentType", "VNF");
requestDetails.setRequestParameters(requestParameters);
@@ -760,12 +811,12 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
}
private void logInvocationInDebug(String methodName) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
}
private void logException(String methodName, Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.error(EELFLoggerDelegate.errorLogger, methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + e.toString());
}
enum RequestType {
@@ -781,6 +832,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
SCALE_OUT("scaleOut"),
UNKNOWN("unknown"),
NOT_PROVIDED("not provided");
+ private final String value;
private static final Map<String, RequestType> CONSTANTS = new HashMap<>();
static {
@@ -789,8 +841,6 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
}
}
- private final String value;
-
RequestType(String value) {
this.value = value;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
index 7c8ab89c1..41400f978 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
@@ -20,15 +20,10 @@
*/
package org.onap.vid.mso;
-import com.fasterxml.jackson.core.JsonProcessingException;
import io.joshworks.restclient.http.HttpResponse;
-import io.joshworks.restclient.http.mapper.ObjectMapper;
-import org.onap.vid.aai.util.CustomJacksonJaxBJsonProvider;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.mso.rest.RequestDetails;
-import java.io.IOException;
-
/**
* Created by pickjonathan on 21/06/2017.
*/
@@ -43,7 +38,7 @@ public interface MsoInterface {
* @throws Exception
*/
MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint);
-
+
//For VoLTE E2E services
MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint);
MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String endpoint);
@@ -90,19 +85,19 @@ public interface MsoInterface {
MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint);
- MsoResponseWrapper getOrchestrationRequest(String endpoint);
+ MsoResponseWrapper getOrchestrationRequest(String t, String sourceId, String endpoint, RestObject restObject, boolean warpException);
- MsoResponseWrapper getOrchestrationRequestsForDashboard(String t , String sourceId , String endpoint , RestObject restObject);
+ MsoResponseWrapper getOrchestrationRequest(String endpoint);
MsoResponseWrapper getManualTasksByRequestId(String t , String sourceId , String endpoint , RestObject restObject);
MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject);
- MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint);
+ MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnfEndpoint);
- MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint);
+ MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnfEndpoint);
- MsoResponseWrapper deleteConfiguration(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmc_endpoint);
+ MsoResponseWrapper deleteConfiguration(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmcEndpoint);
MsoResponseWrapper setConfigurationActiveStatus(RequestDetails requestDetails, String endpoint);
@@ -120,29 +115,5 @@ public interface MsoInterface {
<T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper,
Class<T> responseClass);
-
- static ObjectMapper objectMapper() {
- return new ObjectMapper() {
- CustomJacksonJaxBJsonProvider mapper = new CustomJacksonJaxBJsonProvider();
-
- @Override
- public <T> T readValue(String s, Class<T> aClass) {
- try {
- return mapper.getMapper().readValue(s, aClass);
- } catch (IOException e) {
- throw new MsoException(e);
- }
- }
-
- @Override
- public String writeValue(Object o) {
- try {
- return mapper.getMapper().writeValueAsString(o);
- } catch (JsonProcessingException e) {
- throw new MsoException(e);
- }
- }
- };
- }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
index 1d71e9c75..1039a29d4 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
@@ -20,12 +20,8 @@
package org.onap.vid.mso;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
/**
* The Class MsoProperties.
*/
@@ -71,7 +67,7 @@ public class MsoProperties extends SystemProperties {
/** The Constant MSO_REST_API_SVC_INSTANCE. */
public static final String MSO_REST_API_E2E_SVC_INSTANCE = "mso.restapi.svc.e2einstance"; // /e2eServiceInstances/v3
-
+
/** The Constant MSO_REST_API_SVC_INSTANCE. */
public static final String MSO_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance"; // /serviceInstances/v2
@@ -79,13 +75,13 @@ public class MsoProperties extends SystemProperties {
public static final String MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance.deleteAndUnassign";
/** 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
+ public static final String MSO_REST_API_VNF_INSTANCE = "mso.restapi.vnf.instance";
/** 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}
+ public static final String MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE = "mso.restapi.vnf.changemanagement.instance";
/** The Constant MSO_REST_API_NETWORK_INSTANCE. */
- public static final String MSO_REST_API_NETWORK_INSTANCE = "mso.restapi.network.instance"; // /serviceInstances/v2/{serviceInstanceId}/networks
+ public static final String MSO_REST_API_NETWORK_INSTANCE = "mso.restapi.network.instance";
/** The Constant MSO_REST_API_GET_ORC_REQ. */
public static final String MSO_REST_API_GET_ORC_REQ = "mso.restapi.get.orc.req";
@@ -102,11 +98,14 @@ public class MsoProperties extends SystemProperties {
public static final String MSO_REST_API_VF_MODULE_SCALE_OUT = "mso.restapi.vf.module.scaleout";
/** 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
+ public static final String MSO_REST_API_VOLUME_GROUP_INSTANCE = "mso.restapi.volume.group.instance";
+
+ /** The Constant MSO_REST_API_VOLUME_GROUP_INSTANCE. */
+ public static final String MSO_REST_API_INSTANCE_GROUP = "mso.restapi.instance.group";
/** The Constant MSO_REST_API_CONFIGURATION_INSTANCE. */
- public static final String MSO_REST_API_CONFIGURATIONS = "mso.restapi.configurations"; //serviceInstances/v5/{serviceInstanceId}/configurations
- public static final String MSO_REST_API_CONFIGURATION_INSTANCE = "mso.restapi.configuration.instance"; //serviceInstances/v5/{serviceInstanceId}/configurations/{configurationId}
+ public static final String MSO_REST_API_CONFIGURATIONS = "mso.restapi.configurations";
+ public static final String MSO_REST_API_CONFIGURATION_INSTANCE = "mso.restapi.configuration.instance";
/** The Constant MSO_REST_API_OPERATIONAL_ENVIRONMENT */
public static final String MSO_REST_API_OPERATIONAL_ENVIRONMENT_ACTIVATE = "mso.restapi.operationalEnvironment.activate";
@@ -118,10 +117,9 @@ public class MsoProperties extends SystemProperties {
/** The Constant MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS */
public static final String MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS = "mso.restapi.operationalEnvironment.cloudResourcesRequests.status";
- /** The logger. */
- public EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoProperties.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+ /** The Constant MSO_REST_API_SERVICE_INSTANCE_CREATE */
+ public static final String MSO_REST_API_SERVICE_INSTANCE_CREATE = "mso.restapi.serviceInstanceCreate";
+ /** The Constant MSO_REST_API_SERVICE_INSTANCE_ASSIGN */
+ public static final String MSO_REST_API_SERVICE_INSTANCE_ASSIGN = "mso.restapi.serviceInstanceAssign";
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper.java
index b890114b5..5a35e1092 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper.java
@@ -20,6 +20,7 @@
package org.onap.vid.mso;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -111,8 +112,7 @@ public class MsoResponseWrapper implements MsoResponseWrapperInterface {
*
* @return the response
*/
- @org.codehaus.jackson.annotate.JsonIgnore
- @com.fasterxml.jackson.annotation.JsonIgnore
+ @JsonIgnore
public String getResponse () {
StringBuilder b = new StringBuilder ("{ \"status\": ");
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java
index 2372e7fb7..fff14ebc3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java
@@ -20,6 +20,7 @@
*/
package org.onap.vid.mso;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -38,7 +39,7 @@ The serialized "entity" field may be either String or nested object.
*/
public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface {
- final static ObjectMapper objectMapper = new ObjectMapper();
+ static final ObjectMapper objectMapper = new ObjectMapper();
private final int status;
private final T entity;
@@ -69,8 +70,7 @@ public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface {
}
@Override
- @org.codehaus.jackson.annotate.JsonIgnore
- @com.fasterxml.jackson.annotation.JsonIgnore
+ @JsonIgnore
public String getResponse() {
try {
return objectMapper.writeValueAsString(this);
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapperInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapperInterface.java
index ad251bdeb..e293398fb 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapperInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapperInterface.java
@@ -1,5 +1,6 @@
package org.onap.vid.mso;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
public interface MsoResponseWrapperInterface {
@@ -9,7 +10,6 @@ public interface MsoResponseWrapperInterface {
@JsonProperty("status")
int getStatus();
- @org.codehaus.jackson.annotate.JsonIgnore
- @com.fasterxml.jackson.annotation.JsonIgnore
+ @JsonIgnore
String getResponse();
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java
index 722a1c4cd..999188ffc 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java
@@ -3,14 +3,13 @@
* VID
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2018 Nokia. 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.
@@ -28,9 +27,6 @@ import org.apache.commons.lang3.ObjectUtils;
import org.glassfish.jersey.client.ClientResponse;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
import static org.onap.vid.utils.Logging.getMethodName;
/**
@@ -40,10 +36,7 @@ public class MsoUtil {
/** The logger. */
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoUtil.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
+
/**
* Wrap response.
*
@@ -67,12 +60,13 @@ public class MsoUtil {
* @return the mso response wrapper
*/
public static MsoResponseWrapper wrapResponse (ClientResponse cres) {
- String resp_str = "";
+ String respStr = "";
+ int statuscode = 0;
if ( cres != null ) {
- resp_str = cres.readEntity(String.class);
+ respStr = cres.readEntity(String.class);
+ statuscode = cres.getStatus();
}
- int statuscode = cres.getStatus();
- MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, statuscode );
+ MsoResponseWrapper w = MsoUtil.wrapResponse ( respStr, statuscode );
return (w);
}
@@ -83,16 +77,16 @@ public class MsoUtil {
* @return the mso response wrapper
*/
public static MsoResponseWrapper wrapResponse (RestObject<String> rs) {
- String resp_str = null;
+ String respStr = null;
int status = 0;
if ( rs != null ) {
- resp_str = rs.get() != null ? rs.get() : rs.getRaw();
+ respStr = rs.get() != null ? rs.get() : rs.getRaw();
status = rs.getStatusCode();
}
- MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, status );
+ MsoResponseWrapper w = MsoUtil.wrapResponse ( respStr, status );
return (w);
- }
-
+ }
+
public static <T> MsoResponseWrapper wrapResponse (HttpResponse<T> rs) {
MsoResponseWrapper w = new MsoResponseWrapper();
w.setStatus (rs.getStatus());
@@ -111,19 +105,17 @@ public class MsoUtil {
* @throws JsonProcessingException the json processing exception
*/
public static <T> String convertPojoToString ( T t ) {
-
- String methodName = "convertPojoToString";
ObjectMapper mapper = new ObjectMapper();
- String r_json_str = "";
+ String rJsonStr = "";
if ( t != null ) {
try {
- r_json_str = mapper.writeValueAsString(t);
+ rJsonStr = mapper.writeValueAsString(t);
}
catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
logger.debug(EELFLoggerDelegate.debugLogger,getMethodName() + " Unable to parse object of type " + t.getClass().getName() + " as json", j);
}
}
- return (r_json_str);
+ return (rJsonStr);
}
/**
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
index 0494facd5..31836f66a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
@@ -3,15 +3,17 @@ package org.onap.vid.mso;
import com.att.eelf.configuration.EELFLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.binary.Base64;
+import org.apache.http.HttpException;
import org.eclipse.jetty.util.security.Password;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.aai.ExceptionWithRequestInfo;
import org.onap.vid.aai.util.HttpClientMode;
import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.client.HttpBasicClient;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.mso.rest.RestInterface;
import org.onap.vid.utils.Logging;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
@@ -21,53 +23,44 @@ import javax.ws.rs.client.Invocation;
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;
-import java.util.UUID;
+import java.util.Optional;
import static org.onap.vid.utils.Logging.*;
/**
* Created by pickjonathan on 26/06/2017.
*/
-public class RestMsoImplementation implements RestInterface {
-
- public static final String START_LOG = " start";
- public static final String APPLICATION_JSON = "application/json";
- public static final String WITH_STATUS = " with status=";
- public static final String URL_LOG = ", url=";
- public static final String NO_RESPONSE_ENTITY_LOG = " No response entity, this is probably ok, e=";
- public static final String WITH_URL_LOG = " with url=";
- public static final String EXCEPTION_LOG = ", Exception: ";
- public static final String REST_API_SUCCESSFULL_LOG = " REST api was successfull!";
- public static final String REST_API_POST_WAS_SUCCESSFUL_LOG = " REST api POST was successful!";
+public abstract class RestMsoImplementation implements RestInterface {
+
/**
* The logger.
*/
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMsoImplementation.class);
+ protected EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMsoImplementation.class);
private final EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("mso");
- /**
- * The Constant dateFormat.
- */
- static final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
/** The client. */
private Client client = null;
@Autowired
- HttpsAuthClient httpsAuthClient;
-
+ protected HttpsAuthClient httpsAuthClient;
+
+ private static final String START_LOG = " start";
+ private static final String APPLICATION_JSON = "application/json";
+ private static final String WITH_STATUS = " with status=";
+ private static final String URL_LOG = ", url=";
+ private static final String NO_RESPONSE_ENTITY_LOG = " No response entity, this is probably ok, e=";
+ private static final String WITH_URL_LOG = " with url=";
+ private static final String EXCEPTION_LOG = ", Exception: ";
+ private static final String REST_API_SUCCESSFULL_LOG = " REST api was successfull!";
+ private static final String REST_MSG_TEMPLATE = "start {}->{}({}, {}, {})";
/** The common headers. */
/**
* Instantiates a new mso rest interface.
*/
@SuppressWarnings("Duplicates")
- @Override
- public MultivaluedHashMap<String, Object> initMsoClient()
+ protected MultivaluedHashMap<String, Object> initMsoClient()
{
final String methodname = "initRestClient()";
@@ -83,15 +76,11 @@ public class RestMsoImplementation implements RestInterface {
MultivaluedHashMap<String, Object> commonHeaders = new MultivaluedHashMap();
commonHeaders.put("Authorization", Collections.singletonList(("Basic " + authStringEnc)));
- //Pass calling application identifier to SO
- commonHeaders.put("X-FromAppId", Collections.singletonList(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)));
- try {
- commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(Logging.extractOrGenerateRequestId()));
- }
- catch (IllegalStateException e){
- //in async jobs we don't have any HttpServletRequest
- commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(UUID.randomUUID().toString()));
- }
+ commonHeaders.put("X-ONAP-PartnerName", Collections.singletonList("VID"));
+
+ String requestIdValue = Logging.extractOrGenerateRequestId();
+ commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue));
+ commonHeaders.put(ONAP_REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue));
boolean useSsl = true;
@@ -108,54 +97,65 @@ public class RestMsoImplementation implements RestInterface {
client = HttpBasicClient.getClient();
}
} catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " Unable to get the SSL client");
+ logger.info(EELFLoggerDelegate.errorLogger,methodname + " Unable to get the SSL client");
}
}
return commonHeaders;
}
- public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) {
+ public <T> RestObjectWithRequestInfo<T> Get(T t, String path, RestObject<T> restObject, boolean warpException) {
String methodName = "Get";
logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_LOG);
- String url="";
- restObject.set(t);
+ String url = null;
+ String rawData = null;
+ Integer status = null;
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ try {
+ restObject.set(t);
+ url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
- Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);
- final Response cres = client.target(url)
- .request()
- .accept(APPLICATION_JSON)
- .headers(commonHeaders)
- .get();
- Logging.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, cres);
- int status = cres.getStatus();
- restObject.setStatusCode (status);
+ MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
+ Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);
+ final Response cres = client.target(url)
+ .request()
+ .accept(APPLICATION_JSON)
+ .headers(commonHeaders)
+ .get();
+ Logging.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, cres);
- 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_SUCCESSFULL_LOG);
+ cres.bufferEntity();
+ status = cres.getStatus();
+ rawData = cres.readEntity(String.class);
- } else {
- throw new GenericUncheckedException(methodName + WITH_STATUS + status + ", url= " + url );
- }
+ restObject.setStatusCode(status);
- logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );
+ if (status == 200 || status == 202) {
+ t = (T) cres.readEntity(t.getClass());
+ restObject.set(t);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + REST_API_SUCCESSFULL_LOG);
- return;
+ } else {
+ throw new GenericUncheckedException(new HttpException(methodName + WITH_STATUS + status + " (200 or 202 expected), url= " + url));
+ }
+
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " received status=" + status);
+
+ return new RestObjectWithRequestInfo<>(HttpMethod.GET, url, restObject, status, rawData);
+ } catch (RuntimeException e) {
+ throw warpException ? new ExceptionWithRequestInfo(HttpMethod.GET, url, rawData, status, e) : e;
+ }
}
- public <T> RestObject<T> GetForObject(String sourceID, String path, Class<T> clazz) {
+ @Override
+ public <T> RestObject<T> GetForObject(String path, Class<T> clazz) {
final String methodName = getMethodName();
- logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {}, {})", getMethodCallerName(), methodName, sourceID, path, clazz);
+ logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {})", getMethodCallerName(), methodName, path, clazz);
String url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
+ logger.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " sending request to url= " + url);
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);
@@ -169,9 +169,9 @@ public class RestMsoImplementation implements RestInterface {
int status = cres.getStatus();
if (status == 200 || status == 202) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + REST_API_SUCCESSFULL_LOG);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + REST_API_SUCCESSFULL_LOG);
} else {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_STATUS +status+ URL_LOG +url);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_STATUS +status+ URL_LOG +url);
}
logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );
@@ -180,13 +180,13 @@ public class RestMsoImplementation implements RestInterface {
}
@Override
- public <T> void Delete(T t, Object r, String sourceID, String path, RestObject<T> restObject) {
+ public <T> void Delete(T t, Object r, String path, RestObject<T> restObject) {
String methodName = "Delete";
String url="";
- Response cres = null;
+ Response cres;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + START_LOG);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + START_LOG);
try {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
@@ -206,16 +206,16 @@ public class RestMsoImplementation implements RestInterface {
if (status == 404) { // resource not found
String msg = "Resource does not exist...: " + cres.getStatus();
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + msg);
} else if (status == 200 || status == 204){
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + "Resource " + url + " deleted");
} else if (status == 202) {
- String msg = "Delete in progress: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ String msg = "Delete in progress: " + status;
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + msg);
}
else {
String msg = "Deleting Resource failed: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + msg);
}
try {
@@ -223,37 +223,40 @@ public class RestMsoImplementation implements RestInterface {
restObject.set(t);
}
catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + NO_RESPONSE_ENTITY_LOG
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + NO_RESPONSE_ENTITY_LOG
+ e.getMessage());
}
}
catch (Exception e)
{
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
throw e;
}
}
- public <T> RestObject<T> PostForObject(Object requestDetails, String sourceID, String path, Class<T> clazz) {
- logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {}, {}, {})", getMethodCallerName(), getMethodName(), requestDetails, sourceID, path, clazz);
- RestObject<T> restObject = new RestObject<>();
- Post(clazz, requestDetails, path, restObject);
- return restObject;
+ public <T> RestObject<T> PostForObject(Object requestDetails, String path, Class<T> clazz) {
+ logger.debug(EELFLoggerDelegate.debugLogger, REST_MSG_TEMPLATE, getMethodCallerName(), getMethodName(), requestDetails, path, clazz);
+ return restCall(HttpMethod.POST, clazz, requestDetails, path);
+ }
+
+ public <T> RestObject<T> DeleteForObject(Object requestDetails, String path, Class<T> clazz) {
+ logger.debug(EELFLoggerDelegate.debugLogger, REST_MSG_TEMPLATE, getMethodCallerName(), getMethodName(), requestDetails, path, clazz);
+ return restCall(HttpMethod.DELETE, clazz, requestDetails, path);
}
@Override
- public <T> void Post(T t, Object r, String sourceID, String path, RestObject<T> restObject) {
- logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {}, {}, {})", getMethodCallerName(), getMethodName(), t.getClass(), r, sourceID, path);
- Post(t.getClass(), r, path, restObject);
+ public void Post(String t, Object r, String path, RestObject<String> restObject) {
+ logger.debug(EELFLoggerDelegate.debugLogger, REST_MSG_TEMPLATE, getMethodCallerName(), getMethodName(), t.getClass(), r, path);
+ restObject.copyFrom(restCall(HttpMethod.POST, String.class, r, path));
}
public Invocation.Builder prepareClient(String path, String methodName) {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
String url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + " sending request to url= " + url);
// Change the content length
return client.target(url)
.request()
@@ -261,49 +264,44 @@ public class RestMsoImplementation implements RestInterface {
.headers(commonHeaders);
}
+ public <T> RestObject<T> restCall(HttpMethod httpMethod, Class<T> tClass, Object payload, String path) {
+ return restCall(httpMethod, tClass, payload, path, Optional.empty());
+ }
- public <T> void Post(Class<?> tClass, Object requestDetails, String path, RestObject<T> restObject) {
- String methodName = "Post";
+ /*
+ user id is needed to be pass as X-RequestorID in new MSO flows like Delete instanceGroup
+ */
+ public <T> RestObject<T> restCall(HttpMethod httpMethod, Class<T> tClass, Object payload, String path, Optional<String> userId) {
+ String methodName = httpMethod.name();
String url="";
try {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
+ userId.ifPresent(id->commonHeaders.put("X-RequestorID", Collections.singletonList(id)));
url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- Logging.logRequest(outgoingRequestsLogger, HttpMethod.POST, url, requestDetails);
+ Logging.logRequest(outgoingRequestsLogger, httpMethod, url, payload);
// Change the content length
- final Response cres = client.target(url)
+ final Invocation.Builder restBuilder = client.target(url)
.request()
.accept(APPLICATION_JSON)
- .headers(commonHeaders)
- .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON));
- Logging.logResponse(outgoingRequestsLogger, HttpMethod.POST, url, cres);
- final RestObject<T> cresToRestObject = cresToRestObject(cres, tClass);
- restObject.set(cresToRestObject.get());
- restObject.setStatusCode(cresToRestObject.getStatusCode());
- restObject.setRaw(cresToRestObject.getRaw());
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
+ .headers(commonHeaders);
- if ( status >= 200 && status <= 299 ) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);
-
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_STATUS +status+ URL_LOG +url);
- }
+ Invocation restInvocation = payload==null ?
+ restBuilder.build(httpMethod.name()) :
+ restBuilder.build(httpMethod.name(), Entity.entity(payload, MediaType.APPLICATION_JSON));
+ final Response cres = restInvocation.invoke();
- } catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
+ Logging.logResponse(outgoingRequestsLogger, httpMethod, url, cres);
+ return cresToRestObject(cres, tClass);
+ }
+ catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
throw e;
-
}
- logger.debug(EELFLoggerDelegate.debugLogger, "end {}() => ({}){}", getMethodName(), tClass, restObject);
}
private <T> RestObject<T> cresToRestObject(Response cres, Class<?> tClass) {
@@ -319,10 +317,10 @@ public class RestMsoImplementation implements RestInterface {
}
catch ( Exception e ) {
try {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + " Error reading response entity as " + tClass + ": , e="
+ logger.debug(EELFLoggerDelegate.debugLogger, "<== " + getMethodCallerName() + " Error reading response entity as " + tClass + ": , e="
+ e.getMessage() + ", Entity=" + rawEntity);
} catch (Exception e2) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + NO_RESPONSE_ENTITY_LOG
+ logger.debug(EELFLoggerDelegate.debugLogger, "<== " + getMethodCallerName() + NO_RESPONSE_ENTITY_LOG
+ e.getMessage());
}
}
@@ -335,12 +333,12 @@ public class RestMsoImplementation implements RestInterface {
}
@Override
- public <T> void Put(T t, org.onap.vid.changeManagement.RequestDetailsWrapper r, String sourceID, String path, RestObject<T> restObject) {
+ public <T> void Put(T t, org.onap.vid.changeManagement.RequestDetailsWrapper r, String path, RestObject<T> restObject) {
String methodName = "Put";
String url="";
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + START_LOG);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + START_LOG);
try {
@@ -354,7 +352,6 @@ public class RestMsoImplementation implements RestInterface {
.accept(APPLICATION_JSON)
.headers(commonHeaders)
//.header("content-length", 201)
- //.header("X-FromAppId", sourceID)
.put(Entity.entity(r, MediaType.APPLICATION_JSON));
Logging.logResponse(outgoingRequestsLogger, HttpMethod.PUT, url, cres);
@@ -364,7 +361,7 @@ public class RestMsoImplementation implements RestInterface {
restObject.set(t);
}
catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + NO_RESPONSE_ENTITY_LOG
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + NO_RESPONSE_ENTITY_LOG
+ e.getMessage());
}
@@ -372,16 +369,16 @@ public class RestMsoImplementation implements RestInterface {
restObject.setStatusCode (status);
if ( status >= 200 && status <= 299 ) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);
+ logger.info(EELFLoggerDelegate.errorLogger, "<== " + methodName + REST_API_SUCCESSFULL_LOG);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + REST_API_SUCCESSFULL_LOG);
} else {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_STATUS +status+ URL_LOG +url);
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_STATUS +status+ URL_LOG +url);
}
} catch (Exception e)
{
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
throw e;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/RestObject.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestObject.java
index e5024518b..7ebecba57 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/RestObject.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestObject.java
@@ -25,9 +25,6 @@ import com.google.common.base.MoreObjects;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import javax.ws.rs.core.Response;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import static org.onap.vid.utils.Logging.getMethodCallerName;
@@ -38,9 +35,7 @@ import static org.onap.vid.utils.Logging.getMethodCallerName;
*/
public class RestObject<T> {
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- final static ObjectMapper objectMapper = new ObjectMapper();
+ static final ObjectMapper objectMapper = new ObjectMapper();
/**
* Generic version of the RestObject class.
@@ -58,6 +53,12 @@ public class RestObject<T> {
public RestObject() {
}
+ public void copyFrom(RestObject<T> src) {
+ set(src.get());
+ setRaw(src.getRaw());
+ setStatusCode(src.getStatusCode());
+ }
+
public RestObject(Response cres, Class<?> tClass, EELFLoggerDelegate logger) {
String rawEntity = null;
@@ -70,10 +71,10 @@ public class RestObject<T> {
catch ( Exception e ) {
try {
this.setRaw(rawEntity);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + " Error reading response entity as " + tClass + ": , e="
+ logger.debug(EELFLoggerDelegate.debugLogger, "<== " + getMethodCallerName() + " Error reading response entity as " + tClass + ": , e="
+ e.getMessage() + ", Entity=" + rawEntity);
} catch (Exception e2) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + " No response entity, this is probably ok, e="
+ logger.debug(EELFLoggerDelegate.debugLogger, "<== " + getMethodCallerName() + " No response entity, this is probably ok, e="
+ e.getMessage());
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/RestObjectWithRequestInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestObjectWithRequestInfo.java
new file mode 100644
index 000000000..98cc808cd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestObjectWithRequestInfo.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.onap.vid.mso;
+
+import org.springframework.http.HttpMethod;
+
+public class RestObjectWithRequestInfo<T> {
+
+ private final RestObject<T> restObject;
+ private final String requestedUrl;
+ private final int httpCode;
+ private final String rawData;
+ private final HttpMethod httpMethod;
+
+ public RestObjectWithRequestInfo(HttpMethod httpMethod, String requestedUrl, RestObject<T> restObject, int httpCode, String rawData) {
+ this.restObject = restObject;
+ this.requestedUrl = requestedUrl;
+ this.httpCode = httpCode;
+ this.rawData = rawData;
+ this.httpMethod = httpMethod;
+ }
+
+ public RestObject<T> getRestObject() {
+ return restObject;
+ }
+
+ public String getRequestedUrl() {
+ return requestedUrl;
+ }
+
+ public int getHttpCode() {
+ return httpCode;
+ }
+
+ public String getRawData() {
+ return rawData;
+ }
+
+ public HttpMethod getHttpMethod() {
+ return httpMethod;
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java
new file mode 100644
index 000000000..9ade2abc4
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java
@@ -0,0 +1,142 @@
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+import java.util.List;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+@JsonInclude(NON_NULL)
+public class BaseResourceInstantiationRequestDetails {
+
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+
+ @JsonProperty("requestInfo")
+ protected RequestInfo requestInfo;
+
+ @JsonProperty("platform")
+ protected Platform platform;
+
+ @JsonProperty("lineOfBusiness")
+ protected LineOfBusiness lineOfBusiness;
+
+ @JsonProperty("relatedInstanceList")
+ protected List<RelatedInstance> relatedInstanceList;
+
+ @JsonProperty("requestParameters")
+ protected RequestParameters requestParameters;
+
+ public BaseResourceInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
+ @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
+ @JsonProperty(value = "platform", required = true) Platform platform,
+ @JsonProperty(value = "lineOfBusiness", required = true) LineOfBusiness lineOfBusiness,
+ @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
+ @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters)
+ {
+ this.modelInfo = modelInfo;
+ this.cloudConfiguration = cloudConfiguration;
+ this.requestInfo = requestInfo;
+ this.platform = platform;
+ this.lineOfBusiness = lineOfBusiness;
+ this.relatedInstanceList = relatedInstanceList;
+ this.requestParameters = requestParameters;
+ }
+
+ public BaseResourceInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
+ @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
+ @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
+ @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters)
+ {
+ this.modelInfo = modelInfo;
+ this.cloudConfiguration = cloudConfiguration;
+ this.requestInfo = requestInfo;
+ this.relatedInstanceList = relatedInstanceList;
+ this.requestParameters = requestParameters;
+ }
+
+ public static class RequestInfo {
+
+ @JsonInclude(NON_NULL) public final String instanceName;
+ @JsonInclude(NON_NULL) public final String productFamilyId;
+ public final String source;
+ public final boolean suppressRollback;
+ public final String requestorId;
+
+ public RequestInfo(String instanceName, String productFamilyId, String source, boolean rollbackOnFailure, String requestorId) {
+ this.instanceName = instanceName;
+ this.productFamilyId = productFamilyId;
+ this.source = source;
+ this.requestorId = requestorId;
+ // in the FE we are asking for "RollbackOnFailure" but to MSO we are passing the negative value "suppressRollback"
+ this.suppressRollback = !rollbackOnFailure;
+ }
+ }
+
+ public static class Project{
+ public final String projectName;
+
+ public Project(String projectName) {
+ this.projectName = projectName;
+ }
+ }
+
+ public static class Platform{
+ public final String platformName;
+
+ public Platform(String platformName) {
+ this.platformName = platformName;
+ }
+ }
+
+ public static class LineOfBusiness{
+ public final String lineOfBusinessName;
+
+ public LineOfBusiness(String lineOfBusiness) {
+ this.lineOfBusinessName = lineOfBusiness;
+ }
+ }
+
+ @JsonTypeName("relatedInstance")
+ @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
+ public static class RelatedInstance{
+ public ModelInfo modelInfo;
+ @JsonInclude(NON_NULL) public String instanceId; //TODO ask Eylon - is this needed, and if yes, for other fields as well?
+ @JsonInclude(NON_NULL) public String instanceName;
+
+ public RelatedInstance (@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty (value = "instanceId", required = true) String instanceId){
+ this.modelInfo = modelInfo;
+ this.instanceId = instanceId;
+ }
+
+ public RelatedInstance (@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty (value = "instanceId", required = true) String instanceId,
+ @JsonProperty (value = "instanceName", required = true) String instanceName){
+ this.modelInfo = modelInfo;
+ this.instanceId = instanceId;
+ this.instanceName = instanceName;
+ }
+ }
+
+ public static class RequestParameters {
+ public final List<? extends UserParamTypes> userParams;
+
+ public RequestParameters(List<? extends UserParamTypes> userParams) {
+ this.userParams = userParams;
+ }
+
+ public List<? extends UserParamTypes> getUserParams() {
+ return userParams;
+ }
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java
new file mode 100644
index 000000000..8286ec2b0
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java
@@ -0,0 +1,173 @@
+
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * fields communicating the cloud configuration in a standard way
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "nodeLocation",
+ "lcpCloudRegionId",
+ "tenantId",
+ "cloudOwner"
+})
+public class CloudConfiguration {
+
+ /**
+ * Location identifier for the node
+ *
+ */
+ @JsonProperty("nodeLocation")
+ private String nodeLocation;
+ /**
+ * LCP Node Location identifier
+ *
+ */
+ @JsonProperty("lcpCloudRegionId")
+ private String lcpCloudRegionId;
+ /**
+ * Openstack tenant id
+ *
+ */
+ @JsonProperty("tenantId")
+ private String tenantId;
+ /**
+ * the cloud owner
+ *
+ */
+ @JsonProperty("cloudOwner")
+ private String cloudOwner;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ * Location identifier for the node
+ *
+ * @return
+ * The nodeLocation
+ */
+ @JsonProperty("nodeLocation")
+ public String getNodeLocation() {
+ return nodeLocation;
+ }
+
+ /**
+ * Location identifier for the node
+ *
+ * @param nodeLocation
+ * The nodeLocation
+ */
+ @JsonProperty("nodeLocation")
+ public void setNodeLocation(String nodeLocation) {
+ this.nodeLocation = nodeLocation;
+ }
+
+ /**
+ * LCP Node Location identifier
+ *
+ * @return
+ * The lcpCloudRegionId
+ */
+ @JsonProperty("lcpCloudRegionId")
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ /**
+ * LCP Node Location identifier
+ *
+ * @param lcpCloudRegionId
+ * The lcpCloudRegionId
+ */
+ @JsonProperty("lcpCloudRegionId")
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+ /**
+ * Openstack tenant id
+ *
+ * @return
+ * The tenantId
+ */
+ @JsonProperty("tenantId")
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Openstack tenant id
+ *
+ * @param tenantId
+ * The tenantId
+ */
+ @JsonProperty("tenantId")
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ /**
+ * the cloud owner
+ *
+ * @return
+ * The cloudOwner
+ */
+ @JsonProperty("cloudOwner")
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ /**
+ * the cloud owner
+ *
+ * @param cloudOwner
+ * The cloudOwner
+ */
+ @JsonProperty("cloudOwner")
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(nodeLocation).append(lcpCloudRegionId).append(tenantId).append(cloudOwner).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof CloudConfiguration)) {
+ return false;
+ }
+ CloudConfiguration rhs = ((CloudConfiguration) other);
+ return new EqualsBuilder().append(nodeLocation, rhs.nodeLocation).append(lcpCloudRegionId, rhs.lcpCloudRegionId).append(tenantId, rhs.tenantId).append(cloudOwner, rhs.cloudOwner).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java
new file mode 100644
index 000000000..26013412b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java
@@ -0,0 +1,48 @@
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+/* Based on this model:
+
+//{
+// "requestDetails": {
+// "modelInfo": {
+// "modelType": "instanceGroup",
+// "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc"
+// },
+// "requestInfo": {
+// "source": "VID",
+// "requestorId": "az2016"
+// },
+// "relatedInstanceList": [
+// {
+// "relatedInstance": {
+// "instanceId": "{the relate-to/parent serviceInstanceId}",
+// "modelInfo": {
+// "modelType": "service",
+// "modelVersionId": "b3b7e7d3-ecb9-4a91-8f6d-e60d236e8e77",
+// }
+// }
+// }
+// ],
+// "requestParameters": {
+// "userParams": []
+// }
+// }
+//}
+
+ */
+
+public class InstanceGroupInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails {
+
+ public InstanceGroupInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
+ @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
+ @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters)
+ {
+ super(modelInfo, null, requestInfo, null, null, relatedInstanceList, requestParameters);
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java
new file mode 100644
index 000000000..091a241df
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java
@@ -0,0 +1,279 @@
+
+package org.onap.vid.mso.model;
+
+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;
+
+
+/**
+ * fields describing the SDC entity being operated on by the request
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "modelCustomizationName",
+ "modelCustomizationId",
+ "modelInvariantId",
+ "modelVersionId",
+ "modelName",
+ "modelNameVersionId",
+ "modelType",
+ "modelVersion"
+})
+public class ModelInfo {
+
+ /**
+ * reference to the customized set of parameters associated with a model in a given service context
+ *
+ */
+ @JsonProperty("modelCustomizationName")
+ private String modelCustomizationName;
+ /**
+ * reference to the customized set of parameters associated with a model in a given service context
+ *
+ */
+ @JsonProperty("modelCustomizationId")
+ private String modelCustomizationId;
+ /**
+ * Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative
+ *
+ */
+ @JsonProperty("modelInvariantId")
+ private String modelInvariantId;
+ /**
+ * Version id for version
+ *
+ */
+ @JsonProperty("modelVersionId")
+ private String modelVersionId;
+ /**
+ * name of the model as defined in SDC--not authoritative
+ *
+ */
+ @JsonProperty("modelName")
+ private String modelName;
+ /**
+ * UUID for the model name and version combination as defined in SDC--authoritative
+ *
+ */
+ @JsonProperty("modelNameVersionId")
+ private String modelNameVersionId;
+ /**
+ * short description of the entity being operated on
+ * (Required)
+ *
+ */
+ @JsonProperty("modelType")
+ private String modelType;
+ /**
+ * the version of the model as defined in SDC--not authoritative
+ *
+ */
+ @JsonProperty("modelVersion")
+ private String modelVersion;
+
+ /**
+ * reference to the customized set of parameters associated with a model in a given service context
+ *
+ * @return
+ * The modelCustomizationName
+ */
+ @JsonProperty("modelCustomizationName")
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ /**
+ * reference to the customized set of parameters associated with a model in a given service context
+ *
+ * @param modelCustomizationName
+ * The modelCustomizationName
+ */
+ @JsonProperty("modelCustomizationName")
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ /**
+ * reference to the customized set of parameters associated with a model in a given service context
+ *
+ * @return
+ * The modelCustomizationId
+ */
+ @JsonProperty("modelCustomizationId")
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ /**
+ * reference to the customized set of parameters associated with a model in a given service context
+ *
+ * @param modelCustomizationId
+ * The modelCustomizationId
+ */
+ @JsonProperty("modelCustomizationId")
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ /**
+ * Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative
+ *
+ * @return
+ * The modelInvariantId
+ */
+ @JsonProperty("modelInvariantId")
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ /**
+ * Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative
+ *
+ * @param modelInvariantId
+ * The modelInvariantId
+ */
+ @JsonProperty("modelInvariantId")
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ /**
+ * Version id for version
+ *
+ * @return
+ * The modelVersionId
+ */
+ @JsonProperty("modelVersionId")
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ /**
+ * Version id for version
+ *
+ * @param modelVersionId
+ * The modelVersionId
+ */
+ @JsonProperty("modelVersionId")
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ /**
+ * name of the model as defined in SDC--not authoritative
+ *
+ * @return
+ * The modelName
+ */
+ @JsonProperty("modelName")
+ public String getModelName() {
+ return modelName;
+ }
+
+ /**
+ * name of the model as defined in SDC--not authoritative
+ *
+ * @param modelName
+ * The modelName
+ */
+ @JsonProperty("modelName")
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ /**
+ * UUID for the model name and version combination as defined in SDC--authoritative
+ *
+ * @return
+ * The modelNameVersionId
+ */
+ @JsonProperty("modelNameVersionId")
+ public String getModelNameVersionId() {
+ return modelNameVersionId;
+ }
+
+ /**
+ * UUID for the model name and version combination as defined in SDC--authoritative
+ *
+ * @param modelNameVersionId
+ * The modelNameVersionId
+ */
+ @JsonProperty("modelNameVersionId")
+ public void setModelNameVersionId(String modelNameVersionId) {
+ this.modelNameVersionId = modelNameVersionId;
+ }
+
+ /**
+ * short description of the entity being operated on
+ * (Required)
+ *
+ * @return
+ * The modelType
+ */
+ @JsonProperty("modelType")
+ public String getModelType() {
+ return modelType;
+ }
+
+ /**
+ * short description of the entity being operated on
+ * (Required)
+ *
+ * @param modelType
+ * The modelType
+ */
+ @JsonProperty("modelType")
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ /**
+ * the version of the model as defined in SDC--not authoritative
+ *
+ * @return
+ * The modelVersion
+ */
+ @JsonProperty("modelVersion")
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ /**
+ * the version of the model as defined in SDC--not authoritative
+ *
+ * @param modelVersion
+ * The modelVersion
+ */
+ @JsonProperty("modelVersion")
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationName).append(modelCustomizationId).append(modelInvariantId).append(modelVersionId).append(modelName).append(modelNameVersionId).append(modelType).append(modelVersion).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof ModelInfo)) {
+ return false;
+ }
+ ModelInfo rhs = ((ModelInfo) other);
+ return new EqualsBuilder().append(modelCustomizationName, rhs.modelCustomizationName).append(modelCustomizationId, rhs.modelCustomizationId).append(modelInvariantId, rhs.modelInvariantId).append(modelVersionId, rhs.modelVersionId).append(modelName, rhs.modelName).append(modelNameVersionId, rhs.modelNameVersionId).append(modelType, rhs.modelType).append(modelVersion, rhs.modelVersion).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java
new file mode 100644
index 000000000..d8539f6a9
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java
@@ -0,0 +1,86 @@
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+/* Based on this model:
+
+
+// {
+// "requestDetails": {
+// "modelInfo": {
+// “modelType”: “network”,
+// “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”,
+// “modelVersionId”: “fe042c22-ba82-43c6-b2f6-8f1fc4164091”,
+// “modelName”: “vSAMP12”,
+// "modelVersion": "1.0",
+// “modelCustomizationName”: “vSAMP12 1”,
+// “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7”
+// },
+// “cloudConfiguration”: {
+// “lcpCloudRegionId”: “mdt1”,
+// “tenantId”: “88a6ca3ee0394ade9403f075db23167e”
+// },
+// "requestInfo": {
+// “instanceName”: “MSOTEST103a”,
+// “productFamilyId”: “a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb”,
+// “source”: “VID”,
+// “suppressRollback”: false,
+// “requestorId”: “az2016”
+// },
+// "platform": {
+// "platformName": "{some platformName}"
+// },
+// "lineOfBusiness": {
+// "lineOfBusinessName": "{some string}"
+// },
+// "relatedInstanceList": [
+// {
+// “relatedInstance”: {
+// “instanceId”: “{serviceInstanceId}”,
+// “modelInfo”: {
+// “modelType”: “service”,
+// “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”,
+// “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”,
+// “modelName”: “{parent service model name}”,
+// "modelVersion": "1.0"
+// }
+// }
+// },
+// {
+// “relatedInstance”: {
+// “instanceId”: “{instanceGroupId}”,
+// “modelInfo”: {
+// “modelType”: “networkCollection”,
+// “modelInvariantId”: “9ea660dc-155f-44d3-b45c-cc7648b4f31c”,
+// “modelVersionId”: “bb07aad1-ce2d-40c1-85cb-5392f76bb1ef”,
+// “modelName”: “{network collection model name}”,
+// "modelVersion": "1.0"
+// }
+// }
+// }
+
+// ],
+// “requestParameters”: {
+// “userParams”: []
+// }
+// }
+// }
+
+ */
+
+public class NetworkInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails {
+
+ public NetworkInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
+ @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
+ @JsonProperty(value = "platform", required = true) Platform platform,
+ @JsonProperty(value = "lineOfBusiness", required = true) LineOfBusiness lineOfBusiness,
+ @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
+ @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters)
+ {
+ super(modelInfo, cloudConfiguration, requestInfo, platform, lineOfBusiness, relatedInstanceList, requestParameters);
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java
index a5a10a774..bca643a6d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java
@@ -1,8 +1,7 @@
package org.onap.vid.mso.model;
-import org.onap.vid.controllers.OperationalEnvironmentController;
-
import com.google.common.base.MoreObjects;
+import org.onap.vid.controller.OperationalEnvironmentController;
public class OperationalEnvironmentActivateInfo extends OperationalEnvironmentController.OperationalEnvironmentActivateBody {
private final String userId;
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java
new file mode 100644
index 000000000..1290361a1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java
@@ -0,0 +1,376 @@
+
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * fields providing general context information for the request
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "billingAccountNumber",
+ "callbackUrl",
+ "correlator",
+ "instanceName",
+ "orderNumber",
+ "orderVersion",
+ "productFamilyId",
+ "source",
+ "suppressRollback",
+ "responseValue",
+ "requestorId"
+})
+public class RequestInfo {
+
+ /**
+ * billing account associated with the model being operated on
+ *
+ */
+ @JsonProperty("billingAccountNumber")
+ private String billingAccountNumber;
+ /**
+ * client URL to use for asynchronous responses
+ *
+ */
+ @JsonProperty("callbackUrl")
+ private String callbackUrl;
+ /**
+ * Optional correlationId for async callback requests
+ *
+ */
+ @JsonProperty("correlator")
+ private String correlator;
+ /**
+ * Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique)
+ *
+ */
+ @JsonProperty("instanceName")
+ private String instanceName;
+ /**
+ * reference to an order
+ *
+ */
+ @JsonProperty("orderNumber")
+ private String orderNumber;
+ /**
+ * order version number
+ *
+ */
+ @JsonProperty("orderVersion")
+ private Double orderVersion;
+ /**
+ * UUID for the product family associated with the model being operated on
+ *
+ */
+ @JsonProperty("productFamilyId")
+ private String productFamilyId;
+ /**
+ * source of the request--not authoritative--actual source revealed via authentication
+ *
+ */
+ @JsonProperty("source")
+ private String source;
+ /**
+ * true or false boolean indicating whether rollbacks should be suppressed on failures
+ *
+ */
+ @JsonProperty("suppressRollback")
+ private Boolean suppressRollback;
+ /**
+ * Is the user selected value based on the validResponses list provided to complete the manual task
+ *
+ */
+ @JsonProperty("responseValue")
+ private String responseValue;
+ /**
+ * The id of the person who initiated the completion request
+ *
+ */
+ @JsonProperty("requestorId")
+ private String requestorId;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ * billing account associated with the model being operated on
+ *
+ * @return
+ * The billingAccountNumber
+ */
+ @JsonProperty("billingAccountNumber")
+ public String getBillingAccountNumber() {
+ return billingAccountNumber;
+ }
+
+ /**
+ * billing account associated with the model being operated on
+ *
+ * @param billingAccountNumber
+ * The billingAccountNumber
+ */
+ @JsonProperty("billingAccountNumber")
+ public void setBillingAccountNumber(String billingAccountNumber) {
+ this.billingAccountNumber = billingAccountNumber;
+ }
+
+ /**
+ * client URL to use for asynchronous responses
+ *
+ * @return
+ * The callbackUrl
+ */
+ @JsonProperty("callbackUrl")
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ /**
+ * client URL to use for asynchronous responses
+ *
+ * @param callbackUrl
+ * The callbackUrl
+ */
+ @JsonProperty("callbackUrl")
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ /**
+ * Optional correlationId for async callback requests
+ *
+ * @return
+ * The correlator
+ */
+ @JsonProperty("correlator")
+ public String getCorrelator() {
+ return correlator;
+ }
+
+ /**
+ * Optional correlationId for async callback requests
+ *
+ * @param correlator
+ * The correlator
+ */
+ @JsonProperty("correlator")
+ public void setCorrelator(String correlator) {
+ this.correlator = correlator;
+ }
+
+ /**
+ * Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique)
+ *
+ * @return
+ * The instanceName
+ */
+ @JsonProperty("instanceName")
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ /**
+ * Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique)
+ *
+ * @param instanceName
+ * The instanceName
+ */
+ @JsonProperty("instanceName")
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ /**
+ * reference to an order
+ *
+ * @return
+ * The orderNumber
+ */
+ @JsonProperty("orderNumber")
+ public String getOrderNumber() {
+ return orderNumber;
+ }
+
+ /**
+ * reference to an order
+ *
+ * @param orderNumber
+ * The orderNumber
+ */
+ @JsonProperty("orderNumber")
+ public void setOrderNumber(String orderNumber) {
+ this.orderNumber = orderNumber;
+ }
+
+ /**
+ * order version number
+ *
+ * @return
+ * The orderVersion
+ */
+ @JsonProperty("orderVersion")
+ public Double getOrderVersion() {
+ return orderVersion;
+ }
+
+ /**
+ * order version number
+ *
+ * @param orderVersion
+ * The orderVersion
+ */
+ @JsonProperty("orderVersion")
+ public void setOrderVersion(Double orderVersion) {
+ this.orderVersion = orderVersion;
+ }
+
+ /**
+ * UUID for the product family associated with the model being operated on
+ *
+ * @return
+ * The productFamilyId
+ */
+ @JsonProperty("productFamilyId")
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ /**
+ * UUID for the product family associated with the model being operated on
+ *
+ * @param productFamilyId
+ * The productFamilyId
+ */
+ @JsonProperty("productFamilyId")
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ /**
+ * source of the request--not authoritative--actual source revealed via authentication
+ *
+ * @return
+ * The source
+ */
+ @JsonProperty("source")
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * source of the request--not authoritative--actual source revealed via authentication
+ *
+ * @param source
+ * The source
+ */
+ @JsonProperty("source")
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ /**
+ * true or false boolean indicating whether rollbacks should be suppressed on failures
+ *
+ * @return
+ * The suppressRollback
+ */
+ @JsonProperty("suppressRollback")
+ public Boolean getSuppressRollback() {
+ return suppressRollback;
+ }
+
+ /**
+ * true or false boolean indicating whether rollbacks should be suppressed on failures
+ *
+ * @param suppressRollback
+ * The suppressRollback
+ */
+ @JsonProperty("suppressRollback")
+ public void setSuppressRollback(Boolean suppressRollback) {
+ this.suppressRollback = suppressRollback;
+ }
+
+ /**
+ * Is the user selected value based on the validResponses list provided to complete the manual task
+ *
+ * @return
+ * The responseValue
+ */
+ @JsonProperty("responseValue")
+ public String getResponseValue() {
+ return responseValue;
+ }
+
+ /**
+ * Is the user selected value based on the validResponses list provided to complete the manual task
+ *
+ * @param responseValue
+ * The responseValue
+ */
+ @JsonProperty("responseValue")
+ public void setResponseValue(String responseValue) {
+ this.responseValue = responseValue;
+ }
+
+ /**
+ * The id of the person who initiated the completion request
+ *
+ * @return
+ * The requestorId
+ */
+ @JsonProperty("requestorId")
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ /**
+ * The id of the person who initiated the completion request
+ *
+ * @param requestorId
+ * The requestorId
+ */
+ @JsonProperty("requestorId")
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(billingAccountNumber).append(callbackUrl).append(correlator).append(instanceName).append(orderNumber).append(orderVersion).append(productFamilyId).append(source).append(suppressRollback).append(responseValue).append(requestorId).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof RequestInfo)) {
+ return false;
+ }
+ RequestInfo rhs = ((RequestInfo) other);
+ return new EqualsBuilder().append(billingAccountNumber, rhs.billingAccountNumber).append(callbackUrl, rhs.callbackUrl).append(correlator, rhs.correlator).append(instanceName, rhs.instanceName).append(orderNumber, rhs.orderNumber).append(orderVersion, rhs.orderVersion).append(productFamilyId, rhs.productFamilyId).append(source, rhs.source).append(suppressRollback, rhs.suppressRollback).append(responseValue, rhs.responseValue).append(requestorId, rhs.requestorId).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java
new file mode 100644
index 000000000..65e351258
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java
@@ -0,0 +1,123 @@
+
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "subscriptionServiceType",
+ "testApi",
+ "userParams"
+})
+public class RequestParameters {
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+ @JsonProperty("testApi")
+ private String testApi;
+ @JsonProperty("userParams")
+ private List<UserParam> userParams = new ArrayList<>();
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ *
+ * @return
+ * The subscriptionServiceType
+ */
+ @JsonProperty("subscriptionServiceType")
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ /**
+ *
+ * @param subscriptionServiceType
+ * The subscriptionServiceType
+ */
+ @JsonProperty("subscriptionServiceType")
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ /**
+ *
+ * @return
+ * The testApi
+ */
+ @JsonProperty("testApi")
+ public String getTestApi() {
+ return testApi;
+ }
+
+ /**
+ *
+ * @param testApi
+ * The testApi
+ */
+ @JsonProperty("testApi")
+ public void setTestApi(String testApi) {
+ this.testApi = testApi;
+ }
+
+ /**
+ *
+ * @return
+ * The userParams
+ */
+ @JsonProperty("userParams")
+ public List<UserParam> getUserParams() {
+ return userParams;
+ }
+
+ /**
+ *
+ * @param userParams
+ * The userParams
+ */
+ @JsonProperty("userParams")
+ public void setUserParams(List<UserParam> userParams) {
+ this.userParams = userParams;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(subscriptionServiceType).append(testApi).append(userParams).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof RequestParameters)) {
+ return false;
+ }
+ RequestParameters rhs = ((RequestParameters) other);
+ return new EqualsBuilder().append(subscriptionServiceType, rhs.subscriptionServiceType).append(testApi, rhs.testApi).append(userParams, rhs.userParams).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java
new file mode 100644
index 000000000..9c044e113
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java
@@ -0,0 +1,121 @@
+
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * provides the instanceId and requestId associated with the request
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "instanceId",
+ "requestId"
+})
+public class RequestReferences {
+
+ /**
+ * UUID for the service instance
+ * (Required)
+ *
+ */
+ @JsonProperty("instanceId")
+ private String instanceId;
+ /**
+ * UUID for the request
+ * (Required)
+ *
+ */
+ @JsonProperty("requestId")
+ private String requestId;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ * UUID for the service instance
+ * (Required)
+ *
+ * @return
+ * The instanceId
+ */
+ @JsonProperty("instanceId")
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ /**
+ * UUID for the service instance
+ * (Required)
+ *
+ * @param instanceId
+ * The instanceId
+ */
+ @JsonProperty("instanceId")
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ /**
+ * UUID for the request
+ * (Required)
+ *
+ * @return
+ * The requestId
+ */
+ @JsonProperty("requestId")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * UUID for the request
+ * (Required)
+ *
+ * @param requestId
+ * The requestId
+ */
+ @JsonProperty("requestId")
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(instanceId).append(requestId).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof RequestReferences)) {
+ return false;
+ }
+ RequestReferences rhs = ((RequestReferences) other);
+ return new EqualsBuilder().append(instanceId, rhs.instanceId).append(requestId, rhs.requestId).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt
new file mode 100644
index 000000000..c41db0861
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt
@@ -0,0 +1,15 @@
+package org.onap.vid.mso.model
+
+import com.fasterxml.jackson.annotation.JsonInclude
+import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
+import com.fasterxml.jackson.annotation.JsonProperty
+
+class ServiceDeletionRequestDetails(val modelInfo: ModelInfo,
+ val requestInfo: RequestInfo,
+ val requestParameters: RequestParameters) {
+
+ class RequestInfo(val source: String, val requestorId: String)
+
+ class RequestParameters(@JsonInclude(NON_NULL) @get:JsonProperty("aLaCarte") val aLaCarte: Boolean?,
+ @JsonInclude(NON_NULL) val testApi: String?)
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java
index 1a54b74cb..c6d89e31f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java
@@ -2,12 +2,7 @@ package org.onap.vid.mso.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import org.onap.vid.domain.mso.CloudConfiguration;
-import org.onap.vid.domain.mso.ModelInfo;
-import org.onap.vid.domain.mso.SubscriberInfo;
-import org.onap.vid.model.serviceInstantiation.VfModule;
+import org.onap.vid.mso.rest.SubscriberInfo;
import java.util.List;
import java.util.Map;
@@ -62,7 +57,7 @@ public class ServiceInstantiationRequestDetails {
public static class RequestInfo {
@JsonInclude(NON_NULL) public final String instanceName;
- public final String productFamilyId;
+ @JsonInclude(NON_NULL) public final String productFamilyId;
public final String source;
public final boolean suppressRollback;
public final String requestorId;
@@ -86,33 +81,68 @@ public class ServiceInstantiationRequestDetails {
}
public static class RequestParameters {
-
+ @JsonInclude(NON_NULL) public final String testApi;
public final String subscriptionServiceType;
public final boolean aLaCarte;
- public final List<ServiceInstantiationService> userParams;
+ public final List<? extends UserParamTypes> userParams;
- public RequestParameters(String subscriptionServiceType, boolean aLaCarte, List<ServiceInstantiationService> userParams) {
+ public RequestParameters(String subscriptionServiceType, boolean aLaCarte, List<? extends UserParamTypes> userParams) {
+ this(subscriptionServiceType, aLaCarte, userParams, null);
+ }
+
+ public RequestParameters(String subscriptionServiceType, boolean aLaCarte, List<? extends UserParamTypes> userParams, String testApi) {
this.subscriptionServiceType = subscriptionServiceType;
this.aLaCarte = aLaCarte;
this.userParams = userParams;
+ this.testApi = testApi;
}
}
- @JsonTypeName("service")
- @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
- public static class ServiceInstantiationService{
- public ModelInfo modelInfo = new ModelInfo();
- @JsonInclude(NON_NULL) public String instanceName;
- public List<Map<String,String>> instanceParams;
- public ServiceInstantiationVnfList resources;
-
- public ServiceInstantiationService (ModelInfo modelInfo, String instanceName, List<Map<String,String>> instanceParams, ServiceInstantiationVnfList vnfs){
- this.modelInfo.setModelType(modelInfo.getModelType());
- this.modelInfo.setModelName(modelInfo.getModelName());
- this.modelInfo.setModelVersionId(modelInfo.getModelVersionId());
- this.instanceName = instanceName;
- this.instanceParams = instanceParams;
- this.resources = vnfs;
+ public static class UserParamNameAndValue implements UserParamTypes {
+ private final String name;
+ private final String value;
+
+ public UserParamNameAndValue(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+ }
+
+ public static class ServiceInstantiationService implements UserParamTypes {
+ private final ServiceInstantiationServiceInner serviceInstantiationServiceInner;
+
+ public ServiceInstantiationService(ModelInfo modelInfo, String instanceName, List<Map<String, String>> instanceParams, ServiceInstantiationVnfList vnfs) {
+ serviceInstantiationServiceInner = new ServiceInstantiationServiceInner(modelInfo, instanceName, instanceParams, vnfs);
+ }
+
+ @JsonProperty("service")
+ public ServiceInstantiationServiceInner getServiceInstantiationServiceInner() {
+ return serviceInstantiationServiceInner;
+ }
+
+ private static class ServiceInstantiationServiceInner implements UserParamTypes {
+ public ModelInfo modelInfo = new ModelInfo();
+ @JsonInclude(NON_NULL)
+ public String instanceName;
+ public List<Map<String, String>> instanceParams;
+ public ServiceInstantiationVnfList resources;
+
+ public ServiceInstantiationServiceInner(ModelInfo modelInfo, String instanceName, List<Map<String, String>> instanceParams, ServiceInstantiationVnfList vnfs) {
+ this.modelInfo.setModelType(modelInfo.getModelType());
+ this.modelInfo.setModelName(modelInfo.getModelName());
+ this.modelInfo.setModelVersionId(modelInfo.getModelVersionId());
+ this.instanceName = instanceName;
+ this.instanceParams = instanceParams;
+ this.resources = vnfs;
+ }
}
}
@@ -131,10 +161,10 @@ public class ServiceInstantiationRequestDetails {
public final LineOfBusiness lineOfBusiness;
public final String productFamilyId;
public final List<Map<String, String>> instanceParams;
- @JsonInclude(NON_EMPTY) public final List<VfModule> vfModules;
+ @JsonInclude(NON_EMPTY) public final List<VfModuleMacro> vfModules;
@JsonInclude(NON_NULL) public final String instanceName;
- public ServiceInstantiationVnf(ModelInfo modelInfo, CloudConfiguration cloudConfiguration, String platform, String lineOfBusiness, String productFamilyId, List<Map<String, String>> instanceParams, List<VfModule> vfModules, String instanceName) {
+ public ServiceInstantiationVnf(ModelInfo modelInfo, CloudConfiguration cloudConfiguration, String platform, String lineOfBusiness, String productFamilyId, List<Map<String, String>> instanceParams, List<VfModuleMacro> vfModules, String instanceName) {
this.modelInfo = modelInfo;
this.cloudConfiguration = cloudConfiguration;
this.platform = new Platform(platform);
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java
new file mode 100644
index 000000000..b6c9131ed
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java
@@ -0,0 +1,98 @@
+
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "name",
+ "value"
+})
+public class UserParam {
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("value")
+ private String value;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ *
+ * @return
+ * The name
+ */
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ * The name
+ */
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ * The value
+ */
+ @JsonProperty("value")
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ *
+ * @param value
+ * The value
+ */
+ @JsonProperty("value")
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(name).append(value).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof UserParam)) {
+ return false;
+ }
+ UserParam rhs = ((UserParam) other);
+ return new EqualsBuilder().append(name, rhs.name).append(value, rhs.value).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java
new file mode 100644
index 000000000..8e5a88d28
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java
@@ -0,0 +1,4 @@
+package org.onap.vid.mso.model;
+
+public interface UserParamTypes {
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java
new file mode 100644
index 000000000..9a3a0c853
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java
@@ -0,0 +1,111 @@
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/* Based on this model:
+
+{
+ "requestDetails": {
+ "modelInfo": {
+ “modelType”: “vfModule”,
+ “modelInvariantId”: “ff5256d2-5a33-55df-13ab-12abad84e7ff”,
+ “modelVersionId”: “fe6478e5-ea33-3346-ac12-ab121484a3fe”,
+ “modelCustomizationId”: “856f9806-b01a-11e6-80f5-76304dec7eb7”,
+ “modelName”: “vSAMP12..base..module-0”,
+ "modelVersion": "1"
+ },
+ “cloudConfiguration”: {
+ “lcpCloudRegionId”: “mdt1”,
+ “tenantId”: “88a6ca3ee0394ade9403f075db23167e”
+ },
+ "requestInfo": {
+ “instanceName”: “MSOTEST103a-vSAMP12_base_module-0”,
+ “source”: “VID”,
+ “suppressRollback”: true,
+ “requestorId”: “az2016”
+ },
+ "relatedInstanceList": [
+ {
+ // This related instance captures the volumeGroup to attach
+ “relatedInstance”: {
+ “instanceId”: “17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c”,
+ “instanceName”: “MSOTESTVOL103a-vSAMP12_base_module-0_vol”,
+ “modelInfo”: {
+ “modelType”: “volumeGroup”
+ }
+ }
+ },
+ {
+ “relatedInstance”: {
+ “instanceId”: “{serviceInstanceId}”,
+ “modelInfo”: {
+ “modelType”: “service”,
+ “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”,
+ “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”,
+ “modelName”: “{parent service model name}”,
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ “relatedInstance”: {
+ “instanceId”: “{vnfInstanceId}”,
+ "modelInfo": {
+ “modelType”: “vnf”,
+ “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”,
+ “modelVersionId”: “fe6478e4-ea33-3346-ac12-ab121484a3fe”,
+ “modelName”: “vSAMP12”,
+ "modelVersion": "1.0",
+ “modelCustomizationName”: “vSAMP12 1”,
+ “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7”
+ }
+ }
+ }
+ ],
+ “requestParameters”: {
+ “usePreload”: true,
+ “userParams”: []
+ }
+ }
+}
+
+
+ */
+
+public class VfModuleInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails {
+
+ public VfModuleInstantiationRequestDetails(
+ @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
+ @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
+ @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
+ @JsonProperty(value = "requestParameters", required = true) RequestParametersVfModule requestParameters)
+ {
+ super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters);
+ }
+
+ public static class RequestParametersVfModule extends BaseResourceInstantiationRequestDetails.RequestParameters {
+ private final boolean usePreload;
+
+ public RequestParametersVfModule(List<? extends UserParamTypes> userParams, boolean usePreload) {
+ super(userParams);
+ this.usePreload = usePreload;
+ }
+
+ public boolean isUsePreload() {
+ return usePreload;
+ }
+ }
+
+ public static class UserParamMap<K,V> extends HashMap<K,V> implements UserParamTypes, Map<K,V> {
+
+ public UserParamMap() {
+ super();
+ }
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java
new file mode 100644
index 000000000..1bb8a37c6
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java
@@ -0,0 +1,71 @@
+/*-
+ * ============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.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+public class VfModuleMacro {
+
+ private final ModelInfo modelInfo;
+
+ @JsonInclude(NON_NULL)
+ private final String instanceName;
+
+ private final List<Map<String, String>> instanceParams;
+
+ @JsonInclude(NON_NULL)
+ private final String volumeGroupInstanceName;
+
+ public VfModuleMacro(@JsonProperty("modelInfo") ModelInfo modelInfo,
+ @JsonProperty("instanceName") String instanceName,
+ @JsonProperty("volumeGroupName") String volumeGroupInstanceName,
+ @JsonProperty("instanceParams") List<Map<String, String>> instanceParams) {
+ this.modelInfo = modelInfo;
+ this.modelInfo.setModelType("vfModule");
+ this.instanceName = instanceName;
+ this.instanceParams = instanceParams;
+ this.volumeGroupInstanceName = volumeGroupInstanceName;
+ }
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public String getVolumeGroupInstanceName() {
+ return volumeGroupInstanceName;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams == null ? Collections.emptyList() : instanceParams;
+ }
+}
+
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java
new file mode 100644
index 000000000..4a60c1a51
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java
@@ -0,0 +1,87 @@
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+/* Based on this model:
+
+
+// {
+// "requestDetails": {
+// "modelInfo": {
+// “modelType”: “vnf”,
+// “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”,
+// “modelVersionId”: “fe042c22-ba82-43c6-b2f6-8f1fc4164091”,
+// “modelName”: “vSAMP12”,
+// "modelVersion": "1.0",
+// “modelCustomizationName”: “vSAMP12 1”,
+// “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7”
+// },
+// “cloudConfiguration”: {
+// “lcpCloudRegionId”: “mdt1”,
+// “tenantId”: “88a6ca3ee0394ade9403f075db23167e”
+// },
+// "requestInfo": {
+// “instanceName”: “MSOTEST103a”,
+// “productFamilyId”: “a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb”,
+// “source”: “VID”,
+// “suppressRollback”: false,
+// “requestorId”: “az2016”
+// },
+// "platform": {
+// "platformName": "{some platformName}"
+// },
+// "lineOfBusiness": {
+// "lineOfBusinessName": "{some string}"
+// },
+// "relatedInstanceList": [
+// {
+// “relatedInstance”: {
+// “instanceId”: “{serviceInstanceId}”,
+// “modelInfo”: {
+// “modelType”: “service”,
+// “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”,
+// “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”,
+// “modelName”: “{parent service model name}”,
+// "modelVersion": "1.0"
+// }
+// }
+// },
+// {
+// “relatedInstance”: {
+// “instanceId”: “{instanceGroupId}”,
+// “modelInfo”: {
+// “modelType”: “networkCollection”,
+// “modelInvariantId”: “9ea660dc-155f-44d3-b45c-cc7648b4f31c”,
+// “modelVersionId”: “bb07aad1-ce2d-40c1-85cb-5392f76bb1ef”,
+// “modelName”: “{network collection model name}”,
+// "modelVersion": "1.0"
+// }
+// }
+// }
+
+// ],
+// “requestParameters”: {
+// “userParams”: []
+// }
+// }
+// }
+
+ */
+
+public class VnfInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails {
+
+ public VnfInstantiationRequestDetails(
+ @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
+ @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
+ @JsonProperty(value = "platform", required = true) Platform platform,
+ @JsonProperty(value = "lineOfBusiness", required = true) LineOfBusiness lineOfBusiness,
+ @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
+ @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters)
+ {
+ super(modelInfo, cloudConfiguration, requestInfo, platform, lineOfBusiness, relatedInstanceList, requestParameters);
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java
new file mode 100644
index 000000000..d60c9975b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java
@@ -0,0 +1,18 @@
+package org.onap.vid.mso.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class VolumeGroupRequestDetails extends BaseResourceInstantiationRequestDetails {
+
+ public VolumeGroupRequestDetails(
+ @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
+ @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
+ @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
+ @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
+ @JsonProperty(value = "requestParameters", required = true) VfModuleInstantiationRequestDetails.RequestParametersVfModule requestParameters)
+ {
+ super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java
index 4c3dca26f..7d844feed 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java
@@ -23,7 +23,6 @@ package org.onap.vid.mso.rest;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
-import org.onap.vid.domain.mso.RequestStatus;
/**
* Represent response for: GET orchestrationRequests
@@ -53,16 +52,29 @@ public class AsyncRequestStatus {
}
public String requestId;
+ public String requestScope;
/**
* The instance ids.
*/
public InstanceReferences instanceReferences;
+
+ /**
+ * The request details.
+ */
+ public RequestDetails requestDetails;
+
/**
* The request status.
*/
public RequestStatus requestStatus;
+
+ /**
+ * The time of start.
+ */
+ public String startTime;
+
}
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -71,5 +83,18 @@ public class AsyncRequestStatus {
public String serviceInstanceId;
}
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class RequestDetails {
+
+ public RequestInfo requestInfo;
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class RequestInfo {
+
+ public String instanceName;
+ }
+
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatusList.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatusList.java
new file mode 100644
index 000000000..04ced39fb
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatusList.java
@@ -0,0 +1,17 @@
+package org.onap.vid.mso.rest;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class AsyncRequestStatusList {
+ AsyncRequestStatusList(@JsonProperty("requestList") List<AsyncRequestStatus> requestList) {
+ this.requestList = requestList;
+ }
+
+ public List<AsyncRequestStatus> getRequestList() {
+ return requestList;
+ }
+
+ private final List<AsyncRequestStatus> requestList;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/InstanceIds.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/InstanceIds.java
new file mode 100644
index 000000000..5e1c5ce88
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/InstanceIds.java
@@ -0,0 +1,202 @@
+
+package org.onap.vid.mso.rest;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * instanceIds that may be associated with a particular request
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "networkInstanceId",
+ "serviceInstanceId",
+ "vfModuleInstanceId",
+ "vnfInstanceId",
+ "volumeGroupInstanceId"
+})
+public class InstanceIds {
+
+ /**
+ * UUID for the network instance (if any)
+ *
+ */
+ @JsonProperty("networkInstanceId")
+ private String networkInstanceId;
+ /**
+ * UUID for the service instance
+ *
+ */
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+ /**
+ * UUID for the vfModule instance (if any)
+ *
+ */
+ @JsonProperty("vfModuleInstanceId")
+ private String vfModuleInstanceId;
+ /**
+ * UUID for the vnf instance (if any)
+ *
+ */
+ @JsonProperty("vnfInstanceId")
+ private String vnfInstanceId;
+ /**
+ * UUID for the volume group instance (if any)
+ *
+ */
+ @JsonProperty("volumeGroupInstanceId")
+ private String volumeGroupInstanceId;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ * UUID for the network instance (if any)
+ *
+ * @return
+ * The networkInstanceId
+ */
+ @JsonProperty("networkInstanceId")
+ public String getNetworkInstanceId() {
+ return networkInstanceId;
+ }
+
+ /**
+ * UUID for the network instance (if any)
+ *
+ * @param networkInstanceId
+ * The networkInstanceId
+ */
+ @JsonProperty("networkInstanceId")
+ public void setNetworkInstanceId(String networkInstanceId) {
+ this.networkInstanceId = networkInstanceId;
+ }
+
+ /**
+ * UUID for the service instance
+ *
+ * @return
+ * The serviceInstanceId
+ */
+ @JsonProperty("serviceInstanceId")
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ /**
+ * UUID for the service instance
+ *
+ * @param serviceInstanceId
+ * The serviceInstanceId
+ */
+ @JsonProperty("serviceInstanceId")
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ /**
+ * UUID for the vfModule instance (if any)
+ *
+ * @return
+ * The vfModuleInstanceId
+ */
+ @JsonProperty("vfModuleInstanceId")
+ public String getVfModuleInstanceId() {
+ return vfModuleInstanceId;
+ }
+
+ /**
+ * UUID for the vfModule instance (if any)
+ *
+ * @param vfModuleInstanceId
+ * The vfModuleInstanceId
+ */
+ @JsonProperty("vfModuleInstanceId")
+ public void setVfModuleInstanceId(String vfModuleInstanceId) {
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ }
+
+ /**
+ * UUID for the vnf instance (if any)
+ *
+ * @return
+ * The vnfInstanceId
+ */
+ @JsonProperty("vnfInstanceId")
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ /**
+ * UUID for the vnf instance (if any)
+ *
+ * @param vnfInstanceId
+ * The vnfInstanceId
+ */
+ @JsonProperty("vnfInstanceId")
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ /**
+ * UUID for the volume group instance (if any)
+ *
+ * @return
+ * The volumeGroupInstanceId
+ */
+ @JsonProperty("volumeGroupInstanceId")
+ public String getVolumeGroupInstanceId() {
+ return volumeGroupInstanceId;
+ }
+
+ /**
+ * UUID for the volume group instance (if any)
+ *
+ * @param volumeGroupInstanceId
+ * The volumeGroupInstanceId
+ */
+ @JsonProperty("volumeGroupInstanceId")
+ public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
+ this.volumeGroupInstanceId = volumeGroupInstanceId;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(networkInstanceId).append(serviceInstanceId).append(vfModuleInstanceId).append(vnfInstanceId).append(volumeGroupInstanceId).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof InstanceIds)) {
+ return false;
+ }
+ InstanceIds rhs = ((InstanceIds) other);
+ return new EqualsBuilder().append(networkInstanceId, rhs.networkInstanceId).append(serviceInstanceId, rhs.serviceInstanceId).append(vfModuleInstanceId, rhs.vfModuleInstanceId).append(vnfInstanceId, rhs.vnfInstanceId).append(volumeGroupInstanceId, rhs.volumeGroupInstanceId).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
index 37600f7b9..2ff337653 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
@@ -22,10 +22,6 @@ package org.onap.vid.mso.rest;
import com.google.common.collect.ImmutableMap;
import io.joshworks.restclient.http.HttpResponse;
-import java.util.HashMap;
-import java.util.Map;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.eclipse.jetty.util.security.Password;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -35,17 +31,21 @@ import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.client.SyncRestClient;
import org.onap.vid.model.RequestReferencesContainer;
import org.onap.vid.mso.*;
+import org.onap.vid.utils.Logging;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.onap.vid.utils.Logging;
+import java.util.HashMap;
+import java.util.Map;
/**
* Created by pickjonathan on 21/06/2017.
*/
-public class MsoRestClientNew implements MsoInterface {
+public class MsoRestClientNew extends RestMsoImplementation implements MsoInterface {
/**
* The Constant dateFormat.
@@ -70,7 +70,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "createSvcInstance ";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetails, path);
@@ -79,7 +79,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint) {
String methodName = "createE2eSvcInstance ";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetails, path);
@@ -89,7 +89,7 @@ public class MsoRestClientNew implements MsoInterface {
public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) {
String methodName = "createVnf";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetails, path);
@@ -99,7 +99,7 @@ public class MsoRestClientNew implements MsoInterface {
public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "createNwInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetails, path);
@@ -108,7 +108,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "createVolumeGroupInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetails, path);
@@ -117,7 +117,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "createVfModuleInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetails, path);
@@ -126,7 +126,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper scaleOutVFModuleInstance(RequestDetailsWrapper requestDetailsWrapper, String endpoint) {
String methodName = "scaleOutVFModuleInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetailsWrapper, path);
}
@@ -134,7 +134,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String endpoint) {
String methodName = "createConfigurationInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return createInstance(requestDetailsWrapper, path);
@@ -143,7 +143,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String endpoint) {
String methodName = "deleteE2eSvcInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return deleteInstance(requestDetails, path);
}
@@ -151,7 +151,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "deleteSvcInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return deleteInstance(requestDetails, path);
}
@@ -159,15 +159,17 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper unassignSvcInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "unassignSvcInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
- HttpResponse<String> response = client.post(endpoint, commonHeaders, requestDetails, String.class);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
+ String path = baseUrl + endpoint;
+
+ HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
return MsoUtil.wrapResponse(response);
}
@Override
public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) {
String methodName = "deleteVnf";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return deleteInstance(requestDetails, path);
@@ -176,7 +178,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) {
String methodName = "deleteVfModule";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return deleteInstance(requestDetails, path);
@@ -185,7 +187,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "deleteVolumeGroupInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return deleteInstance(requestDetails, path);
@@ -194,59 +196,50 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "deleteNwInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return deleteInstance(requestDetails, path);
}
@Override
- public MsoResponseWrapper getOrchestrationRequest(String endpoint) {
+ public MsoResponseWrapper getOrchestrationRequest(String t, String sourceId, String endpoint, RestObject restObject, boolean warpException) {
String path = baseUrl + endpoint;
HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);
return MsoUtil.wrapResponse(response);
}
- public MsoResponseWrapper getManualTasks(String endpoint) {
+ @Override
+ public MsoResponseWrapper getOrchestrationRequest(String endpoint) {
String path = baseUrl + endpoint;
HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);
return MsoUtil.wrapResponse(response);
}
- public MsoResponseWrapper getOrchestrationRequestsForDashboard(String t, String sourceId, String path, RestObject restObject) {
- String methodName = "getOrchestrationRequestsForDashboard";
- logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);
-
- try {
- MsoResponseWrapper w = getOrchestrationRequest(path);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
-
- return w;
+ public MsoResponseWrapper getManualTasks(String endpoint) {
+ String path = baseUrl + endpoint;
- } 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;
- }
+ HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);
+ return MsoUtil.wrapResponse(response);
}
public MsoResponseWrapper getManualTasksByRequestId(String t, String sourceId, String endpoint, RestObject restObject) {
String methodName = "getManualTasksByRequestId";
- logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(methodName + START);
try {
String path = baseUrl + endpoint;
MsoResponseWrapper w =getManualTasks(path);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ logger.debug(EELFLoggerDelegate.debugLogger, 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());
+ logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@@ -254,19 +247,19 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) {
String methodName = "completeManualTask";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Complete ");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Complete ");
try {
String path = baseUrl + endpoint;
HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
MsoResponseWrapper w = MsoUtil.wrapResponse(response);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ logger.debug(EELFLoggerDelegate.debugLogger, 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());
+ logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@@ -274,7 +267,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) {
String methodName = "replaceVnf";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
return replaceInstance(requestDetails, path);
}
@@ -283,7 +276,7 @@ public class MsoRestClientNew implements MsoInterface {
public MsoResponseWrapper deleteConfiguration(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmc_endpoint) {
String methodName = "deleteConfiguration";
logger.debug(EELFLoggerDelegate.debugLogger,
- dateFormat.format(new Date()) + "<== " + methodName + START);
+ methodName + START);
String path = baseUrl + pmc_endpoint;
return deleteInstance(requestDetailsWrapper, path);
@@ -292,7 +285,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper setConfigurationActiveStatus(RequestDetails request, String endpoint) {
String methodName = "setConfigurationActiveStatus";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
try {
String path = baseUrl + endpoint;
@@ -302,8 +295,8 @@ public class MsoRestClientNew implements MsoInterface {
HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
return MsoUtil.wrapResponse(response);
} 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());
+ logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@@ -311,7 +304,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails request, String endpoint) {
String methodName = "setPortOnConfigurationStatus";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
try {
String path = baseUrl + endpoint;
@@ -320,8 +313,8 @@ public class MsoRestClientNew implements MsoInterface {
HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
return MsoUtil.wrapResponse(response);
} 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());
+ logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@@ -335,28 +328,29 @@ public class MsoRestClientNew implements MsoInterface {
public MsoResponseWrapper replaceInstance(org.onap.vid.changeManagement.RequestDetails request, String path) {
String methodName = "replaceInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
try {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Replace VNF, path =[" + path + "]");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Replace VNF, path =[" + path + "]");
+ RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper();
+ requestDetailsWrapper.requestDetails = new MsoRequestDetails(request);
- HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
+ HttpResponse<String> response = client.post(path, commonHeaders, requestDetailsWrapper, String.class);
MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(response);
int status = msoResponseWrapperObject.getStatus();
if (status == 202) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName +
",post succeeded, msoResponseWrapperObject response:" + msoResponseWrapperObject.getResponse());
} else {
- logger.error(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +
+ logger.error(EELFLoggerDelegate.debugLogger, 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());
+ logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
@@ -365,7 +359,7 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) {
String methodName = "updateVnf";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
String path = baseUrl + endpoint;
RequestDetailsWrapper wrapper = new RequestDetailsWrapper();
@@ -375,20 +369,22 @@ public class MsoRestClientNew implements MsoInterface {
public MsoResponseWrapper updateInstance(org.onap.vid.changeManagement.RequestDetails request, String path) {
String methodName = "updateInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
try {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Delete, path =[" + path + "]");
- HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
+ RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper();
+ requestDetailsWrapper.requestDetails = new MsoRequestDetails(request);
+ HttpResponse<String> response = client.put(path, commonHeaders, requestDetailsWrapper, String.class);
MsoResponseWrapper w = MsoUtil.wrapResponse(response);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ logger.debug(EELFLoggerDelegate.debugLogger, 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());
+ logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
@@ -396,16 +392,16 @@ public class MsoRestClientNew implements MsoInterface {
public void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject) {
String methodName = "activateServiceInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start ");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start ");
try {
String path = baseUrl + endpoint;
HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
MsoResponseWrapper w = MsoUtil.wrapResponse(response);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w =" + w.getResponse());
+ logger.debug(EELFLoggerDelegate.debugLogger, 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());
+ logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@@ -413,16 +409,16 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String endpoint) {
String methodName = "removeRelationshipFromServiceInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
try {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Remove relationship from service instance, path =[" + endpoint + "]");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Remove relationship from service instance, path =[" + endpoint + "]");
String path = baseUrl + endpoint;
HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
return MsoUtil.wrapResponse(response);
} 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());
+ logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@@ -430,43 +426,45 @@ public class MsoRestClientNew implements MsoInterface {
@Override
public MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath) {
String methodName = "addRelationshipToServiceInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
try {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Add relationship to service instance, path =[" + addRelationshipsPath + "]");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Add relationship to service instance, path =[" + addRelationshipsPath + "]");
String path = baseUrl + addRelationshipsPath;
HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
return MsoUtil.wrapResponse(response);
} 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());
+ logger.info(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@Override
- public <T> HttpResponse<T> get(String path, Class<T> responseClass) {
+ public <T> HttpResponse<T> get(String endpoint, Class<T> responseClass) {
+ String path = baseUrl + endpoint;
return client.get(path, commonHeaders, new HashMap<>(), responseClass);
}
@Override
- public <T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper,
- Class<T> responseClass) {
+ public <T> HttpResponse<T> post(String endpoint, RequestDetailsWrapper<?> requestDetailsWrapper, Class<T> responseClass) {
+ String path = baseUrl + endpoint;
+
return client.post(path, commonHeaders, requestDetailsWrapper, responseClass);
}
- private MsoResponseWrapper createInstance(Object request, String endpoint) {
+ private MsoResponseWrapper createInstance(Object request, String path) {
String methodName = "createInstance";
- logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(methodName + START);
try {
- HttpResponse<String> response = client.post(endpoint, commonHeaders, request, String.class);
+ HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
return MsoUtil.wrapResponse(response);
} 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());
+ logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
}
@@ -481,20 +479,20 @@ public class MsoRestClientNew implements MsoInterface {
*/
private MsoResponseWrapper deleteInstance(Object request, String path) {
String methodName = "deleteInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START);
try {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " calling Delete, path =[" + path + "]");
HttpResponse<String> response = client.delete(path, commonHeaders, request, String.class);
MsoResponseWrapper w = MsoUtil.wrapResponse(response);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ logger.debug(EELFLoggerDelegate.debugLogger, 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());
+ logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "." + methodName + e.toString());
throw e;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java
index 3fd4cd4d1..2f64e3a56 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedInstance.java
@@ -20,40 +20,92 @@
package org.onap.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 com.fasterxml.jackson.annotation.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
+import org.onap.vid.mso.model.ModelInfo;
+
+import java.util.HashMap;
+import java.util.Map;
/**
* 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.onap.vid.domain.mso.RelatedInstance{
+public class RelatedInstance {
+
+ /**
+ * optional name for the instance Id of the related model
+ *
+ */
+ @JsonProperty("instanceName")
+ private String instanceName;
+ /**
+ * instance Id for the related model
+ *
+ */
+ @JsonProperty("instanceId")
+ private String instanceId;
/** The model info. */
@JsonProperty("modelInfo")
- private org.onap.vid.domain.mso.ModelInfo modelInfo;
+ private ModelInfo modelInfo;
/** The additional properties. */
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ * optional name for the instance Id of the related model
+ *
+ * @return
+ * The instanceName
+ */
+ @JsonProperty("instanceName")
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ /**
+ * optional name for the instance Id of the related model
+ *
+ * @param instanceName
+ * The instanceName
+ */
+ @JsonProperty("instanceName")
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ /**
+ * instance Id for the related model
+ *
+ * @return
+ * The instanceId
+ */
+ @JsonProperty("instanceId")
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ /**
+ * instance Id for the related model
+ *
+ * @param instanceId
+ * The instanceId
+ */
+ @JsonProperty("instanceId")
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
/**
* (Required).
@@ -61,7 +113,7 @@ public class RelatedInstance extends org.onap.vid.domain.mso.RelatedInstance{
* @return The modelInfo
*/
@JsonProperty("modelInfo")
- public org.onap.vid.domain.mso.ModelInfo getModelInfo() {
+ public ModelInfo getModelInfo() {
return modelInfo;
}
@@ -71,7 +123,7 @@ public class RelatedInstance extends org.onap.vid.domain.mso.RelatedInstance{
* @param modelInfo The modelInfo
*/
@JsonProperty("modelInfo")
- public void setModelInfo(org.onap.vid.domain.mso.ModelInfo modelInfo) {
+ public void setModelInfo(ModelInfo modelInfo) {
this.modelInfo = modelInfo;
}
@@ -115,7 +167,7 @@ public class RelatedInstance extends org.onap.vid.domain.mso.RelatedInstance{
if (other == this) {
return true;
}
- if ((other instanceof RelatedInstance) == false) {
+ if (!(other instanceof RelatedInstance)) {
return false;
}
RelatedInstance rhs = ((RelatedInstance) other);
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedModel.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RelatedModel.java
deleted file mode 100644
index 36487c596..000000000
--- a/vid-app-common/src/main/java/org/onap/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.onap.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.onap.vid.domain.mso.RelatedModel {
-
- /** (Required). */
- @JsonProperty("modelInfo")
- private org.onap.vid.domain.mso.ModelInfo modelInfo;
-
-// /** The related model object instance list. */
-// @JsonProperty("instanceId")
-// private org.onap.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.onap.vid.domain.mso.ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- * (Required).
- *
- * @param modelInfo The modelInfo
- */
- @JsonProperty("modelInfo")
- public void setModelInfo(org.onap.vid.domain.mso.ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- /* (non-Javadoc)
- * @see org.onap.vid.domain.mso.RelatedModel#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /* (non-Javadoc)
- * @see org.onap.vid.domain.mso.RelatedModel#getAdditionalProperties()
- */
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- /* (non-Javadoc)
- * @see org.onap.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.onap.vid.domain.mso.RelatedModel#hashCode()
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
- }
-
- /* (non-Javadoc)
- * @see org.onap.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/onap/vid/mso/rest/Request.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java
index ee1652e75..91739937a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Request.java
@@ -20,44 +20,89 @@
package org.onap.vid.mso.rest;
-//import java.util.HashMap;
-//import java.util.Map;
-//import javax.annotation.Generated;
-
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.onap.vid.domain.mso.InstanceIds;
-import org.onap.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 com.fasterxml.jackson.annotation.*;
import org.apache.commons.lang.builder.EqualsBuilder;
-//import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
/**
* request structure.
*/
-public class Request extends org.onap.vid.domain.mso.Request {
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "finishTime",
+ "instanceIds",
+ "requestDetails",
+ "requestId",
+ "requestScope",
+ "requestStatus",
+ "requestType",
+ "startTime"
+})
+public class Request {
/** The instance ids. */
+ @JsonProperty("instanceIds")
private InstanceIds instanceIds;
/** The request details. */
+ @JsonProperty("requestDetails")
private RequestDetails requestDetails;
/** The request status. */
+ @JsonProperty("requestStatus")
private RequestStatus requestStatus;
-
-
+
+ /**
+ * Date and time the request was finished in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT
+ *
+ */
+ @JsonProperty("finishTime")
+ private String finishTime;
+
+ /**
+ * UUID for the request generated by the instantiation service
+ * (Required)
+ *
+ */
+ @JsonProperty("requestId")
+ private String requestId;
+
+ /**
+ * short description of the entity being operated on
+ * (Required)
+ *
+ */
+ @JsonProperty("requestScope")
+ private String requestScope;
+
+ /**
+ * short description of the action being performed on the requestScope
+ * (Required)
+ *
+ */
+ @JsonProperty("requestType")
+ private String requestType;
+
+ /**
+ * Date and time the request was created in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT
+ * (Required)
+ *
+ */
+ @JsonProperty("startTime")
+ private String startTime;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+
/* (non-Javadoc)
- * @see org.onap.vid.domain.mso.Request#getInstanceIds()
+ * @see org.openecomp.vid.domain.mso.Request#getInstanceIds()
*/
@JsonProperty("instanceIds")
public InstanceIds getInstanceIds() {
@@ -115,32 +160,154 @@ public class Request extends org.onap.vid.domain.mso.Request {
this.requestStatus = requestStatus;
}
-
- /* (non-Javadoc)
- * @see org.onap.vid.domain.mso.Request#toString()
+ /**
+ * Date and time the request was finished in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT
+ *
+ * @return
+ * The finishTime
+ */
+ @JsonProperty("finishTime")
+ public String getFinishTime() {
+ return finishTime;
+ }
+
+ /**
+ * Date and time the request was finished in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT
+ *
+ * @param finishTime
+ * The finishTime
+ */
+ @JsonProperty("finishTime")
+ public void setFinishTime(String finishTime) {
+ this.finishTime = finishTime;
+ }
+
+ /**
+ * UUID for the request generated by the instantiation service
+ * (Required)
+ *
+ * @return
+ * The requestId
+ */
+ @JsonProperty("requestId")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * UUID for the request generated by the instantiation service
+ * (Required)
+ *
+ * @param requestId
+ * The requestId
*/
+ @JsonProperty("requestId")
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * short description of the entity being operated on
+ * (Required)
+ *
+ * @return
+ * The requestScope
+ */
+ @JsonProperty("requestScope")
+ public String getRequestScope() {
+ return requestScope;
+ }
+
+ /**
+ * short description of the entity being operated on
+ * (Required)
+ *
+ * @param requestScope
+ * The requestScope
+ */
+ @JsonProperty("requestScope")
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+
+ /**
+ * short description of the action being performed on the requestScope
+ * (Required)
+ *
+ * @return
+ * The requestType
+ */
+ @JsonProperty("requestType")
+ public String getRequestType() {
+ return requestType;
+ }
+
+ /**
+ * short description of the action being performed on the requestScope
+ * (Required)
+ *
+ * @param requestType
+ * The requestType
+ */
+ @JsonProperty("requestType")
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ /**
+ * Date and time the request was created in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT
+ * (Required)
+ *
+ * @return
+ * The startTime
+ */
+ @JsonProperty("startTime")
+ public String getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Date and time the request was created in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT
+ * (Required)
+ *
+ * @param startTime
+ * The startTime
+ */
+ @JsonProperty("startTime")
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
-
- /* (non-Javadoc)
- * @see org.onap.vid.domain.mso.Request#equals(java.lang.Object)
- */
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(17, 37).append(getFinishTime()).append(getInstanceIds()).append(getRequestDetails()).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode();
+ }
+
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
- if ((other instanceof Request) == false) {
+ if (!(other instanceof Request)) {
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();
}
- @Override
- public int hashCode() {
- return new HashCodeBuilder(17, 37).append(getFinishTime()).append(getInstanceIds()).append(getRequestDetails()).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode();
- }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java
index 2b159f812..da6d46da5 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestDetails.java
@@ -20,20 +20,15 @@
package org.onap.vid.mso.rest;
-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 com.fasterxml.jackson.annotation.*;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.onap.vid.domain.mso.CloudConfiguration;
-import org.onap.vid.domain.mso.ModelInfo;
-import org.onap.vid.domain.mso.RequestInfo;
-import org.onap.vid.domain.mso.RequestParameters;
-import org.onap.vid.domain.mso.SubscriberInfo;
+import org.onap.vid.exceptions.NotFoundException;
+import org.onap.vid.mso.model.CloudConfiguration;
+import org.onap.vid.mso.model.ModelInfo;
+import org.onap.vid.mso.model.RequestInfo;
+import org.onap.vid.mso.model.RequestParameters;
import java.util.HashMap;
import java.util.List;
@@ -86,7 +81,7 @@ public class RequestDetails{
/** The additional properties. */
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
/**
* Gets the cloud configuration.
@@ -269,4 +264,26 @@ public class RequestDetails{
public void setRequestParameters(RequestParameters requestParameters) {
this.requestParameters = requestParameters;
}
+
+ public <T> T extractValueByPathUsingAdditionalProperties (List<String> keys, Class<T> clazz) {
+ Object result = getAdditionalProperties();
+ for (String key : keys) {
+ if (result instanceof Map) {
+ result = ((Map) result).get(key);
+ }
+
+ else {
+ throw new NotFoundException("failed to find key: "+key+" in path: "+String.join("\\", keys));
+ }
+ }
+ if (clazz.isInstance(result)) {
+ return clazz.cast(result);
+ }
+
+ throw new NotFoundException(
+ String.format("failed to extract value from path:%s because %s is not of type %s",
+ String.join("\\", keys), String.valueOf(result) , clazz));
+ }
+
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java
index 8f8272c07..00289da65 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestList.java
@@ -20,30 +20,19 @@
package org.onap.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 com.fasterxml.jackson.annotation.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* List of relatedModel structures that are related to a modelInfo being operated on.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({
"finishTime",
"instanceIds",
@@ -62,7 +51,7 @@ public class RequestList {
/** The additional properties. */
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
/**
* (Required).
@@ -127,7 +116,7 @@ public class RequestList {
if (other == this) {
return true;
}
- if ((other instanceof RequestList) == false) {
+ if (!(other instanceof RequestList)) {
return false;
}
RequestList rhs = ((RequestList) other);
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java
new file mode 100644
index 000000000..f9c890454
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RequestStatus.java
@@ -0,0 +1,208 @@
+
+package org.onap.vid.mso.rest;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * fields describing the status of a request
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "percentProgress",
+ "requestState",
+ "statusMessage",
+ "timestamp",
+ "wasRolledBack"
+})
+public class RequestStatus {
+
+ /**
+ * percentage complete estimate from 0 to 100
+ *
+ */
+ @JsonProperty("percentProgress")
+ private Double percentProgress;
+ /**
+ * short description of the instantiation state
+ * (Required)
+ *
+ */
+ @JsonProperty("requestState")
+ private String requestState;
+ /**
+ * additional descriptive information about the status
+ *
+ */
+ @JsonProperty("statusMessage")
+ private String statusMessage;
+ /**
+ * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
+ * (Required)
+ *
+ */
+ @JsonProperty("timestamp")
+ private String timestamp;
+ /**
+ * true or false boolean indicating whether the request was rolled back
+ *
+ */
+ @JsonProperty("wasRolledBack")
+ private Boolean wasRolledBack;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ * percentage complete estimate from 0 to 100
+ *
+ * @return
+ * The percentProgress
+ */
+ @JsonProperty("percentProgress")
+ public Double getPercentProgress() {
+ return percentProgress;
+ }
+
+ /**
+ * percentage complete estimate from 0 to 100
+ *
+ * @param percentProgress
+ * The percentProgress
+ */
+ @JsonProperty("percentProgress")
+ public void setPercentProgress(Double percentProgress) {
+ this.percentProgress = percentProgress;
+ }
+
+ /**
+ * short description of the instantiation state
+ * (Required)
+ *
+ * @return
+ * The requestState
+ */
+ @JsonProperty("requestState")
+ public String getRequestState() {
+ return requestState;
+ }
+
+ /**
+ * short description of the instantiation state
+ * (Required)
+ *
+ * @param requestState
+ * The requestState
+ */
+ @JsonProperty("requestState")
+ public void setRequestState(String requestState) {
+ this.requestState = requestState;
+ }
+
+ /**
+ * additional descriptive information about the status
+ *
+ * @return
+ * The statusMessage
+ */
+ @JsonProperty("statusMessage")
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ /**
+ * additional descriptive information about the status
+ *
+ * @param statusMessage
+ * The statusMessage
+ */
+ @JsonProperty("statusMessage")
+ public void setStatusMessage(String statusMessage) {
+ this.statusMessage = statusMessage;
+ }
+
+ /**
+ * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
+ * (Required)
+ *
+ * @return
+ * The timestamp
+ */
+ @JsonProperty("timestamp")
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
+ * (Required)
+ *
+ * @param timestamp
+ * The timestamp
+ */
+ @JsonProperty("timestamp")
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * true or false boolean indicating whether the request was rolled back
+ *
+ * @return
+ * The wasRolledBack
+ */
+ @JsonProperty("wasRolledBack")
+ public Boolean getWasRolledBack() {
+ return wasRolledBack;
+ }
+
+ /**
+ * true or false boolean indicating whether the request was rolled back
+ *
+ * @param wasRolledBack
+ * The wasRolledBack
+ */
+ @JsonProperty("wasRolledBack")
+ public void setWasRolledBack(Boolean wasRolledBack) {
+ this.wasRolledBack = wasRolledBack;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(percentProgress).append(requestState).append(statusMessage).append(timestamp).append(wasRolledBack).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof RequestStatus)) {
+ return false;
+ }
+ RequestStatus rhs = ((RequestStatus) other);
+ return new EqualsBuilder().append(percentProgress, rhs.percentProgress).append(requestState, rhs.requestState).append(statusMessage, rhs.statusMessage).append(timestamp, rhs.timestamp).append(wasRolledBack, rhs.wasRolledBack).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java
index feb3f3c1e..ec117cf04 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java
@@ -1,8 +1,8 @@
package org.onap.vid.mso.rest;
+import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.mso.RestObject;
-
-import javax.ws.rs.core.MultivaluedHashMap;
+import org.onap.vid.mso.RestObjectWithRequestInfo;
/**
* Created by pickjonathan on 26/06/2017.
@@ -10,21 +10,16 @@ import javax.ws.rs.core.MultivaluedHashMap;
public interface RestInterface {
/**
- * Inits the rest client.
- */
- MultivaluedHashMap<String, Object> 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
+ * @param warpException
* @throws Exception the exception
*/
- <T> void Get (T t, String sourceId, String path, RestObject<T> restObject );
+ <T> RestObjectWithRequestInfo<T> Get(T t, String path, RestObject<T> restObject, boolean warpException);
/**
* Delete.
@@ -32,25 +27,22 @@ public interface RestInterface {
* @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
*/
- <T> void Delete(T t, Object r, String sourceID, String path, RestObject<T> restObject);
+ <T> void Delete(T t, Object r, String path, RestObject<T> restObject);
/**
* 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
*/
- <T> void Post(T t, Object r, String sourceID, String path, RestObject<T> restObject);
+ void Post(String t, Object r, String path, RestObject<String> restObject);
/**
* Put.
@@ -58,11 +50,12 @@ public interface RestInterface {
* @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
*/
- <T> void Put(T t, org.onap.vid.changeManagement.RequestDetailsWrapper r, String sourceID, String path, RestObject<T> restObject);
+ <T> void Put(T t, RequestDetailsWrapper r, String path, RestObject<T> restObject);
+
+ <T> RestObject<T> GetForObject(String path, Class<T> clazz);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/SubscriberInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/SubscriberInfo.java
new file mode 100644
index 000000000..0c8d7c2a1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/SubscriberInfo.java
@@ -0,0 +1,144 @@
+
+package org.onap.vid.mso.rest;
+
+import com.fasterxml.jackson.annotation.*;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * fields providing information about the subscriber associated with the request
+ *
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "globalSubscriberId",
+ "subscriberCommonSiteId",
+ "subscriberName"
+})
+public class SubscriberInfo {
+
+ /**
+ * global Customer Id understood by A&AI
+ *
+ */
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+ /**
+ * id representing the location of the subscriber
+ *
+ */
+ @JsonProperty("subscriberCommonSiteId")
+ private String subscriberCommonSiteId;
+ /**
+ * name of the customer or subscriber
+ *
+ */
+ @JsonProperty("subscriberName")
+ private String subscriberName;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ /**
+ * global Customer Id understood by A&AI
+ *
+ * @return
+ * The globalSubscriberId
+ */
+ @JsonProperty("globalSubscriberId")
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ /**
+ * global Customer Id understood by A&AI
+ *
+ * @param globalSubscriberId
+ * The globalSubscriberId
+ */
+ @JsonProperty("globalSubscriberId")
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ /**
+ * id representing the location of the subscriber
+ *
+ * @return
+ * The subscriberCommonSiteId
+ */
+ @JsonProperty("subscriberCommonSiteId")
+ public String getSubscriberCommonSiteId() {
+ return subscriberCommonSiteId;
+ }
+
+ /**
+ * id representing the location of the subscriber
+ *
+ * @param subscriberCommonSiteId
+ * The subscriberCommonSiteId
+ */
+ @JsonProperty("subscriberCommonSiteId")
+ public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
+ this.subscriberCommonSiteId = subscriberCommonSiteId;
+ }
+
+ /**
+ * name of the customer or subscriber
+ *
+ * @return
+ * The subscriberName
+ */
+ @JsonProperty("subscriberName")
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ /**
+ * name of the customer or subscriber
+ *
+ * @param subscriberName
+ * The subscriberName
+ */
+ @JsonProperty("subscriberName")
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(globalSubscriberId).append(subscriberCommonSiteId).append(subscriberName).append(additionalProperties).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (!(other instanceof SubscriberInfo)) {
+ return false;
+ }
+ SubscriberInfo rhs = ((SubscriberInfo) other);
+ return new EqualsBuilder().append(globalSubscriberId, rhs.globalSubscriberId).append(subscriberCommonSiteId, rhs.subscriberCommonSiteId).append(subscriberName, rhs.subscriberName).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}