aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-common/pom.xml8
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java16
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java21
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java8
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java1
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java2079
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java94
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java110
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java80
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java39
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java96
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ExceptionType.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java177
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java89
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java8
-rw-r--r--mso-api-handlers/mso-requests-db/pom.xml4
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java11
-rw-r--r--mso-api-handlers/pom.xml4
47 files changed, 1826 insertions, 1388 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml
index eaab61c756..8eab5d6a47 100644
--- a/mso-api-handlers/mso-api-handler-common/pom.xml
+++ b/mso-api-handlers/mso-api-handler-common/pom.xml
@@ -3,13 +3,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-api-handler-common</artifactId>
<name>ECOMP MSO API Handler common</name>
@@ -73,13 +73,13 @@
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-catalog-db</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-requests-db</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
index fd1227ec13..3ef6d4974c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
@@ -38,7 +38,7 @@ import org.openecomp.mso.apihandler.common.CommonConstants;
CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE,
CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE,
CommonConstants.VF_MODULE_TYPE_VARIABLE, CommonConstants.NETWORK_TYPE_VARIABLE,
- CommonConstants.CAMUNDA_SERVICE_INPUT})
+ CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.RECIPE_PARAMS})
@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
public class CamundaVIDRequest {
@@ -91,6 +91,9 @@ public class CamundaVIDRequest {
@JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
private CamundaInput networkType;
+ @JsonProperty(CommonConstants.RECIPE_PARAMS)
+ private CamundaInput recipeParams;
+
@JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
public CamundaInput getServiceInput() {
return serviceInput;
@@ -250,8 +253,17 @@ public class CamundaVIDRequest {
this.networkType = networkType;
}
+ @JsonProperty(CommonConstants.RECIPE_PARAMS)
+ public CamundaInput getRecipeParams() {
+ return recipeParams;
+ }
- @Override
+ @JsonProperty(CommonConstants.RECIPE_PARAMS)
+ public void setRecipeParams(CamundaInput recipeParams) {
+ this.recipeParams = recipeParams;
+ }
+
+ @Override
public String toString() {
//return "CamundaRequest [requestId=" + + ", host="
// + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid="
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
index ddeb359071..cc68a45d19 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
@@ -89,7 +89,7 @@ public class BPELRestClient extends RequestClient {
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails) {
+ String requestDetails, String recipeParamXsd) {
return null;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
index b9c0725766..9258cabe5b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
@@ -60,7 +60,8 @@ public class CamundaClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -83,7 +84,8 @@ public class CamundaClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -98,13 +100,13 @@ public class CamundaClient extends RequestClient{
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails)
+ String requestDetails, String recipeParamXsd)
throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE + url);
String jsonReq = wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction,
serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
- serviceType, vnfType, vfModuleType, networkType, requestDetails);
+ serviceType, vnfType, vfModuleType, networkType, requestDetails, recipeParamXsd);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
@@ -115,7 +117,8 @@ public class CamundaClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -178,7 +181,7 @@ public class CamundaClient extends RequestClient{
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
+ String requestDetails, String recipeParams){
String jsonReq = null;
if(requestId == null){
requestId ="";
@@ -236,7 +239,7 @@ public class CamundaClient extends RequestClient{
CamundaInput vnfTypeInput = new CamundaInput();
CamundaInput vfModuleTypeInput = new CamundaInput();
CamundaInput networkTypeInput = new CamundaInput();
-
+ CamundaInput recipeParamsInput = new CamundaInput();
host.setValue(parseURL());
requestIdInput.setValue(requestId);
isBaseVfModuleInput.setValue(isBaseVfModule);
@@ -251,7 +254,7 @@ public class CamundaClient extends RequestClient{
vnfTypeInput.setValue(vnfType);
vfModuleTypeInput.setValue(vfModuleType);
networkTypeInput.setValue(networkType);
-
+ recipeParamsInput.setValue(recipeParams);
serviceInput.setValue(requestDetails);
camundaRequest.setServiceInput(serviceInput);
camundaRequest.setHost(host);
@@ -269,7 +272,7 @@ public class CamundaClient extends RequestClient{
camundaRequest.setVnfType(vnfTypeInput);
camundaRequest.setVfModuleType(vfModuleTypeInput);
camundaRequest.setNetworkType(networkTypeInput);
-
+ camundaRequest.setRecipeParams(recipeParamsInput);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
index 64193cf6c4..4b179daa7c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
@@ -52,7 +52,8 @@ public class CamundaTaskClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -74,7 +75,7 @@ public class CamundaTaskClient extends RequestClient{
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails)
+ String requestDetails, String recipeParamXsd)
throws ClientProtocolException, IOException{
msoLogger.debug("Method not supported");
return null;
@@ -90,7 +91,8 @@ public class CamundaTaskClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- get.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ get.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
index 91bd226c30..cfbe892e68 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
@@ -63,6 +63,7 @@ public final class CommonConstants {
public static final String VF_MODULE_TYPE_VARIABLE = "vfModuleType";
public static final String NETWORK_TYPE_VARIABLE = "networkType";
public static final String REQUEST_DETAILS_VARIABLE = "requestDetails";
+ public static final String RECIPE_PARAMS = "recipeParams";
private CommonConstants () {
// prevent creating an instance of this class
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
index addf4e11a5..eaf8be76a3 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
@@ -74,7 +74,7 @@ public abstract class RequestClient {
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails)
+ String requestDetails, String recipeParamXsd)
throws ClientProtocolException, IOException;
public abstract HttpResponse get()
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index f152116421..08ff9fedd0 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
@@ -220,22 +220,22 @@
<version>${spring-version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-catalog-db</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-requests-db</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-api-handler-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>status-control</artifactId>
<version>${project.version}</version>
</dependency>
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 f6b30e8772..c51c61e3dd 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
@@ -1,926 +1,1155 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * 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;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-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.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.hibernate.Session;
-import org.json.JSONObject;
-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.apihandlerinfra.Messages;
-import org.openecomp.mso.apihandlerinfra.MsoException;
-import org.openecomp.mso.apihandlerinfra.MsoRequest;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.DelE2ESvcResp;
-import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
-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.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoDatabaseException;
-import org.openecomp.mso.requestsdb.OperationStatus;
-import org.openecomp.mso.requestsdb.RequestsDatabase;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.utils.UUIDChecker;
-
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-
-@Path("/e2eServiceInstances")
-@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances")
-public class E2EServiceInstances {
-
- 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";
- private ServiceInstancesRequest sir = null;
-
- public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
- public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
- public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
-
- /**
- * POST Requests for E2E Service create Instance on a version provided
- */
-
- @POST
- @Path("/{version:[vV][3-5]}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create a E2E Service Instance on a version provided", response = Response.class)
- public Response createE2EServiceInstance(String request,
- @PathParam("version") String version) {
-
- return processE2EserviceInstances(request, Action.createInstance, null,
- version);
- }
-
- /**
- * DELETE Requests for E2E Service delete Instance on a specified version
- * and serviceId
- */
-
- @DELETE
- @Path("/{version:[vV][3-5]}/{serviceId}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
- public Response deleteE2EServiceInstance(String request,
- @PathParam("version") String version,
- @PathParam("serviceId") String serviceId) {
-
- instanceIdMap.put("serviceId", serviceId);
-
- return deleteE2EserviceInstances(request, Action.deleteInstance,
- instanceIdMap, version);
- }
-
- @GET
- @Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
- @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class)
- @Produces(MediaType.APPLICATION_JSON)
- public Response getE2EServiceInstances(
- @PathParam("serviceId") String serviceId,
- @PathParam("version") String version,
- @PathParam("operationId") String operationId) {
- return getE2EServiceInstances(serviceId, operationId);
- }
-
- private Response getE2EServiceInstances(String serviceId, String operationId) {
- RequestsDatabase requestsDB = RequestsDatabase.getInstance();
-
- GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
-
- MsoRequest msoRequest = new MsoRequest(serviceId);
-
- long startTime = System.currentTimeMillis();
-
- OperationStatus operationStatus = null;
-
- try {
- operationStatus = requestsDB.getOperationStatus(serviceId,
- operationId);
-
- } 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 (operationStatus == null) {
- Response resp = msoRequest.buildServiceErrorResponse(
- HttpStatus.SC_NO_CONTENT, MsoException.ServiceException,
- "E2E serviceId " + serviceId + " 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 serviceId");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DataNotFound,
- "Null response from RequestDB when searching by serviceId");
- msoLogger.debug("End of the transaction, the final response is: "
- + (String) resp.getEntity());
- return resp;
-
- }
-
- e2eServiceResponse.setOperationStatus(operationStatus);
-
- return Response.status(200).entity(e2eServiceResponse).build();
- }
-
- private Response deleteE2EserviceInstances(String requestJSON,
- Action action, HashMap<String, String> instanceIdMap, String version) {
- // TODO should be a new one or the same service instance Id
- String requestId = instanceIdMap.get("serviceId");
- long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
- E2EServiceInstanceDeleteRequest e2eDelReq = null;
-
- MsoRequest msoRequest = new MsoRequest(requestId);
-
- ObjectMapper mapper = new ObjectMapper();
- try {
- e2eDelReq = mapper.readValue(requestJSON,
- E2EServiceInstanceDeleteRequest.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);
- 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());
- createOperationStatusRecordForError(action, requestId);
- return response;
- }
-
- CatalogDatabase db = null;
- RecipeLookupResult recipeLookupResult = null;
- try {
- db = CatalogDatabase.getInstance();
- recipeLookupResult = getServiceInstanceOrchestrationURI(db, action);
- } catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC,
- 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,
- "No communication to catalog DB " + e.getMessage(),
- ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- alarmLogger.sendAlarm("MsoDatabaseAccessError",
- MsoAlarmLogger.CRITICAL, Messages.errors
- .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
- msoRequest.createRequestRecord(Status.FAILED, action);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with DB");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + (String) response.getEntity());
- return response;
- } finally {
- closeCatalogDB(db);
- }
- if (recipeLookupResult == null) {
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
- 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,
- "Recipe does not exist in catalog DB",
- ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
- msoRequest.createRequestRecord(Status.FAILED, action);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DataNotFound,
- "No recipe found in DB");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + (String) response.getEntity());
- createOperationStatusRecordForError(action, requestId);
- return response;
- }
-
- RequestClient requestClient = null;
- HttpResponse response = null;
-
- long subStartTime = System.currentTimeMillis();
- // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
-
- try {
- requestClient = RequestClientFactory.getRequestClient(
- recipeLookupResult.getOrchestrationURI(),
- MsoPropertiesUtils.loadMsoProperties());
-
- JSONObject jjo = new JSONObject(requestJSON);
- jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
-
- String bpmnRequest = jjo.toString();
-
- // Capture audit event
- msoLogger
- .debug("MSO API Handler Posting call to BPEL engine for url: "
- + requestClient.getUrl());
- String serviceId = instanceIdMap.get("serviceId");
- String serviceInstanceType = e2eDelReq.getServiceType();
- response = requestClient.post(requestId, false,
- recipeLookupResult.getRecipeTimeout(), action.name(),
- serviceId, null, null, null, null, serviceInstanceType,
- null, null, null, bpmnRequest);
-
- msoLogger.recordMetricEvent(subStartTime,
- MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
- } catch (Exception e) {
- msoLogger.recordMetricEvent(subStartTime,
- MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
- Response resp = msoRequest.buildServiceErrorResponse(
- HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
- "Failed calling bpmn " + e.getMessage(),
- ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- alarmLogger.sendAlarm("MsoConfigurationError",
- 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.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());
- createOperationStatusRecordForError(action, requestId);
- return resp;
- }
-
- if (response == null) {
- Response resp = msoRequest.buildServiceErrorResponse(
- HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
- "bpelResponse is null",
- ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- 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 + (String) resp.getEntity());
- createOperationStatusRecordForError(action, requestId);
- return resp;
- }
-
- ResponseHandler respHandler = new ResponseHandler(response,
- requestClient.getType());
- int bpelStatus = respHandler.getStatus();
-
- return beplStatusUpdate(requestId, startTime, msoRequest,
- requestClient, respHandler, bpelStatus, action, instanceIdMap);
- }
-
- private Response processE2EserviceInstances(String requestJSON, Action action,
- HashMap<String, String> instanceIdMap, String version) {
-
- String requestId = UUIDChecker.generateUUID(msoLogger);
- long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
- E2EServiceInstanceRequest e2eSir = null;
-
- MsoRequest msoRequest = new MsoRequest(requestId);
- ObjectMapper mapper = new ObjectMapper();
- try {
- e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
-
- } catch (Exception e) {
- //TODO update the service name
- this.createOperationStatusRecordForError(action, requestId);
-
- 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);
- 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;
- }
-
- mapReqJsonToSvcInstReq(e2eSir, requestJSON);
- sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
- try {
- msoRequest.parse(sir, instanceIdMap, action, version);
- } 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");
- //TODO update the service name
- this.createOperationStatusRecordForError(action, requestId);
- }
- 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;
- }
-
- OperationStatus dup = null;
- String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
- String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
- try {
- if (!(instanceName == null && "service".equals(requestScope)
- && (action == Action.createInstance || action == Action.activateInstance))) {
- //TODO : Need to check for the duplicate record from the operation status,
- //TODO : commenting this check for unblocking current testing for now... induces dead code...
- dup = chkDuplicateServiceNameInOperStatus( instanceName);
- }
- } catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.DataError, "Error during duplicate check ", 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 = 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.getProgress() + " (ServiceId - "
- + dup.getServiceId() + "). The existing request must finish or be cleaned up before proceeding.";
-
- 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");
-
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
- dupMessage);
- msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
- createOperationStatusRecordForError(action, requestId);
- return response;
- }
-
- CatalogDatabase db = null;
- RecipeLookupResult recipeLookupResult = null;
- try {
- db = CatalogDatabase.getInstance();
- recipeLookupResult = getServiceInstanceOrchestrationURI(db, action);
- } catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, 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, "No communication to catalog DB " + e.getMessage(),
- ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
- Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
- createOperationStatusRecordForError(action, requestId);
- return response;
- } finally {
- closeCatalogDB(db);
- }
-
- if (recipeLookupResult == null) {
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, 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, "Recipe does not exist in catalog DB",
- ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- "No recipe found in DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
- createOperationStatusRecordForError(action, requestId);
- return response;
- }
-// try {
-// msoRequest.createRequestRecord(Status.PENDING, action);
-// //createOperationStatusRecord(action, requestId);
-// } 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");
-// msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
-// return response;
-// }
-
- String serviceInstanceType = e2eSir.getService().getParameters().getServiceType();
-
- String serviceId = "";
- RequestClient requestClient = null;
- HttpResponse response = null;
-
- long subStartTime = System.currentTimeMillis();
- String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
-
- try {
- requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
- MsoPropertiesUtils.loadMsoProperties());
-
- // Capture audit event
- 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);
-
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
- null);
- } catch (Exception e) {
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
- MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
- ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- alarmLogger.sendAlarm("MsoConfigurationError", 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.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());
- createOperationStatusRecordForError(action, requestId);
- return resp;
- }
-
- if (response == null) {
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
- MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, 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 + (String) resp.getEntity());
- return resp;
- }
-
- ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
- int bpelStatus = respHandler.getStatus();
-
- return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
- }
-
- private void closeCatalogDB(CatalogDatabase db) {
- if (db != null) {
- db.close();
- }
- }
-
- private Response beplStatusUpdate(String requestId, long startTime,
- MsoRequest msoRequest, RequestClient requestClient,
- ResponseHandler respHandler, int bpelStatus, Action action,
- HashMap<String, String> instanceIdMap) {
- // BPMN accepted the request, the request is in progress
- if (bpelStatus == HttpStatus.SC_ACCEPTED) {
- String camundaJSONResponseBody = respHandler.getResponseBody();
- msoLogger
- .debug("Received from Camunda: " + camundaJSONResponseBody);
-
- // currently only for delete case we update the status here
- if (action == Action.deleteInstance) {
- ObjectMapper mapper = new ObjectMapper();
- try {
- DelE2ESvcResp jo = mapper.readValue(
- camundaJSONResponseBody, DelE2ESvcResp.class);
- String operationId = jo.getOperationId();
- this.createOperationStatusRecord("DELETE", requestId,
- operationId);
- } catch (Exception ex) {
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
- requestClient.getUrl(), "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Response from BPEL engine is failed with HTTP Status="
- + bpelStatus);
- }
- }
- msoLogger.recordAuditEvent(startTime,
- MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "BPMN accepted the request, the request is in progress");
- msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
- return Response.status(HttpStatus.SC_ACCEPTED)
- .entity(camundaJSONResponseBody).build();
- } else {
- List<String> variables = new ArrayList<>();
- variables.add(bpelStatus + "");
- String camundaJSONResponseBody = respHandler.getResponseBody();
- if (camundaJSONResponseBody != null
- && !camundaJSONResponseBody.isEmpty()) {
- Response resp = msoRequest.buildServiceErrorResponse(
- bpelStatus, MsoException.ServiceException,
- "Request Failed due to BPEL error with HTTP Status= %1 "
- + '\n' + camundaJSONResponseBody,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
- requestClient.getUrl(), "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Response from BPEL engine is failed with HTTP Status="
- + bpelStatus);
- msoLogger.recordAuditEvent(startTime,
- MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.InternalError,
- "Response from BPMN engine is failed");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + (String) resp.getEntity());
- return resp;
- } else {
- Response resp = msoRequest
- .buildServiceErrorResponse(
- bpelStatus,
- MsoException.ServiceException,
- "Request Failed due to BPEL error with HTTP Status= %1",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
- variables);
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
- requestClient.getUrl(), "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Response from BPEL engine is empty");
- msoLogger.recordAuditEvent(startTime,
- MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.InternalError,
- "Response from BPEL engine is empty");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + (String) resp.getEntity());
- return resp;
- }
- }
- }
-
- /**
- * Getting recipes from catalogDb
- *
- * @param db
- * @param action
- * @return
- */
- private RecipeLookupResult getServiceInstanceOrchestrationURI(
- CatalogDatabase db, Action action) {
-
- RecipeLookupResult recipeLookupResult = getServiceURI(db, action);
-
- if (recipeLookupResult != null) {
- msoLogger.debug("Orchestration URI is: "
- + recipeLookupResult.getOrchestrationURI()
- + ", recipe Timeout is: "
- + Integer.toString(recipeLookupResult.getRecipeTimeout()));
- } else {
- msoLogger.debug("No matching recipe record found");
- }
- return recipeLookupResult;
- }
-
- /**
- * Getting recipes from catalogDb
- *
- * @param db
- * @param action
- * @return
- */
- private RecipeLookupResult getServiceURI(CatalogDatabase db, Action action) {
-
- String defaultServiceModelName = "UUI_DEFAULT";
-
- Service serviceRecord = db
- .getServiceByModelName(defaultServiceModelName);
- ServiceRecipe recipe = db.getServiceRecipeByModelUUID(
- serviceRecord.getModelUUID(), action.name());
-
- if (recipe == null) {
- return null;
- }
- return new RecipeLookupResult(recipe.getOrchestrationUri(),
- recipe.getRecipeTimeout());
-
- }
-
- /**
- * Converting E2EServiceInstanceRequest to ServiceInstanceRequest and
- * passing it to camunda engine.
- *
- * @param e2eSir
- * @return
- */
- private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir,
- String requestJSON) {
-
- sir = new ServiceInstancesRequest();
-
- String returnString = null;
- RequestDetails requestDetails = new RequestDetails();
- ModelInfo modelInfo = new ModelInfo();
-
- // ModelInvariantId
- modelInfo.setModelInvariantId(e2eSir.getService().getServiceDefId());
-
- // modelNameVersionId
- modelInfo.setModelNameVersionId(e2eSir.getService().getTemplateId());
-
- // String modelInfoValue =
- // e2eSir.getService().getParameters().getNodeTemplateName();
- // String[] arrayOfInfo = modelInfoValue.split(":");
- // String modelName = arrayOfInfo[0];
- // String modelVersion = arrayOfInfo[1];
-
- // TODO: To ensure, if we dont get the values from the UUI
- String modelName = "voLTE";
- String modelVersion = "1.0";
- // modelName
- modelInfo.setModelName(modelName);
-
- // modelVersion
- modelInfo.setModelVersion(modelVersion);
-
- // modelType
- modelInfo.setModelType(ModelType.service);
-
- // setting modelInfo to requestDetails
- requestDetails.setModelInfo(modelInfo);
-
- SubscriberInfo subscriberInfo = new SubscriberInfo();
-
- // globalsubscriberId
- subscriberInfo.setGlobalSubscriberId(e2eSir.getService()
- .getParameters().getGlobalSubscriberId());
-
- // subscriberName
- subscriberInfo.setSubscriberName(e2eSir.getService().getParameters()
- .getSubscriberName());
-
- // setting subscriberInfo to requestDetails
- requestDetails.setSubscriberInfo(subscriberInfo);
-
- RequestInfo requestInfo = new RequestInfo();
-
- // instanceName
- requestInfo.setInstanceName(e2eSir.getService().getName());
-
- // source
- requestInfo.setSource("UUI");
-
- // suppressRollback
- requestInfo.setSuppressRollback(true);
-
- // setting requestInfo to requestDetails
- requestDetails.setRequestInfo(requestInfo);
-
- RequestParameters requestParameters = new RequestParameters();
-
- // subscriptionServiceType
- requestParameters.setSubscriptionServiceType("MOG");
-
- // Userparams
- List<E2EUserParam> userParams;
- // userParams =
- // e2eSir.getService().getParameters().getRequestParameters().getUserParams();
- List<Map<String, String>> userParamList = new ArrayList<>();
- Map<String, String> userParamMap = new HashMap<>();
- // complete json request updated in the camunda
- userParamMap.put("UUIRequest", requestJSON);
- userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
-
- // Map<String, String> userParamMap3 = null;
- // for (E2EUserParam userp : userParams) {
- // userParamMap.put(userp.getName(), userp.getValue());
- //
- // }
- userParamList.add(userParamMap);
- requestParameters.setUserParams(userParamList);
-
- // setting requestParameters to requestDetails
- requestDetails.setRequestParameters(requestParameters);
-
- sir.setRequestDetails(requestDetails);
-
- // converting to string
- ObjectMapper mapper = new ObjectMapper();
- try {
- returnString = mapper.writeValueAsString(sir);
- } catch (IOException e) {
- msoLogger
- .debug("Exception while converting ServiceInstancesRequest object to string",
- e);
- }
-
- return returnString;
- }
-
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
- Session session = null;
- try {
-
- session = requestsDbSessionFactoryManager.getSessionFactory()
- .openSession();
- session.beginTransaction();
-
- OperationStatus os = new OperationStatus();
- os.setOperation(action.name());
- os.setOperationContent("");
- os.setOperationId("");
- os.setProgress("100");
- os.setReason("");
- os.setResult("error");
- os.setServiceId(requestId);
- os.setUserId("");
- Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
- Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
- os.setFinishedAt(endTimeStamp);
- os.setOperateAt(startTimeStamp);
-
- session.save(os);
- session.getTransaction().commit();
-
- } catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
- MsoLogger.ErrorCode.DataError,
- "Exception when creation record request in Operation", e);
- throw new MsoDatabaseException(
- "Data did inserted in Operatus Status Table for failure", e);
- } finally {
- if (null != session) {
- session.close();
- }
- }
- }
-
- private void createOperationStatusRecord(String actionNm, String serviceId,
- String operationId) throws MsoDatabaseException {
-
- AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
- Session session = null;
- try {
-
- session = requestsDbSessionFactoryManager.getSessionFactory()
- .openSession();
- session.beginTransaction();
-
- OperationStatus os = new OperationStatus();
- os.setOperation(actionNm);
- os.setOperationContent("");
- os.setOperationId(operationId);
- os.setProgress("0");
- os.setReason("");
- os.setResult("processing");
- os.setServiceId(serviceId);
- // TODO : to be updated...
- os.setUserId("");
- Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
- Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
- os.setFinishedAt(endTimeStamp);
- os.setOperateAt(startTimeStamp);
-
- session.save(os);
- session.getTransaction().commit();
-
- } catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
- MsoLogger.ErrorCode.DataError,
- "Exception when creation record request in Operation", e);
- throw new MsoDatabaseException(
- "Data did inserted in Operatus Status Table", e);
- } finally {
- if (null != session) {
- session.close();
- }
- }
- }
-
- private OperationStatus chkDuplicateServiceInOperStatus(String serviceId) {
- OperationStatus dupServiceName = (RequestsDatabase.getInstance())
- .getOperationStatusByServiceId(serviceId);
-
- return dupServiceName;
- }
-
- private OperationStatus chkDuplicateServiceNameInOperStatus(
- String serviceName) {
- OperationStatus dupServiceName = (RequestsDatabase.getInstance())
- .getOperationStatusByServiceName(serviceName);
-
- return dupServiceName;
- }
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * 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;
+
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+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.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.hibernate.Session;
+import org.json.JSONObject;
+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.apihandlerinfra.Messages;
+import org.openecomp.mso.apihandlerinfra.MsoException;
+import org.openecomp.mso.apihandlerinfra.MsoRequest;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.DelE2ESvcResp;
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
+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.db.AbstractSessionFactoryManager;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoDatabaseException;
+import org.openecomp.mso.requestsdb.OperationStatus;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
+import org.openecomp.mso.utils.UUIDChecker;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+@Path("/e2eServiceInstances")
+@Api(value = "/e2eServiceInstances", description = "API Requests for E2E Service Instances")
+public class E2EServiceInstances {
+
+ 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";
+ private ServiceInstancesRequest sir = null;
+
+ public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+ public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
+ public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
+
+ /**
+ * POST Requests for E2E Service create Instance on a version provided
+ */
+
+ @POST
+ @Path("/{version:[vV][3-5]}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Create an E2E Service Instance on a version provided", response = Response.class)
+ public Response createE2EServiceInstance(String request,
+ @PathParam("version") String version) {
+
+ return processE2EserviceInstances(request, Action.createInstance, null,
+ version);
+ }
+
+ /**
+ * PUT Requests for E2E Service update Instance on a version provided
+ */
+
+ @PUT
+ @Path("/{version:[vV][3-5]}/{serviceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Update an E2E Service Instance on a version provided and serviceId", response = Response.class)
+ public Response updateE2EServiceInstance(String request,
+ @PathParam("version") String version,
+ @PathParam("serviceId") String serviceId) {
+
+ instanceIdMap.put("serviceId", serviceId);
+
+ return updateE2EserviceInstances(request, Action.updateInstance, instanceIdMap,
+ version);
+ }
+
+ /**
+ * DELETE Requests for E2E Service delete Instance on a specified version
+ * and serviceId
+ */
+
+ @DELETE
+ @Path("/{version:[vV][3-5]}/{serviceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
+ public Response deleteE2EServiceInstance(String request,
+ @PathParam("version") String version,
+ @PathParam("serviceId") String serviceId) {
+
+ instanceIdMap.put("serviceId", serviceId);
+
+ return deleteE2EserviceInstances(request, Action.deleteInstance,
+ instanceIdMap, version);
+ }
+
+ @GET
+ @Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
+ @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getE2EServiceInstances(
+ @PathParam("serviceId") String serviceId,
+ @PathParam("version") String version,
+ @PathParam("operationId") String operationId) {
+ return getE2EServiceInstances(serviceId, operationId);
+ }
+
+ private Response getE2EServiceInstances(String serviceId, String operationId) {
+ RequestsDatabase requestsDB = RequestsDatabase.getInstance();
+
+ GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
+
+ MsoRequest msoRequest = new MsoRequest(serviceId);
+
+ long startTime = System.currentTimeMillis();
+
+ OperationStatus operationStatus = null;
+
+ try {
+ operationStatus = requestsDB.getOperationStatus(serviceId,
+ operationId);
+
+ } 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 (operationStatus == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NO_CONTENT, MsoException.ServiceException,
+ "E2E serviceId " + serviceId + " 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 serviceId");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.DataNotFound,
+ "Null response from RequestDB when searching by serviceId");
+ msoLogger.debug("End of the transaction, the final response is: "
+ + (String) resp.getEntity());
+ return resp;
+
+ }
+
+ e2eServiceResponse.setOperationStatus(operationStatus);
+
+ return Response.status(200).entity(e2eServiceResponse).build();
+ }
+
+ private Response deleteE2EserviceInstances(String requestJSON,
+ Action action, HashMap<String, String> instanceIdMap, String version) {
+ // TODO should be a new one or the same service instance Id
+ String requestId = instanceIdMap.get("serviceId");
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceDeleteRequest e2eDelReq = null;
+
+ MsoRequest msoRequest = new MsoRequest(requestId);
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ e2eDelReq = mapper.readValue(requestJSON,
+ E2EServiceInstanceDeleteRequest.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);
+ 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());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ }
+
+ CatalogDatabase db = null;
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ db = CatalogDatabase.getInstance();
+ //TODO Get the service template model version uuid from AAI.
+ recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action);
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC,
+ 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,
+ "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL, Messages.errors
+ .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ msoRequest.createRequestRecord(Status.FAILED, action);
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.DBAccessError,
+ "Exception while communciate with DB");
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) response.getEntity());
+ return response;
+ } finally {
+ closeCatalogDB(db);
+ }
+ if (recipeLookupResult == null) {
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
+ 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,
+ "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+ msoRequest.createRequestRecord(Status.FAILED, action);
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.DataNotFound,
+ "No recipe found in DB");
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) response.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ }
+
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+ // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
+ try {
+ requestClient = RequestClientFactory.getRequestClient(
+ recipeLookupResult.getOrchestrationURI(),
+ MsoPropertiesUtils.loadMsoProperties());
+
+ JSONObject jjo = new JSONObject(requestJSON);
+ jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+
+ String bpmnRequest = jjo.toString();
+
+ // Capture audit event
+ msoLogger
+ .debug("MSO API Handler Posting call to BPEL engine for url: "
+ + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceInstanceType = e2eDelReq.getServiceType();
+ response = requestClient.post(requestId, false,
+ recipeLookupResult.getRecipeTimeout(), action.name(),
+ serviceId, null, null, null, null, serviceInstanceType,
+ null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());
+
+ msoLogger.recordMetricEvent(subStartTime,
+ MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully received response from BPMN engine", "BPMN",
+ recipeLookupResult.getOrchestrationURI(), null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent(subStartTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError,
+ "Exception while communicate with BPMN engine", "BPMN",
+ recipeLookupResult.getOrchestrationURI(), null);
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoConfigurationError",
+ 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.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());
+ createOperationStatusRecordForError(action, requestId);
+ return resp;
+ }
+
+ if (response == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "bpelResponse is null",
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+ 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 + (String) resp.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler(response,
+ requestClient.getType());
+ int bpelStatus = respHandler.getStatus();
+
+ return beplStatusUpdate(requestId, startTime, msoRequest,
+ requestClient, respHandler, bpelStatus, action, instanceIdMap);
+ }
+
+ private Response updateE2EserviceInstances(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) {
+
+ String requestId = instanceIdMap.get("serviceId");
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceRequest e2eSir = null;
+
+ MsoRequest msoRequest = new MsoRequest(requestId);
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
+
+ } catch (Exception e) {
+
+ this.createOperationStatusRecordForError(action, requestId);
+
+ 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);
+ 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;
+ }
+
+ mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+ sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
+ try {
+ msoRequest.parse(sir, instanceIdMap, action, version);
+ } 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");
+ this.createOperationStatusRecordForError(action, requestId);
+ }
+ 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;
+ }
+
+ //check for the current operation status
+ Response resp = checkE2ESvcInstStatus(action, requestId, startTime, msoRequest);
+ if(resp != null && resp.getStatus() != 200) {
+ return resp;
+ }
+
+ CatalogDatabase db = null;
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ db = CatalogDatabase.getInstance();
+ recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getTemplateId(), action);
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, 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, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+ "Exception while communciate with DB");
+ msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ } finally {
+ closeCatalogDB(db);
+ }
+
+ if (recipeLookupResult == null) {
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, 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, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+ "No recipe found in DB");
+ msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ }
+
+ String serviceInstanceType = e2eSir.getService().getParameters().getServiceType();
+
+ String serviceId = "";
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+ String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
+ try {
+ requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
+ MsoPropertiesUtils.loadMsoProperties());
+
+ // Capture audit event
+ 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());
+
+ msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
+ null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
+ recipeLookupResult.getOrchestrationURI(), null);
+ Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoConfigurationError", 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.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) getBPMNResp.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return getBPMNResp;
+ }
+
+ if (response == null) {
+ Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, 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 + (String) getBPMNResp.getEntity());
+ return getBPMNResp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+ int bpelStatus = respHandler.getStatus();
+
+ return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
+ }
+
+ private Response checkE2ESvcInstStatus(Action action, String requestId, long startTime, MsoRequest msoRequest) {
+ OperationStatus curStatus = null;
+// String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+ String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+ try {
+ if (!(requestId == null && "service".equals(requestScope) && (action == Action.updateInstance))) {
+ curStatus = chkSvcInstOperStatusbySvcId(requestId);
+ }
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, "Error during current operation status check ", 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 current operation status check");
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ return response;
+ }
+
+ if (curStatus != null && !curStatus.getProgress().equals("100")) {
+ String chkMessage = "Error: Locked instance - This " + requestScope + " (" + requestId + ") "
+ + "now being worked with a status of " + curStatus.getProgress() + " (ServiceName - "
+ + curStatus.getServiceName()
+ + "). The existing request must finish or be cleaned up before proceeding.";
+
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
+ MsoException.ServiceException, chkMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
+ chkMessage);
+
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+
+ createOperationStatusRecordForError(action, requestId);
+
+ return response;
+ }
+
+ return Response.status(200).entity(null).build();
+ }
+
+ private Response processE2EserviceInstances(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) {
+
+ String requestId = UUIDChecker.generateUUID(msoLogger);
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("requestId is: " + requestId);
+ E2EServiceInstanceRequest e2eSir = null;
+
+ MsoRequest msoRequest = new MsoRequest(requestId);
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ e2eSir = mapper.readValue(requestJSON, E2EServiceInstanceRequest.class);
+
+ } catch (Exception e) {
+ //TODO update the service name
+ this.createOperationStatusRecordForError(action, requestId);
+
+ 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);
+ 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;
+ }
+
+ mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+ sir.getRequestDetails().getRequestParameters().setaLaCarte(true);
+ try {
+ msoRequest.parse(sir, instanceIdMap, action, version);
+ } 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");
+ //TODO update the service name
+ this.createOperationStatusRecordForError(action, requestId);
+ }
+ 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;
+ }
+
+ OperationStatus dup = null;
+ String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+ String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
+ try {
+ if (!(instanceName == null && "service".equals(requestScope)
+ && (action == Action.createInstance || action == Action.activateInstance))) {
+ //TODO : Need to check for the duplicate record from the operation status,
+ //TODO : commenting this check for unblocking current testing for now... induces dead code...
+ dup = chkDuplicateServiceNameInOperStatus( instanceName);
+ }
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.DataError, "Error during duplicate check ", 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 = 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.getProgress() + " (ServiceId - "
+ + dup.getServiceId() + "). The existing request must finish or be cleaned up before proceeding.";
+
+ 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");
+
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
+ dupMessage);
+ msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ }
+
+ CatalogDatabase db = null;
+ RecipeLookupResult recipeLookupResult = null;
+ try {
+ db = CatalogDatabase.getInstance();
+ recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getTemplateId(), action);
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, 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, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+ "Exception while communciate with DB");
+ msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ } finally {
+ closeCatalogDB(db);
+ }
+
+ if (recipeLookupResult == null) {
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, 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, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+ "No recipe found in DB");
+ msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+ createOperationStatusRecordForError(action, requestId);
+ return response;
+ }
+// try {
+// msoRequest.createRequestRecord(Status.PENDING, action);
+// //createOperationStatusRecord(action, requestId);
+// } 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");
+// msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
+// return response;
+// }
+
+ String serviceInstanceType = e2eSir.getService().getParameters().getServiceType();
+
+ String serviceId = "";
+ RequestClient requestClient = null;
+ HttpResponse response = null;
+
+ long subStartTime = System.currentTimeMillis();
+ String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+
+ try {
+ requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
+ MsoPropertiesUtils.loadMsoProperties());
+
+ // Capture audit event
+ 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());
+
+ msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
+ null);
+ } catch (Exception e) {
+ msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
+ recipeLookupResult.getOrchestrationURI(), null);
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ alarmLogger.sendAlarm("MsoConfigurationError", 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.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());
+ createOperationStatusRecordForError(action, requestId);
+ return resp;
+ }
+
+ if (response == null) {
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, 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 + (String) resp.getEntity());
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+ int bpelStatus = respHandler.getStatus();
+
+ return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
+ }
+
+ private void closeCatalogDB(CatalogDatabase db) {
+ if (db != null) {
+ db.close();
+ }
+ }
+
+ private Response beplStatusUpdate(String requestId, long startTime,
+ MsoRequest msoRequest, RequestClient requestClient,
+ ResponseHandler respHandler, int bpelStatus, Action action,
+ HashMap<String, String> instanceIdMap) {
+ // BPMN accepted the request, the request is in progress
+ if (bpelStatus == HttpStatus.SC_ACCEPTED) {
+ String camundaJSONResponseBody = respHandler.getResponseBody();
+ msoLogger
+ .debug("Received from Camunda: " + camundaJSONResponseBody);
+
+ // currently only for delete case we update the status here
+ if (action == Action.deleteInstance) {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ DelE2ESvcResp jo = mapper.readValue(
+ camundaJSONResponseBody, DelE2ESvcResp.class);
+ String operationId = jo.getOperationId();
+ this.createOperationStatusRecord("DELETE", requestId,
+ operationId);
+ } catch (Exception ex) {
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Response from BPEL engine is failed with HTTP Status="
+ + bpelStatus);
+ }
+ }
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "BPMN accepted the request, the request is in progress");
+ msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
+ return Response.status(HttpStatus.SC_ACCEPTED)
+ .entity(camundaJSONResponseBody).build();
+ } else {
+ List<String> variables = new ArrayList<>();
+ variables.add(bpelStatus + "");
+ String camundaJSONResponseBody = respHandler.getResponseBody();
+ if (camundaJSONResponseBody != null
+ && !camundaJSONResponseBody.isEmpty()) {
+ Response resp = msoRequest.buildServiceErrorResponse(
+ bpelStatus, MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1 "
+ + '\n' + camundaJSONResponseBody,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Response from BPEL engine is failed with HTTP Status="
+ + bpelStatus);
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
+ "Response from BPMN engine is failed");
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) resp.getEntity());
+ return resp;
+ } else {
+ Response resp = msoRequest
+ .buildServiceErrorResponse(
+ bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ variables);
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Response from BPEL engine is empty");
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
+ "Response from BPEL engine is empty");
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) resp.getEntity());
+ return resp;
+ }
+ }
+ }
+
+ /**
+ * Getting recipes from catalogDb
+ *
+ * @param db the catalog db
+ * @param serviceModelUUID the service model version uuid
+ * @param action the action for the service
+ * @return the service recipe result
+ */
+ private RecipeLookupResult getServiceInstanceOrchestrationURI(
+ CatalogDatabase db, String serviceModelUUID, Action action) {
+
+ RecipeLookupResult recipeLookupResult = getServiceURI(db, serviceModelUUID, action);
+
+ if (recipeLookupResult != null) {
+ msoLogger.debug("Orchestration URI is: "
+ + recipeLookupResult.getOrchestrationURI()
+ + ", recipe Timeout is: "
+ + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+ } else {
+ msoLogger.debug("No matching recipe record found");
+ }
+ return recipeLookupResult;
+ }
+
+ /**
+ * Getting recipes from catalogDb
+ * If Service recipe is not set, use default recipe, if set , use special recipe.
+ * @param db the catalog db
+ * @param serviceModelUUID the service version uuid
+ * @param action the action of the service.
+ * @return the service recipe result.
+ */
+ private RecipeLookupResult getServiceURI(CatalogDatabase db, String serviceModelUUID, Action action) {
+
+ String defaultServiceModelName = "UUI_DEFAULT";
+
+ Service defaultServiceRecord = db
+ .getServiceByModelName(defaultServiceModelName);
+ ServiceRecipe defaultRecipe = db.getServiceRecipeByModelUUID(
+ defaultServiceRecord.getModelUUID(), action.name());
+ //set recipe as default generic recipe
+ ServiceRecipe recipe = defaultRecipe;
+ //check the service special recipe
+ if(null != serviceModelUUID && ! serviceModelUUID.isEmpty()){
+ ServiceRecipe serviceSpecialRecipe = db.getServiceRecipeByModelUUID(
+ serviceModelUUID, action.name());
+ if(null != serviceSpecialRecipe){
+ //set service special recipe.
+ recipe = serviceSpecialRecipe;
+ }
+ }
+
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(recipe.getOrchestrationUri(),
+ recipe.getRecipeTimeout(), recipe.getServiceParamXSD());
+
+ }
+
+ /**
+ * Converting E2EServiceInstanceRequest to ServiceInstanceRequest and
+ * passing it to camunda engine.
+ *
+ * @param e2eSir
+ * @return
+ */
+ private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir,
+ String requestJSON) {
+
+ sir = new ServiceInstancesRequest();
+
+ String returnString = null;
+ RequestDetails requestDetails = new RequestDetails();
+ ModelInfo modelInfo = new ModelInfo();
+
+ // ModelInvariantId
+ modelInfo.setModelInvariantId(e2eSir.getService().getServiceDefId());
+
+ // modelNameVersionId
+ modelInfo.setModelNameVersionId(e2eSir.getService().getTemplateId());
+
+ // String modelInfoValue =
+ // e2eSir.getService().getParameters().getNodeTemplateName();
+ // String[] arrayOfInfo = modelInfoValue.split(":");
+ // String modelName = arrayOfInfo[0];
+ // String modelVersion = arrayOfInfo[1];
+
+ // TODO: To ensure, if we dont get the values from the UUI
+ String modelName = "voLTE";
+ String modelVersion = "1.0";
+ // modelName
+ modelInfo.setModelName(modelName);
+
+ // modelVersion
+ modelInfo.setModelVersion(modelVersion);
+
+ // modelType
+ modelInfo.setModelType(ModelType.service);
+
+ // setting modelInfo to requestDetails
+ requestDetails.setModelInfo(modelInfo);
+
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+
+ // globalsubscriberId
+ subscriberInfo.setGlobalSubscriberId(e2eSir.getService()
+ .getParameters().getGlobalSubscriberId());
+
+ // subscriberName
+ subscriberInfo.setSubscriberName(e2eSir.getService().getParameters()
+ .getSubscriberName());
+
+ // setting subscriberInfo to requestDetails
+ requestDetails.setSubscriberInfo(subscriberInfo);
+
+ RequestInfo requestInfo = new RequestInfo();
+
+ // instanceName
+ requestInfo.setInstanceName(e2eSir.getService().getName());
+
+ // source
+ requestInfo.setSource("UUI");
+
+ // suppressRollback
+ requestInfo.setSuppressRollback(true);
+
+ // setting requestInfo to requestDetails
+ requestDetails.setRequestInfo(requestInfo);
+
+ RequestParameters requestParameters = new RequestParameters();
+
+ // subscriptionServiceType
+ requestParameters.setSubscriptionServiceType("MOG");
+
+ // Userparams
+ List<E2EUserParam> userParams;
+ // userParams =
+ // e2eSir.getService().getParameters().getRequestParameters().getUserParams();
+ List<Map<String, String>> userParamList = new ArrayList<>();
+ Map<String, String> userParamMap = new HashMap<>();
+ // complete json request updated in the camunda
+ userParamMap.put("UUIRequest", requestJSON);
+ userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
+
+ // Map<String, String> userParamMap3 = null;
+ // for (E2EUserParam userp : userParams) {
+ // userParamMap.put(userp.getName(), userp.getValue());
+ //
+ // }
+ userParamList.add(userParamMap);
+ requestParameters.setUserParams(userParamList);
+
+ // setting requestParameters to requestDetails
+ requestDetails.setRequestParameters(requestParameters);
+
+ sir.setRequestDetails(requestDetails);
+
+ // converting to string
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ returnString = mapper.writeValueAsString(sir);
+ } catch (IOException e) {
+ msoLogger
+ .debug("Exception while converting ServiceInstancesRequest object to string",
+ e);
+ }
+
+ return returnString;
+ }
+
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+
+ Session session = null;
+ try {
+
+ session = requestsDbSessionFactoryManager.getSessionFactory()
+ .openSession();
+ session.beginTransaction();
+
+ OperationStatus os = new OperationStatus();
+ os.setOperation(action.name());
+ os.setOperationContent("");
+ os.setOperationId("");
+ os.setProgress("100");
+ os.setReason("");
+ os.setResult("error");
+ os.setServiceId(requestId);
+ os.setUserId("");
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ os.setFinishedAt(endTimeStamp);
+ os.setOperateAt(startTimeStamp);
+
+ session.save(os);
+ session.getTransaction().commit();
+
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
+ MsoLogger.ErrorCode.DataError,
+ "Exception when creation record request in Operation", e);
+ throw new MsoDatabaseException(
+ "Data did inserted in Operatus Status Table for failure", e);
+ } finally {
+ if (null != session) {
+ session.close();
+ }
+ }
+ }
+
+ private void createOperationStatusRecord(String actionNm, String serviceId,
+ String operationId) throws MsoDatabaseException {
+
+ AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+
+ Session session = null;
+ try {
+
+ session = requestsDbSessionFactoryManager.getSessionFactory()
+ .openSession();
+ session.beginTransaction();
+
+ OperationStatus os = new OperationStatus();
+ os.setOperation(actionNm);
+ os.setOperationContent("");
+ os.setOperationId(operationId);
+ os.setProgress("0");
+ os.setReason("");
+ os.setResult("processing");
+ os.setServiceId(serviceId);
+ // TODO : to be updated...
+ os.setUserId("");
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ os.setFinishedAt(endTimeStamp);
+ os.setOperateAt(startTimeStamp);
+
+ session.save(os);
+ session.getTransaction().commit();
+
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
+ MsoLogger.ErrorCode.DataError,
+ "Exception when creation record request in Operation", e);
+ throw new MsoDatabaseException(
+ "Data did inserted in Operatus Status Table", e);
+ } finally {
+ if (null != session) {
+ session.close();
+ }
+ }
+ }
+
+ private OperationStatus chkSvcInstOperStatusbySvcId(String serviceId) {
+ OperationStatus svcInstanceOperStatus = (RequestsDatabase.getInstance())
+ .getOperationStatusByServiceId(serviceId);
+
+ return svcInstanceOperStatus;
+ }
+
+ private OperationStatus chkDuplicateServiceNameInOperStatus(
+ String serviceName) {
+ OperationStatus dupServiceName = (RequestsDatabase.getInstance())
+ .getOperationStatusByServiceName(serviceName);
+
+ 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/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index 27c3c2b283..79ac76ff04 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
@@ -252,15 +252,12 @@ public class MsoRequest {
}
RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters();
- if(this.reqVersion >= 3){
- if(requestParameters!=null){
- this.aLaCarteFlag = sir.getRequestDetails().getRequestParameters().isaLaCarte();
- }else{
- this.aLaCarteFlag = false;
- }
- }else{
- this.aLaCarteFlag = true;
- }
+ 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);
@@ -741,7 +738,7 @@ public class MsoRequest {
if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
aq.setStatusMessage (this.errorMessage);
aq.setResponseBody (this.responseBody);
- aq.setProgress(new Long(100));
+ aq.setProgress(100L);
Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
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 bcea8fd8d5..2c7bd1cc36 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
@@ -130,33 +130,35 @@ public class NetworkInfoHandler {
if (ar.getVnfType () != null) {
vi.setNetworkType (ar.getVnfType ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
-
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+
+ break;
}
if (ar.getTenantId () != null) {
@@ -295,8 +297,8 @@ public class NetworkInfoHandler {
private String translateNetworkRequests (List <NetworkRequest> queryResponseList) {
NetworkRequests queryResponses = new NetworkRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getNetworkRequest ().add (queryResponseList.get (i));
+ for (NetworkRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getNetworkRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
index c87b4f387d..3d419926f1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
@@ -147,24 +147,27 @@ public class NetworkMsoInfraRequest {
}
// Verify that the elements correspond to the version
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null ||
- this.networkInputs.getServiceInstanceId() != null) {
- throw new ValidationException ("format for v1 version of network request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null ||
- this.networkInputs.getServiceInstanceId() != null) {
- throw new ValidationException ("format for v2 version of network request");
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null
+ ||
+ this.networkInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v1 version of network request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null ||
+ this.networkInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v2 version of network request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) {
+ throw new ValidationException("format for v3 version of network request");
+ }
+ break;
}
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) {
- throw new ValidationException ("format for v3 version of network request");
- }
- }
switch (action) {
case UPDATE:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
index 981fee9fb6..6a770202fa 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
@@ -158,33 +158,35 @@ public class NetworkRequestHandler {
if (ar.getVnfType () != null) {
vi.setNetworkType (ar.getVnfType ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
-
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+
+ break;
}
if (ar.getTenantId () != null) {
@@ -323,8 +325,8 @@ public class NetworkRequestHandler {
private String translateNetworkRequests (List <NetworkRequest> queryResponseList) {
NetworkRequests queryResponses = new NetworkRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getNetworkRequest ().add (queryResponseList.get (i));
+ for (NetworkRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getNetworkRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
index b01c6d6e2a..43f2d2afbb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java
@@ -78,13 +78,13 @@ public class NetworkTypesHandler {
ObjectFactory beansObjectFactory = new ObjectFactory ();
NetworkTypes networkTypes = beansObjectFactory.createNetworkTypes ();
- for (int i = 0; i < networkResources.size (); i++) {
- NetworkType networkType = beansObjectFactory.createNetworkType ();
- NetworkResource vr = networkResources.get (i);
- networkType.setType (vr.getModelName());
- networkType.setDescription (vr.getDescription ());
- networkType.setId (String.valueOf (vr.getModelUUID()));
- networkTypes.getNetworkType ().add (networkType);
+ for (NetworkResource networkResource : networkResources) {
+ NetworkType networkType = beansObjectFactory.createNetworkType();
+ NetworkResource vr = networkResource;
+ networkType.setType(vr.getModelName());
+ networkType.setDescription(vr.getDescription());
+ networkType.setId(String.valueOf(vr.getModelUUID()));
+ networkTypes.getNetworkType().add(networkType);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java
index ac4c01175a..2a02344ab3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResult.java
@@ -25,12 +25,20 @@ public class RecipeLookupResult {
private String orchestrationURI;
private int recipeTimeout;
+ // the service recipe param.
+ private String recipeParamXsd;
public RecipeLookupResult(String orchestrationURI, int recipeTimeout) {
this.orchestrationURI = orchestrationURI;
this.recipeTimeout = recipeTimeout;
}
+ public RecipeLookupResult(String orchestrationURI, int recipeTimeout, String recipeParamXsd) {
+ this.orchestrationURI = orchestrationURI;
+ this.recipeTimeout = recipeTimeout;
+ this.recipeParamXsd = recipeParamXsd;
+ }
+
public String getOrchestrationURI () {
return orchestrationURI;
}
@@ -46,5 +54,23 @@ public class RecipeLookupResult {
public void setRecipeTimeout (int recipeTimeout) {
this.recipeTimeout = recipeTimeout;
}
+
+
+ /**
+ * @return Returns the recipeParamXsd.
+ */
+ public String getRecipeParamXsd() {
+ return recipeParamXsd;
+ }
+
+
+ /**
+ * @param recipeParamXsd The recipeParamXsd to set.
+ */
+ public void setRecipeParamXsd(String recipeParamXsd) {
+ this.recipeParamXsd = recipeParamXsd;
+ }
+
+
}
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 6f6d2972d1..287b0ad812 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
@@ -633,7 +633,7 @@ public class ServiceInstances {
serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
msoRequest.getServiceInstanceType (),
msoRequest.getVnfType (), msoRequest.getVfModuleType (),
- msoRequest.getNetworkType (), msoRequest.getRequestJSON());
+ msoRequest.getNetworkType (), msoRequest.getRequestJSON(), null);
msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null);
} catch (Exception e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
index 57720dcfba..df51a8f96a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
@@ -74,17 +74,17 @@ public class VfModuleModelNamesHandler {
ObjectFactory beansObjectFactory = new ObjectFactory ();
VfModuleModelNames vfModuleModelNames = beansObjectFactory.createVfModuleModelNames ();
- for (int i = 0; i < vfModules.size (); i++) {
- VfModuleModelName vfModuleModelName = beansObjectFactory.createVfModuleModelName ();
- VfModule vm = vfModules.get (i);
- vfModuleModelName.setModelName (vm.getModelName ());
- vfModuleModelName.setModelVersion (vm.getVersion ());
- vfModuleModelName.setModelInvariantUuid (vm.getModelInvariantUuid ());
+ for (VfModule vfModule : vfModules) {
+ VfModuleModelName vfModuleModelName = beansObjectFactory.createVfModuleModelName();
+ VfModule vm = vfModule;
+ vfModuleModelName.setModelName(vm.getModelName());
+ vfModuleModelName.setModelVersion(vm.getVersion());
+ vfModuleModelName.setModelInvariantUuid(vm.getModelInvariantUuid());
vfModuleModelName.setIsBase(vm.isBase());
- vfModuleModelName.setDescription (vm.getDescription ());
- vfModuleModelName.setId (String.valueOf (vm.getModelUUID()));
- vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion ());
- vfModuleModelNames.getVfModuleModelName ().add (vfModuleModelName);
+ vfModuleModelName.setDescription(vm.getDescription());
+ vfModuleModelName.setId(String.valueOf(vm.getModelUUID()));
+ vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion());
+ vfModuleModelNames.getVfModuleModelName().add(vfModuleModelName);
}
StringWriter stringWriter = new StringWriter ();
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 7071ed50c3..d13212a483 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
@@ -148,50 +148,52 @@ public class VnfInfoHandler {
if (ar.getVolumeGroupId () != null) {
vi.setVolumeGroupId (ar.getVolumeGroupId ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ break;
}
qr.setVnfInputs (vi);
@@ -332,8 +334,8 @@ public class VnfInfoHandler {
private String translateVnfRequests (List <VnfRequest> queryResponseList) {
VnfRequests queryResponses = new VnfRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVnfRequest ().add (queryResponseList.get (i));
+ for (VnfRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVnfRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
index 80d0c48a5e..1f3008aa1a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
@@ -157,26 +157,29 @@ public class VnfMsoInfraRequest {
throw new ValidationException ("format for vnf request");
}
// Verify that the elements correspond to the version
-
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (this.vnfInputs.getVfModuleName () != null || this.vnfInputs.getVfModuleId () != null ||
- this.vnfInputs.getVfModuleModelName () != null || this.vnfInputs.getAsdcServiceModelVersion () != null ||
- this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null ||
- this.vnfInputs.getServiceInstanceId () != null) {
- throw new ValidationException ("format for v1 version of vnf request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null || this.vnfInputs.getServiceInstanceId () != null) {
- throw new ValidationException ("format for v2 version of vnf request");
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (this.vnfInputs.getVfModuleName() != null || this.vnfInputs.getVfModuleId() != null ||
+ this.vnfInputs.getVfModuleModelName() != null || this.vnfInputs.getAsdcServiceModelVersion() != null
+ ||
+ this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null ||
+ this.vnfInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v1 version of vnf request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null
+ || this.vnfInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v2 version of vnf request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) {
+ throw new ValidationException("format for v3 version of vnf request");
+ }
+ break;
}
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) {
- throw new ValidationException ("format for v3 version of vnf request");
- }
- }
if (!InfraUtils.isActionAllowed (props, "vnf", version, action.value ())) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
index a61ca5fb30..098ed31b58 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
@@ -179,50 +179,52 @@ public class VnfRequestHandler {
if (ar.getVolumeGroupId () != null) {
vi.setVolumeGroupId (ar.getVolumeGroupId ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ break;
}
qr.setVnfInputs (vi);
@@ -307,7 +309,7 @@ public class VnfRequestHandler {
queryValue,
getRequestType ());
- List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+ List <VnfRequest> queryResponseList = new LinkedList<>();
if (activeReqList != null) {
// build response for active
@@ -351,7 +353,7 @@ public class VnfRequestHandler {
}
private List <VnfRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
- List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+ List <VnfRequest> queryResponseList = new LinkedList<>();
for (InfraRequests ar : arList) {
VnfRequest qr = fillGeneric (ar);
@@ -363,8 +365,8 @@ public class VnfRequestHandler {
private String translateVnfRequests (List <VnfRequest> queryResponseList) {
VnfRequests queryResponses = new VnfRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVnfRequest ().add (queryResponseList.get (i));
+ for (VnfRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVnfRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
@@ -711,12 +713,12 @@ public class VnfRequestHandler {
requestClient = RequestClientFactory.getRequestClient (orchestrationURI, props);
// Capture audit event
msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
- response = requestClient.post (msoRequest.getRequestXML (),
- requestId,
- Integer.toString (recipe.getRecipeTimeout ()).toString (),
- version,
- null,
- null);
+ response = requestClient.post(msoRequest.getRequestXML(),
+ requestId,
+ Integer.toString(recipe.getRecipeTimeout()),
+ version,
+ null,
+ 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", orchestrationURI, null);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
index 44cf038ef8..3d87d131b3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java
@@ -85,12 +85,12 @@ public class VnfTypesHandler {
ObjectFactory beansObjectFactory = new ObjectFactory ();
VnfTypes vnfTypes = beansObjectFactory.createVnfTypes ();
- for (int i = 0; i < vnfResources.size (); i++) {
- VnfType vnfType = beansObjectFactory.createVnfType ();
- VnfResource vr = vnfResources.get (i);
- vnfType.setDescription (vr.getDescription ());
- vnfType.setId (String.valueOf (vr.getModelUuid()));
- vnfTypes.getVnfType ().add (vnfType);
+ for (VnfResource vnfResource : vnfResources) {
+ VnfType vnfType = beansObjectFactory.createVnfType();
+ VnfResource vr = vnfResource;
+ vnfType.setDescription(vr.getDescription());
+ vnfType.setId(String.valueOf(vr.getModelUuid()));
+ vnfTypes.getVnfType().add(vnfType);
}
StringWriter stringWriter = new StringWriter ();
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 6618fcfb00..c74bb0734d 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
@@ -134,43 +134,45 @@ public class VolumeInfoHandler {
if (ar.getVnfType () != null) {
vi.setVnfType (ar.getVnfType ());
}
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
- if (ar.getVnfId () != null) {
- vi.setVnfId (ar.getVnfId ());
- }
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ if (ar.getVnfId() != null) {
+ vi.setVnfId(ar.getVnfId());
+ }
+ break;
+ }
if (ar.getTenantId () != null) {
vi.setTenantId (ar.getTenantId ());
}
@@ -314,8 +316,8 @@ public class VolumeInfoHandler {
private String translateVolumeRequests (List <VolumeRequest> queryResponseList) {
VolumeRequests queryResponses = new VolumeRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVolumeRequest ().add (queryResponseList.get (i));
+ for (VolumeRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVolumeRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
index 0524a85bf3..f908a3f0d6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
@@ -144,24 +144,27 @@ public class VolumeMsoInfraRequest {
// Verify that the elements correspond to the version
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null ||
- this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null ||
- this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) {
- throw new ValidationException ("format for v1 version of volume request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null ||
- this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) {
- throw new ValidationException ("format for v2 version of volume request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) {
- throw new ValidationException ("format for v3 version of volume request");
- }
- }
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null ||
+ this.volumeInputs.getVfModuleModelName() != null
+ || this.volumeInputs.getAsdcServiceModelVersion() != null ||
+ this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) {
+ throw new ValidationException("format for v1 version of volume request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null ||
+ this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) {
+ throw new ValidationException("format for v2 version of volume request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) {
+ throw new ValidationException("format for v3 version of volume request");
+ }
+ break;
+ }
if (!InfraUtils.isActionAllowed (props, "volume", version, action.value ())) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
index 9a8bf35e5c..e3af83df92 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
@@ -166,43 +166,45 @@ public class VolumeRequestHandler {
if (ar.getVnfType () != null) {
vi.setVnfType (ar.getVnfType ());
}
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
- if (ar.getVnfId () != null) {
- vi.setVnfId (ar.getVnfId ());
- }
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ if (ar.getVnfId() != null) {
+ vi.setVnfId(ar.getVnfId());
+ }
+ break;
+ }
if (ar.getTenantId () != null) {
vi.setTenantId (ar.getTenantId ());
}
@@ -289,7 +291,7 @@ public class VolumeRequestHandler {
queryValue,
"VOLUME");
- List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+ List <VolumeRequest> queryResponseList = new LinkedList<>();
if (activeReqList != null) {
// build response for active
@@ -334,7 +336,7 @@ public class VolumeRequestHandler {
}
private List <VolumeRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
- List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+ List <VolumeRequest> queryResponseList = new LinkedList<>();
for (InfraRequests ar : arList) {
VolumeRequest qr = fillGeneric (ar);
@@ -346,8 +348,8 @@ public class VolumeRequestHandler {
private String translateVolumeRequests (List <VolumeRequest> queryResponseList) {
VolumeRequests queryResponses = new VolumeRequests ();
- for (int i = 0; i < queryResponseList.size (); i++) {
- queryResponses.getVolumeRequest ().add (queryResponseList.get (i));
+ for (VolumeRequest aQueryResponseList : queryResponseList) {
+ queryResponses.getVolumeRequest().add(aQueryResponseList);
}
StringWriter stringWriter = new StringWriter ();
@@ -652,12 +654,12 @@ public class VolumeRequestHandler {
requestClient = RequestClientFactory.getRequestClient (orchestrationURI, props);
// Capture audit event
msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
- response = requestClient.post (msoRequest.getRequestXML (),
- requestId,
- Integer.toString (recipe.getRecipeTimeout ()).toString (),
- version,
- null,
- null);
+ response = requestClient.post(msoRequest.getRequestXML(),
+ requestId,
+ Integer.toString(recipe.getRecipeTimeout()),
+ version,
+ null,
+ 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", orchestrationURI, null);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java
index 6121e47f83..4343847b59 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParameters.java
@@ -35,7 +35,7 @@ public class NsParameters {
private List<LocationConstraint> locationConstraints;
- private Map<String, Object> additionalParamForNs = new HashMap<String,Object>();
+ private Map<String, Object> additionalParamForNs = new HashMap<>();
/**
* @return Returns the locationConstraints.
*/
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java
index 036694b9ae..a223d6e384 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java
@@ -91,7 +91,7 @@ public class NetworkRequests {
*/
public List<NetworkRequest> getNetworkRequest() {
if (networkRequest == null) {
- networkRequest = new ArrayList<NetworkRequest>();
+ networkRequest = new ArrayList<>();
}
return this.networkRequest;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java
index 0c0b622dd5..9e9a832843 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java
@@ -91,7 +91,7 @@ public class NetworkTypes {
*/
public List<NetworkType> getNetworkType() {
if (networkType == null) {
- networkType = new ArrayList<NetworkType>();
+ networkType = new ArrayList<>();
}
return this.networkType;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java
index 3655643507..652c6a32ef 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java
@@ -123,7 +123,7 @@ public class ObjectFactory {
*/
@XmlElementDecl(namespace = "http://org.openecomp/mso/infra/network-request/v1", name = "network-params")
public JAXBElement<Object> createNetworkParams(Object value) {
- return new JAXBElement<Object>(_NetworkParams_QNAME, Object.class, null, value);
+ return new JAXBElement<>(_NetworkParams_QNAME, Object.class, null, value);
}
}
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
index e4faf72016..a3ad61c989 100644
--- 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
@@ -148,7 +148,7 @@ public class ExceptionType {
*/
public List<String> getVariables() {
if (variables == null) {
- variables = new ArrayList<String>();
+ variables = new ArrayList<>();
}
return this.variables;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
index cfd49d296b..e77257c596 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
@@ -144,7 +144,7 @@ public class ObjectFactory {
*/
@XmlElementDecl(namespace = "http://org.openecomp/mso/infra/vnf-request/v1", name = "vnf-params")
public JAXBElement<Object> createVnfParams(Object value) {
- return new JAXBElement<Object>(_VnfParams_QNAME, Object.class, null, value);
+ return new JAXBElement<>(_VnfParams_QNAME, Object.class, null, value);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java
index c3f6ec7d19..371cbb8c9d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java
@@ -91,7 +91,7 @@ public class VfModuleModelNames {
*/
public List<VfModuleModelName> getVfModuleModelName() {
if (vfModuleModelName == null) {
- vfModuleModelName = new ArrayList<VfModuleModelName>();
+ vfModuleModelName = new ArrayList<>();
}
return this.vfModuleModelName;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java
index 336cad5210..993c76c588 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java
@@ -91,7 +91,7 @@ public class VnfRequests {
*/
public List<VnfRequest> getVnfRequest() {
if (vnfRequest == null) {
- vnfRequest = new ArrayList<VnfRequest>();
+ vnfRequest = new ArrayList<>();
}
return this.vnfRequest;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java
index eebb1d9879..c066ff461c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java
@@ -91,7 +91,7 @@ public class VnfTypes {
*/
public List<VnfType> getVnfType() {
if (vnfType == null) {
- vnfType = new ArrayList<VnfType>();
+ vnfType = new ArrayList<>();
}
return this.vnfType;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java
index 48cca8f1c2..2d4d588f9a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java
@@ -109,7 +109,7 @@ public class ObjectFactory {
*/
@XmlElementDecl(namespace = "http://org.openecomp/mso/infra/volume-request/v1", name = "volume-params")
public JAXBElement<Object> createVolumeParams(Object value) {
- return new JAXBElement<Object>(_VolumeParams_QNAME, Object.class, null, value);
+ return new JAXBElement<>(_VolumeParams_QNAME, Object.class, null, value);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java
index 00c88a0fd7..318ff90136 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java
@@ -91,7 +91,7 @@ public class VolumeRequests {
*/
public List<VolumeRequest> getVolumeRequest() {
if (volumeRequest == null) {
- volumeRequest = new ArrayList<VolumeRequest>();
+ volumeRequest = new ArrayList<>();
}
return this.volumeRequest;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
index 238b6b677c..664f810b35 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
@@ -110,7 +110,7 @@ public class E2EServiceInstancesTest {
String serviceInstanceId, String vnfId, String vfModuleId,
String volumeGroupId, String networkId, String serviceType,
String vnfType, String vfModuleType, String networkType,
- String requestDetails) {
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 202,
"test response");
@@ -127,7 +127,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -181,7 +181,7 @@ public class E2EServiceInstancesTest {
String serviceInstanceId, String vnfId, String vfModuleId,
String volumeGroupId, String networkId, String serviceType,
String vnfType, String vfModuleType, String networkType,
- String requestDetails) {
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 500,
"test response");
@@ -198,7 +198,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -252,7 +252,7 @@ public class E2EServiceInstancesTest {
String serviceInstanceId, String vnfId, String vfModuleId,
String volumeGroupId, String networkId, String serviceType,
String vnfType, String vfModuleType, String networkType,
- String requestDetails) {
+ String requestDetails, String recipeParamXsd) {
ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
HttpResponse resp = new BasicHttpResponse(pv, 500,
"test response");
@@ -269,7 +269,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -323,7 +323,7 @@ public class E2EServiceInstancesTest {
String serviceInstanceId, String vnfId, String vfModuleId,
String volumeGroupId, String networkId, String serviceType,
String vnfType, String vfModuleType, String networkType,
- String requestDetails) {
+ String requestDetails, String recipeParamXsd) {
HttpResponse resp = null;
return resp;
}
@@ -333,7 +333,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -393,7 +393,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -434,7 +434,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -459,7 +459,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -485,7 +485,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -510,7 +510,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -527,7 +527,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
// assertTrue(true);
}
@@ -553,7 +553,7 @@ public class E2EServiceInstancesTest {
String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -571,7 +571,7 @@ public class E2EServiceInstancesTest {
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
assertTrue(respStr
- .indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
+ .contains("Mapping of request to JSON object failed. No content to map to Object due to end of input"));
}
@Test
@@ -581,7 +581,7 @@ public class E2EServiceInstancesTest {
Response resp = instance.deleteE2EServiceInstance(request, "v3",
"12345678");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC1000") != -1);
+ assertTrue(respStr.contains("SVC1000"));
}
@Test
@@ -610,4 +610,147 @@ public class E2EServiceInstancesTest {
.getE2EServiceInstances("12345", "v3", "123456");
}
+
+ @Test
+ public void updateE2EServiceInstanceTestNormal() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ operationStatus.setProgress("100");
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("success"));
+ }
+
+ @Test
+ public void updateE2EServiceInstanceTestChkStatusFalse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
index 6a7fc2c723..c4a1c1fffc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
@@ -76,7 +76,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -101,7 +101,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -121,7 +121,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -141,7 +141,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -161,7 +161,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -181,7 +181,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON1, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -210,7 +210,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -230,7 +230,7 @@ public class MsoRequestTest {
return;
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
MsoRequest msoRequest = new MsoRequest ("1234");
@@ -251,7 +251,7 @@ public class MsoRequestTest {
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
@@ -270,7 +270,7 @@ public class MsoRequestTest {
}
mapper = new ObjectMapper();
- instanceIdMap = new HashMap<String,String>();
+ instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
@@ -291,7 +291,7 @@ public class MsoRequestTest {
}
ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
index 3c5c89fc92..c1da76e885 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
@@ -179,12 +179,12 @@ UriInfo uriInfo = null;
public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
String queryValue,
String requestType) {
- List <InfraActiveRequests> list = new ArrayList<InfraActiveRequests>();
+ List <InfraActiveRequests> list = new ArrayList<>();
InfraActiveRequests req = new InfraActiveRequests();
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
@@ -206,7 +206,7 @@ UriInfo uriInfo = null;
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
index 08abf5702f..d3d995e851 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
@@ -64,7 +64,7 @@ public class ServiceInstanceTest {
String requestJson = "{\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v5");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
}
@Test
@@ -84,7 +84,8 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Locked instance - This service (testService) already has a request being worked with a status of null (RequestId - null). The existing request must finish or be cleaned up before proceeding.") != -1);
+ assertTrue(respBody.contains(
+ "Locked instance - This service (testService) already has a request being worked with a status of null (RequestId - null). The existing request must finish or be cleaned up before proceeding."));
}
@Test
@@ -121,7 +122,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Exception while creating record in DB null") != -1);
+ assertTrue(respBody.contains("Exception while creating record in DB null"));
}
@Test
@@ -165,7 +166,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Failed calling bpmn properties") != -1);
+ assertTrue(respBody.contains("Failed calling bpmn properties"));
}
@Test(expected = Exception.class)
@@ -216,7 +217,7 @@ public class ServiceInstanceTest {
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -286,7 +287,7 @@ public class ServiceInstanceTest {
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -306,7 +307,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);
+ assertTrue(respBody.contains("Request Failed due to BPEL error with HTTP Status"));
}
@Test
@@ -357,7 +358,7 @@ public class ServiceInstanceTest {
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
+ String requestDetails, String recipeParamXsd){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -377,7 +378,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"vnf\",\"modelName\":\"serviceModel\",\"modelCustomizationName\":\"test\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v5");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("No valid modelVersionId is specified") != -1);
+ assertTrue(respBody.contains("No valid modelVersionId is specified"));
}
@Test
@@ -428,7 +429,7 @@ public class ServiceInstanceTest {
int recipeTimeout, String requestAction, String serviceInstanceId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId,
String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
+ String requestDetails, String recipeParamXsd){
return null;
}
};
@@ -441,7 +442,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("bpelResponse is null") != -1);
+ assertTrue(respBody.contains("bpelResponse is null"));
}
@Test
@@ -461,7 +462,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
+ assertTrue(respBody.contains("Recipe could not be retrieved from catalog DB null"));
}
@@ -476,7 +477,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v5");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelVersionId is specified"));
}
@Test
@@ -490,7 +491,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid instanceName is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid instanceName is specified"));
}
@@ -505,7 +506,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
}
@Test
@@ -519,7 +520,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"1234\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
}
@Test
@@ -533,7 +534,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
}
@@ -548,7 +549,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
}
@Test
@@ -562,7 +563,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"testmodel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Mapping of request to JSON object failed.") != -1);
+ assertTrue(respBody.contains("Mapping of request to JSON object failed."));
}
@Test
@@ -576,7 +577,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelName is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelName is specified"));
}
@Test
@@ -590,7 +591,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": true},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. AutoBuildVfModule is not valid in the v2 version") != -1);
+ assertTrue(respBody.contains("Error parsing request. AutoBuildVfModule is not valid in the v2 version"));
}
@Test
@@ -604,7 +605,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
}
@Test
@@ -618,7 +619,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
}
@Test
@@ -627,7 +628,7 @@ public class ServiceInstanceTest {
String requestJson = "{\"name\":\"test\"}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
/*** Activate Service Instance Test Cases ***/
@@ -638,7 +639,7 @@ public class ServiceInstanceTest {
String requestJson = "{\"name\":\"test\"}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
@Test
@@ -652,7 +653,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
}
@Test
@@ -666,7 +667,8 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ assertTrue(respStr.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
}
@Test
@@ -680,7 +682,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Deactivate Service Instance Test Cases ***/
@@ -691,7 +693,7 @@ public class ServiceInstanceTest {
String requestJson = "{\"name\":\"test\"}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
@Test
@@ -705,7 +707,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
}
@Test
@@ -719,7 +721,8 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ assertTrue(respStr.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
}
@Test
@@ -733,7 +736,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Delete Service Instance Test Cases ***/
@@ -744,7 +747,7 @@ public class ServiceInstanceTest {
String requestJson = "{\"name\":\"test\"}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
@Test
@@ -758,7 +761,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
}
@Test
@@ -772,7 +775,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
}
@Test
@@ -786,7 +789,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Create Vnf Instance Test Cases ***/
@@ -802,7 +805,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid cloudConfiguration is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid cloudConfiguration is specified"));
}
@Test
@@ -817,7 +820,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"cloudConfiguration\":{}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid lcpCloudRegionId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid lcpCloudRegionId is specified"));
}
@Test
@@ -832,7 +835,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid tenantId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid tenantId is specified"));
}
@Test
@@ -847,7 +850,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Replace Vnf Instance Test Cases ***/
@@ -863,7 +866,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.replaceVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Update Vnf Instance Test Cases ***/
@@ -880,7 +883,7 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.updateVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Update Vnf Instance Test Cases ***/
@@ -897,6 +900,6 @@ public class ServiceInstanceTest {
+ "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.deleteVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
index 4305db3e72..1c3c85653b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
@@ -49,7 +49,7 @@ public class VfModuleModelNamesHandlerTest {
new MockUp<CatalogDatabase>() {
@Mock
public List <VfModule> getAllVfModules(){
- List <VfModule> list = new ArrayList<VfModule>();
+ List <VfModule> list = new ArrayList<>();
VfModule resource = new VfModule();
list.add(resource);
return list;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
index 2d3a2a47a5..9c9ebaee35 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
@@ -177,12 +177,12 @@ public class VnfRequestHandlerTest {
public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
String queryValue,
String requestType) {
- List <InfraActiveRequests> list = new ArrayList<InfraActiveRequests>();
+ List <InfraActiveRequests> list = new ArrayList<>();
InfraActiveRequests req = new InfraActiveRequests();
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
@@ -202,12 +202,12 @@ public class VnfRequestHandlerTest {
public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
String queryValue,
String requestType) {
- List <InfraActiveRequests> list = new ArrayList<InfraActiveRequests>();
+ List <InfraActiveRequests> list = new ArrayList<>();
InfraActiveRequests req = new InfraActiveRequests();
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
@@ -229,7 +229,7 @@ public class VnfRequestHandlerTest {
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
index 7eabc1ac2a..1800bb4695 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
@@ -62,7 +62,7 @@ public class VnfTypesHandlerTest {
new MockUp<CatalogDatabase>() {
@Mock
public List <VnfResource> getAllVnfResources(){
- List <VnfResource> list = new ArrayList<VnfResource>();
+ List <VnfResource> list = new ArrayList<>();
VnfResource resource = new VnfResource();
list.add(resource);
return list;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
index bf4d7c4d98..fa5e094336 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
@@ -151,12 +151,12 @@ public class VolumeRequestHandlerTest {
public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
String queryValue,
String requestType) {
- List <InfraActiveRequests> list = new ArrayList<InfraActiveRequests>();
+ List <InfraActiveRequests> list = new ArrayList<>();
InfraActiveRequests req = new InfraActiveRequests();
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
@@ -177,7 +177,7 @@ public class VolumeRequestHandlerTest {
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
@@ -197,7 +197,7 @@ public class VolumeRequestHandlerTest {
req.setAaiServiceId("299392");
req.setAction("CREATE");
req.setRequestStatus("COMPLETE");
- req.setProgress(10001l);
+ req.setProgress(10001L);
req.setSource("test");
req.setStartTime(new Timestamp(10020100));
req.setEndTime(new Timestamp(20020100));
diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml
index cdfa0fa8db..b14c87a0d4 100644
--- a/mso-api-handlers/mso-requests-db/pom.xml
+++ b/mso-api-handlers/mso-requests-db/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
@@ -103,7 +103,7 @@
<version>1.0.0.Final</version>
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
index e3c7cda3bd..c88f31c819 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
@@ -30,7 +30,7 @@ public class MockRequestsDatabase {
private Map<String, InfraActiveRequests> activeRequests;
public MockRequestsDatabase() {
- activeRequests = new HashMap<String, InfraActiveRequests>();
+ activeRequests = new HashMap<>();
}
public void addRecord(InfraActiveRequests record) {
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index 98121d8490..d6b0b6b419 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -38,6 +38,7 @@ import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.openecomp.mso.db.AbstractSessionFactoryManager;
+import org.openecomp.mso.requestsdb.RequestsDbConstant.Status;
import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
import org.openecomp.mso.logger.MsoLogger;
@@ -177,7 +178,7 @@ public class RequestsDatabase {
long startTime = System.currentTimeMillis ();
msoLogger.debug ("Execute query on infra active request table");
- List <InfraActiveRequests> results = new ArrayList<InfraActiveRequests>();
+ List <InfraActiveRequests> results = new ArrayList<>();
Session session = sessionFactoryRequestDB.getSessionFactory ().openSession ();
try {
@@ -698,7 +699,7 @@ public class RequestsDatabase {
* update the resource operation
* <br>
*
- * @param operstatus the resource operation object
+ * @param operStatus the resource operation object
* @since ONAP Amsterdam Release
*/
public void updateResOperStatus(ResourceOperationStatus operStatus) {
@@ -757,9 +758,9 @@ public class RequestsDatabase {
int resourceCount = lstResourceStatus.size();
int progress = 0;
boolean isFinished = true;
- for(int i = 0; i < resourceCount; i++) {
- progress = progress + Integer.valueOf(lstResourceStatus.get(i).getProgress()) / resourceCount;
- if(RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatus.get(i).getStatus())) {
+ for (ResourceOperationStatus lstResourceStatu : lstResourceStatus) {
+ progress = progress + Integer.valueOf(lstResourceStatu.getProgress()) / resourceCount;
+ if (Status.PROCESSING.equals(lstResourceStatu.getStatus())) {
isFinished = false;
}
}
diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml
index 4399c75155..06eedc5675 100644
--- a/mso-api-handlers/pom.xml
+++ b/mso-api-handlers/pom.xml
@@ -2,12 +2,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
- <groupId>org.openecomp.so</groupId>
+ <groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
<name>API Handler</name>
<description>API Handler for MSO</description>