summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java52
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java138
-rw-r--r--deployment-configs/src/main/resources/logger/logback-spring.xml26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java26
-rw-r--r--pom.xml2
12 files changed, 264 insertions, 43 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index 5d9c1a3acd..ec8ad3127c 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -1,6 +1,5 @@
<?xml version="1.0"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -23,7 +22,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
- <configuration>
+ <configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
index 59b34c4074..79b40ba385 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
@@ -57,9 +57,10 @@ abstract class MsoGroovyTest {
protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString();
protected void init(String procName){
- mockExecution = setupMock(procName)
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ // mockExecution = setupMock(procName)
+ // when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
client = mock(AAIResourcesClient.class)
+ mockExecution = mock(ExecutionEntity.class)
}
protected ExecutionEntity setupMock(String procName) {
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
index 99b178c044..39aadd29d7 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
@@ -25,7 +25,7 @@ import org.junit.rules.ExpectedException
import static org.mockito.Mockito.*
import javax.ws.rs.NotFoundException
-
+import org.camunda.bpm.engine.ProcessEngineServices
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
import org.junit.Before
@@ -57,6 +57,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
void init() throws IOException {
super.init("UpdateAAIVfModule")
when(updateAAIVfModule.getAAIClient()).thenReturn(client)
+ mockExecution = setupMock("UpdateAAIVfModule")
}
@Test
@@ -110,7 +111,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
doNothing().when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
updateAAIVfModule.updateVfModule(mockExecution)
- verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200)
+ verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200)
}
@Test
@@ -126,7 +127,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
- verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404)
+ verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404)
}
@@ -143,7 +144,6 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
- verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500)
-
+ verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 1a4e9c6ee8..86df60bb54 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -32,11 +32,11 @@
</execution>
</executions>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
- <configuration>
+ <configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 1cde9fb8f6..e2dd73f9ec 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -24,6 +24,8 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import java.util.EnumSet;
+import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
@@ -34,11 +36,15 @@ import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
+import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
@Component
public class OrchestrationStatusValidator {
@@ -52,6 +58,14 @@ public class OrchestrationStatusValidator {
"Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)";
private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult";
private static final String ALACARTE = "aLaCarte";
+ private static final String MULTI_STAGE_DESIGN_OFF = "false";
+ private static final String MULTI_STAGE_DESIGN_ON = "true";
+ private static final String RESOURCE_EXIST_STATUS_MESSAGE =
+ "The %s was found to already exist, thus no new %s was created in the cloud via this request";
+ private static final String RESOURCE_NOT_EXIST_STATUS_MESSAGE =
+ "The %s was not found, thus no %s was deleted in the cloud via this request";
+ private static final Set<ResourceType> cloudResources =
+ EnumSet.of(ResourceType.VF_MODULE, ResourceType.VOLUME_GROUP, ResourceType.NETWORK);
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -59,6 +73,8 @@ public class OrchestrationStatusValidator {
private ExceptionBuilder exceptionBuilder;
@Autowired
private CatalogDbClient catalogDbClient;
+ @Autowired
+ RequestsDbClient requestDBClient;
/**
@@ -160,6 +176,13 @@ public class OrchestrationStatusValidator {
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
orchestrationStatusStateTransitionDirective.getFlowDirective());
+
+ if (buildingBlockFlowName.matches("Create(.*)|Delete(.*)") && orchestrationStatusStateTransitionDirective
+ .getFlowDirective() == OrchestrationStatusValidationDirective.SILENT_SUCCESS) {
+
+ updatedResourceStatus(execution, buildingBlockDetail);
+ }
+
} catch (BBObjectNotFoundException ex) {
logger.error(
"Error occurred for bb object notfound in OrchestrationStatusValidator validateOrchestrationStatus ",
@@ -175,4 +198,33 @@ public class OrchestrationStatusValidator {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
}
}
+
+ private void updatedResourceStatus(BuildingBlockExecution execution, BuildingBlockDetail buildingBlockDetail) {
+
+ if (cloudResources.contains(buildingBlockDetail.getResourceType())) {
+ String resource = buildingBlockDetail.getResourceType().toString();
+
+ String resourceId = execution.getLookupMap()
+ .get(ResourceKey.valueOf(buildingBlockDetail.getResourceType().getResourceKey()));
+
+ String resourceStatusMessage = RESOURCE_NOT_EXIST_STATUS_MESSAGE;
+ if (execution.getFlowToBeCalled().matches("Create(.*)")) {
+ resourceStatusMessage = RESOURCE_EXIST_STATUS_MESSAGE;
+ }
+
+ updateRequestsDb(resourceId, String.format(resourceStatusMessage, resource, resource));
+ }
+
+ }
+
+ private void updateRequestsDb(String requestId, String resourceStatusMessage) {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId(requestId);
+ request.setResourceStatusMessage(resourceStatusMessage);
+ try {
+ requestDBClient.patchInfraActiveRequests(request);
+ } catch (HttpClientErrorException e) {
+ logger.warn("Unable to update active request resource status");
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index ffe48876c4..b9feeedc14 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -34,8 +34,10 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
+import org.mockito.Mockito;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -49,13 +51,19 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
+import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.beans.factory.annotation.Autowired;
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
- @InjectMocks
- protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
+ private static final String vfModuleExistExpectedMessage =
+ "The VfModule was found to already exist, thus no new VfModule was created in the cloud via this request";
+
+ private static final String vfModuleNotExistExpectedMessage =
+ "The VfModule was not found, thus no VfModule was deleted in the cloud via this request";
+ @InjectMocks
+ protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@Test
public void test_validateOrchestrationStatus() throws Exception {
@@ -95,6 +103,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ Mockito.verifyZeroInteractions(requestsDbClient);
}
@Test
@@ -146,6 +156,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ Mockito.verifyZeroInteractions(requestsDbClient);
}
@Ignore
@@ -192,6 +204,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
OrchestrationAction.ASSIGN);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ Mockito.verifyZeroInteractions(requestsDbClient);
}
@Ignore
@@ -224,6 +238,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
OrchestrationAction.ASSIGN);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ Mockito.verifyZeroInteractions(requestsDbClient);
}
@Test
@@ -293,6 +309,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ Mockito.verifyZeroInteractions(requestsDbClient);
}
@@ -337,10 +355,21 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("testVfModuleId1");
+ request.setResourceStatusMessage(vfModuleExistExpectedMessage);
+
+ Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
+
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
+ Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
+
+ assertEquals(vfModuleExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
@Test
@@ -385,10 +414,21 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("testVfModuleId1");
+ request.setResourceStatusMessage(vfModuleExistExpectedMessage);
+
+ Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
+
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
+ Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
+
+ assertEquals(vfModuleExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
@Test
@@ -433,10 +473,21 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ASSIGNED,
OrchestrationAction.CREATE);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("testVfModuleId1");
+ request.setResourceStatusMessage(vfModuleExistExpectedMessage);
+
+ Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
+
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
+ Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
+
+ assertEquals(vfModuleExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
@Test
@@ -481,10 +532,21 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.ACTIVATE);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("testVfModuleId1");
+ request.setResourceStatusMessage(vfModuleExistExpectedMessage);
+
+ Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
+
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
+ Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
+
+ assertEquals(vfModuleExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
@Test
@@ -529,10 +591,21 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("testVfModuleId1");
+ request.setResourceStatusMessage(vfModuleExistExpectedMessage);
+
+ Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
+
orchestrationStatusValidator.validateOrchestrationStatus(execution);
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
+ Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
+
+ assertEquals(vfModuleExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
@Test
@@ -568,5 +641,66 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
execution.getVariable("orchestrationStatusValidationResult"));
+
+ Mockito.verifyZeroInteractions(requestsDbClient);
+ }
+
+ @Test
+ public void test_validateOrchestrationStatusDeleteVfModuleSilentSuccess() throws Exception {
+ String flowToBeCalled = "DeleteVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult",
+ OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("DeleteVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective
+ .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
+ OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("testVfModuleId1");
+ request.setResourceStatusMessage(vfModuleNotExistExpectedMessage);
+
+ Mockito.doNothing().when(requestsDbClient).patchInfraActiveRequests(request);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ execution.getVariable("orchestrationStatusValidationResult"));
+
+ ArgumentCaptor<InfraActiveRequests> argument = ArgumentCaptor.forClass(InfraActiveRequests.class);
+ Mockito.verify(requestsDbClient).patchInfraActiveRequests(argument.capture());
+
+ assertEquals(vfModuleNotExistExpectedMessage, argument.getValue().getResourceStatusMessage());
}
}
diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml
index 3f022f55fb..76dbc1d1ab 100644
--- a/deployment-configs/src/main/resources/logger/logback-spring.xml
+++ b/deployment-configs/src/main/resources/logger/logback-spring.xml
@@ -157,6 +157,7 @@
<pattern>${debugPattern}</pattern>
</encoder>
</appender>
+
<appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>256</queueSize>
@@ -190,28 +191,29 @@
<logger name="org.springframework" level="WARN" />
<logger
name="org.springframework.security.authentication.dao.DaoAuthenticationProvider"
- level="DEBUG" />
+ level="${LOG_LEVEL:-DEBUG}" />
<!-- Camunda related loggers -->
- <logger name="org.camunda.bpm.engine.jobexecutor.level" level="DEBUG" />
+ <logger name="org.camunda.bpm.engine.jobexecutor.level" level="${LOG_LEVEL:-DEBUG}" />
<logger
name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level"
- level="DEBUG" />
+ level="${LOG_LEVEL:-DEBUG}" />
- <logger name="org.flywaydb" level="DEBUG"/>
- <logger name="org.apache.wire" level="DEBUG" />
- <logger name="org.onap" level="DEBUG" />
- <logger name="org.apache.cxf.interceptor" level="DEBUG" />
- <logger name="com.woorea.openstack.connector" level="DEBUG" />
+ <logger name="org.flywaydb" level="${LOG_LEVEL:-DEBUG}"/>
+ <logger name="org.apache.wire" level="${LOG_LEVEL:-DEBUG}" />
+ <logger name="org.onap" level="${LOG_LEVEL:-DEBUG}" />
+ <logger name="org.apache.cxf.interceptor" level="${LOG_LEVEL:-DEBUG}" />
+ <logger name="com.woorea.openstack.connector" level="${LOG_LEVEL:-DEBUG}" />
<!-- AAF Logs go here-->
<logger name="org.apache.catalina.core.ContainerBase" level="INFO" additivity="false">
<appender-ref ref="asyncCadi" />
</logger>
-
- <logger name="org.reflections.Reflections" level="ERROR" additivity="false">
- <appender-ref ref="asyncCadi" />
- </logger>
+
+ <!-- Jersey Openstack Connector Logs Go Here for Openstack4J -->
+ <logger name="os" level="${LOG_LEVEL:-DEBUG}" />
+
+ <logger name="org.reflections" level="ERROR" additivity="false" />
<logger name="AUDIT" level="INFO" additivity="false">
<appender-ref ref="asyncAudit" />
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index 4e3d8736c2..a522129c31 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -1,19 +1,29 @@
package org.onap.so.apihandlerinfra.infra.rest;
+import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.client.aai.AAIDSLQueryClient;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.DSLQuery;
+import org.onap.so.client.graphinventory.entities.DSLQueryBuilder;
+import org.onap.so.client.graphinventory.entities.DSLStartNode;
+import org.onap.so.client.graphinventory.entities.Node;
+import org.onap.so.client.graphinventory.entities.Start;
+import org.onap.so.client.graphinventory.entities.TraversalBuilder;
+import org.onap.so.client.graphinventory.entities.__;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -25,6 +35,8 @@ public class AAIDataRetrieval {
private AAIResourcesClient aaiResourcesClient;
+ private AAIDSLQueryClient aaiDslQueryClient;
+
private static final Logger logger = LoggerFactory.getLogger(AAIDataRetrieval.class);
public ServiceInstance getServiceInstance(String serviceInstanceId) {
@@ -129,6 +141,22 @@ public class AAIDataRetrieval {
});
}
+ public List<LInterface> getLinterfacesOfVnf(String vnfId) {
+ DSLStartNode startNode = new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("generic-vnf-id", vnfId));
+ DSLQueryBuilder<Start, Node> builder = TraversalBuilder.fragment(startNode)
+ .to(__.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.L_INTERFACE).output()));
+ List<LInterface> linterfaces =
+ getAAIDSLQueryClient().querySingleResource(new DSLQuery(builder.build()), LInterface.class);
+ return linterfaces;
+ }
+
+ private AAIDSLQueryClient getAAIDSLQueryClient() {
+ if (aaiDslQueryClient == null) {
+ aaiDslQueryClient = new AAIDSLQueryClient();
+ }
+ return aaiDslQueryClient;
+ }
+
protected AAIResourcesClient getAaiResourcesClient() {
if (aaiResourcesClient == null) {
aaiResourcesClient = new AAIResourcesClient();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
index 0c7ba65cf4..61f757ba64 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
@@ -6,11 +6,10 @@ import java.util.regex.Pattern;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
-import org.onap.so.listener.Skip;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.beans.factory.annotation.Autowired;
-@Skip
+
public class ServiceInstanceDeleteValidator implements RequestValidator {
@Autowired
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
index 750fa13c77..49fce7608b 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -69,10 +69,10 @@ public class InfraActiveRequests extends InfraRequests {
@Override
public String toString() {
return new ToStringBuilder(this).append("requestId", getRequestId()).append("requestStatus", getRequestStatus())
- .append("statusMessage", getStatusMessage()).append("progress", getProgress())
- .append("startTime", getStartTime()).append("endTime", getEndTime()).append("source", getSource())
- .append("vnfId", getVnfId()).append("vnfName", getVnfName()).append("vnfType", getVnfType())
- .append("pnfName", getPnfName()).append("serviceType", getServiceType())
+ .append("statusMessage", getStatusMessage()).append("resourceStatusMessage", getResourceStatusMessage())
+ .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
+ .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
+ .append("vnfType", getVnfType()).append("pnfName", getPnfName()).append("serviceType", getServiceType())
.append("tenantId", getTenantId()).append("vnfParams", getVnfParams())
.append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
.append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
index 4fd28c910e..74f58a210c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
@@ -21,24 +21,30 @@
package org.onap.so.db.catalog.beans;
public enum ResourceType {
- SERVICE("Service"),
- VNF("Vnf"),
- VOLUME_GROUP("VolumeGroup"),
- VF_MODULE("VfModule"),
- NETWORK("Network"),
- NETWORK_COLLECTION("NetworkCollection"),
- CONFIGURATION("Configuration"),
- INSTANCE_GROUP("InstanceGroup"),
- NO_VALIDATE("NoValidate");
+ SERVICE("Service", "SERVICE_INSTANCE_ID"),
+ VNF("Vnf", "GENERIC_VNF_ID"),
+ VOLUME_GROUP("VolumeGroup", "VOLUME_GROUP_ID"),
+ VF_MODULE("VfModule", "VF_MODULE_ID"),
+ NETWORK("Network", "NETWORK_ID"),
+ NETWORK_COLLECTION("NetworkCollection", "NETWORK_COLLECTION_ID"),
+ CONFIGURATION("Configuration", "CONFIGURATION_ID"),
+ INSTANCE_GROUP("InstanceGroup", "INSTANCE_GROUP_ID"),
+ NO_VALIDATE("NoValidate", "");
private final String name;
+ private final String resourceKey;
- private ResourceType(String name) {
+ private ResourceType(String name, String resourceKey) {
this.name = name;
+ this.resourceKey = resourceKey;
}
@Override
public String toString() {
return name;
}
+
+ public String getResourceKey() {
+ return resourceKey;
+ }
}
diff --git a/pom.xml b/pom.xml
index 83450c0c1b..6fd89b102f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
<sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
<jacoco.version>0.8.5</jacoco.version>
<org.apache.maven.user-settings />
- <openstack.version>1.5.2-SNAPSHOT</openstack.version>
+ <openstack.version>1.6.1-SNAPSHOT</openstack.version>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
<originalClassifier>original</originalClassifier>
<docker.skip>true</docker.skip>