summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
authorTomasz Wrobel <tomasz.wrobel@nokia.com>2020-02-06 14:41:54 +0100
committerTomasz Wrobel <tomasz.wrobel@nokia.com>2020-02-12 15:43:15 +0100
commitf5741f77b38d41dd5aa0ee8fd9077f57dff8def9 (patch)
tree18e5087d5563a3d19ffddc205afe96689ac48fa3 /mso-api-handlers/mso-api-handler-infra
parent00ba764f619848bcd4a384e26b0806bd5fb80749 (diff)
Fix Sonar issue - Refactor nested for if while if..
Issue-ID: SO-1841 Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com> Change-Id: I65380661dc11cd0e5d77b59a72aa5a25a955a638
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java106
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java232
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java8
4 files changed, 135 insertions, 246 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index dbdc274bc6..028abd6d25 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -7,12 +7,14 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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.
@@ -133,7 +135,7 @@ public class InstanceManagement {
HashMap<String, String> instanceIdMap, String version, String requestId,
ContainerRequestContext requestContext) throws ApiException {
String serviceInstanceId;
- Boolean aLaCarte = true;
+ boolean aLaCarte = true;
ServiceInstancesRequest sir;
String apiVersion = version.substring(1);
@@ -162,26 +164,14 @@ public class InstanceManagement {
currentActiveReq);
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
- int requestVersion = Integer.parseInt(version.substring(1));
- String vnfType = msoRequest.getVnfType(sir, requestScope, action, requestVersion);
+ String vnfType = msoRequest.getVnfType(sir, requestScope);
if (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && vnfType != null) {
currentActiveReq.setVnfType(vnfType);
}
- InfraActiveRequests dup = null;
- boolean inProgress = false;
-
- dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
-
- if (dup != null) {
- inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
- }
+ checkDuplicateAndBuildError(action, instanceIdMap, requestScope, currentActiveReq);
- if (dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
- dup);
- }
ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
RequestReferences referencesResponse = new RequestReferences();
@@ -189,7 +179,7 @@ public class InstanceManagement {
referencesResponse.setRequestId(requestId);
serviceResponse.setRequestReferences(referencesResponse);
- Boolean isBaseVfModule = false;
+ boolean isBaseVfModule = false;
String workflowUuid = null;
if (instanceIdMap != null) {
@@ -207,17 +197,9 @@ public class InstanceManagement {
vnfId = sir.getVnfInstanceId();
}
- try {
- infraActiveRequestsClient.save(currentActiveReq);
- } catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
- }
+ saveCurrentActiveRequest(currentActiveReq);
- RequestClientParameter requestClientParameter = null;
+ RequestClientParameter requestClientParameter;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
.setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
@@ -237,10 +219,38 @@ public class InstanceManagement {
recipeLookupResult.getOrchestrationURI(), requestScope);
}
+ private void saveCurrentActiveRequest(InfraActiveRequests currentActiveReq) throws RequestDbFailureException {
+ try {
+ infraActiveRequestsClient.save(currentActiveReq);
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
+ }
+ }
+
+ private void checkDuplicateAndBuildError(Actions action, HashMap<String, String> instanceIdMap, String requestScope,
+ InfraActiveRequests currentActiveReq) throws ApiException {
+
+ InfraActiveRequests dup =
+ requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
+ if (dup == null) {
+ return;
+ }
+
+ boolean inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
+ if (inProgress) {
+ requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
+ dup);
+ }
+ }
+
private Response processPNFCustomWorkflowRequest(String requestJSON, Actions action,
HashMap<String, String> instanceIdMap, String version, String requestId,
ContainerRequestContext requestContext) throws ApiException {
- Boolean aLaCarte = false;
+ boolean aLaCarte = false;
ServiceInstancesRequest sir;
String apiVersion = version.substring(1);
@@ -279,33 +289,13 @@ public class InstanceManagement {
currentActiveReq);
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
- InfraActiveRequests dup = null;
- boolean inProgress = false;
-
- dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
-
- if (dup != null) {
- inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
- }
-
- if (dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
- dup);
- }
+ checkDuplicateAndBuildError(action, instanceIdMap, requestScope, currentActiveReq);
RecipeLookupResult recipeLookupResult = getInstanceManagementWorkflowRecipe(currentActiveReq, workflowUuid);
- try {
- infraActiveRequestsClient.save(currentActiveReq);
- } catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
- }
+ saveCurrentActiveRequest(currentActiveReq);
- RequestClientParameter requestClientParameter = null;
+ RequestClientParameter requestClientParameter;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
.setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.toString())
@@ -326,7 +316,7 @@ public class InstanceManagement {
private RecipeLookupResult getInstanceManagementWorkflowRecipe(InfraActiveRequests currentActiveReq,
String workflowUuid) throws ApiException {
- RecipeLookupResult recipeLookupResult = null;
+ RecipeLookupResult recipeLookupResult;
try {
recipeLookupResult = getCustomWorkflowUri(workflowUuid);
@@ -359,14 +349,12 @@ public class InstanceManagement {
private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) {
- String recipeUri = null;
Workflow workflow = catalogDbClient.findWorkflowByArtifactUUID(workflowUuid);
- if (workflow == null) {
- return null;
- } else {
+ if (workflow != null) {
String workflowName = workflow.getName();
- recipeUri = "/mso/async/services/" + workflowName;
+ String recipeUri = "/mso/async/services/" + workflowName;
+ return new RecipeLookupResult(recipeUri, 180);
}
- return new RecipeLookupResult(recipeUri, 180);
+ return null;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index c077558301..5c81f4e6a5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -7,12 +7,14 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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.
@@ -30,7 +32,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
+import java.util.Optional;
import java.util.StringTokenizer;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
@@ -69,7 +71,6 @@ import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.LogConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
-import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.PolicyException;
@@ -148,7 +149,6 @@ public class MsoRequest {
}
-
// Parse request JSON
public void parse(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action,
String version, String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag)
@@ -222,44 +222,31 @@ public class MsoRequest {
}
}
- public Map<String, List<String>> getOrchestrationFilters(MultivaluedMap<String, String> queryParams)
- throws ValidationException {
-
- String queryParam = null;
+ public Map<String, List<String>> getOrchestrationFilters(MultivaluedMap<String, String> queryParams) {
+ final String FILTER_KEY = "filter";
Map<String, List<String>> orchestrationFilterParams = new HashMap<>();
+ Optional.ofNullable(queryParams.get(FILTER_KEY)).ifPresent(listValues -> listValues
+ .forEach(value -> addValueToOrchestrationFilterParamsMap(orchestrationFilterParams, value)));
- for (Entry<String, List<String>> entry : queryParams.entrySet()) {
- queryParam = entry.getKey();
-
- try {
- if ("filter".equalsIgnoreCase(queryParam)) {
- for (String value : entry.getValue()) {
- StringTokenizer st = new StringTokenizer(value, ":");
-
- int counter = 0;
- String mapKey = null;
- List<String> orchestrationList = new ArrayList<>();
- while (st.hasMoreElements()) {
- if (counter == 0) {
- mapKey = st.nextElement() + "";
- } else {
- orchestrationList.add(st.nextElement() + "");
- }
- counter++;
- }
- orchestrationFilterParams.put(mapKey, orchestrationList);
- }
- }
+ return orchestrationFilterParams;
+ }
- } catch (Exception e) {
- throw new ValidationException("QueryParam ServiceInfo", e);
- }
+ private void addValueToOrchestrationFilterParamsMap(Map<String, List<String>> orchestrationFilterParams,
+ String value) {
+ final String TOKEN_DELIMITER = ":";
+ StringTokenizer stringTokenizer = new StringTokenizer(value, TOKEN_DELIMITER);
+ if (!stringTokenizer.hasMoreTokens()) {
+ return;
+ }
+ String mapKey = stringTokenizer.nextToken();
+ List<String> orchestrationList = new ArrayList<>();
+ while (stringTokenizer.hasMoreTokens()) {
+ orchestrationList.add(stringTokenizer.nextToken());
}
-
- return orchestrationFilterParams;
+ orchestrationFilterParams.put(mapKey, orchestrationList);
}
public InfraActiveRequests createRequestObject(ServiceInstancesRequest servInsReq, Actions action, String requestId,
@@ -465,7 +452,6 @@ public class MsoRequest {
}
-
public Response buildResponse(int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
return buildResponseWithError(httpResponseCode, errorCode, inProgress, null);
}
@@ -474,7 +460,6 @@ public class MsoRequest {
String errorString) {
-
// Log the failed request into the MSO Requests database
return Response.status(httpResponseCode).entity(null).build();
@@ -487,7 +472,6 @@ public class MsoRequest {
}
-
public String getServiceType(VnfInputs vnfInputs) {
if (vnfInputs.getServiceType() != null)
return vnfInputs.getServiceType();
@@ -625,156 +609,78 @@ public class MsoRequest {
}
- public String getVfModuleType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) {
+ public String getVfModuleType(ServiceInstancesRequest sir, String requestScope) {
- String serviceInstanceType = null;
-
- String vnfType = null;
+ String vnfType;
String vfModuleType = null;
- String vfModuleModelName = null;
+ String vfModuleModelName;
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
String vnfModelName = null;
- String asdcServiceModelVersion = null;
String volumeGroupId = null;
- boolean isRelatedServiceInstancePresent = false;
- boolean isRelatedVnfInstancePresent = false;
- boolean isSourceVnfPresent = false;
- boolean isDestinationVnfPresent = false;
- boolean isConnectionPointPresent = false;
-
- if (instanceList != null) {
- for (RelatedInstanceList relatedInstanceList : instanceList) {
- RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
-
- if (action != Action.deleteInstance) {
-
- if (ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- if (InstanceDirection.source.equals(relatedInstance.getInstanceDirection())
- && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
- isSourceVnfPresent = true;
- } else if (InstanceDirection.destination.equals(relatedInstance.getInstanceDirection())
- && (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- || (relatedInstanceModelInfo.getModelType().equals(ModelType.pnf)
- && reqVersion == 6))) {
- isDestinationVnfPresent = true;
- }
- }
- if (ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType())
- && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- isConnectionPointPresent = true;
- }
- }
-
-
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
- isRelatedServiceInstancePresent = true;
- serviceModelName = relatedInstanceModelInfo.getModelName();
- asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
- isRelatedVnfInstancePresent = true;
- vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
- volumeGroupId = relatedInstance.getInstanceId();
- }
+ if (instanceList == null) {
+ return null;
+ }
+ for (RelatedInstanceList relatedInstanceList : instanceList) {
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
+
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ serviceModelName = relatedInstanceModelInfo.getModelName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
+ && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
+ vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
+ volumeGroupId = relatedInstance.getInstanceId();
}
-
- if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) {
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- } else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
- vfModuleModelName = modelInfo.getModelName();
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- vfModuleType = vnfType + "::" + vfModuleModelName;
- sir.setVolumeGroupInstanceId(volumeGroupId);
- } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name()))
- vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
-
+ }
+ if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
+ vfModuleModelName = modelInfo.getModelName();
+ vnfType = serviceModelName + "/" + vnfModelName;
+ vfModuleType = vnfType + "::" + vfModuleModelName;
+ sir.setVolumeGroupInstanceId(volumeGroupId);
}
return vfModuleType;
}
- public String getVnfType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) {
+ public String getVnfType(ServiceInstancesRequest sir, String requestScope) {
- String serviceInstanceType = null;
- String networkType = null;
String vnfType = null;
- String vfModuleType = null;
- String vfModuleModelName = null;
- ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
String vnfModelName = null;
- String asdcServiceModelVersion = null;
String volumeGroupId = null;
- boolean isRelatedServiceInstancePresent = false;
- boolean isRelatedVnfInstancePresent = false;
- boolean isSourceVnfPresent = false;
- boolean isDestinationVnfPresent = false;
- boolean isConnectionPointPresent = false;
-
- if (instanceList != null) {
- for (RelatedInstanceList relatedInstanceList : instanceList) {
- RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
-
- if (action != Action.deleteInstance) {
-
- if (ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- if (InstanceDirection.source.equals(relatedInstance.getInstanceDirection())
- && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
- isSourceVnfPresent = true;
- } else if (InstanceDirection.destination.equals(relatedInstance.getInstanceDirection())
- && (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- || (relatedInstanceModelInfo.getModelType().equals(ModelType.pnf)
- && reqVersion == 6))) {
- isDestinationVnfPresent = true;
- }
- }
- if (ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType())
- && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- isConnectionPointPresent = true;
- }
- }
-
-
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
- isRelatedServiceInstancePresent = true;
- serviceModelName = relatedInstanceModelInfo.getModelName();
- asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
- isRelatedVnfInstancePresent = true;
- vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
- volumeGroupId = relatedInstance.getInstanceId();
- }
+ if (instanceList == null) {
+ return null;
+ }
+ for (RelatedInstanceList relatedInstanceList : instanceList) {
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
+
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ serviceModelName = relatedInstanceModelInfo.getModelName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
+ && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
+ vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
+ volumeGroupId = relatedInstance.getInstanceId();
}
-
- if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) {
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- } else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
- vfModuleModelName = modelInfo.getModelName();
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- vfModuleType = vnfType + "::" + vfModuleModelName;
- sir.setVolumeGroupInstanceId(volumeGroupId);
- } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name()))
- vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
-
}
- return vnfType;
+ if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) {
+ vnfType = serviceModelName + "/" + vnfModelName;
+ } else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
+ vnfType = serviceModelName + "/" + vnfModelName;
+ sir.setVolumeGroupInstanceId(volumeGroupId);
+ } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name()))
+ vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
+ return vnfType;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index 65537cbba0..a15d9cfd48 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -251,25 +251,22 @@ public class ResumeOrchestrationRequest {
}
try {
- requestClientParameter =
- new RequestClientParameter.Builder().setRequestId(currentActiveRequest.getRequestId())
- .setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
- .setRequestAction(infraActiveRequest.getRequestAction())
- .setServiceInstanceId(infraActiveRequest.getServiceInstanceId())
- .setPnfCorrelationId(pnfCorrelationId).setVnfId(infraActiveRequest.getVnfId())
- .setVfModuleId(infraActiveRequest.getVfModuleId())
- .setVolumeGroupId(infraActiveRequest.getVolumeGroupId())
- .setNetworkId(infraActiveRequest.getNetworkId())
- .setServiceType(infraActiveRequest.getServiceType())
- .setVnfType(infraActiveRequest.getVnfType())
- .setVfModuleType(msoRequest.getVfModuleType(sir, infraActiveRequest.getRequestScope(),
- action, Integer.parseInt(version)))
- .setNetworkType(infraActiveRequest.getNetworkType())
- .setRequestDetails(requestHandlerUtils
- .mapJSONtoMSOStyle(infraActiveRequest.getRequestBody(), sir, aLaCarte, action))
- .setApiVersion(version).setALaCarte(aLaCarte)
- .setRequestUri(currentActiveRequest.getRequestUrl())
- .setInstanceGroupId(infraActiveRequest.getInstanceGroupId()).build();
+ requestClientParameter = new RequestClientParameter.Builder()
+ .setRequestId(currentActiveRequest.getRequestId()).setBaseVfModule(isBaseVfModule)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(infraActiveRequest.getRequestAction())
+ .setServiceInstanceId(infraActiveRequest.getServiceInstanceId())
+ .setPnfCorrelationId(pnfCorrelationId).setVnfId(infraActiveRequest.getVnfId())
+ .setVfModuleId(infraActiveRequest.getVfModuleId())
+ .setVolumeGroupId(infraActiveRequest.getVolumeGroupId())
+ .setNetworkId(infraActiveRequest.getNetworkId()).setServiceType(infraActiveRequest.getServiceType())
+ .setVnfType(infraActiveRequest.getVnfType())
+ .setVfModuleType(msoRequest.getVfModuleType(sir, infraActiveRequest.getRequestScope()))
+ .setNetworkType(infraActiveRequest.getNetworkType())
+ .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(infraActiveRequest.getRequestBody(), sir,
+ aLaCarte, action))
+ .setApiVersion(version).setALaCarte(aLaCarte).setRequestUri(currentActiveRequest.getRequestUrl())
+ .setInstanceGroupId(infraActiveRequest.getInstanceGroupId()).build();
} catch (IOException e) {
logger.error("IOException while generating requestClientParameter to send to BPMN", e);
ErrorLoggerInfo errorLoggerInfo =
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index 175b212c86..33eae43e44 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -844,17 +844,15 @@ public class ServiceInstances extends AbstractRestHandler {
}
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
-
- int requestVersion = Integer.parseInt(version.substring(1));
String instanceName = null;
if (sir.getRequestDetails().getRequestInfo() != null) {
instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
}
boolean alaCarteFlag = msoRequest.getAlacarteFlag(sir);
- String vnfType = msoRequest.getVnfType(sir, requestScope, action, requestVersion);
+ String vnfType = msoRequest.getVnfType(sir, requestScope);
String networkType = msoRequest.getNetworkType(sir, requestScope);
String sdcServiceModelVersion = msoRequest.getSDCServiceModelVersion(sir);
- String vfModuleType = msoRequest.getVfModuleType(sir, requestScope, action, requestVersion);
+ String vfModuleType = msoRequest.getVfModuleType(sir, requestScope);
if (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && vnfType != null) {
currentActiveReq.setVnfType(vnfType);
@@ -935,7 +933,7 @@ public class ServiceInstances extends AbstractRestHandler {
}
- RequestClientParameter requestClientParameter = null;
+ RequestClientParameter requestClientParameter;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
.setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())