Merge "Exclude problematic dependency from cxf"
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
index b3b22e2..9e08cda 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
@@ -32,13 +32,15 @@
private final String endpoint;
private final String encryptedBasicAuth;
private final String encrytptionKey;
+ private final String aaiVersion;
public AaiPropertiesImpl() {
-
final ApplicationContext context = SpringContextHelper.getAppContext();
this.endpoint = context.getEnvironment().getProperty("aai.endpoint");
this.encryptedBasicAuth = context.getEnvironment().getProperty("aai.auth");
this.encrytptionKey = context.getEnvironment().getProperty("mso.key");
+ this.aaiVersion = context.getEnvironment().getProperty("aai.version");
+
}
@Override
@@ -53,6 +55,11 @@
@Override
public AAIVersion getDefaultVersion() {
+ for (final AAIVersion version : AAIVersion.values()) {
+ if (version.toString().equalsIgnoreCase(this.aaiVersion)) {
+ return version;
+ }
+ }
return AAIVersion.LATEST;
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
index 8d79aff..aaf4949 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
@@ -187,10 +187,5 @@
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
</dependencies>
</project>
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
index f34fb61..6554da3 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
@@ -187,11 +187,6 @@
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
index 442339d..b972517 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
@@ -59,8 +59,8 @@
public EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId) {
return aaiClientProvider.getAaiClient()
.get(EsrSystemInfoList.class,
- AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.externalSystem().esrThirdpartySdnc((sdncId))))
+ AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.externalSystem().esrThirdpartySdnc((sdncId)).esrSystemInfoList()))
.orElseGet(() -> {
logger.debug("VNFM not found in AAI");
return null;
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
index 97a4c5e..2ccd88a 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
@@ -141,7 +141,9 @@
public RestResponse queryJobStatus(NssmfAdapterNBIRequest jobReq, String jobId) throws ApplicationException {
this.params.clear();
this.params.put("jobId", jobId);
- this.params.put("responseId", jobReq.getResponseId());
+ if (jobReq.getResponseId() != null) {
+ this.params.put("responseId", jobReq.getResponseId());
+ }
this.urlHandler();
/**
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
index d8a9088..0d0d896 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
@@ -127,8 +127,8 @@
return restUtil.send(nssmfUrl, this.httpMethod, content, header);
}
- private void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status, RestResponse rsp)
- throws ApplicationException {
+ protected void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status,
+ RestResponse rsp) throws ApplicationException {
switch (fromString(rspDesc.getStatus())) {
case STARTED:
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
index bc7a3d0..491da0a 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
@@ -30,6 +30,8 @@
import org.onap.so.beans.nsmf.DeAllocateNssi;
import org.onap.so.beans.nsmf.NssiResponse;
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest;
+import org.onap.so.beans.nsmf.ResponseDescriptor;
+import org.onap.so.beans.nsmf.JobStatusResponse;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import java.util.HashMap;
import java.util.Map;
@@ -72,7 +74,7 @@
restResponse = returnRsp;
ResourceOperationStatus status =
- new ResourceOperationStatus(serviceInfo.getNsiId(), nssiId, serviceInfo.getServiceUuid());
+ new ResourceOperationStatus(serviceInfo.getNsiId(), resp.getJobId(), serviceInfo.getServiceUuid());
status.setResourceInstanceID(nssiId);
updateDbStatus(status, restResponse.getStatus(), JobStatus.FINISHED,
@@ -111,6 +113,25 @@
}
@Override
+ protected RestResponse doQueryJobStatus(ResourceOperationStatus status) throws ApplicationException {
+ ResponseDescriptor responseDescriptor = new ResponseDescriptor();
+ responseDescriptor.setStatus(JobStatus.FINISHED.toString());
+ responseDescriptor.setProgress(100);
+ responseDescriptor.setStatusDescription("Finished");
+
+ JobStatusResponse jobStatusResponse = new JobStatusResponse();
+ jobStatusResponse.setResponseDescriptor(responseDescriptor);
+
+ RestResponse restResponse = new RestResponse();
+ restResponse.setStatus(200);
+ restResponse.setResponseContent(marshal(jobStatusResponse));
+
+ updateRequestDbJobStatus(responseDescriptor, status, restResponse);
+
+ return restResponse;
+ }
+
+ @Override
protected SelectionType doQueryNSSISelectionCapability() {
return SelectionType.NSSMF;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 4206596..3b84b15 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -213,7 +213,8 @@
String targetState = "";
if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
- } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) {
+ } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)
+ || "RollbackToCreatedNoConfiguration".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_CREATED.toString();
} else {
targetState = Status.ROLLED_BACK.toString();
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index 843cca0..43db279 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -232,6 +232,20 @@
throw new BpmnError("MSOWorkflowException");
}
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
+ ONAPComponentsList extSystemErrorSource, String workStep) {
+ String processKey = getProcessKey(execution);
+ logger.info("Building a WorkflowException for Subflow");
+
+ WorkflowException exception =
+ new WorkflowException(processKey, errorCode, errorMessage, workStep, extSystemErrorSource);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
public WorkflowException buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
ONAPComponentsList extSystemErrorSource) {
String processKey = getProcessKey(execution);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
index ee47b51..b34d9dc 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
@@ -259,6 +259,35 @@
assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
+ @Test
+ public void queryRainyDayTableRollbackToCreatedNoConfiguration() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock);
+ delegateExecution.setVariable("buildingBlock", executeBuildingBlock);
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AddFabricConfigurationBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("RollbackToCreatedNoConfiguration");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AddFabricConfigurationBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("RollbackToCreatedNoConfiguration", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
+ }
+
@Test
public void suppressRollbackTest() throws Exception {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
index 5baafbb..b7e4dd9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -22,6 +22,7 @@
package org.onap.so.client.exception;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -39,6 +40,7 @@
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.WorkflowException;
import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
@@ -95,4 +97,17 @@
thrown.expect(BpmnError.class);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
}
+
+ @Test
+ public void buildAndThrowWorkflowExceptionWithWorkStepTest() {
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+
+ try {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC,
+ "WORKSTEP");
+ } catch (BpmnError e) {
+ }
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals("WORKSTEP", workflowException.getWorkStep());
+ }
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index f2e0ce2..5fd9701 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -95,7 +95,7 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"||execution.getVariable("handlingCode")=="RollbackToCreatedNoConfiguration"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
index 0900863..e5c9514 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
@@ -158,7 +158,7 @@
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index 88014e7..3e834fa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -4,6 +4,7 @@
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.JobStatusResponse
import org.onap.so.beans.nsmf.NssiResponse
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.beans.nsmf.ResponseDescriptor
@@ -17,7 +18,6 @@
import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.http.ResponseEntity
class DoAllocateNSSI extends AbstractServiceTaskProcessor {
@@ -34,7 +34,7 @@
private static final NSSMF_ALLOCATE_URL = "/api/rest/provMns/v1/NSS/SliceProfiles"
- private static final NSSMF_QUERY_JOB_STATUS_URL = "/NSS/jobs/%s"
+ private static final NSSMF_QUERY_JOB_STATUS_URL = "/api/rest/provMns/v1/NSS/jobs/%s"
@Override
void preProcessRequest(DelegateExecution execution) {
@@ -64,11 +64,12 @@
NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest
String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL,
objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String respBody = responseEntity.getBody()
- NssiResponse result = objectMapper.readValue(respBody, NssiResponse.class)
- //todo: if success
- //todo:
+
+ if (response != null) {
+ NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class)
+ execution.setVariable("nssiAllocateResult", nssiResponse)
+ }
+
execution.setVariable("serviceInfo", nbiRequest.getServiceInfo())
execution.setVariable("esrInfo", nbiRequest.getEsrInfo())
}
@@ -96,13 +97,14 @@
String response =
nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String result = responseEntity.getBody()
- //todoï¼›if success
- ResponseDescriptor responseDescriptor = objectMapper.readValue(result, ResponseDescriptor.class)
+ if (response != null) {
+ JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class)
+ execution.setVariable("nssiAllocateStatus", jobStatusResponse)
- //todo: handle status
- execution.setVariable("nssiAllocateResult", responseDescriptor)
+ if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) {
+ execution.setVariable("jobFinished", true)
+ }
+ }
}
void prepareUpdateOrchestrationTask(DelegateExecution execution) {
@@ -111,10 +113,10 @@
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- ResponseDescriptor response = execution.getVariable("nssiAllocateResult") as ResponseDescriptor
+ JobStatusResponse jobStatusResponse = execution.getVariable("nssiAllocateStatus") as JobStatusResponse
+ ResponseDescriptor response = jobStatusResponse.getResponseDescriptor()
SubnetType subnetType = execution.getVariable("subnetType") as SubnetType
-
SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
sliceTaskInfo.progress = response.getProgress()
sliceTaskInfo.status = response.getStatus()
@@ -127,6 +129,7 @@
execution.setVariable("sliceTaskParams", sliceParams)
execution.setVariable("sliceTaskInfo", sliceTaskInfo)
+
logger.debug("Finish prepareUpdateOrchestrationTask progress")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
index 0f1bf0d..7beafef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
@@ -23,12 +23,10 @@
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
@@ -38,6 +36,7 @@
class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class);
+ final String AAI_VERSION = "v21"
JsonUtils jsonUtil = new JsonUtils()
TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -67,23 +66,26 @@
void createSliceProfile(DelegateExecution execution) {
- String sliceserviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+ String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
String sliceProfileStr = execution.getVariable("sliceProfile")
String sliceProfileId = UUID.randomUUID().toString()
SliceProfile sliceProfile = new SliceProfile();
sliceProfile.setProfileId(sliceProfileId)
sliceProfile.setLatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
sliceProfile.setResourceSharingLevel(jsonUtil.getJsonValue(sliceProfileStr, "resourceSharingLevel"))
- sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)) //TODO: should be list
+ //sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr))
- sliceProfile.setE2ELatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
sliceProfile.setMaxBandwidth(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth")))
- //TODO: new API
- sliceProfile.setReliability(new Object())
+ //sliceProfile.setReliability(new Object())
try {
AAIResourcesClient client = getAAIClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceserviceInstanceId).sliceProfile(sliceProfileId))
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId)
+ .sliceProfile(sliceProfileId))
client.create(uri, sliceProfile)
} catch (BpmnError e) {
@@ -112,20 +114,25 @@
ss.setOrchestrationStatus(serviceStatus)
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
- ss.setModelInvariantId(modelInvariantUuid)
- ss.setModelVersionId(modelUuid)
+ //TODO: need valid model ID from the caller, as AAI does not accept invalid IDs
+ //ss.setModelInvariantId(modelInvariantUuid)
+ //ss.setModelVersionId(modelUuid)
String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr)
ss.setServiceInstanceLocationId(serviceInstanceLocationid)
String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)
ss.setEnvironmentContext(snssai)
ss.setServiceRole(serviceRole)
AAIResourcesClient client = getAAIClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId))
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId))
client.create(uri, ss)
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
- String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance. " + ex.getMessage()
+ String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance: " + ex.getMessage()
logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -133,17 +140,19 @@
void createAllottedResource(DelegateExecution execution) {
- String serviceInstanceId = execution.getVariable('sliceServiceInstanceId')
-
- AAIResourcesClient resourceClient = getAAIClient()
- AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ String ssInstanceId = execution.getVariable('sliceServiceInstanceId')
try {
List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportSliceNetworks"))
for (String networkStr : networkStrList) {
String allottedResourceId = UUID.randomUUID().toString()
- AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("sliceserviceInstanceId")).allottedResource(allottedResourceId))
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(execution.getVariable("sliceServiceInstanceId"))
+ .allottedResource(allottedResourceId))
execution.setVariable("allottedResourceUri", allottedResourceUri)
String modelInvariantId = execution.getVariable("modelInvariantUuid")
String modelVersionId = execution.getVariable("modelUuid")
@@ -152,27 +161,37 @@
resource.setId(allottedResourceId)
resource.setType("TsciNetwork")
resource.setAllottedResourceName("network_" + execution.getVariable("sliceServiceInstanceName"))
- resource.setModelInvariantId(modelInvariantId)
- resource.setModelVersionId(modelVersionId)
getAAIClient().create(allottedResourceUri, resource)
- //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build())
- //getAAIClient().connect(allottedResourceUri,ssServiceuri)
- //execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
- createLogicalLinksForAllocatedResource(execution, linkArrayStr, serviceInstanceId, allottedResourceId)
+ createLogicalLinksForAllocatedResource(execution, linkArrayStr, ssInstanceId, allottedResourceId)
}
-
+ } catch (BpmnError e) {
+ throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+ String msg = "Exception in DoCreateTnNssiInstance.createAllottedResource: " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
void createLogicalLinksForAllocatedResource(DelegateExecution execution,
- String linkArrayStr, String serviceInstanceId,
+ String linkArrayStr, String ssInstanceId,
String allottedResourceId) {
-
try {
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId)
+ .allottedResource(allottedResourceId))
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
for (String linkStr : linkStrList) {
@@ -186,15 +205,22 @@
resource.setLinkId(logicalLinkId)
resource.setLinkName(epA)
resource.setLinkName2(epB)
- resource.setModelInvariantId(modelInvariantId)
- resource.setModelVersionId(modelVersionId)
+ resource.setLinkType("TsciConnectionLink")
+ resource.setInMaint(false)
- AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+ //epA is link-name
+ AAIResourceUri logicalLinkUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA))
getAAIClient().create(logicalLinkUri, resource)
+
+ tnNssmfUtils.attachLogicalLinkToAllottedResource(execution, AAI_VERSION, allottedResourceUri, epA);
}
+ } catch (BpmnError e) {
+ throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
- "Exception in createLogicalLinksForAllocatedResource" + ex.getMessage())
+ String msg = "Exception in DoCreateTnNssiInstance.createLogicalLinksForAllocatedResource: " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
index 9d6c4a1..75ef7d3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -19,8 +19,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import com.fasterxml.jackson.databind.ObjectMapper
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
@@ -47,6 +47,7 @@
private ExceptionUtil exceptionUtil = new ExceptionUtil()
private JsonUtils jsonUtil = new JsonUtils()
+ ObjectMapper objectMapper = new ObjectMapper()
private RequestDBUtil requestDBUtil = new RequestDBUtil()
private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
@@ -133,10 +134,9 @@
String nssiId = currentNSSI['nssiServiceInstanceId']
String nsiId = currentNSSI['nsiServiceInstanceId']
String scriptName = execution.getVariable("scriptName")
- boolean modifyAction = execution.getVariable("terminateNSI")
String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
+ String serviceUuid = currentNSSI['modelId']
String globalSubscriberId = currentNSSI['globalSubscriberId']
String subscriptionServiceType = execution.getVariable("serviceType")
@@ -146,37 +146,37 @@
deAllocateNssi.setTerminateNssiOption(0)
deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
deAllocateNssi.setScriptName(scriptName)
- deAllocateNssi.setSliceProfileId(profileId)
- deAllocateNssi.setModifyAction(modifyAction)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
serviceInfo.setServiceUuid(serviceUuid)
+ serviceInfo.setNsiId(nsiId)
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ String serviceInfoString = objectMapper.writeValueAsString(serviceInfo)
EsrInfo esrInfo = getEsrInfo(currentNSSI)
+ String esrInfoString = objectMapper.writeValueAsString(esrInfo)
execution.setVariable("deAllocateNssi",deAllocateNssi)
- execution.setVariable("esrInfo",esrInfo)
- execution.setVariable("serviceInfo",serviceInfo)
+ execution.setVariable("esrInfo", esrInfoString)
+ execution.setVariable("serviceInfo", serviceInfoString)
String nssmfRequest = """
{
- "deAllocateNssi": "${execution.getVariable("deAllocateNssi") as JSONObject}",
- "esrInfo": ${execution.getVariable("esrInfo") as JSONObject},
- "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
+ "deAllocateNssi": ${objectMapper.writeValueAsString(deAllocateNssi)},
+ "esrInfo": ${esrInfoString},
+ "serviceInfo": ${serviceInfoString}
}
"""
- String urlStr = String.format("/api/rest/provMns/v1/NSS/nssi/%s",nssiId)
+ String urlStr = String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s", profileId)
NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, NssiResponse.class)
if (nssmfResponse != null) {
currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
currentNSSI['jobProgress'] = 0
execution.setVariable("currentNSSI", currentNSSI)
- }
- else {
+ } else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
}
LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
@@ -190,32 +190,9 @@
{
def currentNSSI = execution.getVariable("currentNSSI")
String jobId = currentNSSI['jobId']
- String nssiId = currentNSSI['nssiServiceInstanceId']
- String nsiId = currentNSSI['nsiServiceInstanceId']
- String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
- String globalSubscriberId = currentNSSI['globalSubscriberId']
- String subscriptionServiceType = execution.getVariable("serviceType")
- String sST = currentNSSI['sST']
- String PLMNIdList = currentNSSI['PLMNIdList']
- String nssiName = currentNSSI['nssiName']
-
+
execution.setVariable("responseId", "3")
- execution.setVariable("esrInfo", getEsrInfo(currentNSSI))
execution.setVariable("jobId", jobId)
-
- Map<String, ?> serviceInfoMap = new HashMap<>()
- serviceInfoMap.put("nssiId", nssiId)
- serviceInfoMap.put("nsiId", nsiId)
- serviceInfoMap.put("nssiName", nssiName)
- serviceInfoMap.put("sST", sST)
- serviceInfoMap.put("PLMNIdList", PLMNIdList)
- serviceInfoMap.put("globalSubscriberId", globalSubscriberId)
- serviceInfoMap.put("subscriptionServiceType", subscriptionServiceType)
- serviceInfoMap.put("serviceInvariantUuid", serviceInvariantUuid)
- serviceInfoMap.put("serviceUuid", serviceUuid)
-
- execution.setVariable("serviceInfo", serviceInfoMap)
}
@@ -238,8 +215,9 @@
LOGGER.error("job progress is null or empty!")
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Job progress from NSSMF.")
}
+ def currentNSSI = execution.getVariable("currentNSSI")
int oldProgress = currentNSSI['jobProgress']
- int currentProgress = progress
+ int currentProgress = Integer.parseInt(progress)
execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
@@ -247,6 +225,8 @@
currentNSSI['status'] = status
currentNSSI['statusDescription'] = statusDescription
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
}
else {
@@ -256,7 +236,7 @@
}
catch (any)
{
- String msg = "Received a Bad Response from NSSMF." cause-"+any.getCause()"
+ String msg = "Received a Bad Response from NSSMF. cause-"+any.getCause()
LOGGER.error(any.printStackTrace())
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -309,7 +289,7 @@
String nssiServiceInstanceId = currentNSSI['nssiServiceInstanceId']
String profileId = currentNSSI['profileId']
String globalSubscriberId = currentNSSI["globalSubscriberId"]
- String serviceType = currentNSSI["serviceType"]
+ String serviceType = execution.getVariable("serviceType")
try
{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
index a410b93..baf0333 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
@@ -162,7 +162,7 @@
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
index 03a726c..4ff15a5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
@@ -387,7 +387,7 @@
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
index 7d2e536..e856522 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
@@ -27,11 +27,9 @@
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -155,7 +153,7 @@
"modelUuid":"${modelUuid}",
"modelVersion":""
}"""
- execution.setVariable("ssServiceModelInfo", serviceModelInfo)
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
logger.debug("Finish prepareDecomposeService")
}
@@ -186,13 +184,14 @@
if (maxIndex < 1) {
String msg = "Exception in TN NSST processDecomposition. There is no NSST associated with TN NSST "
logger.info(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ } else {
+ execution.setVariable("tnNsstInfoList", nsstInfoList)
+ execution.setVariable("tnModelVersion", tnModelVersion)
+ execution.setVariable("tnModelName", tnModelName)
+ execution.setVariable("currentIndex", currentIndex)
+ execution.setVariable("maxIndex", maxIndex)
}
- execution.setVariable("tnNsstInfoList", nsstInfoList)
- execution.setVariable("tnModelVersion", tnModelVersion)
- execution.setVariable("tnModelName", tnModelName)
- execution.setVariable("currentIndex", currentIndex)
- execution.setVariable("maxIndex", maxIndex)
logger.debug("End processDecomposition")
}
@@ -334,7 +333,7 @@
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
index a1b883c..1bb0e8a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
@@ -20,8 +20,11 @@
package org.onap.so.bpmn.infrastructure.scripts
-
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -241,4 +244,40 @@
return res
}
+
+ void createRelationShipInAAI(DelegateExecution execution, AAIResourceUri uri, Relationship relationship) {
+ logger.debug("createRelationShipInAAI Start")
+ String msg
+ AAIResourcesClient client = new AAIResourcesClient()
+ try {
+ if (!client.exists(uri)) {
+ logger.info("ERROR: createRelationShipInAAI: not exist: uri={}", uri)
+ return
+ }
+ AAIResourceUri from = ((AAIResourceUri) (uri.clone())).relationshipAPI()
+ client.create(from, relationship)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("createRelationShipInAAI Exit")
+ }
+
+ void attachLogicalLinkToAllottedResource(DelegateExecution execution, String aaiVersion, AAIResourceUri arUri,
+ String logicalLinkId) {
+
+
+ String toLink = "aai/${aaiVersion}/network/logical-links/logical-link/${logicalLinkId}"
+
+ Relationship relationship = new Relationship()
+ relationship.setRelatedLink(toLink)
+ relationship.setRelatedTo("logical-link")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+
+ createRelationShipInAAI(execution, arUri, relationship)
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
index f488632..12632de 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
@@ -68,12 +68,12 @@
<bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def rupScript = new TnAllocateNssi()
+def runScript = new TnAllocateNssi()
runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI started")</bpmn:script>
</bpmn:scriptTask>
<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection">
<bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming>
- <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="OofTnNssiSelect" />
+ <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="TnAllocateNssi" />
</bpmn:intermediateThrowEvent>
<bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
index c107cfb..a745f7c 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
@@ -99,10 +99,11 @@
<bpmn:callActivity id="Task_1x3et9h" name="Query Job Status" calledElement="QueryJobStatus">
<bpmn:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
- <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
- <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
- <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" />
+ <camunda:in source="esrInfo" target="esrInfo" />
+ <camunda:in source="serviceInfo" target="serviceInfo" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="responseId" target="responseId" />
+ <camunda:out source="responseDescriptor" target="responseDescriptor" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0w01l14</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_10nogqz</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 5425b2a..f0898ac 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -75,6 +75,7 @@
private static final String COMPLETED = "completed";
private static final String HANDLINGCODE = "handlingCode";
private static final String ROLLBACKTOCREATED = "RollbackToCreated";
+ private static final String ROLLBACKTOCREATEDNOCONFIGURATION = "RollbackToCreatedNoConfiguration";
private static final String REPLACEINSTANCE = "replaceInstance";
private static final String VFMODULE = "VfModule";
protected String maxRetries = "mso.rainyDay.maxRetries";
@@ -334,14 +335,19 @@
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows);
- if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
+ if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)
+ || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) {
for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) {
if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign")
&& !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
rollbackFlowsFiltered.remove(rollbackFlow);
} else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete")
- && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
- && ROLLBACKTOCREATED.equals(handlingCode)) {
+ && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
+ && (ROLLBACKTOCREATED.equals(handlingCode)
+ || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))
+ || (rollbackFlow.getBuildingBlock().getBpmnFlowName()
+ .contains("FabricConfiguration")
+ && ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))) {
rollbackFlowsFiltered.remove(rollbackFlow);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index a7ee89f..3290bb3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -436,6 +436,40 @@
}
@Test
+ public void rollbackExecutionRollbackToCreatedNoConfigurationWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToCreatedNoConfiguration");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+
+ BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
+ flowsToExecute.add(ebb1);
+
+ BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
+ flowsToExecute.add(ebb2);
+
+ BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
+ flowsToExecute.add(ebb3);
+
+ BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
+ flowsToExecute.add(ebb4);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 4);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(1, ebbs.size());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
index 27c5cf8..dc8e691 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
@@ -22,14 +22,16 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
+import java.io.Serializable;
import java.util.Map;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
-public class AllocateAnNssi {
+public class AllocateAnNssi implements Serializable {
@Deprecated
public final static String URL = "/api/rest/provMns/v1/an/NSS" + "/SliceProfiles";
+ private static final long serialVersionUID = 4925129853421138442L;
private String nsstId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java b/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java
index 418f8a5..e2c2e99 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class AnPerfReq {
+public class AnPerfReq implements Serializable {
+
+ private static final long serialVersionUID = -7415880702887244040L;
private PerfReqEmbb perfReqEmbb;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
index e5eb3e0..eef0396 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
@@ -24,12 +24,15 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.ToString;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
@ToString
-public class AnSliceProfile {
+public class AnSliceProfile implements Serializable {
+
+ private static final long serialVersionUID = -3057342171549542794L;
@JsonProperty(value = "sliceProfileId", required = true)
private String sliceProfileId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
index 399d51e..10aaf26 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
@@ -21,12 +21,14 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class DeAllocateNssi {
+public class DeAllocateNssi implements Serializable {
@Deprecated
public final static String URL = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/%s";
+ private static final long serialVersionUID = 8198187346132154044L;
private String nsiId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
index 9259d51..a0a9531 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class JobStatusResponse {
+public class JobStatusResponse implements Serializable {
+
+ private static final long serialVersionUID = -2039407266985403172L;
private ResponseDescriptor responseDescriptor;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
index d1679c6..3219846 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class NsiInfo {
+public class NsiInfo implements Serializable {
+
+ private static final long serialVersionUID = -8432406430744875618L;
private String nsiName;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
index 66368be..92acdaa 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class NssiResponse {
+public class NssiResponse implements Serializable {
+
+ private static final long serialVersionUID = 2723440188640857903L;
private String nssiId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
index bce0d56..f6e945e 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class PerfReqEmbb {
+public class PerfReqEmbb implements Serializable {
+
+ private static final long serialVersionUID = 8886635511695277599L;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int expDataRateDL;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
index 0b05d39..9e4b4ed 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class PerfReqUrllc {
+public class PerfReqUrllc implements Serializable {
+
+ private static final long serialVersionUID = 3133479142915485943L;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int e2eLatency;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
index 146032c..2456d54 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
@@ -22,11 +22,14 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
-public class ResponseDescriptor {
+public class ResponseDescriptor implements Serializable {
+
+ private static final long serialVersionUID = 6330527958947215910L;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int progress;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
index 19e8b46..f9848fc 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
@@ -19,10 +19,11 @@
*/
package org.onap.so.beans.nsmf;
+import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
-import java.util.List;
+@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class ServiceInfo implements Serializable {
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
index dd73fdb..8ea0eb6 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
@@ -27,6 +27,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
+import java.io.Serializable;
import java.util.Map;
@@ -35,7 +36,8 @@
@AllArgsConstructor
@ToString
@Builder
-public class SliceTaskParamsAdapter {
+public class SliceTaskParamsAdapter implements Serializable {
+
private static final long serialVersionUID = -7785578865170503301L;
private String serviceId;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index b09d676..7ed6038 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -403,7 +403,7 @@
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"Exception while communciate with " + "Catalog DB", action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -415,7 +415,7 @@
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Recipe does not exist in catalog DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -493,7 +493,7 @@
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"Exception while communciate with " + "Catalog DB", action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -505,7 +505,7 @@
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Recipe does not exist in catalog DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -725,7 +725,7 @@
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"No communication to catalog DB " + e.getMessage(), action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -737,7 +737,7 @@
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No recipe found in DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -958,7 +958,7 @@
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
throw validateException;
}
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 bf76cd3..64c42a0 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
@@ -451,7 +451,7 @@
}
public void createErrorRequestRecord(Status status, String requestId, String errorMessage, Actions action,
- String requestScope, String requestJSON, String serviceInstanceId) {
+ String requestScope, String requestJSON, String serviceInstanceId, ServiceInstancesRequest sir) {
try {
InfraActiveRequests request = new InfraActiveRequests(requestId);
Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
@@ -469,6 +469,17 @@
Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
request.setEndTime(endTimeStamp);
request.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ if (sir != null) {
+ if (sir.getRequestDetails() != null && sir.getRequestDetails().getRequestInfo() != null) {
+ request.setRequestorId(sir.getRequestDetails().getRequestInfo().getRequestorId());
+ request.setSource(sir.getRequestDetails().getRequestInfo().getSource());
+ if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
+ if (sir.getRequestDetails().getRequestInfo().getInstanceName() != null) {
+ request.setServiceInstanceName(sir.getRequestDetails().getRequestInfo().getInstanceName());
+ }
+ }
+ }
+ }
requestsDbClient.save(request);
} catch (Exception e) {
logger.error("Exception when updating record in DB", e);
@@ -476,7 +487,6 @@
}
}
-
public Response buildResponse(int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
return buildResponseWithError(httpResponseCode, errorCode, inProgress, null);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index 60e9c3b..cddb1ad 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -326,7 +326,7 @@
String requestScope = requestScopeFromUri(requestUri);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action,
- requestScope, requestJSON, null);
+ requestScope, requestJSON, null, null);
throw validateException;
}
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 2c8e926..7924ca3 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
@@ -830,7 +830,8 @@
} catch (ApiException e) {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, e.getMessage(), action, requestScope,
requestJSON, requestHandlerUtils
- .getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).orElse(null));
+ .getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).orElse(null),
+ sir);
throw e;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml
index a541117..272ac0c 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml
@@ -166,14 +166,8 @@
<version>${okhttp-version}</version>
</dependency>
<dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
- <dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
- <version>${jaxb-api}</version>
</dependency>
</dependencies>
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml
index 1c13eca..3178b28 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml
@@ -102,5 +102,11 @@
<version>${hamcrest-version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>nl.jqno.equalsverifier</groupId>
+ <artifactId>equalsverifier</artifactId>
+ <version>${equalsverifier-version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java
index 0dcadfd..0901f07 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java
@@ -31,10 +31,11 @@
public class NsRequestProcessingException extends RuntimeException {
private static final long serialVersionUID = 66862444537194516L;
- private InlineResponse400 problemDetails;
+ private final InlineResponse400 problemDetails;
public NsRequestProcessingException(final String message) {
super(message);
+ problemDetails = null;
}
public NsRequestProcessingException(final String message, final InlineResponse400 problemDetails) {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java
index 75dd710..749e85e 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java
@@ -25,7 +25,7 @@
import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.exceptions.EtsiCatalogManagerRequestFailureException;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
-import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptorParser;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser.NetworkServiceDescriptorParser;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,9 +66,8 @@
}
return Optional.empty();
} catch (final Exception restProcessingException) {
- logger.error("Caught exception while getting NS package model for: {}", nsdId, restProcessingException);
- throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.",
- restProcessingException);
+ final String message = "Caught exception while getting NS package model for: " + nsdId;
+ throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException);
}
}
@@ -82,9 +81,8 @@
}
return Optional.empty();
} catch (final Exception restProcessingException) {
- logger.error("Caught exception while getting VNF package model for: {}", vnfPkgId, restProcessingException);
- throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.",
- restProcessingException);
+ final String message = "Caught exception while getting VNF package model for: " + vnfPkgId;
+ throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException);
}
}
@@ -101,9 +99,8 @@
}
return Optional.empty();
} catch (final Exception restProcessingException) {
- logger.error("Caught exception while getting NS package content for: {}", nsdId, restProcessingException);
- throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.",
- restProcessingException);
+ final String message = "Caught exception while getting NS package content for: " + nsdId;
+ throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException);
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
index 8c6ea92..7adf87a 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
@@ -69,11 +69,11 @@
@Configuration
public class EtsiCatalogServiceProviderConfiguration {
- public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate";
+ private static final Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class);
public static final String ETSI_CATALOG_SERVICE_PROVIDER_BEAN = "etsiCatalogServiceProvider";
- private final static Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class);
+ public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate";
private final HttpClientConnectionConfiguration clientConnectionConfiguration;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java
index e3c159c..54f6ad6 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java
@@ -33,8 +33,6 @@
@Value("${etsi-catalog-manager.base.endpoint}")
private String etsiCatalogManagerEndpoint;
- public EtsiCatalogUrlProvider() {}
-
public String getNsPackageUrl(final String nsdId) {
return etsiCatalogManagerEndpoint + "/nsd/v1/ns_descriptors/" + nsdId;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java
index fe710ec..6776d8b 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java
@@ -73,20 +73,20 @@
@Value("${rest.http.client.configuration.ssl.trustStorePassword:#{null}}")
private String trustStorePassword;
- @Value("so.adapters.sol003-adapter.auth:Basic dm5mbTpwYXNzd29yZDEk")
+ @Value("${so.adapters.sol003-adapter.auth:Basic dm5mbTpwYXNzd29yZDEk}")
private String sol003AdapterBasicAuth;
@Autowired
private GsonProvider gsonProvider;
- @Autowired
- private HttpComponentsClientConfiguration httpComponentsClientConfiguration;
-
@Bean
@Qualifier(SOL003_ADAPTER_REST_TEMPLATE_BEAN)
- public RestTemplate sol003AdapterRestTemplate() {
+ public RestTemplate sol003AdapterRestTemplate(
+ @Autowired final HttpComponentsClientConfiguration httpComponentsClientConfiguration) {
+
final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory =
httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory();
+
final RestTemplate restTemplate =
new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory));
restTemplate.getInterceptors().add(new SOSpringClientFilter());
@@ -114,7 +114,7 @@
final HttpComponentsClientHttpRequestFactory factory =
new HttpComponentsClientHttpRequestFactory(httpClient);
restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
- } catch (Exception exception) {
+ } catch (final Exception exception) {
logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java
index a0798f6..df3a0c2 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java
@@ -22,6 +22,7 @@
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_HTTP_REST_SERVICE_PROVIDER_BEAN;
import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse;
@@ -76,7 +77,7 @@
final CreateVnfResponse createVnfResponse = response.getBody();
- if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
+ if (StringUtils.isBlank(createVnfResponse.getJobId())) {
LOGGER.error("Received invalid instantiation response: {}", response);
return Optional.empty();
}
@@ -134,7 +135,7 @@
}
final DeleteVnfResponse deleteVnfResponse = response.getBody();
- if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) {
+ if (StringUtils.isBlank(deleteVnfResponse.getJobId())) {
LOGGER.error("Received invalid terminate response: {}", response);
return Optional.empty();
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java
index 58ca250..cfe5b94 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java
@@ -22,6 +22,7 @@
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.utils.Utils.toIndentedString;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.util.Arrays;
import java.util.Objects;
/**
@@ -82,7 +83,7 @@
@Override
public int hashCode() {
- return Objects.hash(isDirectory, filePath, fileContent);
+ return Objects.hash(isDirectory, filePath) + Arrays.hashCode(fileContent);
}
@Override
@@ -90,7 +91,7 @@
if (obj instanceof FileEntry) {
final FileEntry other = (FileEntry) obj;
return Objects.equals(isDirectory, other.isDirectory) && Objects.equals(filePath, other.filePath)
- && Objects.equals(fileContent, other.fileContent);
+ && Arrays.equals(fileContent, other.fileContent);
}
return false;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/FileParser.java
similarity index 89%
rename from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileParser.java
rename to so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/FileParser.java
index 9df5262..2a37922 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/FileParser.java
@@ -17,9 +17,10 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import java.util.Map;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java
similarity index 93%
rename from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParser.java
rename to so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java
index 33737f4..cc92234 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -31,6 +31,10 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.apache.commons.io.IOUtils;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.ToscaMetadata;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.VirtualNetworkFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,7 +83,7 @@
final Map<String, Object> nodeTemplates = getNodeTemplates(topologyTemplates);
final Optional<NetworkServiceDescriptor> nsdOptional =
- getNetworkServiceDescriptor(topologyTemplates);;
+ getNetworkServiceDescriptor(topologyTemplates);
if (nsdOptional.isPresent()) {
final NetworkServiceDescriptor networkServiceDescriptor = nsdOptional.get();
networkServiceDescriptor.setVnfs(getVirtualNetworkFunctions(nodeTemplates));
@@ -91,10 +95,10 @@
}
+ logger.error("Unable to find {} file in {}", TOSCA_META_PATH_FILE_NAME, files);
} catch (final Exception exception) {
- logger.error("Unable to parser nsd zip content", exception);
+ logger.error("Unable to parse nsd zip content", exception);
}
- logger.error("Unable to parser nsd zip content");
return Optional.empty();
}
@@ -104,7 +108,7 @@
final Map<String, Object> substitutionMappings =
(Map<String, Object>) topologyTemplates.get(SUBSTITUTION_MAPPINGS);
final Object nodeType = substitutionMappings.get(NODE_TYPE);
- if (substitutionMappings != null && nodeType != null && NS_NODE_TYPE.equals(nodeType)) {
+ if (substitutionMappings != null && NS_NODE_TYPE.equals(nodeType)) {
final NetworkServiceDescriptor networkServiceDescriptor = new NetworkServiceDescriptor();
networkServiceDescriptor.setType(nodeType.toString());
networkServiceDescriptor.setProperties((Map<String, Object>) substitutionMappings.get(PROPERTIES));
@@ -191,7 +195,7 @@
}
return files;
} catch (final Exception exception) {
- logger.error("Unable to parser nsd zip content", exception);
+ logger.error("Unable to parse nsd zip content", exception);
return Collections.emptyMap();
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/ToscaMetadataParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/ToscaMetadataParser.java
similarity index 90%
rename from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/ToscaMetadataParser.java
rename to so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/ToscaMetadataParser.java
index fe23f5e..746416c 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/ToscaMetadataParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/ToscaMetadataParser.java
@@ -17,12 +17,15 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.util.List;
import java.util.Optional;
import org.apache.commons.io.IOUtils;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.ToscaMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -39,7 +42,7 @@
public Optional<ToscaMetadata> parse(final FileEntry toscaMetaFile) {
try {
final ToscaMetadata toscaMetadata = new ToscaMetadata();
- final List<String> lines = IOUtils.readLines(toscaMetaFile.getFileContentAsStream(), "utf-8");
+ final List<String> lines = IOUtils.readLines(toscaMetaFile.getFileContentAsStream(), UTF_8);
for (final String line : lines) {
final String trimmedLine = line.trim();
if (!trimmedLine.isEmpty() && trimmedLine.contains(ATTRIBUTE_VALUE_SEPARATOR)) {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/YamlFileParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/YamlFileParser.java
similarity index 91%
rename from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/YamlFileParser.java
rename to so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/YamlFileParser.java
index ac8f782..eab6974 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/YamlFileParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/YamlFileParser.java
@@ -17,9 +17,10 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import java.util.Map;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.Yaml;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java
index d23e812..f87a35f 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java
@@ -48,7 +48,7 @@
private final Logger logger = LoggerFactory.getLogger(getClass());
protected final DatabaseServiceProvider databaseServiceProvider;
- public AbstractNetworkServiceTask(final DatabaseServiceProvider jobServiceProvider) {
+ protected AbstractNetworkServiceTask(final DatabaseServiceProvider jobServiceProvider) {
this.databaseServiceProvider = jobServiceProvider;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java
index bfeaf49..fcebea5 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java
@@ -47,6 +47,7 @@
*/
@Component
public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
+ private static final String CREATE_INSTANTIATE_REQUEST_PARAM_NAME = "request";
private static final Logger logger = LoggerFactory.getLogger(CreateInstantiateVnfTask.class);
private static final String NF_INST_ID_PARAM_NAME = "NF_INST_ID";
public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
@@ -64,7 +65,8 @@
public void checkIfNfInstanceExistsInDb(final DelegateExecution execution) {
logger.info("Executing checkIfNfInstanceInDb");
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
setJobStatus(execution, JobStatusEnum.IN_PROGRESS, "Checking if NF Instance record exists in database for "
@@ -79,7 +81,8 @@
public void createNfInstanceInDb(final DelegateExecution execution) {
logger.info("Executing createNfInstanceInDb");
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
setJobStatus(execution, IN_PROGRESS, "Creating NF Instance record in database for " + request.getVnfName());
@@ -104,7 +107,8 @@
public void createGenericVnfInAai(final DelegateExecution execution) {
logger.info("Executing createGenericVnfInAai");
try {
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
setJobStatus(execution, IN_PROGRESS, "Creating GenericVnf record in AAI for " + request.getVnfName());
@@ -140,7 +144,8 @@
logger.info("Executing invokeCreateInstantiationRequest");
try {
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
setJobStatus(execution, IN_PROGRESS,
@@ -180,7 +185,8 @@
logger.info("Executing updateNfInstanceStatusToInstantiated");
updateNfInstanceStatus(execution, State.INSTANTIATED);
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
setJobStatus(execution, FINISHED, "Successfully created and Instantiated VNF: " + request.getVnfName()
+ " will set status to " + State.INSTANTIATED);
@@ -192,7 +198,8 @@
logger.info("Executing updateNfInstanceStatusToActive");
updateNfInstanceStatus(execution, State.FAILED);
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
setJobStatus(execution, ERROR, "Failed to create and instantiate VNF: " + request.getVnfName()
+ " will set status to " + State.FAILED);
@@ -204,7 +211,7 @@
final String nfInstId = (String) execution.getVariable(NF_INST_ID_PARAM_NAME);
final Optional<NfvoNfInst> optional = databaseServiceProvider.getNfvoNfInst(nfInstId);
- if (!optional.isPresent()) {
+ if (optional.isEmpty()) {
final String message = "Unable to find NfvoNfInst record in database using nfInstId: " + nfInstId;
logger.error(message);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java
index 1d9e09e..a6d35e3 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java
@@ -240,12 +240,20 @@
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution, nsInstId);
-
final String nsPackageId = nfvoNsInst.getNsPackageId();
- final NsdInfo nsdInfo = getNsdInfo(execution, nsPackageId);
final Map<String, String> vnfdIdToVnfPkgIdMapping = new HashMap<>();
try {
+ final Optional<NsdInfo> nsdInfoOptional =
+ etsiCatalogPackageManagementServiceProvider.getNSPackageModel(nsPackageId);
+
+ if (nsdInfoOptional.isEmpty()) {
+ final String message = "Unable to find NS package using NS package id: " + nsPackageId;
+ logger.error(message);
+ abortOperation(execution, message);
+ }
+
+ final NsdInfo nsdInfo = nsdInfoOptional.get();
for (final String vnfPkgId : nsdInfo.getVnfPkgIds()) {
final Optional<VnfPkgInfo> optional =
etsiCatalogPackageManagementServiceProvider.getVnfPkgInfo(vnfPkgId);
@@ -290,34 +298,8 @@
setJobStatusToError(execution, "Instantiate NS workflow process failed");
}
- private NsdInfo getNsdInfo(final DelegateExecution execution, final String nsPackageId) {
- try {
- final Optional<NsdInfo> optional =
- etsiCatalogPackageManagementServiceProvider.getNSPackageModel(nsPackageId);
-
- if (optional.isPresent()) {
- final NsdInfo packageModel = optional.get();
- logger.info("NS Package exists {}", packageModel);
- return packageModel;
- }
-
- } catch (final EtsiCatalogManagerRequestFailureException failureException) {
- final String message =
- "Unexpected exception occured while getting ns package using nsPackageId: " + nsPackageId;
- logger.error(message, failureException);
-
- abortOperation(execution, message);
- }
-
- final String message = "Unable to find NS package using NS package id: " + nsPackageId;
- logger.error(message);
- abortOperation(execution, message);
- return null;
-
- }
-
private Optional<Tenant> getTenant(final Map<String, String> additionalParams) {
- final String vimId = (String) additionalParams.get("vim_id");
+ final String vimId = additionalParams.get("vim_id");
if (vimId != null) {
final String[] splitString = vimId.split("_");
if (splitString.length == 3) {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java
index e4dc3d5..001c369 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java
@@ -37,7 +37,7 @@
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorSol003AdapterNodeTask.class);
private final AaiServiceProvider aaiServiceProvider;
- public MonitorSol003AdapterNodeTask(final DatabaseServiceProvider databaseServiceProvider,
+ protected MonitorSol003AdapterNodeTask(final DatabaseServiceProvider databaseServiceProvider,
final AaiServiceProvider aaiServiceProvider) {
super(databaseServiceProvider);
this.aaiServiceProvider = aaiServiceProvider;
@@ -56,7 +56,7 @@
LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId);
final Optional<GenericVnf> aaiGenericVnfOptional = aaiServiceProvider.getGenericVnf(vnfId);
- if (!aaiGenericVnfOptional.isPresent()) {
+ if (aaiGenericVnfOptional.isEmpty()) {
abortOperation(execution, "Unable to find generic vnf in A&AI using vnfId" + vnfId);
}
final GenericVnf genericVnf = aaiGenericVnfOptional.get();
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java
index 2baa284..c0d1df8 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java
@@ -109,9 +109,8 @@
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
final List<NfvoNfInst> nfInstances = databaseServiceProvider.getNfvoNfInstByNsInstId(nsInstId);
if (nfInstances != null) {
- nfInstances.stream().forEach(instance -> {
- logger.info("Current status {} of vnf: {}", instance.getStatus(), instance.getName());
- });
+ nfInstances.stream().forEach(
+ instance -> logger.info("Current status {} of vnf: {}", instance.getStatus(), instance.getName()));
}
}
@@ -120,16 +119,14 @@
logger.info("Getting NfvoNfInstList using nsInstId: {}", nsInstId);
final List<NfvoNfInst> nfvoNfInstList = databaseServiceProvider.getNfvoNfInstByNsInstId(nsInstId);
- if (nfvoNfInstList.size() == 0) {
+ if (nfvoNfInstList == null || nfvoNfInstList.isEmpty()) {
final String message = "Unable to find NF Instances in database using id: " + nsInstId;
abortOperation(execution, message);
}
final List<String> vnfIdsList = new ArrayList<>();
- nfvoNfInstList.stream().forEach(nfvoNfInst -> {
- vnfIdsList.add(nfvoNfInst.getNfInstId());
- });
+ nfvoNfInstList.stream().forEach(nfvoNfInst -> vnfIdsList.add(nfvoNfInst.getNfInstId()));
return vnfIdsList;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java
index 34959ee..9f21d2b 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java
@@ -24,6 +24,7 @@
import java.time.format.DateTimeFormatter;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
/**
@@ -45,14 +46,14 @@
@Override
public LocalDateTime read(final JsonReader in) throws IOException {
- switch (in.peek()) {
- case NULL:
- in.nextNull();
- return null;
- default:
- final String dateTime = in.nextString();
- return LocalDateTime.parse(dateTime, FORMATTER);
+ if (JsonToken.NULL == in.peek()) {
+ in.nextNull();
+ return null;
+
}
+ final String dateTime = in.nextString();
+ return LocalDateTime.parse(dateTime, FORMATTER);
+
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/PojoClassesTests.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/PojoClassesTests.java
new file mode 100644
index 0000000..edfb20a
--- /dev/null
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/PojoClassesTests.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows;
+
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Test;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.ToscaMetadata;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.VirtualNetworkFunction;
+import org.onap.so.openpojo.rules.ToStringTester;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+import nl.jqno.equalsverifier.EqualsVerifier;
+import nl.jqno.equalsverifier.Warning;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class PojoClassesTests {
+
+ @Test
+ public void test_nsd_parser_pojo_classes() throws ClassNotFoundException {
+
+ final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester())
+ .with(new ToStringTester()).build();
+ validator.validate(FileEntry.class.getPackageName(), new FilterPackageInfo());
+ }
+
+
+ @Test
+ public void test_nsd_parser_pojo_classes_equalAndHashMethod() throws ClassNotFoundException {
+ final List<Class<?>> classes = Arrays.asList(FileEntry.class, NetworkServiceDescriptor.class,
+ ToscaMetadata.class, VirtualNetworkFunction.class);
+ for (final Class<?> clazz : classes) {
+ EqualsVerifier.forClass(clazz).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS,
+ Warning.INHERITED_DIRECTLY_FROM_OBJECT).verify();
+ }
+ }
+
+}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParserTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParserTest.java
similarity index 93%
rename from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParserTest.java
rename to so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParserTest.java
index 2bebf1c..4a8c715 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParserTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParserTest.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -31,6 +31,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.TestApplication;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser.NetworkServiceDescriptorParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java
index ce2487e..60b06e1 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java
@@ -42,24 +42,24 @@
public class NfvoJob {
@Id
- @Column(name = "JOB_ID")
+ @Column(name = "JOB_ID", nullable = false)
private String jobId;
- @Column(name = "JOB_TYPE")
+ @Column(name = "JOB_TYPE", nullable = false)
private String jobType;
@Enumerated(EnumType.STRING)
- @Column(name = "JOB_ACTION")
+ @Column(name = "JOB_ACTION", nullable = false)
private JobAction jobAction;
- @Column(name = "RESOURCE_ID")
+ @Column(name = "RESOURCE_ID", nullable = false)
private String resourceId;
@Column(name = "RESOURCE_NAME")
private String resourceName;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private JobStatusEnum status;
@Column(name = "START_TIME")
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java
index be673b4..66ae0e5 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java
@@ -44,17 +44,17 @@
private int id;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private JobStatusEnum status;
@Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
private String description;
- @Column(name = "UPDATED_TIME")
+ @Column(name = "UPDATED_TIME", nullable = false)
private LocalDateTime updatedTime;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "JOB_ID")
+ @JoinColumn(name = "JOB_ID", nullable = false)
private NfvoJob nfvoJob;
public int getId() {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java
index e685781..570355f 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java
@@ -41,7 +41,7 @@
public class NfvoNfInst {
@Id
- @Column(name = "NF_INST_ID")
+ @Column(name = "NF_INST_ID", nullable = false)
private String nfInstId;
@Column(name = "NAME")
@@ -54,11 +54,11 @@
private String packageId;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "NS_INST_ID")
+ @JoinColumn(name = "NS_INST_ID", nullable = false)
private NfvoNsInst nsInst;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private State status;
@Column(name = "CREATE_TIME")
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java
index 146e551..04f988c 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java
@@ -44,29 +44,29 @@
public class NfvoNsInst {
@Id
- @Column(name = "NS_INST_ID")
+ @Column(name = "NS_INST_ID", nullable = false)
private String nsInstId;
- @Column(name = "NAME")
+ @Column(name = "NAME", nullable = false)
private String name;
@Column(name = "NS_PACKAGE_ID")
private String nsPackageId;
- @Column(name = "NSD_ID")
+ @Column(name = "NSD_ID", nullable = false)
private String nsdId;
- @Column(name = "NSD_INVARIANT_ID")
+ @Column(name = "NSD_INVARIANT_ID", nullable = false)
private String nsdInvariantId;
@Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
private String description;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private State status;
- @Column(name = "STATUS_UPDATED_TIME")
+ @Column(name = "STATUS_UPDATED_TIME", nullable = false)
private LocalDateTime statusUpdatedTime;
@Column(name = "GLOBAL_CUSTOMER_ID")
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java
index 7668ed2..19fe969 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java
@@ -41,11 +41,11 @@
public class NsLcmOpOcc {
@Id
- @Column(name = "ID")
+ @Column(name = "ID", nullable = false)
private String id;
@Enumerated(EnumType.STRING)
- @Column(name = "OPERATION_STATE")
+ @Column(name = "OPERATION_STATE", nullable = false)
private OperationStateEnum operationState;
@Column(name = "STATE_ENTERED_TIME")
@@ -55,20 +55,20 @@
private LocalDateTime startTime;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "NS_INST_ID")
+ @JoinColumn(name = "NS_INST_ID", nullable = false)
private NfvoNsInst nfvoNsInst;
@Enumerated(EnumType.STRING)
- @Column(name = "OPERATION")
+ @Column(name = "OPERATION", nullable = false)
private NsLcmOpType operation;
- @Column(name = "IS_AUTO_INNOVATION")
+ @Column(name = "IS_AUTO_INNOVATION", nullable = false)
private boolean isAutoInnovation;
- @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT")
+ @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT", nullable = false)
private String operationParams;
- @Column(name = "IS_CANCEL_PENDING")
+ @Column(name = "IS_CANCEL_PENDING", nullable = false)
private boolean isCancelPending;
public NsLcmOpOcc() {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
index 78ab9e9..2390cef 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
@@ -77,7 +77,7 @@
*/
@PostMapping(value = "/ns_instances", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> createNs(
+ public ResponseEntity<NsInstancesNsInstance> createNs(
@RequestHeader(value = HTTP_GLOBAL_CUSTOMER_ID_HTTP_HEADER_PARM_NAME,
required = true) final String globalCustomerId,
@RequestHeader(value = HTTP_SERVICETYPE_HEADER_PARM_NAME, required = false,
@@ -106,7 +106,7 @@
*/
@DeleteMapping(value = "/ns_instances/{nsInstanceId}",
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> deleteNs(@PathVariable("nsInstanceId") final String nsInstanceId) {
+ public ResponseEntity<Void> deleteNs(@PathVariable("nsInstanceId") final String nsInstanceId) {
logger.debug("Received delete NS request for nsInstanceId: {}", nsInstanceId);
nsLifeCycleManager.deleteNs(nsInstanceId);
logger.info("Successfully deleted NS for nsInstanceId: {}", nsInstanceId);
@@ -124,7 +124,7 @@
@PostMapping(value = "/ns_instances/{nsInstanceId}/instantiate",
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> instantiateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
+ public ResponseEntity<Void> instantiateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
@RequestBody final InstantiateNsRequest instantiateNsRequest) {
logger.debug("Received instantiate NS request: {}\n with nsInstanceId: {}", instantiateNsRequest, nsInstanceId);
final URI resourceUri = nsLifeCycleManager.instantiateNs(nsInstanceId, instantiateNsRequest);
@@ -144,7 +144,7 @@
@PostMapping(value = "/ns_instances/{nsInstanceId}/terminate",
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> terminateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
+ public ResponseEntity<Void> terminateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
@RequestBody final TerminateNsRequest terminateNsRequest) {
logger.debug("Received terminate NS request: {}\n with nsInstanceId: {}", terminateNsRequest, nsInstanceId);
final URI resourceUri = nsLifeCycleManager.terminateNs(nsInstanceId, terminateNsRequest);