aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-03-14 09:22:15 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-14 09:22:15 +0000
commit09f3630ea990197e9d7b669aa2d6a63ec397bf3e (patch)
tree6625d3e9ac31600d86bf54a50e75dba61cc2c82a /mso-api-handlers/mso-api-handler-infra/src/main
parenta56de0e221751debd038aca5b6d20d8f9325d294 (diff)
parent38f720752af4d4aad8c4e467a288d9048659f688 (diff)
Merge "AT&T 1712 and 1802 release code"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java31
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java444
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java425
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java726
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java156
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java109
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java117
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java118
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java221
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java134
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java92
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java85
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java)56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java333
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java81
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java335
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java160
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java476
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java106
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java172
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java)79
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java145
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java78
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java216
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java290
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java342
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java82
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java216
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java92
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java78
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java)41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java)77
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java44
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java)23
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java)175
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java)102
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java118
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java96
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java84
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java)88
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java)39
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java95
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java115
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java)35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java)70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties1
90 files changed, 6015 insertions, 2212 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
index a32f9ef0f7..86cacb9d1c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Action.java
@@ -30,5 +30,11 @@ public enum Action {
configureInstance,
replaceInstance,
activateInstance,
- deactivateInstance
+ deactivateInstance,
+ enablePort,
+ disablePort,
+ addRelationships,
+ removeRelationships,
+ inPlaceSoftwareUpdate,
+ applyUpdatedConfig
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
index 328ef816e9..50716d83ae 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java
@@ -26,19 +26,12 @@ public class Constants {
private Constants() {
}
- public static final String VNF_TYPES_PATH = "/{version: v1|v2|v3}/vnf-types";
- public static final String NETWORK_TYPES_PATH = "/{version: v1|v2|v3}/network-types";
- public static final String VF_MODULE_MODEL_NAMES_PATH = "/{version: v2|v3}/vf-module-model-names";
public static final String REQUEST_ID_PATH = "/{request-id}";
public static final String STATUS_SUCCESS = "SUCCESS";
public static final String MODIFIED_BY_APIHANDLER = "APIH";
- public static final String SCHEMA_VERSION_V1 = "v1";
- public static final String SCHEMA_VERSION_V2 = "v2";
- public static final String SCHEMA_VERSION_V3 = "v3";
-
public static final long PROGRESS_REQUEST_COMPLETED = 100L;
public static final long PROGRESS_REQUEST_RECEIVED = 0L;
public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L;
@@ -50,4 +43,14 @@ public class Constants {
public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$";
public static final String A_LA_CARTE = "aLaCarte";
+
+ public static final String VNF_TYPES_PATH = "/{version: v1|v2|v3}/vnf-types";
+ public static final String NETWORK_TYPES_PATH = "/{version: v1|v2|v3}/network-types";
+ public static final String VF_MODULE_MODEL_NAMES_PATH = "/{version: v2|v3}/vf-module-model-names";
+
+ public static final String SCHEMA_VERSION_V1 = "v1";
+ public static final String SCHEMA_VERSION_V2 = "v2";
+ public static final String SCHEMA_VERSION_V3 = "v3";
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index c51c61e3dd..9f028c19f5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -55,12 +55,13 @@ import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInsta
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.SubscriberInfo;
+import org.openecomp.mso.serviceinstancebeans.ModelInfo;
+import org.openecomp.mso.serviceinstancebeans.ModelType;
+import org.openecomp.mso.serviceinstancebeans.RequestDetails;
+import org.openecomp.mso.serviceinstancebeans.RequestInfo;
+import org.openecomp.mso.serviceinstancebeans.RequestParameters;
+import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.serviceinstancebeans.SubscriberInfo;
import org.openecomp.mso.db.AbstractSessionFactoryManager;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.Service;
@@ -333,7 +334,7 @@ public class E2EServiceInstances {
String serviceInstanceType = e2eDelReq.getServiceType();
response = requestClient.post(requestId, false,
recipeLookupResult.getRecipeTimeout(), action.name(),
- serviceId, null, null, null, null, serviceInstanceType,
+ serviceId, null, null, null, null, null, serviceInstanceType,
null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
msoLogger.recordMetricEvent(subStartTime,
@@ -423,7 +424,7 @@ public class E2EServiceInstances {
mapReqJsonToSvcInstReq(e2eSir, requestJSON);
sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
try {
- msoRequest.parse(sir, instanceIdMap, action, version);
+ msoRequest.parse(sir, instanceIdMap, action, version, requestJSON);
} catch (Exception e) {
msoLogger.debug("Validation failed: ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
@@ -503,7 +504,8 @@ public class E2EServiceInstances {
msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
- serviceId, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, recipeLookupResult.getRecipeParamXsd());
+ serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson,
+ recipeLookupResult.getRecipeParamXsd());
msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
"Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
@@ -618,7 +620,7 @@ public class E2EServiceInstances {
mapReqJsonToSvcInstReq(e2eSir, requestJSON);
sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
try {
- msoRequest.parse(sir, instanceIdMap, action, version);
+ msoRequest.parse(sir, instanceIdMap, action, version, requestJSON);
} catch (Exception e) {
msoLogger.debug("Validation failed: ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
@@ -757,7 +759,8 @@ public class E2EServiceInstances {
msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
- serviceId, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, recipeLookupResult.getRecipeParamXsd());
+ serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson,
+ recipeLookupResult.getRecipeParamXsd());
msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
"Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
@@ -1021,8 +1024,8 @@ public class E2EServiceInstances {
List<E2EUserParam> userParams;
// userParams =
// e2eSir.getService().getParameters().getRequestParameters().getUserParams();
- List<Map<String, String>> userParamList = new ArrayList<>();
- Map<String, String> userParamMap = new HashMap<>();
+ List<Map<String, Object>> userParamList = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
// complete json request updated in the camunda
userParamMap.put("UUIRequest", requestJSON);
userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
@@ -1152,4 +1155,4 @@ public class E2EServiceInstances {
return dupServiceName;
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
index 52256d91b9..811b6109b4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -39,8 +39,6 @@ import com.wordnik.swagger.annotations.ApiOperation;
@Api(value="/globalhealthcheck",description="APIH Infra Global Health Check")
public class GlobalHealthcheckHandler {
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@HEAD
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java
index 55f44a7449..86604b392a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/HealthcheckHandler.java
@@ -38,8 +38,6 @@ import com.wordnik.swagger.annotations.ApiOperation;
@Api(value="/healthcheck",description="API Handler Infra Health Check")
public class HealthcheckHandler {
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@HEAD
@@ -55,7 +53,7 @@ public class HealthcheckHandler {
return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
}
- if (!healthCheck.configFileCheck(msoLogger, startTime, MSO_PROP_APIHANDLER_INFRA)) {
+ if (!healthCheck.configFileCheck(msoLogger, startTime, Constants.MSO_PROP_APIHANDLER_INFRA)) {
return HealthCheckUtils.NOT_STARTED_RESPONSE;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
index f6abcc35b1..e268c65263 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
@@ -44,15 +44,14 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
@Path("/tasks")
public class ManualTasks {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@POST
@Path("/{version:[vV]1}/{taskId}/complete")
@@ -91,7 +90,7 @@ public class ManualTasks {
"Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null);
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, request, e);
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, request, e);
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
@@ -112,7 +111,7 @@ public class ManualTasks {
String camundaJsonReq = null;
try {
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
camundaJsonReq = mapper.writeValueAsString(variablesForComplete);
msoLogger.debug("Camunda Json Request: " + camundaJsonReq);
} catch(Exception e){
@@ -121,7 +120,7 @@ public class ManualTasks {
"Mapping of JSON object to Camunda Request failed. " + e.getMessage(),
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
- msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, request, e);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, request, e);
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Mapping of JSON object to Camunda request failed");
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
@@ -155,7 +154,7 @@ public class ManualTasks {
MsoAlarmLogger.CRITICAL,
Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
return resp;
@@ -169,7 +168,7 @@ public class ManualTasks {
ErrorNumbers.SVC_NO_SERVER_RESOURCES,
null);
msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN");
msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
return resp;
@@ -188,7 +187,7 @@ public class ManualTasks {
String completeResp = null;
try {
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
completeResp = mapper.writeValueAsString(trr);
}
catch (Exception e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
index 746493c194..f46d327531 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
@@ -49,4 +49,8 @@ public class Messages {
private Messages(){
}
+
+ public static Map<String,String> getErrors() {
+ return errors;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java
index 3f8074b9ba..28076b17fe 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoPropertiesUtils.java
@@ -26,8 +26,6 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
public class MsoPropertiesUtils {
- private final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory ();
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@@ -37,9 +35,9 @@ public class MsoPropertiesUtils {
public synchronized static MsoJavaProperties loadMsoProperties () {
MsoJavaProperties msoProperties;
try {
- msoProperties = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_APIHANDLER_INFRA);
+ msoProperties = msoPropertiesFactory.getMsoJavaProperties (Constants.MSO_PROP_APIHANDLER_INFRA);
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_LOAD_PROPERTIES_FAIL, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception when loading MSO Properties", e);
+ msoLogger.error (MessageEnum.APIH_LOAD_PROPERTIES_FAIL, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception when loading MSO Properties", e);
return null;
}
@@ -48,7 +46,7 @@ public class MsoPropertiesUtils {
msoLogger.info (MessageEnum.APIH_PROPERTY_LOAD_SUC, "", "");
return msoProperties;
} else {
- msoLogger.error (MessageEnum.APIH_NO_PROPERTIES, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No MSO APIH_INFRA Properties found");
+ msoLogger.error (MessageEnum.APIH_NO_PROPERTIES, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No MSO APIH_INFRA Properties found");
return null;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index 79ac76ff04..59c78b5439 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -21,24 +21,29 @@
package org.openecomp.mso.apihandlerinfra;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.StringTokenizer;
+
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
import org.hibernate.Session;
import org.openecomp.mso.apihandler.common.ValidationException;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.CloudConfiguration;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.PolicyException;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestError;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceException;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.SubscriberInfo;
import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest;
@@ -48,31 +53,33 @@ import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
+import org.openecomp.mso.serviceinstancebeans.CloudConfiguration;
+import org.openecomp.mso.serviceinstancebeans.InstanceDirection;
+import org.openecomp.mso.serviceinstancebeans.LineOfBusiness;
+import org.openecomp.mso.serviceinstancebeans.ModelInfo;
+import org.openecomp.mso.serviceinstancebeans.ModelType;
+import org.openecomp.mso.serviceinstancebeans.OwningEntity;
+import org.openecomp.mso.serviceinstancebeans.Platform;
+import org.openecomp.mso.serviceinstancebeans.PolicyException;
+import org.openecomp.mso.serviceinstancebeans.Project;
+import org.openecomp.mso.serviceinstancebeans.RelatedInstance;
+import org.openecomp.mso.serviceinstancebeans.RelatedInstanceList;
+import org.openecomp.mso.serviceinstancebeans.RequestError;
+import org.openecomp.mso.serviceinstancebeans.RequestInfo;
+import org.openecomp.mso.serviceinstancebeans.RequestParameters;
+import org.openecomp.mso.serviceinstancebeans.ServiceException;
+import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.serviceinstancebeans.SubscriberInfo;
import org.openecomp.mso.utils.UUIDChecker;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.StringTokenizer;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class MsoRequest {
@@ -91,6 +98,7 @@ public class MsoRequest {
private String errorCode;
private String httpResponse;
private String responseBody;
+ private String originalRequestJSON;
private RequestStatusType status;
private ServiceInstancesRequest sir;
private long startTime;
@@ -103,7 +111,11 @@ public class MsoRequest {
private String asdcServiceModelVersion;
private String requestScope;
private int reqVersion;
- private boolean aLaCarteFlag = false;
+ private boolean aLaCarteFlag;
+ private Platform platform;
+ private LineOfBusiness lineOfBusiness;
+ private Project project;
+ private OwningEntity owningEntity;
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static final String NOT_PROVIDED = "not provided";
@@ -164,10 +176,10 @@ public class MsoRequest {
se.setMessageId(messageId);
se.setText(text);
if(variables != null){
- for(String variable: variables){
- se.getVariables().add(variable);
- }
- }
+ for(String variable: variables){
+ se.getVariables().add(variable);
+ }
+ }
re.setServiceException(se);
}
@@ -175,7 +187,7 @@ public class MsoRequest {
try{
ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
+ mapper.setSerializationInclusion(Include.NON_DEFAULT);
requestErrorStr = mapper.writeValueAsString(re);
}catch(Exception e){
msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e);
@@ -195,25 +207,16 @@ public class MsoRequest {
}
// Parse request JSON
- void parse (ServiceInstancesRequest sir, HashMap<String,String> instanceIdMap, Action action, String version) throws ValidationException {
+ void parse (ServiceInstancesRequest sir, HashMap<String,String> instanceIdMap, Action action, String version, String originalRequestJSON) throws ValidationException {
msoLogger.debug ("Validating the Service Instance request");
this.sir = sir;
this.action = action;
this.reqVersion = reqVersionToInt(version);
+ this.originalRequestJSON = originalRequestJSON;
msoLogger.debug ("Incoming version is: " + version + " coverting to int: " + this.reqVersion);
-
-
- try{
- ObjectMapper mapper = new ObjectMapper();
- //mapper.configure(Feature.WRAP_ROOT_VALUE, true);
- requestJSON = mapper.writeValueAsString(sir.getRequestDetails());
-
- } catch(Exception e){
- throw new ValidationException ("Parse ServiceInstanceRequest to JSON string",e);
- }
-
+
if(instanceIdMap != null){
if(instanceIdMap.get("serviceInstanceId") != null){
if (!UUIDChecker.isValidUUID (instanceIdMap.get ("serviceInstanceId"))) {
@@ -249,20 +252,22 @@ public class MsoRequest {
}
this.sir.setNetworkInstanceId(instanceIdMap.get("networkInstanceId"));
}
+
+ if(instanceIdMap.get("configurationInstanceId") != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get ("configurationInstanceId"))) {
+ throw new ValidationException ("configurationInstanceId");
+ }
+ this.sir.setConfigurationId(instanceIdMap.get("configurationInstanceId"));
+ }
}
-
- RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters();
- if (this.reqVersion >= 3) {
- this.aLaCarteFlag =
- requestParameters != null && sir.getRequestDetails().getRequestParameters().isaLaCarte();
- } else {
- this.aLaCarteFlag = true;
- }
-
- if(requestParameters != null && (reqVersion < 3) && requestParameters.getAutoBuildVfModules()){
- throw new ValidationException("AutoBuildVfModule", version);
+
+ if(reqVersion >= 6 && (action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig)){
+ parsePayload(sir, action);
}
-
+ else{
+
+ RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters();
+
this.modelInfo = sir.getRequestDetails().getModelInfo();
if (this.modelInfo == null) {
@@ -280,23 +285,80 @@ public class MsoRequest {
}
this.requestScope = modelInfo.getModelType().name();
-
+
+ if(this.reqVersion >= 4){
+ if(Action.addRelationships.equals(action) || Action.removeRelationships.equals(action)) {
+ if(requestParameters == null || requestParameters.getALaCarte() == null) {
+ throw new ValidationException ("aLaCarte in requestParameters");
+ }
+ }
+ }
+
+ if(requestParameters != null){
+ if(requestScope.equalsIgnoreCase(ModelType.vnf.name())){
+ if(action == Action.createInstance){
+ if(requestParameters.getAutoBuildVfModules() == null){
+ requestParameters.setAutoBuildVfModules(false);
+ }
+ }
+ if(action == Action.deleteInstance){
+ if(requestParameters.getCascadeDelete() == null){
+ requestParameters.setCascadeDelete(false);
+ }
+ }
+ if(action == Action.updateInstance){
+ if(requestParameters.isUsePreload() == null){
+ requestParameters.setUsePreload(true);
+ }
+ }
+ if(action == Action.replaceInstance){
+ if(requestParameters.rebuildVolumeGroups() == null){
+ requestParameters.setRebuildVolumeGroups(false);
+ }
+ }
+ }
+ if(requestScope.equalsIgnoreCase(ModelType.vfModule.name())){
+ if(action == Action.createInstance || action == Action.updateInstance){
+ if(requestParameters.isUsePreload() == null){
+ requestParameters.setUsePreload(true);
+ }
+ }
+ }
+ if(this.reqVersion >= 4){
+ if(requestParameters.getALaCarte() != null){
+ this.aLaCarteFlag = requestParameters.getALaCarte();
+ }
+ if(requestScope.equalsIgnoreCase(ModelType.service.name())){
+ if(action == Action.createInstance || action == Action.deleteInstance || action == Action.activateInstance || action == Action.deactivateInstance){
+ if(requestParameters.getALaCarte() == null){
+ requestParameters.setaLaCarte(false);
+ this.aLaCarteFlag = requestParameters.getALaCarte();
+ }
+ }
+ }
+ }else{
+ this.aLaCarteFlag = true;
+ }
+ }
+ if(reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance){
+ parsePlatformAndLineOfBusiness(sir);
+ }
// modelCustomizationId is required when usePreLoad is false for v4 and higher for VF Module Create
- if(requestParameters != null && reqVersion > 3 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.createInstance && !requestParameters.isUsePreload()) {
+ if(requestParameters != null && reqVersion >= 4 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.createInstance && !requestParameters.isUsePreload()) {
if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) {
throw new ValidationException("modelCustomizationId");
}
}
- // modelCustomizationId is required when usePreLoad is false for v5 and higher for VF Module Replace
- if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.replaceInstance && !requestParameters.isUsePreload()) {
+ // modelCustomizationId is required for v5 and higher for VF Module Replace
+ if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.replaceInstance) {
if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId())) {
throw new ValidationException("modelCustomizationId");
}
}
- // modelCustomizationId or modelCustomizationName are required when usePreLoad is false for v5 and higher for VNF Replace
- if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.replaceInstance && !requestParameters.isUsePreload()) {
+ // modelCustomizationId or modelCustomizationName are required for VNF Replace
+ if(requestParameters != null && reqVersion > 4 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.replaceInstance) {
if(!UUIDChecker.isValidUUID(modelInfo.getModelCustomizationId()) && modelInfo.getModelCustomizationName() == null) {
throw new ValidationException("modelCustomizationId or modelCustomizationName");
}
@@ -305,7 +367,9 @@ public class MsoRequest {
//is required for serviceInstance delete macro when aLaCarte=false (v3)
//create and updates except for network (except v4)
if (empty (modelInfo.getModelInvariantId ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
- !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) {
+ !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) &&
+ (action == Action.createInstance || action == Action.updateInstance || action == Action.enablePort || action == Action.disablePort || action == Action.addRelationships || action == Action.removeRelationships ||
+ (requestScope.equalsIgnoreCase(ModelType.configuration.name()) && (action == Action.activateInstance || action == Action.deactivateInstance))))) {
throw new ValidationException ("modelInvariantId");
}
@@ -313,35 +377,31 @@ public class MsoRequest {
throw new ValidationException ("modelInvariantId format");
}
- if (this.reqVersion <= 2 && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || (action == Action.deleteInstance &&
- (requestScope.equalsIgnoreCase (ModelType.network.name ()) || requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))) {
- throw new ValidationException ("modelName");
- }
- if(this.reqVersion > 2 && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || (action == Action.deleteInstance &&
- (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){
+ if(this.reqVersion >= 4 && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance ||
+ action == Action.addRelationships || action == Action.removeRelationships || (action == Action.deleteInstance && (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){
throw new ValidationException ("modelName");
}
- if (empty (modelInfo.getModelVersion ()) && ((this.reqVersion == 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
- !(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) {
+ if (empty (modelInfo.getModelVersion ()) && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) &&
+ (!(this.reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ()))
+ && (action == Action.createInstance || action == Action.updateInstance || action == Action.addRelationships || action == Action.removeRelationships))) {
throw new ValidationException ("modelVersion");
}
- // modelVersionId doesn't exist in v2, not required field in v3, is required for serviceInstance delete macro when aLaCarte=false in v4
- if (this.reqVersion > 3 && empty (modelInfo.getModelVersionId()) && ((!this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
- (action == Action.createInstance || action == Action.updateInstance))) {
+ // is required for serviceInstance delete macro when aLaCarte=false in v4
+ if (this.reqVersion >= 4 && empty (modelInfo.getModelVersionId()) && ((!this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) ||
+ (action == Action.createInstance || action == Action.updateInstance || action == Action.enablePort || action == Action.disablePort || action == Action.addRelationships || action == Action.removeRelationships ||
+ (requestScope.equalsIgnoreCase(ModelType.configuration.name()) && (action == Action.activateInstance || action == Action.deactivateInstance))))) {
throw new ValidationException ("modelVersionId");
- }
+ }
if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action != Action.deleteInstance && empty (modelInfo.getModelCustomizationName ())) {
- if(this.reqVersion<=2){
- throw new ValidationException ("modelCustomizationName");
- } else if (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) {
+ if (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) {
throw new ValidationException ("modelCustomizationId or modelCustomizationName");
}
}
- if(this.reqVersion > 2 && (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) && requestScope.equalsIgnoreCase (ModelType.network.name ())
+ if(this.reqVersion >= 4 && (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) && (requestScope.equalsIgnoreCase (ModelType.network.name ()) || requestScope.equalsIgnoreCase(ModelType.configuration.name()))
&& (action == Action.updateInstance || action == Action.createInstance)){
throw new ValidationException ("modelCustomizationId");
}
@@ -351,8 +411,8 @@ public class MsoRequest {
}
this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration ();
- if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ()) && this.reqVersion < 5) ||
- (!requestScope.equalsIgnoreCase (ModelType.service.name ())) && action != Action.updateInstance))
+ if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ()) && this.reqVersion < 5) ||
+ (!requestScope.equalsIgnoreCase (ModelType.service.name ())) && action != Action.updateInstance))
&& cloudConfiguration == null) {
throw new ValidationException ("cloudConfiguration");
}
@@ -361,21 +421,23 @@ public class MsoRequest {
if (empty (cloudConfiguration.getLcpCloudRegionId ())) {
throw new ValidationException ("lcpCloudRegionId");
}
- if (empty (cloudConfiguration.getTenantId ())) {
+ if (empty (cloudConfiguration.getTenantId ()) && !(requestScope.equalsIgnoreCase(ModelType.configuration.name()))) {
throw new ValidationException ("tenantId");
}
}
- if (requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) {
+ if (requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance) {
if (requestParameters == null) {
throw new ValidationException ("requestParameters");
}
- if (empty (requestParameters.getSubscriptionServiceType ())) {
+ if (empty (requestParameters.getSubscriptionServiceType())) {
throw new ValidationException ("subscriptionServiceType");
}
}
-
+ if(this.reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance){
+ parseProjectAndOwningEntity(sir);
+ }
if (this.reqVersion > 4 && requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) {
SubscriberInfo subscriberInfo = sir.getRequestDetails ().getSubscriberInfo();
if (subscriberInfo == null) {
@@ -394,11 +456,6 @@ public class MsoRequest {
this.networkType = modelInfo.getModelName();
}
- // Verify instanceName existence and format except for macro serviceInstance
- if (this.reqVersion < 3 && requestScope.equalsIgnoreCase (ModelType.service.name ()) && empty (requestInfo.getInstanceName ()) && action == Action.createInstance) {
- throw new ValidationException ("instanceName");
- }
-
if (!empty (requestInfo.getInstanceName ())) {
if (!requestInfo.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) {
throw new ValidationException ("instanceName format");
@@ -410,13 +467,13 @@ public class MsoRequest {
//Mandatory for macro request create service instance
if((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) ||
(requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)) ||
- (this.reqVersion > 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance)) {
+ (this.reqVersion > 3 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.createInstance)) {
throw new ValidationException ("productFamilyId");
}
}
//required for all operations in V4
- if(empty(requestInfo.getRequestorId()) && this.reqVersion > 3) {
+ if(empty(requestInfo.getRequestorId()) && this.reqVersion >= 4) {
throw new ValidationException ("requestorId");
}
@@ -424,7 +481,6 @@ public class MsoRequest {
throw new ValidationException ("source");
}
-
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
@@ -433,6 +489,9 @@ public class MsoRequest {
String volumeGroupId = null;
boolean isRelatedServiceInstancePresent = false;
boolean isRelatedVnfInstancePresent = false;
+ boolean isSourceVnfPresent = false;
+ boolean isDestinationVnfPresent = false;
+ boolean isConnectionPointPresent = false;
if (instanceList != null) {
for(RelatedInstanceList relatedInstanceList : instanceList){
@@ -447,28 +506,33 @@ public class MsoRequest {
throw new ValidationException ("modelType in relatedInstance");
}
-
+ if(empty(relatedInstance.getInstanceName ()) && ModelType.pnf.equals(relatedInstanceModelInfo.getModelType())) {
+ throw new ValidationException ("instanceName in relatedInstance for pnf modelType");
+ }
+
if (!empty (relatedInstance.getInstanceName ())) {
if (!relatedInstance.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) {
throw new ValidationException ("instanceName format in relatedInstance");
}
}
- if (empty (relatedInstance.getInstanceId ())) {
+ if (empty (relatedInstance.getInstanceId ()) && !ModelType.pnf.equals(relatedInstanceModelInfo.getModelType())) {
throw new ValidationException ("instanceId in relatedInstance");
}
- if (!UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) {
+ if (!empty(relatedInstance.getInstanceId ()) && !UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) {
throw new ValidationException ("instanceId format in relatedInstance");
}
if (action != Action.deleteInstance) {
- if(!relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
+ if(!( relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup) ||
+ relatedInstanceModelInfo.getModelType().equals(ModelType.connectionPoint) ||
+ relatedInstanceModelInfo.getModelType().equals(ModelType.pnf))) {
if(empty (relatedInstanceModelInfo.getModelInvariantId ())) {
- throw new ValidationException ("modelInvariantId in relatedInstance");
- } else if(this.reqVersion > 3 && empty(relatedInstanceModelInfo.getModelVersionId ())) {
+ throw new ValidationException ("modelInvariantId in relatedInstance");
+ } else if(this.reqVersion >= 4 && empty(relatedInstanceModelInfo.getModelVersionId ())) {
throw new ValidationException("modelVersionId in relatedInstance");
} else if(empty(relatedInstanceModelInfo.getModelName ())) {
throw new ValidationException ("modelName in relatedInstance");
@@ -481,14 +545,25 @@ public class MsoRequest {
!UUIDChecker.isValidUUID (relatedInstanceModelInfo.getModelInvariantId ())) {
throw new ValidationException ("modelInvariantId format in relatedInstance");
}
+
+ if(ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ if(InstanceDirection.source.equals(relatedInstance.getInstanceDirection()) && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
+ isSourceVnfPresent = true;
+ } else if(InstanceDirection.destination.equals(relatedInstance.getInstanceDirection()) &&
+ (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) || (relatedInstanceModelInfo.getModelType().equals(ModelType.pnf) && this.reqVersion == 6))) {
+ isDestinationVnfPresent = true;
+ }
}
+
+ if(ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType()) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ isConnectionPointPresent = true;
+ }
+ }
if (empty (relatedInstanceModelInfo.getModelCustomizationName ()) && relatedInstanceModelInfo.getModelType ().equals (ModelType.vnf) ) {
- if(this.reqVersion >=3 && empty (relatedInstanceModelInfo.getModelCustomizationId()) && action != Action.deleteInstance) {
+ if(this.reqVersion >=4 && empty (relatedInstanceModelInfo.getModelCustomizationId()) && action != Action.deleteInstance) {
throw new ValidationException ("modelCustomizationName or modelCustomizationId in relatedInstance of vnf");
- } else if(this.reqVersion < 3) {
- throw new ValidationException ("modelCustomizationName in relatedInstance");
- }
+ }
}
if(relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
@@ -498,7 +573,7 @@ public class MsoRequest {
}
serviceModelName = relatedInstanceModelInfo.getModelName ();
asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion ();
- } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
+ } else if(relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
isRelatedVnfInstancePresent = true;
if (!relatedInstance.getInstanceId ().equals (this.sir.getVnfInstanceId ())) {
throw new ValidationException ("vnfInstanceId matching the vnfInstanceId in request URI");
@@ -509,7 +584,22 @@ public class MsoRequest {
}
}
+ if(action == Action.createInstance && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ if(!isSourceVnfPresent) {
+ throw new ValidationException ("source vnf relatedInstance for Port Configuration");
+ }
+
+ if(!isDestinationVnfPresent) {
+ throw new ValidationException ("destination vnf relatedInstance for Port Configuration");
+ }
+ }
+ if((action == Action.enablePort || action == Action.disablePort) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ if(!isConnectionPointPresent) {
+ throw new ValidationException ("connectionPoint relatedInstance for Port Configuration");
+ }
+ }
+
if(requestScope.equalsIgnoreCase (ModelType.volumeGroup.name ())) {
if (!isRelatedServiceInstancePresent) {
throw new ValidationException ("related service instance for volumeGroup request");
@@ -543,29 +633,87 @@ public class MsoRequest {
this.vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
}
}
- else if ((( requestScope.equalsIgnoreCase(ModelType.vnf.name ()) || requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ()) ) && (action == Action.createInstance)) ||
- (this.reqVersion > 2 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance)){
+ else if ((( requestScope.equalsIgnoreCase(ModelType.vnf.name ()) || requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())
+ || requestScope.equalsIgnoreCase(ModelType.configuration.name())) && (action == Action.createInstance || action == Action.enablePort || action == Action.disablePort)) ||
+ (this.reqVersion >= 4 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance) ||
+ (requestScope.equalsIgnoreCase(ModelType.service.name()) && (action.equals(Action.addRelationships) || action.equals(Action.removeRelationships)))){
msoLogger.debug ("related instance exception");
throw new ValidationException ("related instances");
}
-
+ }
}
-
+ void parsePayload(ServiceInstancesRequest sir, Action action) throws ValidationException{
+ msoLogger.debug("Validating for requestParameters and payload");
+ this.sir = sir;
+ this.action = action;
+ this.requestScope = ModelType.vnf.name();
+ RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters();
+ this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration();
+ this.requestInfo = sir.getRequestDetails().getRequestInfo();
+
+ if(action == Action.inPlaceSoftwareUpdate){
+ if (cloudConfiguration == null) {
+ throw new ValidationException ("cloudConfiguration");
+ }else if (empty (cloudConfiguration.getLcpCloudRegionId ())) {
+ throw new ValidationException ("lcpCloudRegionId");
+ }else if (empty (cloudConfiguration.getTenantId ())) {
+ throw new ValidationException ("tenantId");
+ }
+ }
+ if(requestInfo == null){
+ throw new ValidationException("requestInfo");
+ }else if(empty(requestInfo.getRequestorId())) {
+ throw new ValidationException ("requestorId");
+ }else if (empty (requestInfo.getSource ())) {
+ throw new ValidationException ("source");
+ }
+ if(requestParameters == null){
+ throw new ValidationException("requestParameters");
+ }
+ }
+ void parsePlatformAndLineOfBusiness(ServiceInstancesRequest sir) throws ValidationException {
+ msoLogger.debug("Validating Platform and LineOfBusiness Objects");
+ this.sir = sir;
+ platform = sir.getRequestDetails().getPlatform();
+ lineOfBusiness = sir.getRequestDetails().getLineOfBusiness();
+
+ if(this.reqVersion > 5 && platform == null) {
+ throw new ValidationException("platform");
+ }
+
+ if(platform != null && empty(platform.getPlatformName())){
+ throw new ValidationException("platformName");
+ }
+
+ if(lineOfBusiness != null && empty(lineOfBusiness.getLineOfBusinessName())){
+ throw new ValidationException("lineOfBusinessName");
+ }
+ }
+
+ void parseProjectAndOwningEntity(ServiceInstancesRequest sir) throws ValidationException {
+ msoLogger.debug("Validating Project and OwningEntity Objects");
+ this.sir = sir;
+ this.project = sir.getRequestDetails().getProject();
+ this.owningEntity = sir.getRequestDetails().getOwningEntity();
+
+ if(this.reqVersion > 5 && owningEntity == null) {
+ throw new ValidationException("owningEntity");
+ }
+
+ if(owningEntity != null && empty(owningEntity.getOwningEntityId())){
+ throw new ValidationException("owningEntityId");
+ }
+
+ if(project != null && empty(project.getProjectName())){
+ throw new ValidationException("projectName");
+ }
+ }
+
void parseOrchestration (ServiceInstancesRequest sir) throws ValidationException {
msoLogger.debug ("Validating the Orchestration request");
this.sir = sir;
-
- try{
- ObjectMapper mapper = new ObjectMapper();
- //mapper.configure(Feature.WRAP_ROOT_VALUE, true);
- requestJSON = mapper.writeValueAsString(sir.getRequestDetails());
-
- } catch(Exception e){
- throw new ValidationException ("Parse ServiceInstanceRequest to JSON string", e);
- }
-
this.requestInfo = sir.getRequestDetails().getRequestInfo();
if (this.requestInfo == null) {
@@ -660,7 +808,7 @@ public class MsoRequest {
}
}
- if (modelInfo != null) {
+ if (modelInfo != null || (action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig)) {
aq.setRequestScope(requestScope);
}
@@ -711,6 +859,11 @@ public class MsoRequest {
aq.setVnfType(vnfType);
}
+
+ if(ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
+ aq.setConfigurationId(sir.getConfigurationId());
+ aq.setConfigurationName(requestInfo.getInstanceName());
+ }
if(ModelType.vnf.name().equalsIgnoreCase(requestScope)){
aq.setVnfName(requestInfo.getInstanceName());
@@ -730,7 +883,7 @@ public class MsoRequest {
}
}
- aq.setRequestBody (this.requestJSON);
+ aq.setRequestBody (this.originalRequestJSON);
aq.setRequestStatus (status.toString ());
aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
@@ -738,8 +891,7 @@ public class MsoRequest {
if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
aq.setStatusMessage (this.errorMessage);
aq.setResponseBody (this.responseBody);
- aq.setProgress(100L);
-
+ aq.setProgress(new Long(100));
Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
}
@@ -798,7 +950,35 @@ public class MsoRequest {
return Response.status (httpResponseCode).entity (null).build ();
}
+
+ public Platform getPlatform(){
+ return platform;
+ }
+
+ public void setPlatform(Platform value){
+ this.platform = value;
+ }
+
+ public LineOfBusiness getLineOfBusiness(){
+ return lineOfBusiness;
+ }
+
+ public void setLineOfBusiness(LineOfBusiness value){
+ this.lineOfBusiness = value;
+ }
+ public Project getProject(){
+ return project;
+ }
+ public void setProject(Project value){
+ this.project = value;
+ }
+ public OwningEntity getOwningEntity(){
+ return owningEntity;
+ }
+ public void setOwningEntity(OwningEntity value){
+ this.owningEntity = value;
+ }
public String getRequestUri () {
return requestUri;
}
@@ -971,7 +1151,7 @@ public class MsoRequest {
public String getRequestJSON() throws JsonGenerationException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Inclusion.NON_NULL);
+ mapper.setSerializationInclusion(Include.NON_NULL);
//mapper.configure(Feature.WRAP_ROOT_VALUE, true);
msoLogger.debug ("building sir from object " + sir);
requestJSON = mapper.writeValueAsString(sir);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
index 2c7bd1cc36..d9528930e5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
@@ -5,7 +5,7 @@ package org.openecomp.mso.apihandlerinfra;
* #%L
* MSO
* %%
- * Copyright (C) 2016 OPENECOMP - MSO
+ * Copyright (C) 2016 ONAP - SO
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
index 0191b546e3..3a7235d370 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
@@ -37,8 +37,6 @@ import com.wordnik.swagger.annotations.ApiOperation;
@Api(value="/nodehealthcheck",description="API Handler Infra Node Health Check")
public class NodeHealthcheckHandler {
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
@HEAD
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
index d60915bf43..7be86fed9d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
@@ -3,7 +3,6 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -38,40 +37,35 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.http.HttpStatus;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2ERequest;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.Request;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestList;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestStatus;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
-import org.openecomp.mso.requestsdb.OperationStatus;
import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.serviceinstancebeans.GetOrchestrationListResponse;
+import org.openecomp.mso.serviceinstancebeans.GetOrchestrationResponse;
+import org.openecomp.mso.serviceinstancebeans.InstanceReferences;
+import org.openecomp.mso.serviceinstancebeans.Request;
+import org.openecomp.mso.serviceinstancebeans.RequestDetails;
+import org.openecomp.mso.serviceinstancebeans.RequestList;
+import org.openecomp.mso.serviceinstancebeans.RequestStatus;
+import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
-@Path("/")
-@Api(value = "/", description = "API Requests for Orchestration requests")
+@Path("/orchestrationRequests")
+@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests")
public class OrchestrationRequests {
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
-
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
-
- private RequestsDatabase requestsDB = RequestsDatabase.getInstance();
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private RequestsDatabase requestsDB = RequestsDatabase.getInstance();
+
/**
*
*/
@@ -80,69 +74,66 @@ public class OrchestrationRequests {
}
@GET
- @Path("orchestrationRequests/{version:[vV][2-5]}/{requestId}")
- @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class)
+ @Path("/{version:[vV][4-6]}/{requestId}")
+ @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class)
@Produces(MediaType.APPLICATION_JSON)
- public Response getOrchestrationRequest(@PathParam("requestId") String requestId,
- @PathParam("version") String version) {
+ public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) {
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
- MsoRequest msoRequest = new MsoRequest(requestId);
+ MsoRequest msoRequest = new MsoRequest (requestId);
- long startTime = System.currentTimeMillis();
+ long startTime = System.currentTimeMillis ();
InfraActiveRequests requestDB = null;
- try {
- requestDB = requestsDB.getRequestFromInfraActive(requestId);
-
- } catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError,
- "Exception while communciate with Request DB - Infra Request Lookup", e);
- msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null);
- alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
- Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with Request DB");
- msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
- return response;
-
- }
-
- if (requestDB == null) {
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
- MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Null response from RequestDB when searching by RequestId");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- "Null response from RequestDB when searching by RequestId");
- msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
- return resp;
-
- }
-
- Request request = mapInfraActiveRequestToRequest(requestDB);
-
- orchestrationResponse.setRequest(request);
-
- return Response.status(200).entity(orchestrationResponse).build();
+ try {
+ requestDB = requestsDB.getRequestFromInfraActive(requestId);
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ e.getMessage (),
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+
+ }
+
+ if(requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+
+ }
+
+ Request request = mapInfraActiveRequestToRequest(requestDB);
+
+ orchestrationResponse.setRequest(request);
+
+ return Response.status(200).entity(orchestrationResponse).build();
}
-
-
@GET
- @Path("orchestrationRequests/{version:[vV][2-5]}")
- @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class)
+ @Path("/{version:[vV][4-6]}")
+ @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class)
@Produces(MediaType.APPLICATION_JSON)
public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) {
- long startTime = System.currentTimeMillis();
+ long startTime = System.currentTimeMillis ();
MsoRequest msoRequest = new MsoRequest();
@@ -152,7 +143,8 @@ public class OrchestrationRequests {
GetOrchestrationListResponse orchestrationList = null;
- try {
+
+ try{
Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams);
@@ -162,7 +154,7 @@ public class OrchestrationRequests {
List<RequestList> requestLists = new ArrayList<>();
- for (InfraActiveRequests infraActive : activeRequests) {
+ for(InfraActiveRequests infraActive : activeRequests){
Request request = mapInfraActiveRequestToRequest(infraActive);
RequestList requestList = new RequestList();
@@ -174,216 +166,209 @@ public class OrchestrationRequests {
orchestrationList.setRequestList(requestLists);
- } catch (Exception e) {
- msoLogger.debug("Get Orchestration Request with Filters Failed : ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
- MsoException.ServiceException, "Get Orchestration Request with Filters Failed. " + e.getMessage(),
- ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
- msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError,
- "Get Orchestration Request with Filters Failed");
- msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
- return response;
+ }catch(Exception e){
+ msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ "Get Orchestration Request with Filters Failed. " + e.getMessage(),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
}
- return Response.status(200).entity(orchestrationList).build();
+
+ return Response.status(200).entity(orchestrationList).build();
}
+
@POST
- @Path("orchestrationRequests/{version: [vV][3-5]}/{requestId}/unlock")
+ @Path("/{version: [vV][4-6]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class)
- public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
- @PathParam("version") String version) {
+ @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class)
+ public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) {
- MsoRequest msoRequest = new MsoRequest(requestId);
+ MsoRequest msoRequest = new MsoRequest (requestId);
- long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
InfraActiveRequests requestDB = null;
Request request = null;
- msoLogger.debug("requestId is: " + requestId);
+ msoLogger.debug ("requestId is: " + requestId);
ServiceInstancesRequest sir = null;
- try {
+ try{
ObjectMapper mapper = new ObjectMapper();
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- } catch (Exception e) {
- msoLogger.debug("Mapping of request to JSON object failed : ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
- MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId() != null) {
- msoLogger.debug("Mapping of request to JSON object failed");
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Mapping of request to JSON object failed");
}
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
- "Mapping of request to JSON object failed");
- msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
}
- try {
+
+ try{
msoRequest.parseOrchestration(sir);
} catch (Exception e) {
- msoLogger.debug("Validation failed: ", e);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
- MsoException.ServiceException, "Error parsing request. " + e.getMessage(),
+ msoLogger.debug ("Validation failed: ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Error parsing request. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId() != null) {
- msoLogger.debug("Logging failed message to the database");
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
}
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
- "Validation of the input request failed");
- msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
}
try {
requestDB = requestsDB.getRequestFromInfraActive(requestId);
- if (requestDB == null) {
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Null response from RequestDB when searching by RequestId");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- "Null response from RequestDB when searching by RequestId");
- msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+ if(requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
return resp;
- } else {
+ }else{
request = mapInfraActiveRequestToRequest(requestDB);
RequestStatus reqStatus = request.getRequestStatus();
Status status = Status.valueOf(reqStatus.getRequestState());
- if (status == Status.IN_PROGRESS || status == Status.PENDING) {
- msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED);
- reqStatus.setRequestState(Status.UNLOCKED.toString());
- requestsDB.updateInfraStatus(requestId, Status.UNLOCKED.toString(),
+ if(status == Status.IN_PROGRESS || status == Status.PENDING || status == Status.PENDING_MANUAL_TASK){
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED);
+ reqStatus.setRequestState(Status.UNLOCKED.toString ());
+ requestsDB.updateInfraStatus (requestId,
+ Status.UNLOCKED.toString (),
Constants.MODIFIED_BY_APIHANDLER);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "RequestId " + requestId + " has been unlocked");
-
- } else {
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
- MsoException.ServiceException, "Orchestration RequestId " + requestId + " has a status of "
- + status + " and can not be unlocked",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of "
- + status + " and can not be unlocked");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError,
- "Orchestration RequestId " + requestId + " has a status of " + status
- + " and can not be unlocked");
- msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked");
+
+ }else{
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
return resp;
}
}
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError,
- "Exception while communciate with Request DB - Infra Request Lookup", e);
- msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null);
- alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
- Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with Request DB");
- msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ e.getMessage (),
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
}
- return Response.status(HttpStatus.SC_NO_CONTENT).entity("").build();
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
}
- private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) {
-
- Request request = new Request();
-
- ObjectMapper mapper = new ObjectMapper();
- // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
-
- request.setRequestId(requestDB.getRequestId());
- request.setRequestScope(requestDB.getRequestScope());
- request.setRequestType(requestDB.getRequestAction());
-
- InstanceReferences ir = new InstanceReferences();
- if (requestDB.getNetworkId() != null)
- ir.setNetworkInstanceId(requestDB.getNetworkId());
- if (requestDB.getNetworkName() != null)
- ir.setNetworkInstanceName(requestDB.getNetworkName());
- if (requestDB.getServiceInstanceId() != null)
- ir.setServiceInstanceId(requestDB.getServiceInstanceId());
- if (requestDB.getServiceInstanceName() != null)
- ir.setServiceInstanceName(requestDB.getServiceInstanceName());
- if (requestDB.getVfModuleId() != null)
- ir.setVfModuleInstanceId(requestDB.getVfModuleId());
- if (requestDB.getVfModuleName() != null)
- ir.setVfModuleInstanceName(requestDB.getVfModuleName());
- if (requestDB.getVnfId() != null)
- ir.setVnfInstanceId(requestDB.getVnfId());
- if (requestDB.getVnfName() != null)
- ir.setVnfInstanceName(requestDB.getVnfName());
- if (requestDB.getVolumeGroupId() != null)
- ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId());
- if (requestDB.getVolumeGroupName() != null)
- ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName());
- if (requestDB.getRequestorId() != null)
+ private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) {
+
+
+ Request request = new Request();
+
+ ObjectMapper mapper = new ObjectMapper();
+ // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+
+ request.setRequestId(requestDB.getRequestId());
+ request.setRequestScope(requestDB.getRequestScope());
+ request.setRequestType(requestDB.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if(requestDB.getNetworkId() != null)
+ ir.setNetworkInstanceId(requestDB.getNetworkId());
+ if(requestDB.getNetworkName() != null)
+ ir.setNetworkInstanceName(requestDB.getNetworkName());
+ if(requestDB.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(requestDB.getServiceInstanceId());
+ if(requestDB.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(requestDB.getServiceInstanceName());
+ if(requestDB.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(requestDB.getVfModuleId());
+ if(requestDB.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(requestDB.getVfModuleName());
+ if(requestDB.getVnfId() != null)
+ ir.setVnfInstanceId(requestDB.getVnfId());
+ if(requestDB.getVnfName() != null)
+ ir.setVnfInstanceName(requestDB.getVnfName());
+ if(requestDB.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId());
+ if(requestDB.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName());
+ if(requestDB.getRequestorId() != null)
ir.setRequestorId(requestDB.getRequestorId());
+
request.setInstanceReferences(ir);
- String requestBody = requestDB.getRequestBody();
+ String requestBody = requestDB.getRequestBody();
- RequestDetails requestDetails = null;
+ RequestDetails requestDetails = null;
- try {
- requestDetails = mapper.readValue(requestBody, RequestDetails.class);
+ try{
+ requestDetails = mapper.readValue(requestBody, RequestDetails.class);
- } catch (Exception e) {
- msoLogger.debug("Exception caught mapping requestBody to RequestDetails", e);
- }
+ }catch(Exception e){
+ msoLogger.debug("Exception caught mapping requestBody to RequestDetails");
+ }
- request.setRequestDetails(requestDetails);
- String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime())
- + " GMT";
- request.setStartTime(startTimeStamp);
+ request.setRequestDetails(requestDetails);
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT";
+ request.setStartTime(startTimeStamp);
- RequestStatus status = new RequestStatus();
- if (requestDB.getStatusMessage() != null) {
- status.setStatusMessage(requestDB.getStatusMessage());
- }
+ RequestStatus status = new RequestStatus();
+ if(requestDB.getStatusMessage() != null){
+ status.setStatusMessage(requestDB.getStatusMessage());
+ }
- if (requestDB.getEndTime() != null) {
- String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime())
- + " GMT";
- status.setFinishTime(endTimeStamp);
- }
+ if(requestDB.getEndTime() != null){
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT";
+ status.setFinishTime(endTimeStamp);
+ }
- if (requestDB.getRequestStatus() != null) {
- status.setRequestState(requestDB.getRequestStatus());
- }
- if (requestDB.getProgress() != null) {
- status.setPercentProgress(requestDB.getProgress().intValue());
- }
+ if(requestDB.getRequestStatus() != null){
+ status.setRequestState(requestDB.getRequestStatus());
+ }
- request.setRequestStatus(status);
+ if(requestDB.getProgress() != null){
+ status.setPercentProgress(requestDB.getProgress().intValue());
+ }
- return request;
- }
+ request.setRequestStatus(status);
-} \ No newline at end of file
+ return request;
+ }
+ }
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
index 287b0ad812..efc58ed691 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
@@ -34,21 +34,24 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.mso.apihandler.common.CommonConstants;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
import org.openecomp.mso.apihandler.common.ResponseHandler;
import org.openecomp.mso.apihandler.common.ValidationException;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestReferences;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest;
-import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesResponse;
+import org.openecomp.mso.serviceinstancebeans.ModelInfo;
+import org.openecomp.mso.serviceinstancebeans.ModelType;
+import org.openecomp.mso.serviceinstancebeans.RelatedInstance;
+import org.openecomp.mso.serviceinstancebeans.RelatedInstanceList;
+import org.openecomp.mso.serviceinstancebeans.RequestParameters;
+import org.openecomp.mso.serviceinstancebeans.RequestReferences;
+import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest;
+import org.openecomp.mso.serviceinstancebeans.ServiceInstancesResponse;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.NetworkResource;
import org.openecomp.mso.db.catalog.beans.Recipe;
@@ -62,6 +65,7 @@ import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.utils.UUIDChecker;
@@ -76,10 +80,9 @@ public class ServiceInstances {
private HashMap<String, String> instanceIdMap = new HashMap<>();
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
- public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@POST
- @Path("/{version:[vV][3-5]}")
+ @Path("/{version:[vV][4-6]}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Create a Service Instance on a version provided",response=Response.class)
@@ -91,12 +94,12 @@ public class ServiceInstances {
}
@POST
- @Path("/{version:[vV][5]}/{serviceInstanceId}/activate")
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/activate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Activate provided Service Instance",response=Response.class)
public Response activateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
Response response = serviceInstances(request, Action.activateInstance, instanceIdMap, version);
@@ -104,38 +107,153 @@ public class ServiceInstances {
}
@POST
- @Path("/{version:[vV][5]}/{serviceInstanceId}/deactivate")
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Deactivate provided Service Instance",response=Response.class)
public Response deactivateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
Response response = serviceInstances(request, Action.deactivateInstance, instanceIdMap, version);
return response;
}
-
@DELETE
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Delete provided Service Instance",response=Response.class)
public Response deleteServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version);
return response;
}
+
+ @POST
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create Port Mirroring Configuration",response=Response.class)
+ public Response createPortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = configurationRecipeLookup(request, Action.createInstance, instanceIdMap, version);
+
+ return response;
+ }
+
+ @DELETE
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Delete provided Port",response=Response.class)
+ public Response deletePortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ Response response = configurationRecipeLookup(request, Action.deleteInstance, instanceIdMap, version);
+ return response;
+ }
+
+ @POST
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/enablePort")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Enable Port Mirroring",response=Response.class)
+ public Response enablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ Response response = configurationRecipeLookup(request, Action.enablePort, instanceIdMap, version);
+
+ return response;
+ }
+
+ @POST
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/disablePort")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Disable Port Mirroring",response=Response.class)
+ public Response disablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ Response response = configurationRecipeLookup(request, Action.disablePort, instanceIdMap, version);
+
+ return response;
+ }
+
+ @POST
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/activate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Activate Port Mirroring",response=Response.class)
+ public Response activatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ Response response = configurationRecipeLookup(request, Action.activateInstance, instanceIdMap, version);
+
+ return response;
+ }
+
+ @POST
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/configurations/{configurationInstanceId}/deactivate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Deactivate Port Mirroring",response=Response.class)
+ public Response deactivatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("configurationInstanceId") String configurationInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("configurationInstanceId", configurationInstanceId);
+ Response response = configurationRecipeLookup(request, Action.deactivateInstance, instanceIdMap, version);
+
+ return response;
+ }
+
+ @POST
+ @Path("/{version:[vV][6]}/{serviceInstanceId}/addRelationships")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Add Relationships to a Service Instance",response=Response.class)
+ public Response addRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
+ msoLogger.debug ("version is: " + version);
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = configurationRecipeLookup(request, Action.addRelationships, instanceIdMap, version);
+
+ return response;
+ }
+
+ @POST
+ @Path("/{version:[vV][6]}/{serviceInstanceId}/removeRelationships")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Remove Relationships from Service Instance",response=Response.class)
+ public Response removeRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
+ msoLogger.debug ("version is: " + version);
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ Response response = configurationRecipeLookup(request, Action.removeRelationships, instanceIdMap, version);
+ return response;
+ }
+
@POST
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Create VNF on a specified version and serviceInstance",response=Response.class)
public Response createVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
msoLogger.debug ("version is: " + version);
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version);
@@ -143,13 +261,14 @@ public class ServiceInstances {
}
@POST
- @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace")
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Replace provided VNF instance",response=Response.class)
public Response replaceVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId) {
msoLogger.debug ("version is: " + version);
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
Response response = serviceInstances(request, Action.replaceInstance, instanceIdMap, version);
@@ -158,29 +277,44 @@ public class ServiceInstances {
}
@PUT
- @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Update VNF on a specified version, serviceInstance and vnfInstance",response=Response.class)
public Response updateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
Response response = serviceInstances(request, Action.updateInstance, instanceIdMap, version);
return response;
}
+
+ @POST
+ @Path("/{version:[vV][6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/applyUpdatedConfig")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Apply updated configuration",response=Response.class)
+ public Response applyUpdatedConfig(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.applyUpdatedConfig, instanceIdMap, version);
+
+ return response;
+ }
@DELETE
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Delete provided VNF instance",response=Response.class)
public Response deleteVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version);
@@ -189,13 +323,14 @@ public class ServiceInstances {
}
@POST
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class)
public Response createVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId) {
msoLogger.debug ("version is: " + version);
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version);
@@ -204,15 +339,15 @@ public class ServiceInstances {
}
@POST
- @Path("/{version:[vV][5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace")
+ @Path("/{version:[vV][5-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Create VfModule on a specified version, serviceInstance and vnfInstance",response=Response.class)
public Response replaceVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId,
@PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
-
msoLogger.debug ("version is: " + version);
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
@@ -222,14 +357,14 @@ public class ServiceInstances {
}
@PUT
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",response=Response.class)
public Response updateVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId,
@PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
@@ -237,17 +372,31 @@ public class ServiceInstances {
return response;
}
+
+ @POST
+ @Path("/{version:[vV][6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/inPlaceSoftwareUpdate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Perform VNF software update",response=Response.class)
+ public Response inPlaceSoftwareUpdate(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("vnfInstanceId") String vnfInstanceId) {
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ Response response = serviceInstances(request, Action.inPlaceSoftwareUpdate, instanceIdMap, version);
+ return response;
+ }
+
@DELETE
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Delete provided VfModule instance",response=Response.class)
public Response deleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId,
@PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) {
-
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
@@ -258,13 +407,13 @@ public class ServiceInstances {
@POST
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Create VolumeGroup on a specified version, serviceInstance, vnfInstance",response=Response.class)
public Response createVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version);
@@ -273,15 +422,14 @@ public class ServiceInstances {
}
@PUT
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",response=Response.class)
public Response updateVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId,
@PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
-
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
@@ -291,15 +439,14 @@ public class ServiceInstances {
}
@DELETE
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Delete provided VolumeGroup instance",response=Response.class)
public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("vnfInstanceId") String vnfInstanceId,
@PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) {
-
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId);
@@ -309,12 +456,12 @@ public class ServiceInstances {
}
@POST
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/networks")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Create NetworkInstance on a specified version and serviceInstance ",response=Response.class)
public Response createNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version);
@@ -322,13 +469,13 @@ public class ServiceInstances {
}
@PUT
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Update VolumeGroup on a specified version, serviceInstance, networkInstance",response=Response.class)
public Response updateNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("networkInstanceId") String networkInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("networkInstanceId", networkInstanceId);
Response response = serviceInstances(request, Action.updateInstance, instanceIdMap, version);
@@ -337,13 +484,13 @@ public class ServiceInstances {
}
@DELETE
- @Path("/{version:[vV][3-5]}/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Path("/{version:[vV][4-6]}/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="Delete provided Network instance",response=Response.class)
public Response deleteNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId,
@PathParam("networkInstanceId") String networkInstanceId) {
-
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("networkInstanceId", networkInstanceId);
Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version);
@@ -351,8 +498,6 @@ public class ServiceInstances {
return response;
}
-
-
private Response serviceInstances(String requestJSON, Action action, HashMap<String,String> instanceIdMap, String version) {
String requestId = UUIDChecker.generateUUID(msoLogger);
@@ -362,31 +507,19 @@ public class ServiceInstances {
MsoRequest msoRequest = new MsoRequest (requestId);
-
- try{
- ObjectMapper mapper = new ObjectMapper();
- sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
-
- } catch(Exception e){
- msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ try {
+ sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest);
+ } catch(Exception e) {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
"Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null);
- if (msoRequest.getRequestId () != null) {
- msoLogger.debug ("Mapping of request to JSON object failed");
- msoRequest.createRequestRecord (Status.FAILED, action);
- }
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
}
-
- try{
- msoRequest.parse(sir, instanceIdMap, action, version);
- } catch (Exception e) {
- msoLogger.debug ("Validation failed: ", e);
+ try {
+ parseRequest(requestJSON, action, instanceIdMap, version, startTime, sir, msoRequest);
+ } catch(Exception e) {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
"Error parsing request. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null);
@@ -394,59 +527,34 @@ public class ServiceInstances {
msoLogger.debug ("Logging failed message to the database");
msoRequest.createRequestRecord (Status.FAILED, action);
}
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
}
-
- InfraActiveRequests dup = null;
+
String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
- String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+ String requestScope;
+ if(action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig){
+ requestScope = (ModelType.vnf.name());
+ }else{
+ requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+ }
+ InfraActiveRequests dup = null;
+
try {
- if(!(instanceName==null && "service".equals(requestScope) && (action == Action.createInstance || action == Action.activateInstance))){
- dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
- }
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
-
+ dup = duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,requestScope);
+ } catch(Exception e) {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
e.getMessage(),
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
null) ;
-
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check");
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
}
if (dup != null) {
- // Found the duplicate record. Return the appropriate error.
- String instance;
- if(instanceName != null){
- instance = instanceName;
- }else{
- instance = instanceIdMap.get(requestScope + "InstanceId");
- }
- String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
- //List<String> variables = new ArrayList<String>();
- //variables.add(dup.getRequestStatus());
-
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
- dupMessage,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- null) ;
-
-
- msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service");
- msoRequest.createRequestRecord (Status.FAILED, action);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- return response;
+ return buildErrorOnDuplicateRecord(action, instanceIdMap, startTime, msoRequest, instanceName, requestScope, dup);
}
-
ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
RequestReferences referencesResponse = new RequestReferences();
@@ -459,7 +567,7 @@ public class ServiceInstances {
try {
db = CatalogDatabase.getInstance();
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException,
@@ -475,8 +583,6 @@ public class ServiceInstances {
return response;
}
-
-
RecipeLookupResult recipeLookupResult = null;
try {
recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, action);
@@ -489,12 +595,12 @@ public class ServiceInstances {
msoLogger.debug ("Logging failed message to the database");
msoRequest.createRequestRecord (Status.FAILED, action);
}
- msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e);
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException,
@@ -512,7 +618,7 @@ public class ServiceInstances {
}
if (recipeLookupResult == null) {
- msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB");
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException,
@@ -528,8 +634,20 @@ public class ServiceInstances {
Boolean isBaseVfModule = false;
-
- if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule)) {
+
+ if (msoRequest.getModelInfo() != null && (action == Action.applyUpdatedConfig ||
+ action == Action.inPlaceSoftwareUpdate)) {
+
+ }
+ ModelType modelType;
+ if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
+ modelType = ModelType.vnf;
+ }
+ else {
+ modelType = msoRequest.getModelInfo().getModelType();
+ }
+
+ if (modelType.equals(ModelType.vfModule)) {
String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion ();
// Get VF Module-specific base module indicator
@@ -551,7 +669,7 @@ public class ServiceInstances {
else if (action == Action.createInstance || action == Action.updateInstance){
// There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in Catalog DB.
// This request cannot proceed
- msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB");
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB");
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
String serviceVersionText = "";
if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) {
@@ -605,39 +723,44 @@ public class ServiceInstances {
msoLogger.debug ("About to insert a record");
try {
- msoRequest.createRequestRecord (Status.PENDING, action);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
- MsoException.ServiceException,
- "Exception while creating record in DB " + e.getMessage(),
- ErrorNumbers.SVC_BAD_PARAMETER,
- null);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB");
+ createRequestRecord(action, startTime, msoRequest);
+ } catch(Exception e) {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ "Exception while creating record in DB " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
}
+
+ return postBPELRequest(action, requestId, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), recipeLookupResult.getRecipeTimeout(),
+ isBaseVfModule, serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, null,
+ msoRequest.getServiceInstanceType(), msoRequest.getVnfType(), msoRequest.getVfModuleType(), msoRequest.getNetworkType());
+ }
+ private Response postBPELRequest(Action action, String requestId, long startTime, MsoRequest msoRequest,
+ String orchestrationUri, int timeOut, Boolean isBaseVfModule,
+ String serviceInstanceId, String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String configurationId, String serviceInstanceType, String vnfType, String vfModuleType, String networkType) {
RequestClient requestClient = null;
HttpResponse response = null;
long subStartTime = System.currentTimeMillis();
try {
- requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), MsoPropertiesUtils.loadMsoProperties ());
- // Capture audit event
+ requestClient = RequestClientFactory.getRequestClient (orchestrationUri, MsoPropertiesUtils.loadMsoProperties ());
msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
- msoLogger.debug ("URL : " + requestClient.getUrl ());
+ System.out.println("URL : " + requestClient.getUrl ());
- response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (),
- serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
+ response = requestClient.post(requestId, isBaseVfModule, timeOut, action.name (),
+ serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId,
msoRequest.getServiceInstanceType (),
msoRequest.getVnfType (), msoRequest.getVfModuleType (),
msoRequest.getNetworkType (), msoRequest.getRequestJSON(), null);
- msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationUri, null);
} catch (Exception e) {
- msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null);
+ msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationUri, null);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException,
@@ -648,7 +771,7 @@ public class ServiceInstances {
MsoAlarmLogger.CRITICAL,
Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
return resp;
@@ -662,7 +785,7 @@ public class ServiceInstances {
ErrorNumbers.SVC_NO_SERVER_RESOURCES,
null);
msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN");
msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
return resp;
@@ -713,9 +836,90 @@ public class ServiceInstances {
return resp;
}
}
+ }
+
+ private void createRequestRecord(Action action, long startTime, MsoRequest msoRequest) throws Exception {
+ try {
+ msoRequest.createRequestRecord (Status.PENDING, action);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB");
+ throw new Exception(e);
+ }
+ }
+
+ private Response buildErrorOnDuplicateRecord(Action action, HashMap<String, String> instanceIdMap, long startTime, MsoRequest msoRequest,
+ String instanceName, String requestScope, InfraActiveRequests dup) {
+
+ // Found the duplicate record. Return the appropriate error.
+ String instance = null;
+ if(instanceName != null){
+ instance = instanceName;
+ }else{
+ instance = instanceIdMap.get(requestScope + "InstanceId");
+ }
+ String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
+ //List<String> variables = new ArrayList<String>();
+ //variables.add(dup.getRequestStatus());
+
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
+ dupMessage,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+
+
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service");
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ private InfraActiveRequests duplicateCheck(Action action, HashMap<String, String> instanceIdMap, long startTime,
+ MsoRequest msoRequest, String instanceName, String requestScope) throws Exception {
+ InfraActiveRequests dup = null;
+ try {
+ if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance))){
+ dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check");
+ throw new Exception(e);
+ }
+ return dup;
+ }
- //return Response.status (HttpStatus.SC_ACCEPTED).entity (serviceResponse).build ();
- // return serviceResponse;
+ private void parseRequest(String originalRequestJSON, Action action, HashMap<String, String> instanceIdMap, String version,
+ long startTime, ServiceInstancesRequest sir, MsoRequest msoRequest) throws Exception {
+ try{
+ msoRequest.parse(sir, instanceIdMap, action, version, originalRequestJSON);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, originalRequestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
+ throw new Exception(e);
+ }
+ }
+
+ private ServiceInstancesRequest convertJsonToServiceInstanceRequest(String requestJSON, Action action, long startTime,
+ ServiceInstancesRequest sir, MsoRequest msoRequest) throws Exception {
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Mapping of request to JSON object failed");
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ throw new Exception(e);
+ }
+ return sir;
}
private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
@@ -724,8 +928,11 @@ public class ServiceInstances {
msoLogger.debug("aLaCarteFlag is " + msoRequest.getALaCarteFlag());
// Query MSO Catalog DB
-
- if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) {
+
+ if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
+ recipeLookupResult = getDefaultVnfUri(db, msoRequest, action);
+ }
+ else if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) {
recipeLookupResult = getServiceURI(db, msoRequest, action);
}
else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) ||
@@ -751,11 +958,6 @@ public class ServiceInstances {
private RecipeLookupResult getServiceURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
// SERVICE REQUEST
// Construct the default service name
- // if no source is provided then make it as VID
-// if (null == msoRequest.getRequestInfo().getSource() || msoRequest.getRequestInfo().getSource().isEmpty()){
-// msoRequest.getRequestInfo().setSource("VID");
-// }
-
// TODO need to make this a configurable property
String defaultServiceModelName = "*";
String defaultSourceServiceModelName = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
@@ -780,7 +982,7 @@ public class ServiceInstances {
}
//if an aLaCarte flag was sent in the request, throw an error if the recipe was not found
RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters();
- if(reqParam!=null && reqParam.isaLaCarteSet() && recipe==null){
+ if(reqParam!=null && reqParam.isaLaCarte() && recipe==null){
return null;
}
@@ -812,7 +1014,7 @@ public class ServiceInstances {
}
Recipe recipe = null;
- String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+ String defaultSource = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
String modelCustomizationId = modelInfo.getModelCustomizationId();
String modelCustomizationName = modelInfo.getModelCustomizationName();
String relatedInstanceModelVersionId = null;
@@ -884,7 +1086,7 @@ public class ServiceInstances {
}
}
- VnfRecipe vnfRecipe = db.getVnfRecipe(defaultVnfType, action.name());
+ VnfRecipe vnfRecipe = db.getVnfRecipe(defaultSource, action.name());
if (vnfRecipe == null) {
return null;
@@ -904,51 +1106,49 @@ public class ServiceInstances {
// in vf_module_customization and looking up in vf_module (using vf_module_customization’s FK into vf_module) to find a match on MODEL_INVARIANT_UUID (modelInvariantId)
// and MODEL_VERSION (modelVersion).
- if(!msoRequest.getALaCarteFlag()) {
- VfModuleCustomization vfmc = null;
+ VfModuleCustomization vfmc = null;
VnfResourceCustomization vnfrc;
- VfModule vfModule = null;
-
- if( modelInfo.getModelCustomizationId() != null) {
- vfmc = db.getVfModuleCustomizationByModelCustomizationId(modelInfo.getModelCustomizationId());
- } else {
- vnfrc =db.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId(relatedInstanceModelCustomizationName, relatedInstanceModelVersionId);
- if(vnfrc == null) {
- vnfrc = db.getVnfResourceCustomizationByModelInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion, relatedInstanceModelCustomizationName);
- }
-
- List<VfModuleCustomization> list = db.getVfModuleCustomizationByVnfModuleCustomizationUuid(vnfrc.getModelCustomizationUuid());
-
- String vfModuleModelUUID = modelInfo.getModelVersionId();
- for(VfModuleCustomization vf : list) {
- if(vfModuleModelUUID != null) {
- vfModule = db.getVfModuleByModelCustomizationIdAndVersion(vf.getModelCustomizationUuid(), vfModuleModelUUID);
- } else {
- vfModule = db.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId(vf.getModelCustomizationUuid(), modelInfo.getModelVersion(), modelInfo.getModelInvariantId());
- }
-
- if(vfModule != null) {
- modelInfo.setModelCustomizationId(vf.getModelCustomizationUuid());
- modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUuid());
- break;
- }
+ VfModule vfModule = null;
+
+ if( modelInfo.getModelCustomizationId() != null) {
+ vfmc = db.getVfModuleCustomizationByModelCustomizationId(modelInfo.getModelCustomizationId());
+ } else {
+ vnfrc =db.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId(relatedInstanceModelCustomizationName, relatedInstanceModelVersionId);
+ if(vnfrc == null) {
+ vnfrc = db.getVnfResourceCustomizationByModelInvariantId(relatedInstanceModelInvariantId, relatedInstanceVersion, relatedInstanceModelCustomizationName);
+ }
+
+ List<VfModuleCustomization> list = db.getVfModuleCustomizationByVnfModuleCustomizationUuid(vnfrc.getModelCustomizationUuid());
+
+ String vfModuleModelUUID = modelInfo.getModelVersionId();
+ for(VfModuleCustomization vf : list) {
+ if(vfModuleModelUUID != null) {
+ vfModule = db.getVfModuleByModelCustomizationIdAndVersion(vf.getModelCustomizationUuid(), vfModuleModelUUID);
+ } else {
+ vfModule = db.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId(vf.getModelCustomizationUuid(), modelInfo.getModelVersion(), modelInfo.getModelInvariantId());
}
- }
- if(vfmc == null && vfModule == null) {
- throw new ValidationException("no catalog entry found");
- } else if (vfModule == null && vfmc != null) {
- vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in VfModuleCustomization table
+ if(vfModule != null) {
+ modelInfo.setModelCustomizationId(vf.getModelCustomizationUuid());
+ modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUuid());
+ break;
+ }
}
+ }
- if(modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(vfModule.getModelUUID());
- }
- recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(vfModule.getModelUUID(), vnfComponentType, action.name());
- }
+ if(vfmc == null && vfModule == null) {
+ throw new ValidationException("no catalog entry found");
+ } else if (vfModule == null && vfmc != null) {
+ vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in VfModuleCustomization table
+ }
+
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vfModule.getModelUUID());
+ }
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(vfModule.getModelUUID(), vnfComponentType, action.name());
if(recipe == null) {
- recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(defaultVnfType, vnfComponentType, action.name());
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(defaultSource, vnfComponentType, action.name());
if (recipe == null) {
recipe = db.getVnfComponentsRecipeByVfModuleModelUUId("*", vnfComponentType, action.name());
}
@@ -962,12 +1162,12 @@ public class ServiceInstances {
msoLogger.debug("recipe is null, getting default");
if(modelInfo.getModelType().equals(ModelType.vnf)) {
- recipe = db.getVnfRecipe(defaultVnfType, action.name());
+ recipe = db.getVnfRecipe(defaultSource, action.name());
if (recipe == null) {
return null;
}
} else {
- recipe = db.getVnfComponentsRecipeByVfModuleModelUUId("VID_DEFAULT", vnfComponentType, action.name());
+ recipe = db.getVnfComponentsRecipeByVfModuleModelUUId(defaultSource, vnfComponentType, action.name());
if (recipe == null) {
return null;
@@ -977,6 +1177,20 @@ public class ServiceInstances {
return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
}
+
+ private RecipeLookupResult getDefaultVnfUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
+
+ String defaultSource = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
+
+ VnfRecipe vnfRecipe = db.getVnfRecipe(defaultSource, action.name());
+
+ if (vnfRecipe == null) {
+ return null;
+ }
+
+ return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ }
+
private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
@@ -984,31 +1198,137 @@ public class ServiceInstances {
ModelInfo modelInfo = msoRequest.getModelInfo();
String modelName = modelInfo.getModelName();
- Recipe recipe;
- if(msoRequest.getALaCarteFlag()){
- recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
- }else{
- if(modelInfo.getModelCustomizationId()!=null){
- NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(modelInfo.getModelCustomizationId());
- if(networkResource!=null){
- if(modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(networkResource.getModelUUID());
- }
- recipe = db.getNetworkRecipe(networkResource.getModelName(), action.name());
- }else{
- throw new ValidationException("no catalog entry found");
+ Recipe recipe = null;
+
+ if(modelInfo.getModelCustomizationId()!=null){
+ NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(modelInfo.getModelCustomizationId());
+ if(networkResource!=null){
+ if(modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(networkResource.getModelUUID());
}
+ recipe = db.getNetworkRecipe(networkResource.getModelName(), action.name());
}else{
- //ok for version < 3 and action delete
- recipe = db.getNetworkRecipe(modelName, action.name());
- }
- if(recipe == null){
- recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
+ throw new ValidationException("no catalog entry found");
}
+ }else{
+ //ok for version < 3 and action delete
+ recipe = db.getNetworkRecipe(modelName, action.name());
}
- if (recipe == null) {
- return null;
+
+ if(recipe == null){
+ recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
}
- return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ());
+
+ return recipe !=null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
+ }
+
+ private Response configurationRecipeLookup(String requestJSON, Action action, HashMap<String,String> instanceIdMap, String version) {
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
+ ServiceInstancesRequest sir = null;
+ MsoRequest msoRequest = new MsoRequest (requestId);
+
+ try {
+ sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest);
+ } catch(Exception e) {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try {
+ parseRequest(requestJSON, action, instanceIdMap, version, startTime, sir, msoRequest);
+ } catch(Exception e) {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Error parsing request. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+ String requestScope;
+ if(action == Action.inPlaceSoftwareUpdate || action == Action.applyUpdatedConfig){
+ requestScope = (ModelType.vnf.name());
+ }else{
+ requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+ }
+ InfraActiveRequests dup = null;
+
+ try {
+ dup = duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,requestScope);
+ } catch(Exception e) {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ e.getMessage(),
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ if (dup != null) {
+ return buildErrorOnDuplicateRecord(action, instanceIdMap, startTime, msoRequest, instanceName, requestScope, dup);
+ }
+
+ ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
+ RequestReferences referencesResponse = new RequestReferences();
+ referencesResponse.setRequestId(requestId);
+ serviceResponse.setRequestReferences(referencesResponse);
+
+ MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties ();
+ String orchestrationUri = props.getProperty(CommonConstants.ALACARTE_ORCHESTRATION, null);
+ String timeOut = props.getProperty(CommonConstants.ALACARTE_RECIPE_TIMEOUT, null);
+
+ if (StringUtils.isBlank(orchestrationUri) || StringUtils.isBlank(timeOut)) {
+ String error = StringUtils.isBlank(orchestrationUri) ? "ALaCarte Orchestration URI not found in properties" : "ALaCarte Recipe Timeout not found in properties";
+
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, error);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ error,
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
+ null);
+ msoRequest.createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+
+ }
+
+ String serviceInstanceId = "";
+ String configurationId = "";
+ ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest();
+
+ if(siReq.getServiceInstanceId () != null){
+ serviceInstanceId = siReq.getServiceInstanceId ();
+ }
+
+ if(siReq.getConfigurationId() != null){
+ configurationId = siReq.getConfigurationId();
+ }
+
+ requestId = msoRequest.getRequestId ();
+ msoLogger.debug ("requestId is: " + requestId);
+ msoLogger.debug ("About to insert a record");
+
+ try {
+ createRequestRecord(action, startTime, msoRequest);
+ } catch(Exception e) {
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ "Exception while creating record in DB " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ return postBPELRequest(action, requestId, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false,
+ serviceInstanceId, null, null, null, null, configurationId, null, null, null, null);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java
index 6ddb03a554..b2b90f76b0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java
@@ -20,7 +20,6 @@
package org.openecomp.mso.apihandlerinfra;
-
/*
* Enum for Status values returned by API Handler to Tail-F
*/
@@ -30,5 +29,6 @@ public enum Status {
COMPLETE,
FAILED,
TIMEOUT,
- UNLOCKED
+ UNLOCKED,
+ PENDING_MANUAL_TASK
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
index 92e3e5b078..368807f9c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
@@ -2,7 +2,7 @@
* #%L
* MSO
* %%
- * Copyright (C) 2016 OPENECOMP - MSO
+ * Copyright (C) 2016 ONAP - SO
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ package org.openecomp.mso.apihandlerinfra;
import org.openecomp.mso.apihandlerinfra.tasksbeans.*;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@@ -35,7 +36,7 @@ import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
import org.openecomp.mso.apihandler.common.RequestClient;
@@ -55,7 +56,6 @@ public class TasksHandler {
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
public final static String requestUrl = "mso/task/";
@Path("/{version:[vV]1}")
@@ -68,7 +68,7 @@ public class TasksHandler {
@QueryParam("buildingBlockName") String buildingBlockName,
@QueryParam("originalRequestDate") String originalRequestDate,
@QueryParam("originalRequestorId") String originalRequestorId,
- @PathParam("version") String version) {
+ @PathParam("version") String version) throws ParseException {
Response responseBack = null;
long startTime = System.currentTimeMillis ();
String requestId = UUIDChecker.generateUUID(msoLogger);
@@ -162,7 +162,7 @@ public class TasksHandler {
MsoAlarmLogger.CRITICAL,
Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
msoRequest.updateFinalStatus (Status.FAILED);
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
return resp;
@@ -204,7 +204,7 @@ public class TasksHandler {
MsoAlarmLogger.CRITICAL,
Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
- msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
return resp;
@@ -293,7 +293,7 @@ public class TasksHandler {
}
- private TaskList buildTaskList(String taskId, String respBody) {
+ private TaskList buildTaskList(String taskId, String respBody) throws ParseException {
TaskList taskList = new TaskList();
JSONObject variables = new JSONObject(respBody);
@@ -313,7 +313,7 @@ public class TasksHandler {
return taskList;
}
- private String getOptVariableValue(JSONObject variables, String name) {
+ private String getOptVariableValue(JSONObject variables, String name) throws ParseException {
String variableEntry = variables.optString(name);
String value = "";
if (!variableEntry.isEmpty()) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
index d13212a483..2fe0103098 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
@@ -4,7 +4,7 @@ package org.openecomp.mso.apihandlerinfra;
* #%L
* MSO
* %%
- * Copyright (C) 2016 OPENECOMP - MSO
+ * Copyright (C) 2016 ONAP - SO
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
index c74bb0734d..adc5189670 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
@@ -4,7 +4,7 @@ package org.openecomp.mso.apihandlerinfra;
* #%L
* MSO
* %%
- * Copyright (C) 2016 OPENECOMP - MSO
+ * Copyright (C) 2016 ONAP - SO
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java
deleted file mode 100644
index a3ad61c989..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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=========================================================
- */
-
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.05.03 at 03:56:30 PM CDT
-//
-
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for exceptionType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="exceptionType">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="variables" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="50" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "exceptionType", propOrder = {
- "messageId",
- "text",
- "variables"
-})
-@XmlSeeAlso({
- ServiceException.class,
- PolicyException.class
-})
-public class ExceptionType {
-
- @XmlElement(required = true)
- protected String messageId;
- @XmlElement(required = true)
- protected String text;
- protected List<String> variables;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the text property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getText() {
- return text;
- }
-
- /**
- * Sets the value of the text property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setText(String value) {
- this.text = value;
- }
-
- /**
- * Gets the value of the variables property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the variables property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getVariables().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
- *
- *
- */
- public List<String> getVariables() {
- if (variables == null) {
- variables = new ArrayList<>();
- }
- return this.variables;
- }
-
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java
deleted file mode 100644
index d8f8d8bb70..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class InstanceReferences {
-
- protected String serviceInstanceId;
- protected String serviceInstanceName;
- protected String vnfInstanceId;
- protected String vnfInstanceName;
- protected String vfModuleInstanceId;
- protected String vfModuleInstanceName;
- protected String volumeGroupInstanceId;
- protected String volumeGroupInstanceName;
- protected String networkInstanceId;
- protected String networkInstanceName;
- protected String requestorId;
-
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
- public String getVnfInstanceId() {
- return vnfInstanceId;
- }
- public void setVnfInstanceId(String vnfInstanceId) {
- this.vnfInstanceId = vnfInstanceId;
- }
- public String getVnfInstanceName() {
- return vnfInstanceName;
- }
- public void setVnfInstanceName(String vnfInstanceName) {
- this.vnfInstanceName = vnfInstanceName;
- }
- public String getVfModuleInstanceId() {
- return vfModuleInstanceId;
- }
- public void setVfModuleInstanceId(String vfModuleInstanceId) {
- this.vfModuleInstanceId = vfModuleInstanceId;
- }
- public String getVfModuleInstanceName() {
- return vfModuleInstanceName;
- }
- public void setVfModuleInstanceName(String vfModuleInstanceName) {
- this.vfModuleInstanceName = vfModuleInstanceName;
- }
- public String getVolumeGroupInstanceId() {
- return volumeGroupInstanceId;
- }
- public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
- this.volumeGroupInstanceId = volumeGroupInstanceId;
- }
- public String getVolumeGroupInstanceName() {
- return volumeGroupInstanceName;
- }
- public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
- this.volumeGroupInstanceName = volumeGroupInstanceName;
- }
- public String getNetworkInstanceId() {
- return networkInstanceId;
- }
- public void setNetworkInstanceId(String networkInstanceId) {
- this.networkInstanceId = networkInstanceId;
- }
- public String getNetworkInstanceName() {
- return networkInstanceName;
- }
- public void setNetworkInstanceName(String networkInstanceName) {
- this.networkInstanceName = networkInstanceName;
- }
-
- public String getRequestorId() {
- return requestorId;
- }
-
- public void setRequestorId(String requestorId) {
- this.requestorId = requestorId;
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java
deleted file mode 100644
index 41c9dcafda..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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=========================================================
- */
-
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.03.30 at 02:48:23 PM CDT
-//
-
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import org.openecomp.mso.apihandlerinfra.ModelType;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class ModelInfo {
-
- protected String modelCustomizationName;
- protected String modelInvariantId;
- protected ModelType modelType;
- //v2
- protected String modelNameVersionId;
- protected String modelName;
- protected String modelVersion;
- protected String modelCustomizationUuid;
- //v3
- protected String modelVersionId;
- protected String modelCustomizationId;
-
-
- public String getModelCustomizationName() {
- return modelCustomizationName;
- }
- public void setModelCustomizationName(String modelCustomizationName) {
- this.modelCustomizationName = modelCustomizationName;
- }
- public String getModelNameVersionId() {
- return modelNameVersionId;
- }
- public void setModelNameVersionId(String modelNameVersionId) {
- this.modelNameVersionId = modelNameVersionId;
- }
- public String getModelName() {
- return modelName;
- }
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
- public String getModelVersion() {
- return modelVersion;
- }
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
- public ModelType getModelType() {
- return modelType;
- }
- public void setModelType(ModelType modelType) {
- this.modelType = modelType;
- }
- public String getModelInvariantId() {
- return modelInvariantId;
- }
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
- public String getModelCustomizationUuid() {
- return modelCustomizationUuid;
- }
- public void setModelCustomizationUuid(String modelCustomizationUuid) {
- this.modelCustomizationUuid = modelCustomizationUuid;
- }
- public String getModelVersionId() {
- return modelVersionId;
- }
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
- public String getModelCustomizationId() {
- return modelCustomizationId;
- }
- public void setModelCustomizationId(String modelCustomizationId) {
- this.modelCustomizationId = modelCustomizationId;
- }
- @Override
- public String toString() {
- return "ModelInfo [modelCustomizationName=" + modelCustomizationName
- + ", modelInvariantId=" + modelInvariantId + ", modelType="
- + modelType + ", modelNameVersionId=" + modelNameVersionId
- + ", modelName=" + modelName + ", modelVersion=" + modelVersion
- + ", modelCustomizationUuid=" + modelCustomizationUuid
- + ", modelVersionId=" + modelVersionId
- + ", modelCustomizationId=" + modelCustomizationId + "]";
- }
-
-
-} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java
deleted file mode 100644
index af026e5ed1..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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=========================================================
- */
-
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.03.30 at 02:48:23 PM CDT
-//
-
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for policyException complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="policyException">
- * &lt;complexContent>
- * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
- * &lt;/extension>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "policyException")
-public class PolicyException
- extends ExceptionType
-{
-
-
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
deleted file mode 100644
index b9450552a6..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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=========================================================
- */
-
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.04.07 at 08:25:52 AM CDT
-//
-
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;choice>
- * &lt;element name="policyException" type="{http://org.openecomp/mso/request/types/v1}policyException"/>
- * &lt;element name="serviceException" type="{http://org.openecomp/mso/request/types/v1}serviceException"/>
- * &lt;/choice>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "policyException",
- "serviceException"
-})
-@XmlRootElement(name = "requestError")
-public class RequestError {
-
- protected PolicyException policyException;
- protected ServiceException serviceException;
-
- /**
- * Gets the value of the policyException property.
- *
- * @return
- * possible object is
- * {@link PolicyException }
- *
- */
- public PolicyException getPolicyException() {
- return policyException;
- }
-
- /**
- * Sets the value of the policyException property.
- *
- * @param value
- * allowed object is
- * {@link PolicyException }
- *
- */
- public void setPolicyException(PolicyException value) {
- this.policyException = value;
- }
-
- /**
- * Gets the value of the serviceException property.
- *
- * @return
- * possible object is
- * {@link ServiceException }
- *
- */
- public ServiceException getServiceException() {
- return serviceException;
- }
-
- /**
- * Sets the value of the serviceException property.
- *
- * @param value
- * allowed object is
- * {@link ServiceException }
- *
- */
- public void setServiceException(ServiceException value) {
- this.serviceException = value;
- }
-
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
deleted file mode 100644
index 66d6ce5398..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class RequestInfo {
-
- protected String billingAccountNumber;
- protected String callbackUrl;
- protected String correlator;
- protected String orderNumber;
- protected String productFamilyId;
- protected Integer orderVersion;
- @JsonSerialize(include=Inclusion.ALWAYS)
- protected String source;
- protected String instanceName;
- @JsonSerialize(include=Inclusion.ALWAYS)
- protected boolean suppressRollback;
- protected String requestorId;
-
- /**
- * Gets the value of the callbackUrl property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCallbackUrl() {
- return callbackUrl;
- }
-
- /**
- * Sets the value of the callbackUrl property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCallbackUrl(String value) {
- this.callbackUrl = value;
- }
-
- /**
- * Gets the value of the correlator property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCorrelator() {
- return correlator;
- }
-
- /**
- * Sets the value of the correlator property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCorrelator(String value) {
- this.correlator = value;
- }
-
- /**
- * Gets the value of the orderNumber property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getOrderNumber() {
- return orderNumber;
- }
-
- /**
- * Sets the value of the orderNumber property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setOrderNumber(String value) {
- this.orderNumber = value;
- }
-
- /**
- * Gets the value of the orderVersion property.
- *
- * @return
- * possible object is
- * {@link Integer }
- *
- */
- public Integer getOrderVersion() {
- return orderVersion;
- }
-
- /**
- * Sets the value of the orderVersion property.
- *
- * @param value
- * allowed object is
- * {@link Integer }
- *
- */
- public void setOrderVersion(Integer value) {
- this.orderVersion = value;
- }
-
- /**
- * Gets the value of the source property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSource() {
- if(null == source || source.isEmpty()){
- source = "VID";
- }
- return source;
- }
-
- /**
- * Sets the value of the source property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSource(String value) {
- this.source = value;
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
- public String getBillingAccountNumber() {
- return billingAccountNumber;
- }
-
- public void setBillingAccountNumber(String billingAccountNumber) {
- this.billingAccountNumber = billingAccountNumber;
- }
-
- public String getProductFamilyId() {
- return productFamilyId;
- }
-
- public void setProductFamilyId(String productFamilyId) {
- this.productFamilyId = productFamilyId;
- }
-
- /**
- * Required for Marshalers to send the fields.
- * @return
- */
- public boolean getSuppressRollback() {
- return suppressRollback;
- }
-
- public void setSuppressRollback(boolean suppressRollback) {
- this.suppressRollback = suppressRollback;
- }
-
- public String getRequestorId() {
- return requestorId;
- }
-
- public void setRequestorId(String requestorId) {
- this.requestorId = requestorId;
- }
-
- @Override
- public String toString() {
- return "RequestInfo [billingAccountNumber=" + billingAccountNumber
- + ", callbackUrl=" + callbackUrl + ", correlator=" + correlator
- + ", orderNumber=" + orderNumber + ", productFamilyId="
- + productFamilyId + ", orderVersion=" + orderVersion
- + ", source=" + source + ", instanceName=" + instanceName
- + ", suppressRollback=" + suppressRollback + ", requestorId="
- + requestorId + "]";
- }
-
-
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
deleted file mode 100644
index f34272954d..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class RequestParameters {
-
- private String subscriptionServiceType;
- private List<Map<String, String>> userParams = new ArrayList<>();
- @JsonSerialize(include=Inclusion.ALWAYS)
- private boolean aLaCarte = false;
- @JsonIgnore
- private boolean aLaCarteSet = false;
- @JsonSerialize(include=Inclusion.ALWAYS)
- private boolean autoBuildVfModules = false;
- @JsonSerialize(include=Inclusion.ALWAYS)
- private boolean cascadeDelete = false;
- @JsonSerialize(include=Inclusion.ALWAYS)
- private boolean usePreload=true; // usePreload would always be true for Update
- @JsonSerialize(include=Inclusion.ALWAYS)
- private boolean rebuildVolumeGroups = false;
-
-
- public String getSubscriptionServiceType() {
- return subscriptionServiceType;
- }
-
- public void setSubscriptionServiceType(String subscriptionServiceType) {
- this.subscriptionServiceType = subscriptionServiceType;
- }
-
- public void setaLaCarte(boolean aLaCarte) {
- this.aLaCarte = aLaCarte;
- this.aLaCarteSet = true;
- }
-
- //returns true if aLaCarte param came in on request
- public boolean isaLaCarteSet() {
- return aLaCarteSet;
- }
-
- public boolean isaLaCarte() {
- return aLaCarte;
- }
-
- public List<Map<String, String>> getUserParams() {
- return userParams;
- }
-
- public void setUserParams(List<Map<String, String>> userParams) {
- this.userParams = userParams;
- }
-
- public String getUserParamValue(String name){
- if(userParams!=null){
- for(Map<String, String> param:userParams){
- if(param.get("name").equals(name)){
- return param.get("value");
- }
- }
- }
- return null;
- }
-
- public boolean getAutoBuildVfModules() {
- return autoBuildVfModules;
- }
-
- public void setAutoBuildVfModules(boolean autoBuildVfModules) {
- this.autoBuildVfModules = autoBuildVfModules;
- }
-
- public boolean getCascadeDelete() {
- return cascadeDelete;
- }
-
- public void setCascadeDelete(boolean cascadeDelete) {
- this.cascadeDelete = cascadeDelete;
- }
-
- public boolean isUsePreload() {
- return usePreload;
- }
-
- public void setUsePreload(boolean usePreload) {
- this.usePreload = usePreload;
- }
-
- public boolean rebuildVolumeGroups() {
- return rebuildVolumeGroups;
- }
-
- public void setRebuildVolumeGroups(boolean rebuildVolumeGroups) {
- this.rebuildVolumeGroups = rebuildVolumeGroups;
- }
-
- @Override
- public String toString() {
- return "RequestParameters [subscriptionServiceType="
- + subscriptionServiceType + ", userParams=" + userParams
- + ", aLaCarte=" + aLaCarte + ", autoBuildVfModules="
- + autoBuildVfModules + ", usePreload="
- + usePreload + ", rebuildVolumeGroups="
- + rebuildVolumeGroups +"]";
- }
-
-
-} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
deleted file mode 100644
index e17e664f97..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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=========================================================
- */
-
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.03.30 at 02:48:23 PM CDT
-//
-
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for serviceException complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="serviceException">
- * &lt;complexContent>
- * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
- * &lt;/extension>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "serviceException")
-public class ServiceException
- extends ExceptionType
-{
-
-
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
deleted file mode 100644
index c5338d4f2d..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-
-
-public class ServiceInstancesRequest {
-
- private RequestDetails requestDetails;
- private String serviceInstanceId;
- private String vnfInstanceId;
- private String networkInstanceId;
- private String volumeGroupInstanceId;
- private String vfModuleInstanceId;
-
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
-
- public void setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- }
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public String getVnfInstanceId() {
- return vnfInstanceId;
- }
-
- public void setVnfInstanceId(String vnfInstanceId) {
- this.vnfInstanceId = vnfInstanceId;
- }
-
- public String getNetworkInstanceId() {
- return networkInstanceId;
- }
-
- public void setNetworkInstanceId(String networkInstanceId) {
- this.networkInstanceId = networkInstanceId;
- }
-
- public String getVolumeGroupInstanceId() {
- return volumeGroupInstanceId;
- }
-
- public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
- this.volumeGroupInstanceId = volumeGroupInstanceId;
- }
-
- public String getVfModuleInstanceId() {
- return vfModuleInstanceId;
- }
-
- public void setVfModuleInstanceId(String vfModuleInstanceId) {
- this.vfModuleInstanceId = vfModuleInstanceId;
- }
-
- @Override
- public String toString() {
- return "ServiceInstancesRequest [requestDetails=" + requestDetails
- + ", serviceInstanceId=" + serviceInstanceId
- + ", vnfInstanceId=" + vnfInstanceId + ", networkInstanceId="
- + networkInstanceId + ", volumeGroupInstanceId="
- + volumeGroupInstanceId + ", vfModuleInstanceId="
- + vfModuleInstanceId + "]";
- }
-
-} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
deleted file mode 100644
index 7b40b4af22..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class SubscriberInfo {
-
- protected String globalSubscriberId;
- protected String subscriberName;
-
- /**
- * Gets the value of the globalSubscriberId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getGlobalSubscriberId() {
- return globalSubscriberId;
- }
-
- /**
- * Sets the value of the globalSubscriberId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setGlobalSubscriberId(String value) {
- this.globalSubscriberId = value;
- }
-
- /**
- * Gets the value of the subscriberName property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSubscriberName() {
- return subscriberName;
- }
-
- /**
- * Sets the value of the subscriberName property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSubscriberName(String value) {
- this.subscriberName = value;
- }
-
- @Override
- public String toString() {
- return "SubscriberInfo [globalSubscriberId=" + globalSubscriberId
- + ", subscriberName=" + subscriberName + "]";
- }
-
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java
index 92612ef029..795b8f4b7a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetails.java
@@ -20,8 +20,8 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonRootName;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonRootName(value = "requestDetails")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java
index 252cca4904..1406c11590 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfo.java
@@ -20,8 +20,7 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class RequestInfo {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java
index aca5455ea6..d18070fbb7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskList.java
@@ -20,11 +20,10 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
-
import org.json.JSONArray;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class TaskList {
protected String taskId;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java
index de04bed8e2..b081f3924f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReference.java
@@ -19,9 +19,8 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonRootName;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonRootName(value = "taskRequestReference")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class TaskRequestReference {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java
index 3dfdf029b1..2a0641a424 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValue.java
@@ -20,8 +20,7 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class TaskVariableValue {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java
index 2e069dc02a..943635ff0c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariables.java
@@ -20,7 +20,7 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.List;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java
index 2eda3d2e80..9310cd4730 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValidResponses.java
@@ -28,8 +28,7 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java
index fbbaeda657..f2fed8589b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Value.java
@@ -20,8 +20,7 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class Value {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java
index 11d1921527..9d3852cc07 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tasksbeans/Variables.java
@@ -20,10 +20,8 @@
package org.openecomp.mso.apihandlerinfra.tasksbeans;
-import org.codehaus.jackson.map.annotate.JsonRootName;
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonRootName(value = "variables")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class Variables {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
index 5a7699b14e..03af038574 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstance.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,37 +18,35 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import java.net.MalformedURLException;
+import java.net.URL;
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class RelatedInstance {
-
- protected String instanceName;
- protected String instanceId;
- protected ModelInfo modelInfo;
-
-
- public String getInstanceName() {
- return instanceName;
- }
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
- public String getInstanceId() {
- return instanceId;
- }
- public void setInstanceId(String instanceId) {
- this.instanceId = instanceId;
+import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils;
+import org.openecomp.mso.client.aai.AAIProperties;
+import org.openecomp.mso.client.aai.AAIVersion;
+import org.openecomp.mso.properties.MsoJavaProperties;
+
+public class AaiClientPropertiesImpl implements AAIProperties {
+
+ final MsoJavaProperties props;
+ public AaiClientPropertiesImpl() {
+ this.props = MsoPropertiesUtils.loadMsoProperties ();
}
- public ModelInfo getModelInfo() {
- return modelInfo;
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(props.getProperty("aai.endpoint", null));
}
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
}
-
-
+ @Override
+ public AAIVersion getDefaultVersion() {
+ return AAIVersion.LATEST;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java
new file mode 100644
index 0000000000..4801811c41
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -0,0 +1,333 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+
+import java.util.HashMap;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandlerinfra.Constants;
+import org.openecomp.mso.apihandlerinfra.MsoException;
+import org.openecomp.mso.apihandlerinfra.Status;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestReferences;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.TenantSyncResponse;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/cloudResources")
+@Api(value="/cloudResources",description="API Requests for cloud resources - Tenant Isolation")
+public class CloudOrchestration {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private TenantIsolationRunnable tenantIsolation = null;
+ private TenantIsolationRequest tenantIsolationRequest = null;
+ private RequestsDatabase requestsDatabase = null;
+
+ @POST
+ @Path("/{version:[vV][1]}/operationalEnvironments")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Create an Operational Environment",response=Response.class)
+ public Response createOperationEnvironment(String request, @PathParam("version") String version) {
+ msoLogger.debug("Received request to Create Operational Environment");
+ return cloudOrchestration(request, Action.create, null, version);
+ }
+
+ @POST
+ @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/activate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Activate an Operational Environment",response=Response.class)
+ public Response activateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId) {
+ msoLogger.debug("Received request to Activate an Operational Environment");
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("operationalEnvironmentId", operationalEnvironmentId);
+ return cloudOrchestration(request, Action.activate, instanceIdMap, version);
+ }
+
+ @POST
+ @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/deactivate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Deactivate an Operational Environment",response=Response.class)
+ public Response deactivateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId) {
+ msoLogger.debug("Received request to Deactivate an Operational Environment");
+ HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ instanceIdMap.put("operationalEnvironmentId", operationalEnvironmentId);
+ return cloudOrchestration(request, Action.deactivate, instanceIdMap, version);
+ }
+
+
+ private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version) {
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+ CloudOrchestrationRequest cor = null;
+ Response response = null;
+ getTenantIsolationRequest().setRequestId(requestId);
+
+ try {
+ cor = convertJsonToCloudOrchestrationRequest(requestJSON, action, startTime, cor);
+ } catch(Exception e) {
+ response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try {
+ getTenantIsolationRequest().parse(cor, instanceIdMap, action);
+ } catch(Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ if (getTenantIsolationRequest().getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ getTenantIsolationRequest().createRequestRecord (Status.FAILED, action);
+ }
+ response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Error parsing request. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ String instanceName = cor.getRequestDetails().getRequestInfo().getInstanceName();
+ String resourceType = cor.getRequestDetails().getRequestInfo().getResourceType().name();
+ InfraActiveRequests dup = null;
+ String messageAppend = null;
+ try {
+ dup = duplicateCheck(action, instanceIdMap, startTime, instanceName, resourceType);
+
+ if(dup != null) {
+ messageAppend = "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + ").";
+ }
+ } catch(Exception e) {
+ response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ e.getMessage(),
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try {
+ if(dup == null && (Action.activate.equals(action) || Action.deactivate.equals(action))) {
+ dup = getRequestsDatabase().checkVnfIdStatus(cor.getOperationalEnvironmentId());
+ if(dup != null) {
+ messageAppend = "OperationalEnvironmentId is not COMPLETED.";
+ }
+ }
+ } catch(Exception e) {
+ response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ e.getMessage(),
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ if(dup != null) {
+ String instance = null;
+ if(instanceName != null){
+ instance = instanceName;
+ }else{
+ instance = instanceIdMap.get(resourceType + "InstanceId");
+ }
+ String dupMessage = "Error: Locked instance - This " + resourceType + " (" + instance + ") " + messageAppend + " The existing request must finish or be cleaned up before proceeding.";
+
+ response = getTenantIsolationRequest().buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
+ MsoException.ServiceException,
+ dupMessage,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null) ;
+
+ msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, dupMessage);
+ getTenantIsolationRequest().createRequestRecord (Status.FAILED, action);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ String instanceId = null;
+ try {
+ if(instanceIdMap != null && instanceIdMap.get("operationalEnvironmentId") != null) {
+ instanceId = instanceIdMap.get("operationalEnvironmentId");
+ } else {
+ instanceId = UUIDChecker.generateUUID(msoLogger);
+ getTenantIsolationRequest().setOperationalEnvironmentId(instanceId);
+ cor.setOperationalEnvironmentId(instanceId);
+ }
+
+ msoLogger.debug("Creating record in Request DB");
+ getTenantIsolationRequest().createRequestRecord(Status.IN_PROGRESS, action);
+ } catch(Exception e) {
+ response = getTenantIsolationRequest().buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ "Exception while creating record in DB " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try {
+ OperationalEnvironment opEnv = cor.getRequestDetails().getRequestParameters().getOperationalEnvironmentType();
+ String operationalEnvType = opEnv != null ? opEnv.name() : null;
+
+ TenantIsolationRunnable runnable = getThread();
+ runnable.setAction(action);
+ runnable.setCor(cor);
+ runnable.setOperationalEnvType(operationalEnvType);
+ runnable.setRequestId(requestId);
+
+ Thread thread = new Thread(runnable);
+ thread.start();
+ } catch(Exception e) {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating a new Thread", "APIH", null, null);
+ response = getTenantIsolationRequest().buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ "Failed creating a Thread " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ getTenantIsolationRequest().updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, "Exception while creating a new Thread");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Exception while creating a new Thread");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try {
+ String encodedValue = new String(instanceId.getBytes("UTF-8"));
+ msoLogger.debug ("InstanceId: " + instanceId + " encoded to " + encodedValue);
+
+ TenantSyncResponse tenantResponse = new TenantSyncResponse();
+ RequestReferences reqReference = new RequestReferences();
+ reqReference.setInstanceId(encodedValue);
+ reqReference.setRequestId(requestId);
+ tenantResponse.setRequestReferences(reqReference);
+
+ response = Response.ok(tenantResponse).build();
+
+ msoLogger.debug ("Successful Sync response " + response.getEntity() + " with status code " + response.getStatus());
+
+ return response;
+ } catch(Exception e) {
+ msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while building sync response", "APIH", null, null);
+ response = getTenantIsolationRequest().buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException,
+ "Failed sending Sync Response " + e.getMessage (),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES,
+ null);
+ getTenantIsolationRequest().updateFinalStatus (Status.FAILED);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, "Exception while sending sync Response");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Exception while sending sync Response");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ }
+
+ private InfraActiveRequests duplicateCheck(Action action, HashMap<String, String> instanceIdMap, long startTime,
+ String instanceName, String requestScope) throws Exception {
+ InfraActiveRequests dup = null;
+ try {
+ dup = getRequestsDatabase().checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check");
+ throw new Exception(e);
+ }
+ return dup;
+ }
+
+ private CloudOrchestrationRequest convertJsonToCloudOrchestrationRequest(String requestJSON, Action action, long startTime,
+ CloudOrchestrationRequest cor) throws Exception {
+ try{
+ msoLogger.debug("Converting incoming JSON request to Object");
+ ObjectMapper mapper = new ObjectMapper();
+ cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ if (getTenantIsolationRequest().getRequestId () != null) {
+ msoLogger.debug ("Mapping of request to JSON object failed");
+ getTenantIsolationRequest().createRequestRecord (Status.FAILED, action);
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ throw new Exception(e);
+ }
+ return cor;
+ }
+
+ public TenantIsolationRequest getTenantIsolationRequest() {
+ if(tenantIsolationRequest == null) {
+ tenantIsolationRequest = new TenantIsolationRequest();
+ }
+ return tenantIsolationRequest;
+ }
+
+ public void setTenantIsolationRequest(TenantIsolationRequest tenantIsolationRequest) {
+ this.tenantIsolationRequest = tenantIsolationRequest;
+ }
+
+ public RequestsDatabase getRequestsDatabase() {
+ if(requestsDatabase == null) {
+ requestsDatabase = RequestsDatabase.getInstance();
+ }
+ return requestsDatabase;
+ }
+
+ public void setRequestsDatabase(RequestsDatabase requestsDatabase) {
+ this.requestsDatabase = requestsDatabase;
+ }
+
+ public TenantIsolationRunnable getThread() {
+ if(tenantIsolation == null) {
+ tenantIsolation = new TenantIsolationRunnable();
+ }
+ return tenantIsolation;
+ }
+
+ public void setThread(TenantIsolationRunnable thread) {
+ this.tenantIsolation = thread;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java
new file mode 100644
index 0000000000..5e6c1ecd60
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudOrchestrationRequest.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+import java.io.Serializable;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Distribution;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestDetails;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class CloudOrchestrationRequest implements Serializable {
+
+ private static final long serialVersionUID = -4959169541182257787L;
+ @JsonProperty("requestDetails")
+ private RequestDetails requestDetails;
+ @JsonProperty("operationalEnvironmentId")
+ private String operationalEnvironmentId;
+ @JsonProperty("distribution")
+ private Distribution distribution;
+ @JsonProperty("distributionId")
+ private String distributionId;
+
+ public String getOperationalEnvironmentId() {
+ return operationalEnvironmentId;
+ }
+
+ public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(RequestDetails requestDetails){
+ this.requestDetails = requestDetails;
+ }
+
+ public Distribution getDistribution() {
+ return distribution;
+ }
+
+ public void setDistribution(Distribution distribution) {
+ this.distribution = distribution;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setDistributionId(String distributionId) {
+ this.distributionId = distributionId;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceInstancesRequest [requestDetails=" + requestDetails
+ + ", operationalEnvironmentId=" + operationalEnvironmentId
+ + ", distribution=" + distribution
+ + ", distributionId=" + distributionId + "]";
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
new file mode 100644
index 0000000000..a580a483c2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
@@ -0,0 +1,335 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.http.HttpStatus;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandlerinfra.Constants;
+import org.openecomp.mso.apihandlerinfra.Messages;
+import org.openecomp.mso.apihandlerinfra.MsoException;
+import org.openecomp.mso.apihandlerinfra.Status;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.CloudOrchestrationRequestList;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.CloudOrchestrationResponse;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.InstanceReferences;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Request;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestDetails;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestStatus;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/cloudResourcesRequests")
+@Api(value="/cloudResourcesRequests",description="API GET Requests for cloud resources - Tenant Isolation")
+public class CloudResourcesOrchestration {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private RequestsDatabase requestsDB = null;
+
+ @POST
+ @Path("/{version: [vV][1]}/{requestId}/unlock")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Unlock CloudOrchestration requests for a specified requestId")
+ public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) {
+ TenantIsolationRequest msoRequest = new TenantIsolationRequest(requestId);
+ InfraActiveRequests requestDB = null;
+ Request request = null;
+ CloudOrchestrationRequest cor = null;
+
+ long startTime = System.currentTimeMillis ();
+ msoLogger.debug ("requestId is: " + requestId);
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
+ } catch(Exception e){
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Mapping of request to JSON object failed");
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try{
+ msoRequest.parseOrchestration(cor);
+ } catch (Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
+ "Error parsing request. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ if (msoRequest.getRequestId () != null) {
+ msoLogger.debug ("Logging failed message to the database");
+ }
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try {
+ requestDB = getRequestsDB().getRequestFromInfraActive(requestId);
+
+ if(requestDB == null) {
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+
+ }else{
+ request = mapInfraActiveRequestToRequest(requestDB);
+ RequestStatus reqStatus = request.getRequestStatus();
+ Status status = Status.valueOf(reqStatus.getRequestState());
+ if(status == Status.IN_PROGRESS || status == Status.PENDING || status == Status.PENDING_MANUAL_TASK){
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED);
+ reqStatus.setRequestState(Status.UNLOCKED.toString ());
+ getRequestsDB().updateInfraStatus (requestId,
+ Status.UNLOCKED.toString (),
+ Constants.MODIFIED_BY_APIHANDLER);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked");
+
+ }else{
+ Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+ }
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e);
+ msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ e.getMessage (),
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.getErrors().get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+
+ }
+
+ return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build ();
+ }
+
+ @GET
+ @Path("/{version:[vV][1]}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Get status of an Operational Environment based on filter criteria",response=Response.class)
+ public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version ) {
+ MsoLogger.setServiceName ("getOperationEnvironmentStatusFilter");
+ UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis ();
+
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+ List<String> requestIdKey = queryParams.get("requestId");
+
+ if(queryParams.size() == 1 && requestIdKey != null) {
+ msoLogger.debug ("Entered requestId GET OperationalEnvironment Request");
+ String requestId = requestIdKey.get(0);
+
+ CloudOrchestrationResponse cloudOrchestrationGetResponse = new CloudOrchestrationResponse();
+ TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest (requestId);
+ InfraActiveRequests requestDB = null;
+
+ try {
+ requestDB = getRequestsDB().getRequestFromInfraActive(requestId);
+
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e);
+ // TODO Will need to set Status for tenantIsolationRequest
+ // tenantIsolationRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = tenantIsolationRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException,
+ e.getMessage (),
+ ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB,
+ null);
+ alarmLogger.sendAlarm ("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL,
+ Messages.getErrors().get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB));
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ if(requestDB == null) {
+ Response resp = tenantIsolationRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT,
+ MsoException.ServiceException,
+ "Orchestration RequestId " + requestId + " is not found in DB",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ null);
+ msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId");
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+ return resp;
+ }
+
+ Request request = mapInfraActiveRequestToRequest(requestDB);
+ cloudOrchestrationGetResponse.setRequest(request);
+ return Response.status(200).entity(cloudOrchestrationGetResponse).build();
+
+ } else {
+ msoLogger.debug ("Entered GET OperationalEnvironment filter Request");
+ TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest ();
+ List<InfraActiveRequests> activeRequests = null;
+ CloudOrchestrationRequestList orchestrationList = null;
+
+ try{
+ Map<String, String> orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams);
+ activeRequests = getRequestsDB().getCloudOrchestrationFiltersFromInfraActive(orchestrationMap);
+ orchestrationList = new CloudOrchestrationRequestList();
+ List<CloudOrchestrationResponse> requestLists = new ArrayList<CloudOrchestrationResponse>();
+
+ for(InfraActiveRequests infraActive : activeRequests){
+
+ Request request = mapInfraActiveRequestToRequest(infraActive);
+ CloudOrchestrationResponse requestList = new CloudOrchestrationResponse();
+ requestList.setRequest(request);
+ requestLists.add(requestList);
+ }
+ orchestrationList.setRequestList(requestLists);
+
+ }catch(Exception e){
+ msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e);
+ Response response = tenantIsolationRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException,
+ "Get CloudOrchestration Request with Filters Failed. " + e.getMessage(),
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get CloudOrchestration Request with Filters Failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+ return Response.status(200).entity(orchestrationList).build();
+ }
+ }
+
+ private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) {
+ Request request = new Request();
+ request.setRequestId(requestDB.getRequestId());
+ request.setRequestScope(requestDB.getRequestScope());
+ request.setRequestType(requestDB.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+
+ if(requestDB.getOperationalEnvId() != null)
+ ir.setOperationalEnvironmentId(requestDB.getOperationalEnvId());
+ if(requestDB.getOperationalEnvName() != null)
+ ir.setOperationalEnvName(requestDB.getOperationalEnvName());
+ if(requestDB.getRequestorId() != null)
+ ir.setRequestorId(requestDB.getRequestorId());
+
+ request.setInstanceReferences(ir);
+ String requestBody = requestDB.getRequestBody();
+ RequestDetails requestDetails = null;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ requestDetails = mapper.readValue(requestBody, RequestDetails.class);
+
+ }catch(Exception e){
+ msoLogger.debug("Exception caught mapping requestBody to RequestDetails");
+ }
+
+ request.setRequestDetails(requestDetails);
+ String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT";
+ request.setStartTime(startTimeStamp);
+
+ RequestStatus status = new RequestStatus();
+ if(requestDB.getStatusMessage() != null){
+ status.setStatusMessage(requestDB.getStatusMessage());
+ }
+
+ if(requestDB.getEndTime() != null){
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT";
+ status.setTimeStamp(endTimeStamp);
+ }
+
+ if(requestDB.getRequestStatus() != null){
+ status.setRequestState(requestDB.getRequestStatus());
+ }
+
+ if(requestDB.getProgress() != null){
+ status.setPercentProgress(requestDB.getProgress().toString());
+ }
+
+ request.setRequestStatus(status);
+
+ return request;
+ }
+
+ public RequestsDatabase getRequestsDB() {
+ if(requestsDB == null) {
+ requestsDB = RequestsDatabase.getInstance();
+ }
+ return requestsDB;
+ }
+
+ public void setRequestsDB(RequestsDatabase requestsDB) {
+ this.requestsDB = requestsDB;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java
new file mode 100644
index 0000000000..fc6d1a551f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/GrmClientPropertiesImpl.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.ws.rs.core.MediaType;
+
+import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils;
+import org.openecomp.mso.client.grm.GRMProperties;
+import org.openecomp.mso.properties.MsoJavaProperties;
+
+public class GrmClientPropertiesImpl implements GRMProperties {
+
+ final MsoJavaProperties props;
+
+ public GrmClientPropertiesImpl() {
+ this.props = MsoPropertiesUtils.loadMsoProperties ();
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(props.getProperty("grm.endpoint", null));
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+ @Override
+ public String getDefaultVersion() {
+ return "v1";
+ }
+
+ @Override
+ public String getUsername() {
+ return props.getProperty("grm.username", null);
+ }
+
+ @Override
+ public String getPassword() {
+ return props.getProperty("grm.password", null);
+ }
+
+ @Override
+ public String getContentType() {
+ return MediaType.APPLICATION_JSON;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
new file mode 100644
index 0000000000..eb5306a155
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.ValidationException;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpStatus;
+import org.openecomp.mso.apihandler.common.ErrorNumbers;
+import org.openecomp.mso.apihandlerinfra.Constants;
+import org.openecomp.mso.apihandlerinfra.MsoException;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Distribution;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Status;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.serviceinstancebeans.RequestError;
+import org.openecomp.mso.serviceinstancebeans.ServiceException;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.jaxrs.PATCH;
+
+@Path("/modelDistributions")
+@Api(value="/modelDistributions",description="API Requests for Model Distributions")
+public class ModelDistributionRequest {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private TenantIsolationRunnable tenantIsolation = null;
+
+ @PATCH
+ @Path("/{version:[vV][1]}/distributions/{distributionId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value="Update model distribution status",response=Response.class)
+ public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version, @PathParam("distributionId") String distributionId) {
+ long startTime = System.currentTimeMillis ();
+ Distribution distributionRequest = null;
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ distributionRequest = mapper.readValue(requestJSON, Distribution.class);
+ } catch(Exception e) {
+ msoLogger.debug ("Mapping of request to JSON object failed : ", e);
+ Response response = buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Mapping of request to JSON object failed. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ try {
+ parse(distributionRequest);
+ } catch(Exception e) {
+ msoLogger.debug ("Validation failed: ", e);
+ msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e);
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed");
+ Response response = buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Error parsing request. " + e.getMessage(),
+ ErrorNumbers.SVC_BAD_PARAMETER, null);
+ msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
+ return response;
+ }
+
+ CloudOrchestrationRequest cor = new CloudOrchestrationRequest();
+ cor.setDistribution(distributionRequest);
+ cor.setDistributionId(distributionId);
+
+ TenantIsolationRunnable runnable = getThread();
+ runnable.setAction(Action.distributionStatus);
+ runnable.setCor(cor);
+ runnable.setOperationalEnvType(null);
+ runnable.setRequestId(null);
+
+ Thread thread = new Thread(runnable);
+ thread.start();
+
+ return Response.ok().build();
+ }
+
+ private void parse(Distribution distributionRequest) throws ValidationException {
+ if(distributionRequest.getStatus() == null) {
+ throw new ValidationException("status");
+ }
+
+ if(StringUtils.isBlank(distributionRequest.getErrorReason()) && Status.DISTRIBUTION_COMPLETE_ERROR.equals(distributionRequest.getStatus())) {
+ throw new ValidationException("errorReason");
+ }
+ }
+
+ private Response buildServiceErrorResponse (int httpResponseCode, MsoException exceptionType, String text,
+ String messageId, List<String> variables) {
+ RequestError re = new RequestError();
+ ServiceException se = new ServiceException();
+ se.setMessageId(messageId);
+ se.setText(text);
+ if(variables != null){
+ if(variables != null){
+ for(String variable: variables){
+ se.getVariables().add(variable);
+ }
+ }
+ }
+ re.setServiceException(se);
+
+ String requestErrorStr = null;
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_DEFAULT);
+ requestErrorStr = mapper.writeValueAsString(re);
+ }catch(Exception e){
+ msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e);
+ }
+
+ return Response.status (httpResponseCode).entity(requestErrorStr).build ();
+ }
+
+ public TenantIsolationRunnable getThread() {
+ if(tenantIsolation == null) {
+ tenantIsolation = new TenantIsolationRunnable();
+ }
+ return tenantIsolation;
+ }
+
+ public void setThread(TenantIsolationRunnable thread) {
+ this.tenantIsolation = thread;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java
new file mode 100644
index 0000000000..e39c1d7ef1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/OperationalEnvironmentProcessFactory.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolation.process.ActivateVnfOperationalEnvironment;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.process.ActivateVnfStatusOperationalEnvironment;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.process.CreateEcompOperationalEnvironment;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.process.CreateVnfOperationalEnvironment;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.process.OperationalEnvironmentProcess;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+
+public class OperationalEnvironmentProcessFactory {
+
+ public OperationalEnvironmentProcess getOperationalEnvironmentProcess(Action action, String operationalEnvType, CloudOrchestrationRequest cor, String requestId) throws Exception{
+
+ if(Action.create.equals(action)) {
+ if(OperationalEnvironment.ECOMP.name().equalsIgnoreCase(operationalEnvType)) {
+ return new CreateEcompOperationalEnvironment(cor, requestId);
+ } else if(OperationalEnvironment.VNF.name().equalsIgnoreCase(operationalEnvType)) {
+ return new CreateVnfOperationalEnvironment(cor, requestId);
+ } else {
+ throw new Exception("Invalid OperationalEnvironment Type specified for Create Action");
+ }
+ } else if(Action.activate.equals(action)) {
+ return new ActivateVnfOperationalEnvironment(cor, requestId);
+ } else if(Action.deactivate.equals(action)) {
+ return new DeactivateVnfOperationalEnvironment(cor, requestId);
+ } else if(Action.distributionStatus.equals(action)) {
+ return new ActivateVnfStatusOperationalEnvironment(cor, requestId);
+ } else {
+ throw new Exception("Invalid Action specified: " + action);
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
new file mode 100644
index 0000000000..ce9d7b3a30
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
@@ -0,0 +1,476 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+import org.apache.commons.lang3.StringUtils;
+import org.hibernate.Session;
+import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.apihandlerinfra.Constants;
+import org.openecomp.mso.apihandlerinfra.MsoException;
+import org.openecomp.mso.apihandlerinfra.Status;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Manifest;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RelatedInstance;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RelatedInstanceList;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestDetails;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestInfo;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RequestParameters;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.ResourceType;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.ServiceModelList;
+import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
+import org.openecomp.mso.serviceinstancebeans.PolicyException;
+import org.openecomp.mso.serviceinstancebeans.RequestError;
+import org.openecomp.mso.serviceinstancebeans.ServiceException;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class TenantIsolationRequest {
+
+ private String requestId;
+ private String requestJSON;
+ private RequestInfo requestInfo;
+
+ private String errorMessage;
+ private String errorCode;
+ private String httpResponse;
+ private String responseBody;
+ private RequestStatusType status;
+ private CloudOrchestrationRequest cor;
+ private String operationalEnvironmentId;
+ private long progress = Constants.PROGRESS_REQUEST_RECEIVED;
+ private String requestScope;
+
+
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager ();
+
+ TenantIsolationRequest (String requestId) {
+ this.requestId = requestId;
+ MsoLogger.setLogContext (requestId, null);
+ }
+
+ TenantIsolationRequest () {
+ MsoLogger.setLogContext (requestId, null);
+ }
+
+ void parse(CloudOrchestrationRequest request, HashMap<String,String> instanceIdMap, Action action) throws ValidationException {
+ msoLogger.debug ("Validating the Cloud Orchestration request");
+ this.cor = request;
+ this.requestInfo = request.getRequestDetails().getRequestInfo();
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ requestJSON = mapper.writeValueAsString(request.getRequestDetails());
+
+ } catch(Exception e){
+ throw new ValidationException ("Parse ServiceInstanceRequest to JSON string");
+ }
+
+ String envId = null;
+ if(instanceIdMap != null) {
+ envId = instanceIdMap.get("operationalEnvironmentId");
+ if(envId != null && !UUIDChecker.isValidUUID (envId)){
+ throw new ValidationException ("operationalEnvironmentId");
+ }
+ cor.setOperationalEnvironmentId(envId);
+ }
+
+ this.operationalEnvironmentId = envId;
+
+ RequestDetails requestDetails = request.getRequestDetails();
+ RequestParameters requestParameters = requestDetails.getRequestParameters();
+
+ requestInfoValidation(action, requestInfo);
+
+ requestParamsValidation(action, requestParameters);
+
+ relatedInstanceValidation(action, requestDetails, requestParameters);
+
+ }
+
+ private void relatedInstanceValidation(Action action, RequestDetails requestDetails, RequestParameters requestParameters) throws ValidationException {
+ RelatedInstanceList[] instanceList = requestDetails.getRelatedInstanceList();
+
+ if((Action.activate.equals(action) || Action.deactivate.equals(action)) && OperationalEnvironment.ECOMP.equals(requestParameters.getOperationalEnvironmentType())) {
+ throw new ValidationException("operationalEnvironmentType in requestParameters");
+ }
+
+ if(!Action.deactivate.equals(action) && OperationalEnvironment.VNF.equals(requestParameters.getOperationalEnvironmentType())) {
+ if(instanceList != null && instanceList.length > 0) {
+ for(RelatedInstanceList relatedInstanceList : instanceList){
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+
+ if(relatedInstance.getResourceType() == null) {
+ throw new ValidationException("ResourceType in relatedInstance");
+ }
+
+ if(!empty(relatedInstance.getInstanceName()) && !relatedInstance.getInstanceName().matches(Constants.VALID_INSTANCE_NAME_FORMAT)) {
+ throw new ValidationException ("instanceName format");
+ }
+
+ if (empty (relatedInstance.getInstanceId ())) {
+ throw new ValidationException ("instanceId in relatedInstance");
+ }
+
+ if (!UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) {
+ throw new ValidationException ("instanceId format in relatedInstance");
+ }
+ }
+ } else {
+ throw new ValidationException ("relatedInstanceList");
+ }
+ }
+ }
+
+ private void requestParamsValidation(Action action, RequestParameters requestParameters) throws ValidationException {
+
+ if(requestParameters != null) {
+ if(!Action.deactivate.equals(action) && requestParameters.getOperationalEnvironmentType() == null) {
+ throw new ValidationException ("OperationalEnvironmentType");
+ }
+
+ if (Action.create.equals(action) && empty(requestParameters.getTenantContext())) {
+ throw new ValidationException ("Tenant Context");
+ }
+ if (!Action.deactivate.equals(action) && empty(requestParameters.getWorkloadContext())) {
+ throw new ValidationException ("Workload Context");
+ }
+
+ Manifest manifest = requestParameters.getManifest();
+
+ if(Action.activate.equals(action)) {
+ if(manifest == null) {
+ throw new ValidationException ("Manifest on Activate");
+ } else {
+ List<ServiceModelList> serviceModelList = manifest.getServiceModelList();
+
+ if(serviceModelList.size() == 0) {
+ throw new ValidationException (" empty ServiceModelList");
+ }
+
+ for(ServiceModelList list : serviceModelList) {
+ if(empty(list.getServiceModelVersionId())) {
+ throw new ValidationException ("ServiceModelVersionId");
+ }
+
+ if (!UUIDChecker.isValidUUID (list.getServiceModelVersionId())) {
+ throw new ValidationException ("ServiceModelVersionId format");
+ }
+
+ if(list.getRecoveryAction() == null) {
+ throw new ValidationException ("RecoveryAction");
+ }
+ }
+ }
+ }
+ } else if(!Action.deactivate.equals(action)) {
+ throw new ValidationException("request Parameters");
+ }
+ }
+
+ private void requestInfoValidation(Action action, RequestInfo requestInfo) throws ValidationException {
+
+ if(Action.create.equals(action) && empty(requestInfo.getInstanceName())) {
+ throw new ValidationException ("instanceName");
+ }
+
+ if(!empty(requestInfo.getInstanceName()) && !requestInfo.getInstanceName().matches(Constants.VALID_INSTANCE_NAME_FORMAT)) {
+ throw new ValidationException ("instanceName format");
+ }
+
+ if (empty(requestInfo.getSource())) {
+ throw new ValidationException ("source");
+ }
+
+ if(empty(requestInfo.getRequestorId())) {
+ throw new ValidationException ("requestorId");
+ }
+
+ ResourceType resourceType = requestInfo.getResourceType();
+ if(resourceType == null) {
+ throw new ValidationException ("resourceType");
+ }
+
+ this.requestScope = resourceType.name();
+ }
+
+ void parseOrchestration (CloudOrchestrationRequest cor) throws ValidationException {
+
+ msoLogger.debug ("Validating the Orchestration request");
+
+ this.cor = cor;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+ requestJSON = mapper.writeValueAsString(cor.getRequestDetails());
+
+ } catch(Exception e){
+ throw new ValidationException ("Parse CloudOrchestrationRequest to JSON string", e);
+ }
+
+ this.requestInfo = cor.getRequestDetails().getRequestInfo();
+
+ if (this.requestInfo == null) {
+ throw new ValidationException ("requestInfo");
+ }
+
+ if (empty (requestInfo.getSource ())) {
+ throw new ValidationException ("source");
+ }
+ if (empty (requestInfo.getRequestorId ())) {
+ throw new ValidationException ("requestorId");
+ }
+ }
+
+ public void createRequestRecord (Status status, Action action) {
+ Session session = null;
+ try {
+
+ session = requestsDbSessionFactoryManager.getSessionFactory ().openSession ();
+ session.beginTransaction ();
+
+ if (null == cor) {
+ cor = new CloudOrchestrationRequest();
+ }
+
+ InfraActiveRequests aq = new InfraActiveRequests ();
+ aq.setRequestId (requestId);
+
+ aq.setRequestAction(action.name());
+ aq.setAction(action.name());
+
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
+
+ aq.setStartTime (startTimeStamp);
+
+ if (requestInfo != null) {
+
+ if(requestInfo.getSource() != null){
+ aq.setSource(requestInfo.getSource());
+ }
+ if(requestInfo.getRequestorId() != null) {
+ aq.setRequestorId(requestInfo.getRequestorId());
+ }
+ if(requestInfo.getResourceType() != null) {
+ aq.setRequestScope(requestInfo.getResourceType().name());
+ }
+ }
+
+ if(ResourceType.operationalEnvironment.name().equalsIgnoreCase(requestScope)) {
+ aq.setOperationalEnvId(operationalEnvironmentId);
+ aq.setOperationalEnvName(requestInfo.getInstanceName());
+ }
+
+ aq.setRequestBody (this.requestJSON);
+
+ aq.setRequestStatus (status.toString ());
+ aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
+
+ if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
+ aq.setStatusMessage (this.errorMessage);
+ aq.setResponseBody (this.responseBody);
+ aq.setProgress(new Long(100));
+
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
+ aq.setEndTime (endTimeStamp);
+ } else if(status == Status.IN_PROGRESS) {
+ aq.setProgress(Constants.PROGRESS_REQUEST_IN_PROGRESS);
+ }
+
+ msoLogger.debug ("About to insert a record");
+
+ session.save (aq);
+ session.getTransaction ().commit ();
+ session.close ();
+ } catch (Exception e) {
+ msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e);
+ if (session != null) {
+ session.close ();
+ }
+ if (!status.equals (Status.FAILED)) {
+ throw e;
+ }
+ }
+ }
+
+
+ public Map<String, String> getOrchestrationFilters (MultivaluedMap<String, String> queryParams) throws ValidationException {
+ String queryParam = null;
+ Map<String, String> orchestrationFilterParams = new HashMap<String, String>();
+
+ for (Entry<String,List<String>> entry : queryParams.entrySet()) {
+ queryParam = entry.getKey();
+ try{
+ for(String value : entry.getValue()) {
+ if(StringUtils.isBlank(value)) {
+ throw new Exception(queryParam + " value");
+ }
+ orchestrationFilterParams.put(queryParam, value);
+ }
+ }catch(Exception e){
+ throw new ValidationException (e.getMessage());
+ }
+ }
+
+ return orchestrationFilterParams;
+ }
+
+ /**
+ * Build Error Response for Exception handling.
+ *
+ * @param int
+ * @param httpResponseCode the HTTP response code
+ * @param exceptionType.
+ * @param text the error description
+ * @param messageId
+ * @return the web service response
+ *
+ */
+ public Response buildServiceErrorResponse (int httpResponseCode,
+ MsoException exceptionType,
+ String text,
+ String messageId,
+ List<String> variables) {
+
+ this.errorCode = messageId;
+
+ if (text != null) {
+ this.errorMessage = text;
+ }
+ else {
+ this.errorMessage = "";
+ }
+ this.httpResponse = Integer.toString(httpResponseCode);
+ if(errorMessage.length() > 1999){
+ errorMessage = errorMessage.substring(0, 1999);
+ }
+
+ RequestError re = new RequestError();
+
+ if(exceptionType.name().equals("PolicyException")){
+
+ PolicyException pe = new PolicyException();
+ pe.setMessageId(messageId);
+ pe.setText(text);
+ if(variables != null){
+ for(String variable: variables){
+ pe.getVariables().add(variable);
+ }
+ }
+ re.setPolicyException(pe);
+
+ } else {
+
+ ServiceException se = new ServiceException();
+ se.setMessageId(messageId);
+ se.setText(text);
+ if(variables != null){
+ if(variables != null){
+ for(String variable: variables){
+ se.getVariables().add(variable);
+ }
+ }
+ }
+ re.setServiceException(se);
+ }
+
+ String requestErrorStr = null;
+
+ try{
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_DEFAULT);
+ requestErrorStr = mapper.writeValueAsString(re);
+ }catch(Exception e){
+ msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e);
+ }
+
+
+ return Response.status (httpResponseCode).entity(requestErrorStr).build ();
+
+ }
+
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
+
+ public String getRequestId () {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public void updateFinalStatus(Status failed) {
+ try {
+ (RequestsDatabase.getInstance()).updateInfraFinalStatus (requestId,
+ status.toString (),
+ this.errorMessage,
+ this.progress,
+ this.responseBody,
+ Constants.MODIFIED_BY_APIHANDLER);
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB");
+ msoLogger.debug ("Exception: ", e);
+ }
+ }
+
+ public void setStatus (RequestStatusType status) {
+ this.status = status;
+ switch (status) {
+ case FAILED:
+ case COMPLETE:
+ this.progress = Constants.PROGRESS_REQUEST_COMPLETED;
+ break;
+ case IN_PROGRESS:
+ this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS;
+ break;
+ }
+ }
+
+ public String getOperationalEnvironmentId() {
+ return operationalEnvironmentId;
+ }
+
+ public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
new file mode 100644
index 0000000000..167b88fbc8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation;
+
+import org.openecomp.mso.apihandlerinfra.Constants;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.process.OperationalEnvironmentProcess;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.RequestsDBHelper;
+
+public class TenantIsolationRunnable implements Runnable {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private OperationalEnvironmentProcessFactory factory = null;
+ private Action action;
+ private String operationalEnvType;
+ private CloudOrchestrationRequest cor;
+ private String requestId;
+ protected RequestsDBHelper requestDb;
+
+ @Override
+ public void run() {
+ msoLogger.debug ("Starting threadExecution in TenantIsolationRunnable for Action " + action.name() + " and OperationalEnvType: " + operationalEnvType);
+ try {
+ OperationalEnvironmentProcess isolation = getFactory().getOperationalEnvironmentProcess(action, operationalEnvType, cor, requestId);
+ isolation.execute();
+ } catch(Exception e) {
+ msoLogger.debug ("Exception during Thread initiation: ", e);
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, null, e);
+ getRequestDb().updateInfraFailureCompletion(e.getMessage(), requestId, cor.getOperationalEnvironmentId());
+ }
+ }
+
+ public Action getAction() {
+ return action;
+ }
+
+ public void setAction(Action action) {
+ this.action = action;
+ }
+
+ public String getOperationalEnvType() {
+ return operationalEnvType;
+ }
+
+ public void setOperationalEnvType(String operationalEnvType) {
+ this.operationalEnvType = operationalEnvType;
+ }
+
+ public CloudOrchestrationRequest getCor() {
+ return cor;
+ }
+
+ public void setCor(CloudOrchestrationRequest cor) {
+ this.cor = cor;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public OperationalEnvironmentProcessFactory getFactory() {
+ if(factory == null) {
+ factory = new OperationalEnvironmentProcessFactory();
+ }
+ return factory;
+ }
+
+ public void setFactory(OperationalEnvironmentProcessFactory factory) {
+ this.factory = factory;
+ }
+
+ protected RequestsDBHelper getRequestDb() {
+ if(requestDb == null) {
+ requestDb = new RequestsDBHelper();
+ }
+ return requestDb;
+ }
+
+ protected void setRequestsDBHelper(RequestsDBHelper helper) {
+ this.requestDb = helper;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java
new file mode 100644
index 0000000000..1f3457e6e0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/CreateEcompOperationEnvironmentBean.java
@@ -0,0 +1,172 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"operationalEnvironmentId",
+"operationalEnvironmentName",
+"operationalEnvironmentType",
+"tenantContext",
+"workloadContext"
+})
+
+public class CreateEcompOperationEnvironmentBean {
+
+@JsonProperty("operationalEnvironmentId")
+private String operationalEnvironmentId;
+@JsonProperty("operationalEnvironmentName")
+private String operationalEnvironmentName;
+@JsonProperty("operationalEnvironmentType")
+private String operationalEnvironmentType;
+@JsonProperty("tenantContext")
+private String tenantContext;
+@JsonProperty("workloadContext")
+private String workloadContext;
+@JsonProperty("action")
+private String action;
+
+
+/**
+* No args constructor for use in serialization
+*
+*/
+public CreateEcompOperationEnvironmentBean() {
+ }
+
+/**
+*
+* @param operationalEnvironmentId
+* @param operationalEnvironmentName
+* @param operationalEnvironmentType
+* @param tenantContext
+* @param workloadContext
+*/
+public CreateEcompOperationEnvironmentBean(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String tenantContext, String workloadContext, String action) {
+super();
+this.operationalEnvironmentId = operationalEnvironmentId;
+this.operationalEnvironmentName = operationalEnvironmentName;
+this.operationalEnvironmentType = operationalEnvironmentType;
+this.tenantContext = tenantContext;
+this.workloadContext = workloadContext;
+this.action = action;
+ }
+
+@JsonProperty("operationalEnvironmentId")
+public String getOperationalEnvironmentId() {
+return operationalEnvironmentId;
+ }
+
+@JsonProperty("operationalEnvironmentId")
+public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+
+public CreateEcompOperationEnvironmentBean withOperationalEnvironmentId(String operationalEnvironmentId) {
+this.operationalEnvironmentId = operationalEnvironmentId;
+return this;
+ }
+
+
+@JsonProperty("operationalEnvironmentName")
+public String getoperationalEnvironmentName() {
+return operationalEnvironmentName;
+ }
+
+@JsonProperty("operationalEnvironmentName")
+public void setoperationalEnvironmentName(String operationalEnvironmentName) {
+this.operationalEnvironmentName = operationalEnvironmentName;
+ }
+
+public CreateEcompOperationEnvironmentBean withOperationalEnvironmentName(String operationalEnvironmentName) {
+this.operationalEnvironmentName = operationalEnvironmentName;
+return this;
+ }
+
+@JsonProperty("operationalEnvironmentType")
+public String getoperationalEnvironmentType() {
+return operationalEnvironmentType;
+ }
+
+@JsonProperty("operationalEnvironmentType")
+public void setoperationalEnvironmentType(String operationalEnvironmentType) {
+this.operationalEnvironmentType = operationalEnvironmentType;
+ }
+
+public CreateEcompOperationEnvironmentBean withOperationalEnvironmentType(String operationalEnvironmentType) {
+this.operationalEnvironmentType = operationalEnvironmentType;
+return this;
+ }
+
+@JsonProperty("tenantContext")
+public String gettenantContext() {
+return tenantContext;
+ }
+
+@JsonProperty("tenantContext")
+public void settenantContext(String tenantContext) {
+this.tenantContext = tenantContext;
+ }
+
+public CreateEcompOperationEnvironmentBean withTenantContext(String tenantContext) {
+this.tenantContext = tenantContext;
+return this;
+ }
+
+@JsonProperty("workloadContext")
+public String getworkloadContext() {
+return workloadContext;
+ }
+
+@JsonProperty("workloadContext")
+public void setworkloadContext(String workloadContext) {
+this.workloadContext = workloadContext;
+ }
+
+public CreateEcompOperationEnvironmentBean withWorkloadContext(String workloadContext) {
+this.workloadContext = workloadContext;
+return this;
+ }
+
+
+@JsonProperty("action")
+public String getaction() {
+return action;
+ }
+
+@JsonProperty("action")
+public void setaction(String action) {
+this.action = action;
+ }
+
+public CreateEcompOperationEnvironmentBean withaction(String action) {
+this.action = action;
+return this;
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
new file mode 100644
index 0000000000..4d47acdd22
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap;
+
+import java.io.IOException;
+
+
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class DmaapOperationalEnvClient {
+
+
+ protected String buildRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String tenantContext, String workloadContext, String action )
+ throws JsonProcessingException {
+ final CreateEcompOperationEnvironmentBean operationalEnv = new CreateEcompOperationEnvironmentBean();
+ operationalEnv.withOperationalEnvironmentId(operationalEnvironmentId)
+ .withOperationalEnvironmentName(operationalEnvironmentName)
+ .withOperationalEnvironmentType(operationalEnvironmentType)
+ .withTenantContext(tenantContext)
+ .withWorkloadContext(workloadContext)
+ .withaction(action);
+
+ return this.getJson(operationalEnv);
+
+ }
+
+ protected String getJson(CreateEcompOperationEnvironmentBean obj) throws JsonProcessingException {
+
+ final ObjectMapper mapper = new ObjectMapper();
+ return mapper.writeValueAsString(obj);
+
+ }
+
+ protected DmaapPublisher getPublisher() throws IOException {
+ return new OperationalEnvironmentPublisher();
+ }
+
+ public void dmaapPublishOperationalEnvRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType,
+ String tenantContext, String workloadContext, String action ) throws Exception {
+
+ String request = this.buildRequest(operationalEnvironmentId, operationalEnvironmentName, operationalEnvironmentType, tenantContext, workloadContext, action);
+ final DmaapPublisher publisher = this.getPublisher();
+ publisher.send(request);
+
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java
new file mode 100644
index 0000000000..3ce4759577
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap;
+
+import java.util.Map;
+
+import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils;
+import org.openecomp.mso.client.dmaap.DmaapProperties;
+import org.openecomp.mso.properties.MsoJavaProperties;
+
+public class DmaapPropertiesImpl implements DmaapProperties {
+
+ private final Map<String, String> props;
+
+ public DmaapPropertiesImpl () {
+
+ MsoJavaProperties properties = MsoPropertiesUtils.loadMsoProperties();
+ this.props = properties.asMap();
+ }
+
+ @Override
+ public Map<String, String> getProperties() {
+
+ return this.props;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java
new file mode 100644
index 0000000000..36c1085655
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Optional;
+
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+
+public class OperationalEnvironmentPublisher extends DmaapPublisher {
+
+
+ public OperationalEnvironmentPublisher() throws FileNotFoundException, IOException {
+ super();
+ }
+
+ @Override
+ public String getUserName() {
+
+ return this.msoProperties.get("so.operational-environment.dmaap.username");
+ }
+
+ @Override
+ public String getPassword() {
+
+ return this.msoProperties.get("so.operational-environment.dmaap.password");
+ }
+
+ @Override
+ public String getTopic() {
+
+ return this.msoProperties.get("so.operational-environment.publisher.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(this.msoProperties.get("so.operational-environment.dmaap.host"));
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java
new file mode 100644
index 0000000000..993c7dc9b7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailed.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions;
+
+public class AAIClientCallFailed extends Exception {
+
+ public AAIClientCallFailed(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java
new file mode 100644
index 0000000000..3e9009d2e3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/AsdcClientCallFailed.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions;
+
+public class AsdcClientCallFailed extends Exception {
+
+ public AsdcClientCallFailed(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AsdcClientCallFailed(String message) {
+ super(message);
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java
index 22f7cf09cd..279a93e1b7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestReferences.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/exceptions/TenantIsolationException.java
@@ -1,43 +1,36 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-public class RequestReferences {
-
- String requestId;
- String instanceId;
-
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getInstanceId() {
- return instanceId;
- }
- public void setInstanceId(String instanceId) {
- this.instanceId = instanceId;
- }
-
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions;
+
+public class TenantIsolationException extends Exception {
+
+ private static final long serialVersionUID = 6948152225371031774L;
+
+ public TenantIsolationException() {
+ super();
+
+ }
+
+ public TenantIsolationException(String msg) {
+ super ("Tenant Isolation error: " + msg);
+
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
new file mode 100644
index 0000000000..c431da66ee
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
@@ -0,0 +1,145 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.helpers;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Map;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed;
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.AAIResourcesClient;
+import org.openecomp.mso.client.aai.entities.AAIResultWrapper;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.openecomp.mso.client.aai.entities.uri.Depth;
+import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment;
+import org.openecomp.mso.logger.MsoLogger;
+
+public class AAIClientHelper {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+
+ public AAIClientHelper() {
+ super();
+ }
+
+ public AAIClientHelper(String serviceName, String requestId) {
+ super();
+ MsoLogger.setServiceName (serviceName);
+ MsoLogger.setLogContext(requestId, "");
+ }
+
+ /**
+ * Get managing ECOMP Environment Info from A&AI
+ * @param id = operationalEnvironmentId
+ * @return AAIResultWrapper object
+ */
+ public AAIResultWrapper getAaiOperationalEnvironment(String id) throws Exception {
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+ uri.depth(Depth.ZERO); //Do not return relationships if any
+ AAIResourcesClient aaiClient = this.getClient();
+ AAIResultWrapper result = aaiClient.get(uri);
+ return result;
+ }
+ catch(Exception ex) {
+ logStackTrace(ex);
+ throw new AAIClientCallFailed("Call to A&AI failed!", ex);
+ }
+ }
+
+
+ /**
+ * Update managing ECOMP Environment Info from A&AI
+ * @param id = operationalEnvironmentId
+ * @param AAIOperationalEnvironment object
+ */
+ public void updateAaiOperationalEnvironment(String id, AAIOperationalEnvironment aaiRequest) throws Exception {
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+ AAIResourcesClient aaiClient = this.getClient();
+ aaiClient.update(uri, aaiRequest);
+ }
+ catch(Exception ex) {
+ logStackTrace(ex);
+ throw new AAIClientCallFailed("Call to A&AI failed!", ex);
+ }
+ }
+
+
+ public void updateAaiOperationalEnvironment(String operationalEnvironmentId, Map<String, String> payload) throws Exception {
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironmentId);
+ AAIResourcesClient aaiClient = this.getClient();
+ aaiClient.update(uri, payload);
+ }
+ catch(Exception ex) {
+ logStackTrace(ex);
+ throw new AAIClientCallFailed("Call to A&AI failed!", ex);
+ }
+ }
+
+ /**
+ * Create an Operational Environment object in A&AI
+ * @param AAIOperationalEnvironment object
+ */
+ public void createOperationalEnvironment(AAIOperationalEnvironment operationalEnvironment) throws Exception {
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironment.getOperationalEnvironmentId());
+ AAIResourcesClient aaiClient = this.getClient();
+ aaiClient.create(uri, operationalEnvironment);
+ }
+ catch(Exception ex) {
+ logStackTrace(ex);
+ throw new AAIClientCallFailed("Call to A&AI failed!", ex);
+ }
+ }
+
+ /**
+ * Create a relationship between ECOMP managing and VNF Operational Environments
+ * @param managingEcompOperationalEnvironmentId
+ * @param vnfOperationalEnvironmentId
+ * @throws Exception
+ */
+ public void createRelationship(String managingEcompOperationalEnvironmentId, String vnfOperationalEnvironmentId) throws Exception {
+ try {
+ AAIResourceUri ecompEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, managingEcompOperationalEnvironmentId);
+ AAIResourceUri vnfEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, vnfOperationalEnvironmentId);
+ AAIResourcesClient aaiClient = this.getClient();
+ aaiClient.connect(vnfEnvUri, ecompEnvUri);
+ }
+ catch(Exception ex) {
+ logStackTrace(ex);
+ throw new AAIClientCallFailed("Call to A&AI failed!", ex);
+ }
+ }
+
+ private void logStackTrace(Exception e) {
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ msoLogger.debug(sw.toString());
+ }
+
+ protected AAIResourcesClient getClient() {
+ return new AAIResourcesClient();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java
new file mode 100644
index 0000000000..58b78d7e8b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AAIClientObjectBuilder.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.helpers;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment;
+
+public class AAIClientObjectBuilder {
+
+ private CloudOrchestrationRequest cloudOrchestrationRequest;
+
+ public AAIClientObjectBuilder(CloudOrchestrationRequest request) {
+ this.cloudOrchestrationRequest = request;
+ }
+
+ /**
+ * Create an AAIOperationalEnvironment object.
+ * @param environmentId
+ * @param environmentName
+ * @param environmentType
+ * @param envrionmentStatus
+ * @param tenantContext
+ * @param workloadContext
+ * @return
+ * @throws JsonProcessingException
+ */
+ @Deprecated
+ public static AAIOperationalEnvironment createAAIOperationalEnvironment(
+ String environmentId,
+ String environmentName,
+ String environmentType,
+ String envrionmentStatus,
+ String tenantContext,
+ String workloadContext) {
+
+ AAIOperationalEnvironment oe = new AAIOperationalEnvironment();
+ oe.setOperationalEnvironmentId(environmentId);
+ oe.setOperationalEnvironmentName(environmentName);
+ oe.setOperationalEnvironmentType(environmentType);
+ oe.setOperationalEnvironmentStatus(envrionmentStatus);
+ oe.setTenantContext(tenantContext);
+ oe.setWorkloadContext(workloadContext);
+
+ return oe;
+ }
+
+
+ public AAIOperationalEnvironment buildAAIOperationalEnvironment(String status) {
+ AAIOperationalEnvironment env = new AAIOperationalEnvironment();
+ env.setOperationalEnvironmentId(this.cloudOrchestrationRequest.getOperationalEnvironmentId());
+ env.setOperationalEnvironmentName(this.cloudOrchestrationRequest.getRequestDetails().getRequestInfo().getInstanceName());
+ env.setOperationalEnvironmentType(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString());
+ env.setOperationalEnvironmentStatus(status);
+ env.setTenantContext(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getTenantContext());
+ env.setWorkloadContext(this.cloudOrchestrationRequest.getRequestDetails().getRequestParameters().getWorkloadContext());
+ return env;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java
new file mode 100644
index 0000000000..2575013609
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/helpers/AsdcClientHelper.java
@@ -0,0 +1,216 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.helpers;
+
+import java.util.UUID;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.json.JSONObject;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AsdcClientCallFailed;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient;
+import org.openecomp.mso.rest.RESTConfig;
+
+public class AsdcClientHelper {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ private String className = this.getClass().getSimpleName();
+ private String methodName = "";
+ private String classMethodMessage = "";
+
+ private JSONObject asdcResponseJsonObj;
+
+ protected MsoJavaProperties properties;
+
+ public static final String ASDC_CONTENT_TYPE = "application/json";
+ public static final String ASDC_ACCEPT_TYPE = "application/json";
+
+ protected String instanceid;
+ protected String userid;
+ protected String asdcEndpoint;
+ protected String basicAuthCred;
+ protected String uri;
+
+ public static String PARTIAL_ASDC_URI = "/sdc/v1/catalog/services/";
+
+ public AsdcClientHelper(MsoJavaProperties properties) {
+ this.properties = properties;
+ setAsdcProperties();
+
+ };
+
+ /**
+ * properties should be set during instantiation of this object
+ */
+ private void setAsdcProperties() {
+ String asdcClientAuth = this.properties.getProperty("mso.asdc.client.auth", null);
+ String msoKey = this.properties.getProperty("mso.msoKey", null);
+ this.basicAuthCred = this.properties.decrypt(asdcClientAuth, msoKey);
+ this.asdcEndpoint = this.properties.getProperty("asdc.endpoint", null);
+ this.userid = this.properties.getProperty("asdc.activate.userid", null);
+ this.instanceid = this.properties.getProperty("asdc.activate.instanceid", null);
+
+ }
+
+ /**
+ * Send POST request to ASDC for operational activation
+ * @param uri - /sdc/v1/catalog/services/{serviceUUID}/distribution/{opEnvId}/activate
+ * @param jsonPayload - json string value of 'workloadContext'.
+ * @return JSONObject
+ */
+ public JSONObject postActivateOperationalEnvironment(String serviceModelVersionId, String operationalEnvironmentId, String workloadContext) {
+
+ try {
+
+ String url = this.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId);
+ msoLogger.debug(" ASDC url : " + url);
+ String jsonPayload = this.buildJsonWorkloadContext(workloadContext);
+ msoLogger.debug(" ASDC jsonPayload : " + jsonPayload);
+ asdcResponseJsonObj = new JSONObject();
+
+ if ( basicAuthCred == null || "".equals(basicAuthCred) ) {
+ String errorMessage = " ** ERROR: ASDC credentials 'mso.asdc.client.auth' not setup in properties file!";
+ throw new AsdcClientCallFailed(errorMessage);
+ }
+
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = setRestClient(config);
+ client.addAuthorizationHeader(basicAuthCred);
+
+ APIResponse apiResponse = setHttpPostResponse(client, jsonPayload);
+ int statusCode = apiResponse.getStatusCode();
+ msoLogger.debug(" ASDC return code : " + statusCode);
+ String responseData = apiResponse.getResponseBodyAsString();
+ msoLogger.debug(" ASDC responseData : " + responseData);
+ asdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode);
+
+ } catch (Exception ex) {
+ msoLogger.debug("calling ASDC Exception message: " + ex.getMessage());
+ String errorMessage = " Encountered Error while calling ASDC POST Activate. " + ex.getMessage();
+ msoLogger.debug(errorMessage);
+ asdcResponseJsonObj.put("statusCode", "500");
+ asdcResponseJsonObj.put("messageId", "");
+ asdcResponseJsonObj.put("message", errorMessage);
+
+ }
+ return asdcResponseJsonObj;
+
+ }
+
+ /**
+ * set RESTClient
+ * @return RestClient object
+ */
+ public RESTClient setRestClient(RESTConfig config) throws Exception {
+
+ RESTClient client = new RESTClient(config).addHeader("X-ECOMP-InstanceID", instanceid)
+ .addHeader("X-ECOMP-RequestID", UUID.randomUUID().toString())
+ .addHeader("Content-Type", AsdcClientHelper.ASDC_CONTENT_TYPE)
+ .addHeader("Accept", AsdcClientHelper.ASDC_ACCEPT_TYPE)
+ .addHeader("USER_ID", userid);
+ return client;
+
+ }
+
+ public APIResponse setHttpPostResponse(RESTClient client, String jsonPayload) throws Exception {
+ return client.httpPost(jsonPayload);
+
+ }
+
+
+ public JSONObject enhanceJsonResponse(JSONObject asdcResponseJsonObj, int statusCode) {
+
+ if (statusCode == 202) { // Accepted
+ asdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
+ asdcResponseJsonObj.put("messageId", "");
+ asdcResponseJsonObj.put("message", "Success");
+
+ } else { // error
+ String message = "Undefined Error Message!";
+ String messageId = "";
+ if (asdcResponseJsonObj.has("requestError") ) {
+ JSONObject requestErrorObj = asdcResponseJsonObj.getJSONObject("requestError");
+ if (asdcResponseJsonObj.getJSONObject("requestError").has("serviceException") ) {
+ message = requestErrorObj.getJSONObject("serviceException").getString("text");
+ messageId = requestErrorObj.getJSONObject("serviceException").getString("messageId");
+ }
+ if (asdcResponseJsonObj.getJSONObject("requestError").has("policyException") ) {
+ message = requestErrorObj.getJSONObject("policyException").getString("text");
+ messageId = requestErrorObj.getJSONObject("policyException").getString("messageId");
+ }
+
+ }
+ asdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
+ asdcResponseJsonObj.put("messageId", messageId);
+ asdcResponseJsonObj.put("message", message);
+ }
+
+ return asdcResponseJsonObj;
+
+ }
+
+ /**
+ * Build Uri
+ * @return String uri
+ */
+ public String buildUriBuilder(String serviceModelVersionId, String operationalEnvironmentId) {
+ String path = serviceModelVersionId + "/distribution/" + operationalEnvironmentId +"/activate";
+ UriBuilder uriBuilder = UriBuilder.fromPath(asdcEndpoint + AsdcClientHelper.PARTIAL_ASDC_URI)
+ .path(path);
+ return uriBuilder.build().toString();
+ }
+
+ /**
+ * Build JSON context
+ * @return String json
+ */
+ public String buildJsonWorkloadContext(String workloadContext) {
+ return new JSONObject().put("workloadContext", workloadContext).toString();
+
+ }
+
+ /**
+ * get asdc instanceId of this object
+ */
+ public String getAsdcInstanceId() {
+ return this.instanceid;
+ }
+
+ /**
+ * get asdc asdcEndpoint of this object
+ */
+ public String getAsdcEndpoint() {
+ return this.asdcEndpoint;
+ }
+
+ /**
+ * get asdc asdcUserId of this object
+ */
+ public String getAsdcUserId() {
+ return this.userid;
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
new file mode 100644
index 0000000000..24111c43c2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -0,0 +1,290 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.process;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.json.JSONObject;
+import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AsdcClientCallFailed;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AsdcClientHelper;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.ServiceModelList;
+import org.openecomp.mso.client.aai.entities.AAIResultWrapper;
+import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatus;
+import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatusDb;
+import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatus;
+import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatusDb;
+import org.openecomp.mso.requestsdb.RequestsDBHelper;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+
+public class ActivateVnfOperationalEnvironment extends OperationalEnvironmentProcess {
+
+ private static final String SERVICE_NAME = "ActivateVnfOperationalEnvironment";
+ private AsdcClientHelper asdcClientHelper = null;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ private String className = this.getClass().getSimpleName();
+ private String methodName = "";
+ private String classMethodMessage = "";
+ private String errorMessage = "";
+
+ private String operationalEnvironmentId = "";
+ private int DEFAULT_ACTIVATE_RETRY_COUNT = 3;
+ private boolean successIndicator = false;
+
+ MsoJavaProperties properties;
+ OperationalEnvDistributionStatusDb activateDistributionDb = null;
+ OperationalEnvDistributionStatus queryDistributionDbResponse = null;
+ OperationalEnvServiceModelStatusDb activateServiceModelDb = null;
+ OperationalEnvServiceModelStatus queryServiceModelResponse = null;
+
+ /**
+ * The class constructor with loadProperties()
+ * @param CloudOrchestrationRequest - object
+ * @param requestId - string
+ */
+ public ActivateVnfOperationalEnvironment(CloudOrchestrationRequest request, String requestId) {
+ super(request, requestId);
+ MsoLogger.setServiceName (getRequestId());
+ MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId());
+ this.properties = MsoPropertiesUtils.loadMsoProperties();
+ asdcClientHelper = new AsdcClientHelper(properties);
+ }
+
+ @Override
+ protected String getServiceName() {
+ return ActivateVnfOperationalEnvironment.SERVICE_NAME;
+ }
+
+ /**
+ * The Point-Of-Entry from APIH with VID request to send activate request
+ * @return void - nothing
+ */
+ @Override
+ public void execute() {
+
+ methodName = "execute() method. ";
+ classMethodMessage = className + " " + methodName;
+ msoLogger.debug("Begin of " + classMethodMessage);
+
+ activateDistributionDb = getOperationalEnvDistributionStatusDb();
+ activateServiceModelDb = getOperationalEnvServiceModelStatusDb();
+
+ try {
+
+ msoLogger.debug("Start of extracting variables from Input.");
+ msoLogger.debug(" requestId: " + requestId);
+ msoLogger.debug(" cloudOrchestrationRequest: " + request.toString());
+ String operationalEnvironmentId = request.getOperationalEnvironmentId();
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ msoLogger.debug(" operationalEnvironmentId: " + this.operationalEnvironmentId);
+ String vidWorkloadContext = request.getRequestDetails().getRequestParameters().getWorkloadContext();
+ List<ServiceModelList> serviceModelVersionIdList = request.getRequestDetails().getRequestParameters().getManifest().getServiceModelList();
+ msoLogger.debug(" serviceModelVersionIdList size(): " + serviceModelVersionIdList.size());
+ msoLogger.debug("End of extracting variables from Input.");
+
+ msoLogger.debug("Start of getting AAIOperationalEnvironment Object.");
+ AAIOperationalEnvironment operationalEnv = getAAIOperationalEnvironment(operationalEnvironmentId);
+ String workloadContext = operationalEnv.getWorkloadContext();
+ msoLogger.debug(" aai workloadContext: " + workloadContext);
+ if (vidWorkloadContext.equals(workloadContext)) {
+ msoLogger.debug(" vid workloadContext matched with aai record, continue!");
+ } else {
+ errorMessage = " The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext;
+ msoLogger.debug(errorMessage);
+ throw new TenantIsolationException(errorMessage);
+ }
+ msoLogger.debug("End of getting AAIOperationalEnvironment Object.");
+
+ msoLogger.debug("Start of sending activation request to ASDC.");
+ processActivateASDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ msoLogger.debug("End of sending activation request to ASDC.");
+
+ msoLogger.debug("** OVERALL status of flow: Processed ALL " + serviceModelVersionIdList.size() + " activation requests are SUCCESSFUL!");
+ successIndicator = true;
+ msoLogger.debug("End of " + classMethodMessage);
+
+ } catch (Exception ex) {
+ errorMessage = "** OVERALL status of flow: " + methodName + ex.getMessage();
+ msoLogger.debug(errorMessage);
+ getRequestDb().updateInfraFailureCompletion(errorMessage, requestId, operationalEnvironmentId);
+
+ }
+
+ }
+
+
+ /**
+ * The Method to send the Activation Requests to ASDC
+ * @param requestId - string
+ * @param operationalEnvironmentId - string
+ * @param List<ServiceModelList> serviceModelVersionIdList - list
+ * @param workloadContext - string
+ * @return void - nothing
+ */
+ public void processActivateASDCRequest(String requestId, String operationalEnvironmentId,
+ List<ServiceModelList> serviceModelVersionIdList, String workloadContext) throws TenantIsolationException, AsdcClientCallFailed {
+
+ int retryCount = 0;
+ String retryCountString = properties.getProperty("mso.tenant.isolation.retry.count", null);
+ try {
+ retryCount = Integer.parseInt(retryCountString);
+ msoLogger.debug(" ** Used Properties File retryCount: " + retryCount);
+ } catch (NumberFormatException e) {
+ retryCount = DEFAULT_ACTIVATE_RETRY_COUNT;
+ msoLogger.debug(" ** Used Default retryCount: " + retryCount + " Exception: " + e.getMessage());
+ }
+
+ msoLogger.debug(" ** serviceModelVersionIdList: " + serviceModelVersionIdList.size());
+
+ // loop through the serviceModelVersionId, and send request ASDC
+ for(ServiceModelList serviceModelList : serviceModelVersionIdList){
+ String serviceModelVersionId = serviceModelList.getServiceModelVersionId();
+ String recoveryAction = serviceModelList.getRecoveryAction().toString().toUpperCase();
+ msoLogger.debug(" ** serviceModelVersionId: " + serviceModelVersionId + "; recoveryAction: " + recoveryAction);
+ // should insert 1 row
+ activateServiceModelDb.insertOperationalEnvServiceModelStatus(requestId, operationalEnvironmentId, serviceModelVersionId, "SENT", recoveryAction, retryCount, workloadContext);
+
+ JSONObject jsonResponse = null;
+ String distributionId = "";
+ try {
+ jsonResponse = asdcClientHelper.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext);
+ msoLogger.debug(" JSONObject jsonResponse:" + jsonResponse.toString());
+ String statusCode = jsonResponse.get("statusCode").toString();
+ if (statusCode.equals("202")) {
+ distributionId = jsonResponse.get("distributionId").toString();
+
+ // should insert 1 row
+ activateDistributionDb.insertOperationalEnvDistributionStatus(distributionId, operationalEnvironmentId, serviceModelVersionId, "SENT", requestId);
+
+ } else {
+ errorMessage = " Failure calling ASDC: statusCode: " + statusCode +
+ "; messageId: " + jsonResponse.get("messageId") +
+ "; message: " + jsonResponse.get("message");
+ msoLogger.debug(errorMessage);
+ throw new AsdcClientCallFailed(errorMessage);
+
+ }
+
+ } catch (Exception ex) {
+ errorMessage = " Encountered Exception in " + methodName + " Exception: " + ex.getMessage();
+ msoLogger.debug(errorMessage);
+ throw new TenantIsolationException(errorMessage);
+ }
+
+ }
+
+ }
+
+ /**
+ * Get AAIOperationalEnvironment object
+ * @param String operationalEnvironmentId
+ * @return object AAIOperationalEnvironment
+ */
+ public AAIOperationalEnvironment getAAIOperationalEnvironment(String operationalEnvironmentId) {
+
+ AAIOperationalEnvironment operationalEnv = null;
+ getAaiHelper();
+
+ try {
+ AAIResultWrapper aaiResult = aaiHelper.getAaiOperationalEnvironment(operationalEnvironmentId);
+ operationalEnv = aaiResult.asBean(AAIOperationalEnvironment.class).get();
+ } catch (JsonParseException e) {
+ msoLogger.debug(" **** JsonParseException: " + e.getMessage());
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ msoLogger.debug(" **** JsonMappingException: " + e.getMessage());
+ e.printStackTrace();
+ } catch (IOException e) {
+ msoLogger.debug(" **** IOException: " + e.getMessage());
+ e.printStackTrace();
+ } catch (Exception e) {
+ msoLogger.debug(" **** Exception: " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ return operationalEnv;
+
+ }
+
+
+ /**
+ * Overall Success indicator
+ * @return true or false
+ */
+ public boolean isSuccess() {
+ return successIndicator;
+ }
+
+ /**
+ * Set to new OperationalEnvDistributionStatusDb
+ * @return void
+ */
+ public void setOperationalEnvDistributionStatusDb (OperationalEnvDistributionStatusDb activateDistributionDb) {
+ this.activateDistributionDb = activateDistributionDb;
+ }
+
+ /**
+ * Set to new OperationalEnvServiceModelStatusDb
+ * @return void
+ */
+ public void setOperationalEnvServiceModelStatusDb (OperationalEnvServiceModelStatusDb activateServiceModelDb) {
+ this.activateServiceModelDb = activateServiceModelDb;
+ }
+
+ /**
+ * Set to new AsdcClientHelper
+ * @return void
+ */
+ public void setAsdcClientHelper (AsdcClientHelper asdcClientHelper) {
+ this.asdcClientHelper = asdcClientHelper;
+ }
+
+ /**
+ * get OperationalEnvDistributionStatusDb instance
+ */
+ public OperationalEnvDistributionStatusDb getOperationalEnvDistributionStatusDb() {
+ if(this.activateDistributionDb == null) {
+ this.activateDistributionDb = OperationalEnvDistributionStatusDb.getInstance();
+ }
+ return this.activateDistributionDb;
+ }
+
+ /**
+ * get OperationalEnvServiceModelStatusDb instance
+ */
+ public OperationalEnvServiceModelStatusDb getOperationalEnvServiceModelStatusDb() {
+ if(this.activateServiceModelDb == null) {
+ this.activateServiceModelDb = OperationalEnvServiceModelStatusDb.getInstance();
+ }
+ return this.activateServiceModelDb;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
new file mode 100644
index 0000000000..7ef0da61f5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -0,0 +1,342 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.process;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.json.JSONObject;
+import org.openecomp.mso.apihandlerinfra.MsoPropertiesUtils;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.AsdcClientCallFailed;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AsdcClientHelper;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Distribution;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.DistributionStatus;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatus;
+import org.openecomp.mso.requestsdb.OperationalEnvDistributionStatusDb;
+import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatus;
+import org.openecomp.mso.requestsdb.OperationalEnvServiceModelStatusDb;
+
+
+public class ActivateVnfStatusOperationalEnvironment extends OperationalEnvironmentProcess {
+
+ private static final String SERVICE_NAME = "ActivateVnfStatusOperationalEnvironment";
+ private AsdcClientHelper asdcClientHelper = null;
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ private String className = this.getClass().getSimpleName();
+ private String methodName = "";
+ private String classMethodMessage = "";
+ private String errorMessage = "";
+
+ private String operationalEnvironmentId = "";
+ private boolean successIndicator = false;
+
+ MsoJavaProperties properties;
+ OperationalEnvDistributionStatusDb activateDistributionDb = null;
+ OperationalEnvDistributionStatus queryDistributionDbResponse = null;
+ OperationalEnvServiceModelStatusDb activateServiceModelDb = null;
+ OperationalEnvServiceModelStatus queryServiceModelResponse = null;
+
+ /**
+ * The class constructor with loadProperties()
+ * @param CloudOrchestrationRequest - object
+ * @param requestId - string
+ */
+ public ActivateVnfStatusOperationalEnvironment(CloudOrchestrationRequest request, String requestId) {
+ super(request, requestId);
+ MsoLogger.setServiceName (getRequestId());
+ MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId());
+ this.properties = MsoPropertiesUtils.loadMsoProperties();
+ asdcClientHelper = new AsdcClientHelper(properties);
+ }
+
+ @Override
+ protected String getServiceName() {
+ return ActivateVnfStatusOperationalEnvironment.SERVICE_NAME;
+ }
+
+
+ /**
+ * The Point-Of-Entry from APIH with activate status from ASDC
+ * @return void - nothing
+ */
+ @Override
+ public void execute() {
+
+ methodName = "execute() method. ";
+ classMethodMessage = className + " " + methodName;
+ msoLogger.debug("Begin of " + classMethodMessage);
+
+ activateDistributionDb = getOperationalEnvDistributionStatusDb();
+ activateServiceModelDb = getOperationalEnvServiceModelStatusDb();
+
+ try {
+
+ String asdcDistributionId = request.getDistributionId();
+ Distribution distributionObject = request.getDistribution();
+ msoLogger.debug(" ** asdcDistributionId: " + asdcDistributionId + ";" + " status: " + request.getDistribution().getStatus());
+
+ // Distribution, Query for operationalEnvironmentId, serviceModelVersionId
+ queryDistributionDbResponse = activateDistributionDb.getOperationalEnvDistributionStatus(asdcDistributionId);
+
+ if(queryDistributionDbResponse == null) {
+ throw new TenantIsolationException("DistributionId doesn't exist in the DB: " + asdcDistributionId);
+ }
+
+ String operationalEnvironmentId = queryDistributionDbResponse.getOperationalEnvId();
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ String serviceModelVersionId = queryDistributionDbResponse.getServiceModelVersionId();
+
+ // ServiceModel, Query for dbRequestId, recoveryAction, retryCountString
+ queryServiceModelResponse = activateServiceModelDb.getOperationalEnvServiceModelStatus(operationalEnvironmentId, serviceModelVersionId);
+ String origRequestId = queryServiceModelResponse.getRequestId();
+ this.requestId = origRequestId;
+
+ msoLogger.debug("Start of processing activation status.");
+ processActivateASDCStatus(asdcDistributionId, distributionObject);
+ msoLogger.debug("End of processing activation status.");
+
+ // After EVERY status processed, need to query the status of all service modelId
+ // to determine the OVERALL status if "COMPLETE" or "FAILURE":
+ checkOrUpdateOverallStatus(origRequestId, operationalEnvironmentId);
+
+ msoLogger.debug("End of " + classMethodMessage);
+
+ } catch (Exception ex) {
+ errorMessage = "** OVERALL status of flow: " + methodName + ex.getMessage();
+ msoLogger.debug(errorMessage);
+ getRequestDb().updateInfraFailureCompletion(errorMessage, requestId, operationalEnvironmentId);
+
+ }
+
+ }
+
+ /**
+ * The Method to process the Activation Status from ASDC
+ * @param asdcDistributionId - string
+ * @param Distribution - object
+ * @return void - nothing
+ */
+ public void processActivateASDCStatus(String asdcDistributionId, Distribution asdcStatus) throws TenantIsolationException {
+
+ String operationalEnvironmentId = queryDistributionDbResponse.getOperationalEnvId();
+ String serviceModelVersionId = queryDistributionDbResponse.getServiceModelVersionId();
+
+ String origRequestId = queryServiceModelResponse.getRequestId();
+ String recoveryAction = queryServiceModelResponse.getRecoveryAction();
+ int retryCount = queryServiceModelResponse.getRetryCount();
+ String workloadContext = queryServiceModelResponse.getWorkloadContext();
+
+ // Validate/process status
+ if (asdcStatus.getStatus().toString().equals(DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString())) {
+ // should update 1 row, update status to "DISTRIBUTION_COMPLETE_OK"
+ activateDistributionDb.updateOperationalEnvDistributionStatus(asdcStatus.getStatus().toString(), asdcDistributionId, operationalEnvironmentId, serviceModelVersionId);
+ // should update 1 row, update status and retryCount = 0 (ie, serviceModelVersionId is DONE!)
+ activateServiceModelDb.updateOperationalEnvRetryCountStatus(operationalEnvironmentId, serviceModelVersionId, asdcStatus.getStatus().toString(), 0);
+
+ } else {
+
+ // "DISTRIBUTION_COMPLETE_ERROR", Check if recoveryAction is "RETRY"
+ if (recoveryAction.equals("RETRY") & retryCount > 0) {
+ // RESEND / RETRY serviceModelVersionId to ASDC
+ JSONObject jsonResponse = null;
+ String newDistributionId = "";
+ try {
+ jsonResponse = asdcClientHelper.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext);
+ String statusCode = jsonResponse.get("statusCode").toString();
+ if (statusCode.equals("202")) {
+ newDistributionId = jsonResponse.get("distributionId").toString();
+
+ // should insert 1 row, NEW distributionId for old serviceModelServiceId
+ activateDistributionDb.insertOperationalEnvDistributionStatus(newDistributionId, operationalEnvironmentId, serviceModelVersionId, "SENT", origRequestId);
+
+ // update retryCount (less 1) for the serviceModelServiceId
+ retryCount = retryCount - 1;
+ // should update 1 row, original insert
+ activateServiceModelDb.updateOperationalEnvRetryCountStatusPerReqId(operationalEnvironmentId, serviceModelVersionId, asdcStatus.getStatus().toString(), retryCount, origRequestId);
+
+ // should update 1 row, OLD distributionId set to status error (ie, old distributionId is DONE!).
+ activateDistributionDb.updateOperationalEnvDistributionStatus(DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString(), asdcDistributionId, operationalEnvironmentId, serviceModelVersionId);
+
+ } else {
+ errorMessage = " Failure calling ASDC: statusCode: " + statusCode +
+ "; messageId: " + jsonResponse.get("messageId") +
+ "; message: " + jsonResponse.get("message");
+ msoLogger.debug(errorMessage);
+ throw new AsdcClientCallFailed(errorMessage);
+
+ }
+
+ } catch (Exception ex) {
+ errorMessage = " Encountered Exception in " + methodName + " Exception: " + ex.getMessage();
+ msoLogger.debug(errorMessage);
+ throw new TenantIsolationException(errorMessage);
+ }
+
+
+ } else { // either RETRY & Count = 0, or 'ABORT', or 'SKIP'
+
+ if (recoveryAction.equals("SKIP") || recoveryAction.equals("ABORT")) {
+ String modifiedStatus = "";
+ if (recoveryAction.equals("SKIP")) { // considered SUCCESS
+ modifiedStatus = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString();
+ } else {
+ if (recoveryAction.equals("ABORT")) {
+ modifiedStatus = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString(); // ABORT, error
+ }
+ }
+ // should update 1 row, modified status & retryCount set 0
+ activateServiceModelDb.updateOperationalEnvRetryCountStatus(operationalEnvironmentId, serviceModelVersionId, modifiedStatus, 0);
+ // should update 1 row, modified status
+ activateDistributionDb.updateOperationalEnvDistributionStatus(modifiedStatus, asdcDistributionId, operationalEnvironmentId, serviceModelVersionId);
+
+ } else {
+ // RETRY & Count = 0 (do nothing!)
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * The Method to check the overall status of the Activation for an operationalEnvironmentId
+ * @param origRequestId - string
+ * @param operationalEnvironmentId - string
+ * @return void - nothing
+ * @throws Exception
+ */
+ public void checkOrUpdateOverallStatus(String origRequestId, String operationalEnvironmentId) throws Exception {
+
+ List<OperationalEnvServiceModelStatus> queryServiceModelResponseList = activateServiceModelDb.getOperationalEnvIdStatus(operationalEnvironmentId, origRequestId);
+ msoLogger.debug(" **** queryServiceModelResponseList.size(): " + queryServiceModelResponseList.size());
+
+ String status = "Waiting";
+ int count = 0;
+ // loop through the statuses of the service model
+ for (OperationalEnvServiceModelStatus queryServiceModelResponse : queryServiceModelResponseList) {
+ status = queryServiceModelResponse.getServiceModelVersionDistrStatus();
+ // all should be OK to be completed.
+ if ((status.equals(DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString()) &&
+ (queryServiceModelResponse.getRetryCount() == 0))) {
+ status = "Completed";
+ count ++;
+ }
+ // one error with zero retry, means all are failures.
+ if ((status.equals(DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString()) &&
+ (queryServiceModelResponse.getRetryCount() == 0))) {
+ status = "Failure";
+ count = queryServiceModelResponseList.size();
+ break;
+ }
+
+ }
+
+ // "DISTRIBUTION_COMPLETE_OK" : Completed / Successful
+ if (status == "Completed" && queryServiceModelResponseList.size() == count) {
+ executeAAIPatch(operationalEnvironmentId);
+ String messageStatus = "Overall Activation process is complete. " + status;
+ successIndicator = true;
+ msoLogger.debug(messageStatus);
+ // Update DB to COMPLETION
+ getRequestDb().updateInfraSuccessCompletion(messageStatus, origRequestId, operationalEnvironmentId);
+ } else {
+ // "DISTRIBUTION_COMPLETE_ERROR" : Failure
+ if (status == "Failure" && queryServiceModelResponseList.size() == count) {
+ errorMessage = "Overall Activation process is a Failure. " + status;
+ msoLogger.debug(errorMessage);
+ getRequestDb().updateInfraFailureCompletion(errorMessage, requestId, operationalEnvironmentId);
+ } else {
+ msoLogger.debug(" **** Still waiting for more distribution status!"); // 1+ rows
+ }
+ }
+
+ }
+
+ private void executeAAIPatch(String operationalEnvironmentId) throws Exception {
+ msoLogger.debug("Start of AA&I UPDATE client call in ActivateVnfStatusOperationalEnvironment");
+
+ Map<String, String> payload = new HashMap<>();
+ payload.put("operational-environment-status", "ACTIVE");
+ getAaiHelper().updateAaiOperationalEnvironment(operationalEnvironmentId, payload);
+
+ msoLogger.debug("End of AA&I UPDATE client call in ActivateVnfStatusOperationalEnvironment");
+ }
+
+ /**
+ * Overall Success indicator
+ * @return true or false
+ */
+ public boolean isSuccess() {
+ return successIndicator;
+ }
+
+ /**
+ * Set to new OperationalEnvDistributionStatusDb
+ * @return void
+ */
+ public void setOperationalEnvDistributionStatusDb (OperationalEnvDistributionStatusDb activateDistributionDb) {
+ this.activateDistributionDb = activateDistributionDb;
+ }
+
+ /**
+ * Set to new OperationalEnvServiceModelStatusDb
+ * @return void
+ */
+ public void setOperationalEnvServiceModelStatusDb (OperationalEnvServiceModelStatusDb activateServiceModelDb) {
+ this.activateServiceModelDb = activateServiceModelDb;
+ }
+
+
+ /**
+ * Set to new AsdcClientHelper
+ * @return void
+ */
+ public void setAsdcClientHelper (AsdcClientHelper asdcClientHelper) {
+ this.asdcClientHelper = asdcClientHelper;
+ }
+
+ /**
+ * get OperationalEnvDistributionStatusDb instance
+ */
+ public OperationalEnvDistributionStatusDb getOperationalEnvDistributionStatusDb() {
+ if(this.activateDistributionDb == null) {
+ this.activateDistributionDb = OperationalEnvDistributionStatusDb.getInstance();
+ }
+ return this.activateDistributionDb;
+ }
+
+ /**
+ * get OperationalEnvServiceModelStatusDb instance
+ */
+ public OperationalEnvServiceModelStatusDb getOperationalEnvServiceModelStatusDb() {
+ if(this.activateServiceModelDb == null) {
+ this.activateServiceModelDb = OperationalEnvServiceModelStatusDb.getInstance();
+ }
+ return this.activateServiceModelDb;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
new file mode 100644
index 0000000000..1ce3c5e06d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.process;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+
+public class CreateEcompOperationalEnvironment extends OperationalEnvironmentProcess {
+
+ private static final String SERVICE_NAME = "CreateEcompOperationalEnvironment";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+
+ public CreateEcompOperationalEnvironment(CloudOrchestrationRequest request, String requestId) {
+ super(request, requestId);
+ MsoLogger.setServiceName (getRequestId());
+ MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId());
+ }
+
+
+ protected DmaapOperationalEnvClient getDmaapClient() {
+ return new DmaapOperationalEnvClient();
+ }
+
+
+ @Override
+ public void execute() {
+ try {
+ msoLogger.debug("Begin of execute method in " + SERVICE_NAME);
+ msoLogger.debug("CloudOrchestrationRequest: " + request.toString());
+
+ //Create ECOMP Managing Environment object in A&AI
+ getAaiHelper().createOperationalEnvironment(getAaiClientObjectBuilder().buildAAIOperationalEnvironment("ACTIVE"));
+ msoLogger.debug("ECOMP operational environment created in A&AI.");
+
+ // Call client to publish to DMaap
+ getDmaapClient().dmaapPublishOperationalEnvRequest(getRequest().getOperationalEnvironmentId(),
+ getRequest().getRequestDetails().getRequestInfo().getInstanceName(),
+ getRequest().getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString(),
+ getRequest().getRequestDetails().getRequestParameters().getTenantContext(),
+ getRequest().getRequestDetails().getRequestParameters().getWorkloadContext(),
+ "Create");
+ msoLogger.debug("ECOMP operational environment published in Dmaap/ASDC.");
+
+ //Update request database
+ getRequestDb().updateInfraSuccessCompletion("SUCCESSFULLY Created ECOMP OperationalEnvironment.", getRequestId(), getRequest().getOperationalEnvironmentId());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ getRequestDb().updateInfraFailureCompletion(e.getMessage(), getRequestId(), getRequest().getOperationalEnvironmentId());
+ }
+ }
+
+
+ @Override
+ protected String getServiceName() {
+ return CreateEcompOperationalEnvironment.SERVICE_NAME;
+ }
+
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
new file mode 100644
index 0000000000..a235526887
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
@@ -0,0 +1,216 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.process;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException;
+import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.RelatedInstanceList;
+import org.openecomp.mso.client.aai.entities.AAIResultWrapper;
+import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment;
+import org.openecomp.mso.client.grm.GRMClient;
+import org.openecomp.mso.client.grm.beans.OperationalInfo;
+import org.openecomp.mso.client.grm.beans.Property;
+import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
+import org.openecomp.mso.client.grm.beans.Version;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.apache.commons.lang3.StringUtils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class CreateVnfOperationalEnvironment extends OperationalEnvironmentProcess {
+
+ private static final String SERVICE_NAME = "CreateVnfOperationalEnvironment";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private ObjectMapper mapper = new ObjectMapper();
+ private GRMClient grmClient;
+
+ public CreateVnfOperationalEnvironment(CloudOrchestrationRequest request, String requestId) {
+ super(request, requestId);
+ MsoLogger.setServiceName (getRequestId());
+ MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId());
+ }
+
+
+ @Override
+ public void execute() {
+ try {
+ msoLogger.debug("Begin of execute method in " + SERVICE_NAME);
+ //Retrieve ECOMP Managing environment info in A&AI
+ AAIResultWrapper aaiResultWrapper = getAaiHelper().getAaiOperationalEnvironment(getEcompManagingEnvironmentId());
+ AAIOperationalEnvironment aaiEnv = mapper.readValue(aaiResultWrapper.getJson(), AAIOperationalEnvironment.class);
+
+ //Find ECOMP environments in GRM
+ msoLogger.debug(" Start of GRM findRunningServicesAsString");
+ String searchKey = getSearchKey(aaiEnv);
+ String tenantContext = getTenantContext().toUpperCase();
+ String jsonResponse = getGRMClient().findRunningServicesAsString(searchKey, 1, tenantContext);
+ ServiceEndPointList sel = getObjectMapper().readValue(jsonResponse, ServiceEndPointList.class);
+ if(sel.getServiceEndPointList().size() == 0) {
+ throw new TenantIsolationException("GRM did not find any matches for " + searchKey + " in " + tenantContext);
+ }
+ //Replicate end-point for VNF Operating environment in GRM
+ List<ServiceEndPointRequest> serviceEndpointRequestList = buildEndPointRequestList(sel);
+ int ctr = 0;
+ int total = serviceEndpointRequestList.size();
+ for(ServiceEndPointRequest request : serviceEndpointRequestList) {
+ msoLogger.debug("Creating endpoint " + ++ctr + " of " + total + ": " + request.getServiceEndPoint().getName());
+ getGRMClient().addServiceEndPoint(request);
+ }
+
+ //Create VNF operating in A&AI
+ getAaiHelper().createOperationalEnvironment(getAaiClientObjectBuilder().buildAAIOperationalEnvironment("INACTIVE"));
+ getAaiHelper().createRelationship(getRequest().getOperationalEnvironmentId(), getEcompManagingEnvironmentId());
+
+ //Update request database
+ getRequestDb().updateInfraSuccessCompletion("SUCCESSFULLY created VNF operational environment", getRequestId(), getRequest().getOperationalEnvironmentId());
+ }
+ catch(Exception e) {
+ msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.DataError, e.getMessage());
+ getRequestDb().updateInfraFailureCompletion(e.getMessage(), requestId, getRequest().getOperationalEnvironmentId());
+ }
+ }
+
+
+ protected String getEcompManagingEnvironmentId() throws TenantIsolationException {
+ RelatedInstanceList[] relatedInstances = getRequest().getRequestDetails().getRelatedInstanceList();
+ if (relatedInstances.length > 0 && relatedInstances[0].getRelatedInstance() != null) {
+ return relatedInstances[0].getRelatedInstance().getInstanceId();
+ } else {
+ throw new TenantIsolationException("Unable to get Managing ECOMP Environment ID, request related instance list is empty!");
+ }
+ }
+
+
+ protected String getTenantContext() throws TenantIsolationException {
+ if(!StringUtils.isEmpty(getRequest().getRequestDetails().getRequestParameters().getTenantContext())) {
+ return getRequest().getRequestDetails().getRequestParameters().getTenantContext();
+ }
+ else {
+ throw new TenantIsolationException("Tenant Context is missing from request!");
+ }
+ }
+
+
+ private List<ServiceEndPointRequest> buildEndPointRequestList(ServiceEndPointList serviceEndPointList) throws TenantIsolationException {
+ List<ServiceEndPoint> endpointList = serviceEndPointList.getServiceEndPointList();
+ msoLogger.debug("Number of service endpoints from GRM: " + endpointList.size());
+ List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<ServiceEndPointRequest>();
+ for(ServiceEndPoint serviceEndpoint : endpointList) {
+ serviceEndPointRequestList.add(buildServiceEndpoint(serviceEndpoint));
+ }
+ return serviceEndPointRequestList;
+ }
+
+
+ private ServiceEndPointRequest buildServiceEndpoint(ServiceEndPoint serviceEndpoint) throws TenantIsolationException {
+
+ //@TODO: handle nulls? Put in a ServiceEndpointWrapper class which will check for nulls and flatten access to fields
+ Version ver = new Version();
+ ver.setMajor(serviceEndpoint.getVersion().getMajor());
+ ver.setMinor(serviceEndpoint.getVersion().getMinor());
+ ver.setPatch(serviceEndpoint.getVersion().getPatch());
+
+ ServiceEndPoint endpoint = new ServiceEndPoint();
+ endpoint.setName(buildServiceNameForVnf(serviceEndpoint.getName()));
+
+ endpoint.setVersion(ver);
+ endpoint.setHostAddress(serviceEndpoint.getHostAddress());
+ endpoint.setListenPort(serviceEndpoint.getListenPort());
+ endpoint.setLatitude(serviceEndpoint.getLatitude());
+ endpoint.setLongitude(serviceEndpoint.getLongitude());
+ endpoint.setContextPath(serviceEndpoint.getContextPath());
+ endpoint.setRouteOffer(serviceEndpoint.getRouteOffer());
+
+ OperationalInfo operInfo = new OperationalInfo();
+ operInfo.setCreatedBy(serviceEndpoint.getOperationalInfo().getCreatedBy());
+ operInfo.setUpdatedBy(serviceEndpoint.getOperationalInfo().getUpdatedBy());
+
+ endpoint.setOperationalInfo(operInfo);
+ endpoint.setProperties(serviceEndpoint.getProperties());
+
+ String env = getEnvironmentName(serviceEndpoint.getProperties());
+
+ ServiceEndPointRequest serviceEndPontRequest = new ServiceEndPointRequest();
+ serviceEndPontRequest.setEnv(env);
+ serviceEndPontRequest.setServiceEndPoint(endpoint);
+
+ return serviceEndPontRequest;
+ }
+
+
+ protected String getEnvironmentName(List<Property> props) {
+ String env = "";
+ for(Property prop : props) {
+ if(prop.getName().equalsIgnoreCase("Environment")) {
+ env = prop.getValue();
+ }
+ }
+ return env;
+ }
+
+
+ protected String buildServiceNameForVnf(String fqName) throws TenantIsolationException {
+ // Service name format is: {tenantContext}.{workloadContext}.{serviceName} e.g. TEST.ECOMP_PSL.Inventory
+ // We need to extract the serviceName, in the above example: "Inventory"
+ String[] tokens = fqName.split("[.]");
+ String serviceName;
+ if(tokens.length > 0) {
+ serviceName = tokens[tokens.length-1];
+ }
+ else {
+ throw new TenantIsolationException("Fully qualified service name is null.");
+ }
+ String tenantContext = getRequest().getRequestDetails().getRequestParameters().getTenantContext();
+ String workloadContext = getRequest().getRequestDetails().getRequestParameters().getWorkloadContext();
+ return tenantContext + "." + workloadContext + "." + serviceName;
+ }
+
+
+ protected GRMClient getGRMClient() {
+ if(this.grmClient == null) {
+ this.grmClient = new GRMClient();
+ }
+ return this.grmClient;
+ }
+
+
+ protected String getSearchKey(AAIOperationalEnvironment aaiEnv) {
+ return aaiEnv.getTenantContext() + "." + aaiEnv.getWorkloadContext() + ".*";
+ }
+
+ protected ObjectMapper getObjectMapper() {
+ return mapper;
+ }
+
+
+ @Override
+ protected String getServiceName() {
+ return CreateVnfOperationalEnvironment.SERVICE_NAME;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
new file mode 100644
index 0000000000..b419a0ccd0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.process;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.exceptions.TenantIsolationException;
+import org.openecomp.mso.client.aai.entities.AAIResultWrapper;
+import org.openecomp.mso.client.aai.objects.AAIOperationalEnvironment;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+public class DeactivateVnfOperationalEnvironment extends OperationalEnvironmentProcess {
+
+ private static final String SERVICE_NAME = "DeactivateVnfOperationalEnvironment";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ private String className = this.getClass().getName();
+
+ public DeactivateVnfOperationalEnvironment(CloudOrchestrationRequest request, String requestId) {
+ super(request, requestId);
+ MsoLogger.setServiceName (getRequestId());
+ MsoLogger.setLogContext(getRequestId(), getRequest().getOperationalEnvironmentId());
+ }
+
+ @Override
+ public void execute() {
+ String methodName = "deactivateOperationalEnvironment() method.";
+ String classMethodMessage = className + " " + methodName;
+
+ msoLogger.debug("Begin of execute method in " + SERVICE_NAME);
+
+ String operationalEnvironmentId = getRequest().getOperationalEnvironmentId();
+ msoLogger.debug("Deactivate OperationalEnvironment on " + operationalEnvironmentId);
+ try {
+ msoLogger.debug("Start of AA&I Get client call in " + classMethodMessage);
+
+ AAIResultWrapper aaiResult = getAaiHelper().getAaiOperationalEnvironment(operationalEnvironmentId);
+ AAIOperationalEnvironment aaiOpEnv = aaiResult.asBean(AAIOperationalEnvironment.class).get();
+ String operationalEnvironmentStatus = aaiOpEnv.getOperationalEnvironmentStatus();
+
+ msoLogger.debug("OperationalEnvironmentStatus is :" + operationalEnvironmentStatus);
+ msoLogger.debug(" End of AA&I Get client call in " + classMethodMessage);
+
+ if(operationalEnvironmentStatus == null) {
+ String error = "OperationalEnvironmentStatus is null on OperationalEnvironmentId: " + operationalEnvironmentId;
+ throw new TenantIsolationException(error);
+ }
+
+ if(operationalEnvironmentStatus.equalsIgnoreCase("ACTIVE")) {
+ msoLogger.debug("Start of AA&I UPDATE client call in " + classMethodMessage);
+
+ aaiOpEnv.setOperationalEnvironmentStatus("INACTIVE");
+ getAaiHelper().updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv);
+
+ msoLogger.debug(" End of AA&I UPDATE client call in " + classMethodMessage);
+ } else if(!operationalEnvironmentStatus.equalsIgnoreCase("INACTIVE")) {
+ String error = "Invalid OperationalEnvironmentStatus on OperationalEnvironmentId: " + operationalEnvironmentId;
+ throw new TenantIsolationException(error);
+ }
+
+ getRequestDb().updateInfraSuccessCompletion("SUCCESSFULLY Deactivated OperationalEnvironment", requestId, operationalEnvironmentId);
+
+ } catch(Exception e) {
+ msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.DataError, e.getMessage());
+ getRequestDb().updateInfraFailureCompletion(e.getMessage(), requestId, operationalEnvironmentId);
+ }
+
+ msoLogger.debug("End of " + classMethodMessage);
+ }
+
+ @Override
+ protected String getServiceName() {
+ return DeactivateVnfOperationalEnvironment.SERVICE_NAME;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java
new file mode 100644
index 0000000000..9c2d443215
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/process/OperationalEnvironmentProcess.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolation.process;
+
+import org.openecomp.mso.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
+import org.openecomp.mso.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder;
+import org.openecomp.mso.requestsdb.RequestsDBHelper;
+
+public abstract class OperationalEnvironmentProcess {
+
+ protected String requestId;
+ protected CloudOrchestrationRequest request;
+ protected AAIClientObjectBuilder aaiClientObjectBuilder;
+ protected AAIClientHelper aaiHelper;
+ protected RequestsDBHelper requestDb;
+
+ public OperationalEnvironmentProcess(CloudOrchestrationRequest request, String requestId) {
+ this.requestId = requestId;
+ this.request = request;
+ this.aaiClientObjectBuilder = new AAIClientObjectBuilder(getRequest());
+ }
+
+ protected String getRequestId() {
+ return this.requestId;
+ }
+
+ protected CloudOrchestrationRequest getRequest() {
+ return this.request;
+ }
+
+ protected AAIClientHelper getAaiHelper() {
+ if(this.aaiHelper == null) {
+ this.aaiHelper = new AAIClientHelper(getServiceName(), getRequestId());
+ }
+ return this.aaiHelper;
+ }
+
+ protected void setAaiHelper(AAIClientHelper helper) {
+ this.aaiHelper = helper;
+ }
+
+ protected AAIClientObjectBuilder getAaiClientObjectBuilder() {
+ return this.aaiClientObjectBuilder;
+ }
+
+ protected RequestsDBHelper getRequestDb() {
+ if(requestDb == null) {
+ requestDb = new RequestsDBHelper();
+ }
+ return requestDb;
+ }
+
+ protected void setRequestsDBHelper(RequestsDBHelper helper) {
+ this.requestDb = helper;
+ }
+
+ protected abstract String getServiceName();
+ public abstract void execute();
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java
new file mode 100644
index 0000000000..381fed4661
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Action.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public enum Action {
+ create,
+ activate,
+ deactivate,
+ distributionStatus
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java
index df2e065152..586843fc4d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationListResponse.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationRequestList.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,23 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import java.util.List;
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class GetOrchestrationListResponse {
-
- protected List<RequestList> requestList;
-
- public List<RequestList> getRequestList() {
- return requestList;
- }
-
- public void setRequestList(List<RequestList> requestList) {
- this.requestList = requestList;
- }
-
-}
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.util.List;
+
+public class CloudOrchestrationRequestList {
+
+ private List<CloudOrchestrationResponse> requestList;
+
+ public List<CloudOrchestrationResponse> getRequestList() {
+ return requestList;
+ }
+
+ public void setRequestList(List<CloudOrchestrationResponse> requestList) {
+ this.requestList = requestList;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java
index 0af030136d..8c8d4011a3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/GetOrchestrationResponse.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/CloudOrchestrationResponse.java
@@ -1,39 +1,38 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class GetOrchestrationResponse {
-
- protected Request request;
-
- public Request getRequest() {
- return request;
- }
-
- public void setRequest(Request request) {
- this.request = request;
- }
-
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class CloudOrchestrationResponse {
+
+ protected Request request;
+
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java
new file mode 100644
index 0000000000..99da235154
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Distribution.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public class Distribution {
+
+ private Status status;
+ private String errorReason;
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public String getErrorReason() {
+ return errorReason;
+ }
+
+ public void setErrorReason(String errorReason) {
+ this.errorReason = errorReason;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java
new file mode 100644
index 0000000000..fbf6db0582
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/DistributionStatus.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public enum DistributionStatus {
+ DISTRIBUTION_COMPLETE_OK,
+ DISTRIBUTION_COMPLETE_ERROR
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java
new file mode 100644
index 0000000000..481e5dac2e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/InstanceReferences.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "instanceReferences")
+@JsonInclude(Include.NON_DEFAULT)
+public class InstanceReferences {
+
+ private String operationalEnvironmentId;
+ private String operationalEnvName;
+ private String requestorId;
+
+ public String getOperationalEnvironmentId() {
+ return operationalEnvironmentId;
+ }
+
+ public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+
+ public String getOperationalEnvName() {
+ return operationalEnvName;
+ }
+
+ public void setOperationalEnvName(String operationalEnvName) {
+ this.operationalEnvName = operationalEnvName;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java
new file mode 100644
index 0000000000..1805672101
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Manifest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "manifest")
+@JsonInclude(Include.NON_DEFAULT)
+public class Manifest implements Serializable {
+
+ private static final long serialVersionUID = -3460949513229380541L;
+ @JsonProperty("serviceModelList")
+ private List<ServiceModelList> serviceModelList = new ArrayList<ServiceModelList>();
+
+ public List<ServiceModelList> getServiceModelList() {
+ return serviceModelList;
+ }
+
+ public void setServiceModelList(List<ServiceModelList> serviceModelList) {
+ this.serviceModelList = serviceModelList;
+ }
+
+ @Override
+ public String toString() {
+ return "Manifest [serviceModelList=" + serviceModelList.toString() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java
new file mode 100644
index 0000000000..8a377132e4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/OperationalEnvironment.java
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public enum OperationalEnvironment {
+
+ ECOMP,
+ VNF
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java
new file mode 100644
index 0000000000..5d0fca542a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RecoveryAction.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public enum RecoveryAction {
+
+ retry,
+ abort,
+ skip
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java
new file mode 100644
index 0000000000..34d879053e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstance.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "relatedInstance")
+@JsonInclude(Include.NON_DEFAULT)
+public class RelatedInstance implements Serializable {
+
+ private static final long serialVersionUID = -6775477105573153067L;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("instanceId")
+ protected String instanceId;
+ @JsonProperty("resourceType")
+ protected ResourceType resourceType;
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+ public String getInstanceId() {
+ return instanceId;
+ }
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+ public void setResourceType(ResourceType resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ @Override
+ public String toString() {
+ return "RelatedInstance [instanceName=" + instanceName +
+ ", instanceId=" + instanceId +
+ ", resourceType=" + resourceType + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java
index de08c0384a..a9eee24b50 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RelatedInstanceList.java
@@ -18,10 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
-public class RelatedInstanceList {
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "relatedInstanceList")
+@JsonInclude(Include.NON_DEFAULT)
+public class RelatedInstanceList implements Serializable {
+
+ private static final long serialVersionUID = 1758713583807257102L;
+ @JsonProperty("relatedInstance")
protected RelatedInstance relatedInstance;
public RelatedInstance getRelatedInstance() {
@@ -31,12 +42,4 @@ public class RelatedInstanceList {
public void setRelatedInstance(RelatedInstance relatedInstance) {
this.relatedInstance = relatedInstance;
}
-
- @Override
- public String toString() {
- return "RelatedInstanceList [relatedInstance=" + relatedInstance + "]";
- }
-
-
-
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java
index 04d252db33..364080d8aa 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/Request.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Request.java
@@ -1,85 +1,90 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import java.util.Date;
-
-import org.codehaus.jackson.map.annotate.JsonRootName;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-//@JsonRootName(value = "request")
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class Request {
-
- protected String requestId;
- protected String startTime;
- protected String requestScope;
- protected String requestType;
- //protected String requestDetails;
- protected RequestDetails requestDetails;
- protected InstanceReferences instanceReferences;
- protected RequestStatus requestStatus;
-
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getStartTime() {
- return startTime;
- }
- public void setStartTime(String startTime) {
- this.startTime = startTime;
- }
- public String getRequestScope() {
- return requestScope;
- }
- public void setRequestScope(String requestScope) {
- this.requestScope = requestScope;
- }
- public String getRequestType() {
- return requestType;
- }
- public void setRequestType(String requestType) {
- this.requestType = requestType;
- }
- public RequestStatus getRequestStatus() {
- return requestStatus;
- }
- public void setRequestStatus(RequestStatus requestStatus) {
- this.requestStatus = requestStatus;
- }
- public InstanceReferences getInstanceReferences() {
- return instanceReferences;
- }
- public void setInstanceReferences(InstanceReferences instanceReferences) {
- this.instanceReferences = instanceReferences;
- }
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
- public void setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+
+@JsonRootName(value = "request")
+@JsonInclude(Include.NON_DEFAULT)
+public class Request {
+
+ protected String requestId;
+ protected String startTime;
+ protected InstanceReferences instanceReferences;
+ protected String requestScope;
+ protected String requestType;
+ protected RequestDetails requestDetails;
+ protected RequestStatus requestStatus;
+
+
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public String getRequestScope() {
+ return requestScope;
+ }
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public InstanceReferences getInstanceReferences() {
+ return instanceReferences;
+ }
+ public void setInstanceReferences(InstanceReferences instanceReferences) {
+ this.instanceReferences = instanceReferences;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java
index f3b88ee3bf..3faa53ac63 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestDetails.java
@@ -18,49 +18,29 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+import java.io.Serializable;
import java.util.Arrays;
-import org.codehaus.jackson.map.annotate.JsonRootName;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName(value = "requestDetails")
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class RequestDetails {
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestDetails implements Serializable {
- protected ModelInfo modelInfo;
+ private static final long serialVersionUID = -73080684945860609L;
+ @JsonProperty("requestInfo")
protected RequestInfo requestInfo;
+ @JsonProperty("relatedInstanceList")
protected RelatedInstanceList[] relatedInstanceList;
- protected SubscriberInfo subscriberInfo;
- protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("requestParameters")
protected RequestParameters requestParameters;
/**
- * Gets the value of the serviceInfo property.
- *
- * @return
- * possible object is
- * {@link ModelInfo }
- *
- */
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- * Sets the value of the serviceInfo property.
- *
- * @param value
- * allowed object is
- * {@link ModelInfo }
- *
- */
- public void setModelInfo(ModelInfo value) {
- this.modelInfo = value;
- }
-
- /**
* Gets the value of the requestInfo property.
*
* @return
@@ -85,54 +65,6 @@ public class RequestDetails {
}
/**
- * Gets the value of the subscriberInfo property.
- *
- * @return
- * possible object is
- * {@link SubscriberInfo }
- *
- */
- public SubscriberInfo getSubscriberInfo() {
- return subscriberInfo;
- }
-
- /**
- * Sets the value of the subscriberInfo property.
- *
- * @param value
- * allowed object is
- * {@link SubscriberInfo }
- *
- */
- public void setSubscriberInfo(SubscriberInfo value) {
- this.subscriberInfo = value;
- }
-
- /**
- * Gets the value of the cloudConfiguration property.
- *
- * @return
- * possible object is
- * {@link CloudConfiguration }
- *
- */
- public CloudConfiguration getCloudConfiguration() {
- return cloudConfiguration;
- }
-
- /**
- * Sets the value of the cloudConfiguration property.
- *
- * @param value
- * allowed object is
- * {@link CloudConfiguration }
- *
- */
- public void setCloudConfiguration(CloudConfiguration value) {
- this.cloudConfiguration = value;
- }
-
- /**
* Gets the value of the requestParameters property.
*
* @return
@@ -163,14 +95,10 @@ public class RequestDetails {
public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
this.relatedInstanceList = relatedInstanceList;
}
-
@Override
public String toString() {
- return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo="
- + requestInfo + ", relatedInstanceList="
- + Arrays.toString(relatedInstanceList) + ", subscriberInfo="
- + subscriberInfo + ", cloudConfiguration=" + cloudConfiguration
- + ", requestParameters=" + requestParameters + "]";
+ return "RequestDetails [requestInfo=" + requestInfo +
+ ", relatedInstanceList=" + Arrays.toString(relatedInstanceList) +
+ ", requestParameters=" + requestParameters + "]";
}
-
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java
new file mode 100644
index 0000000000..fdb9a10845
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestInfo.java
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "requestInfo")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestInfo implements Serializable {
+
+ private static final long serialVersionUID = 1346372792555344857L;
+ @JsonProperty("resourceType")
+ protected ResourceType resourceType;
+ @JsonProperty("source")
+ protected String source;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("requestorId")
+ protected String requestorId;
+
+ /**
+ * Gets the value of the resourceType property.
+ *
+ * @return
+ * possible object is
+ * {@link ResourceType }
+ *
+ */
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ /**
+ * Sets the value of the source property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ResourceType }
+ *
+ */
+ public void setResourceType(ResourceType value) {
+ this.resourceType = value;
+ }
+
+
+ /**
+ * Gets the value of the source property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * Sets the value of the source property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSource(String value) {
+ this.source = value;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestInfo [source=" + source
+ + ", instanceName=" + instanceName
+ + ", requestorId=" + requestorId
+ + ", resourceType=" + resourceType + "]";
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java
new file mode 100644
index 0000000000..b5a1b8a9fb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestList.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "requestDetails")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestList {
+
+
+ @JsonProperty("request")
+ protected Request request;
+ @JsonProperty("requestStatus")
+ protected RequestStatus requestStatus;
+
+ /**
+ * Gets the value of the request property.
+ *
+ * @return
+ * possible object is
+ * {@link Request }
+ *
+ */
+ public Request getRequest() {
+ return request;
+ }
+
+ /**
+ * Sets the value of the requestInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Request }
+ *
+ */
+ public void setRequest(Request value) {
+ this.request = value;
+ }
+
+ /**
+ * Gets the value of the requestStatus property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestStatus }
+ *
+ */
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+
+ /**
+ * Sets the value of the requestStatus property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestStatus }
+ *
+ */
+ public void setRequestStatus(RequestStatus value) {
+ this.requestStatus = value;
+ }
+
+
+ @Override
+ public String toString() {
+ return "RequestList [request=" + request +
+ ", requestStatus=" + requestStatus + "]";
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java
new file mode 100644
index 0000000000..8164fc5d25
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestParameters.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "requestParameters")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestParameters implements Serializable {
+
+ private static final long serialVersionUID = 8530327178156183693L;
+ @JsonProperty("operationalEnvironmentType")
+ private OperationalEnvironment operationalEnvironmentType;
+ @JsonProperty("tenantContext")
+ private String tenantContext;
+ @JsonProperty("workloadContext")
+ private String workloadContext;
+ @JsonProperty("manifest")
+ private Manifest manifest;
+
+ public OperationalEnvironment getOperationalEnvironmentType() {
+ return operationalEnvironmentType;
+ }
+
+ public void setOperationalEnvironmentType(OperationalEnvironment operationalEnvironmentType) {
+ this.operationalEnvironmentType = operationalEnvironmentType;
+ }
+
+ public String getTenantContext() {
+ return tenantContext;
+ }
+
+ public void setTenantContext(String tenantContext) {
+ this.tenantContext = tenantContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public Manifest getManifest() {
+ return manifest;
+ }
+
+ public void setManifest(Manifest manifest) {
+ this.manifest = manifest;
+ }
+
+
+ @Override
+ public String toString() {
+ return "RequestParameters [operationalEnvironmentType=" + operationalEnvironmentType
+ + ", tenantContext=" + tenantContext
+ + ", workloadContext=" + workloadContext
+ + ", manifes=" + manifest +"]";
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java
index ad04befd64..191337cef0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestReferences.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,79 +18,79 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import java.io.Serializable;
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class CloudConfiguration {
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
- protected String aicNodeClli;
- protected String tenantId;
- protected String lcpCloudRegionId;
+@JsonRootName(value = "requestReferences")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestReferences implements Serializable {
+
+ private static final long serialVersionUID = 5873356773819905368L;
+
+ @JsonProperty("requestId")
+ protected String requestId;
+
+ @JsonProperty("instanceId")
+ String instanceId;
/**
- * Gets the value of the aicNodeClli property.
+ * Gets the value of the requestId property.
*
* @return
* possible object is
* {@link String }
*
- */
- public String getAicNodeClli() {
- return aicNodeClli;
- }
-
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
/**
- * Sets the value of the aicNodeClli property.
+ * Sets the value of the requestId property.
*
* @param value
* allowed object is
* {@link String }
*
- */
- public void setAicNodeClli(String value) {
- this.aicNodeClli = value;
- }
-
+ */
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
/**
- * Gets the value of the tenantId property.
+ * Gets the value of the instanceId property.
*
* @return
* possible object is
* {@link String }
*
- */
- public String getTenantId() {
- return tenantId;
- }
-
+ */
+ public String getInstanceId() {
+ return instanceId;
+ }
+
/**
- * Sets the value of the tenantId property.
+ * Sets the value of the instanceId property.
*
* @param value
* allowed object is
* {@link String }
*
- */
- public void setTenantId(String value) {
- this.tenantId = value;
- }
-
-
- public String getLcpCloudRegionId() {
- return lcpCloudRegionId;
- }
-
- public void setLcpCloudRegionId(String lcpCloudRegionId) {
- this.lcpCloudRegionId = lcpCloudRegionId;
+ */
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
}
@Override
public String toString() {
- return "CloudConfiguration [aicNodeClli=" + aicNodeClli + ", tenantId="
- + tenantId + ", lcpCloudRegionId=" + lcpCloudRegionId + "]";
+ return "RequestReferences [requestId=" + requestId +
+ ", instanceId=" + instanceId + "]";
}
-
-
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java
index 6776bedbda..4514b41734 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/RequestStatus.java
@@ -18,19 +18,28 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
-import java.util.Date;
+import java.io.Serializable;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
-public class RequestStatus {
+@JsonRootName(value = "requestStatus")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestStatus implements Serializable {
- protected String requestState;
+ private static final long serialVersionUID = -1835437975187313144L;
+ @JsonProperty("requestState")
+ protected String requestState;
+ @JsonProperty("statusMessage")
protected String statusMessage;
- protected Integer percentProgress;
- protected String finishTime;
+ @JsonProperty("percentProgress")
+ protected String percentProgress;
+ @JsonProperty("timeStamp")
+ protected String timeStamp;
public String getRequestState() {
@@ -45,16 +54,16 @@ public class RequestStatus {
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
- public Integer getPercentProgress() {
+ public String getPercentProgress() {
return percentProgress;
}
- public void setPercentProgress(Integer percentProgress) {
+ public void setPercentProgress(String percentProgress) {
this.percentProgress = percentProgress;
}
- public String getFinishTime() {
- return finishTime;
+ public String getTimeStamp() {
+ return timeStamp;
}
- public void setFinishTime(String finishTime) {
- this.finishTime = finishTime;
+ public void setTimeStamp(String timeStamp) {
+ this.timeStamp = timeStamp;
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java
new file mode 100644
index 0000000000..aac0e18641
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ResourceType.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public enum ResourceType {
+
+ operationalEnvironment
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java
new file mode 100644
index 0000000000..3ef0779476
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/ServiceModelList.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "serviceModelList")
+@JsonInclude(Include.NON_DEFAULT)
+public class ServiceModelList implements Serializable {
+
+ private static final long serialVersionUID = 1758713583807257102L;
+
+ @JsonProperty("serviceModelVersionId")
+ protected String serviceModelVersionId;
+ @JsonProperty("recoveryAction")
+ protected RecoveryAction recoveryAction;
+
+ public String getServiceModelVersionId() {
+ return serviceModelVersionId;
+ }
+ public void setServiceModelVersionId(String serviceModelVersionId) {
+ this.serviceModelVersionId = serviceModelVersionId;
+ }
+ public RecoveryAction getRecoveryAction() {
+ return recoveryAction;
+ }
+ public void setRecoveryAction(RecoveryAction recoveryAction) {
+ this.recoveryAction = recoveryAction;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceModelList [serviceModelVersionId=" + serviceModelVersionId + ","
+ + "recoveryAction=" + recoveryAction +"]";
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java
new file mode 100644
index 0000000000..c7693f5913
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/Status.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public enum Status {
+ DISTRIBUTION_COMPLETE_OK,
+ DISTRIBUTION_COMPLETE_ERROR
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java
new file mode 100644
index 0000000000..10ba3aa9d7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationRequest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "tenantIsolationRequest")
+@JsonInclude(Include.NON_DEFAULT)
+public class TenantIsolationRequest implements Serializable {
+
+ private static final long serialVersionUID = -210322298981798607L;
+ @JsonProperty("requestId")
+ protected String requestId;
+ @JsonProperty("startTime")
+ protected String startTime;
+ @JsonProperty("requestScope")
+ protected String requestScope;
+ @JsonProperty("requestType")
+ protected String requestType;
+ @JsonProperty("requestDetails")
+ protected RequestDetails requestDetails;
+ @JsonProperty("requestStatus")
+ protected RequestStatus requestStatus;
+
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+ public String getStartTime() {
+ return startTime;
+ }
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+ public String getRequestScope() {
+ return requestScope;
+ }
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+ public String getRequestType() {
+ return requestType;
+ }
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ @Override
+ public String toString() {
+ return "Request [requestId=" + requestId +
+ ", startTime=" + startTime +
+ ", requestType=" + requestType +
+ ", requestDetails=" + requestDetails.toString() +
+ ", requestStatus=" + requestStatus.toString() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java
new file mode 100644
index 0000000000..4b1a4541e0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantIsolationResponse.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "tenantIsolationResponse")
+@JsonInclude(Include.NON_DEFAULT)
+public class TenantIsolationResponse implements Serializable {
+
+ private static final long serialVersionUID = 756749312745898666L;
+ @JsonProperty("requestId")
+ protected String requestId;
+ @JsonProperty("status")
+ String status;
+ @JsonProperty("message")
+ String message;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * Gets the value of the status property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the value of the status property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * Gets the value of the message property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java
index 9629019c5f..45676c5e68 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesResponse.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/TenantSyncResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,19 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-public class ServiceInstancesResponse {
-
- RequestReferences requestReferences;
-
- public RequestReferences getRequestReferences() {
- return requestReferences;
- }
-
- public void setRequestReferences(RequestReferences requestReferences) {
- this.requestReferences = requestReferences;
- }
-
-
-}
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
+public class TenantSyncResponse {
+
+ private RequestReferences requestReferences;
+
+ public RequestReferences getRequestReferences() {
+ return requestReferences;
+ }
+
+ public void setRequestReferences(RequestReferences requestReferences) {
+ this.requestReferences = requestReferences;
+ }
+
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java
new file mode 100644
index 0000000000..92d203abdd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolationbeans/package-info.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2015.09.03 at 02:02:13 PM EDT
+//
+
+package org.openecomp.mso.apihandlerinfra.tenantisolationbeans;
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java
index 3129aed7b0..e3830b0c13 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestList.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ModelType.java
@@ -1,38 +1,32 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
-
-import java.util.List;
-
-
-public class RequestList {
-
- protected Request request;
-
- public Request getRequest() {
- return request;
- }
-
- public void setRequest(Request request) {
- this.request = request;
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.vnfbeans;
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum ModelType {
+ service,
+ vnf,
+ vfModule,
+ volumeGroup,
+ network
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties
new file mode 100644
index 0000000000..708fe0e8b5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties
@@ -0,0 +1 @@
+org.openecomp.mso.apihandlerinfra.tenantisolation.AaiClientPropertiesImpl \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties
new file mode 100644
index 0000000000..27c53a4e2e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.dmaap.DmaapProperties
@@ -0,0 +1 @@
+org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap.DmaapPropertiesImpl \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties
new file mode 100644
index 0000000000..bef20d435b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/META-INF/services/org.openecomp.mso.client.grm.GRMProperties
@@ -0,0 +1 @@
+org.openecomp.mso.apihandlerinfra.tenantisolation.GrmClientPropertiesImpl \ No newline at end of file