aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-20 16:10:18 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-21 14:40:34 -0500
commit63bee11f255fcd2cc39a3d87c208aa6e517a8f85 (patch)
treed7b13599feffd4cc2cfd9836e83385c32869b448
parent9756b9992858a5f513953f1d16b4d9b396a8397a (diff)
Bug fixes from AT&T January 20th
sorted vfmodules by base last for negative action reqs store Response in execution as String on network delete added functionality to skip rollback based on flag # Conflicts: # bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflo w/tasks/WorkflowAction.java require XML in the header for delete network request Update APP-C LCM Client library version to 1.7.0. replaced wiremock style test with mockito test Handle AAIClient Exps in CreateCustomerV1 getServiceInstance() changed default status code to be configurable Replace vnfType by nfRole in the healthcheck request to SDNO. updated error messages in sdnc handler and flow status updated flow status message on completion of flow Send GenericVnf object for AAI VNF update for vnf-api updates Add a JUnit test file for SDNOValidatorImpl.java Set nodeType on the inner SDNO request as per update from SDNO. updated rollbackToAssigned logic to remove unassign flows updated sdnc handler error message for client error added exception handling for httpclienterror in sdnc out map workflow exception so error is reported throws sdnc error message on bad response from sdnc add catalog entries for TRANSPORT service delete flows change script number that was duplicate add find method to NorthBoundRequestRepository include serviceType in hash code use asterisk for all non-TRANSPORT flow db entries alacart true, rm not needed transport srvc model steps correct insert query syntax for orchestration_flow support serviceType (TRANSPORT) process flow fix SDNCAdapterException causing no callback to bpmn use JsonAlias for alternate case when deserializing GRM client will accept both "serviceEndPointList" and "ServiceEndPointList" root node in the JSON response. AAIRestClient now uses getSystemName in headers finishtime should not be returned in requeststatus Change-Id: I81a185252b057020f7f36f125c85c3357756da88 Issue-ID: SO-1403 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.2__AddServiceTypeColumnToNorthBoundRequest.sql7
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java10
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java10
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java12
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java11
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Request.java19
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java9
-rw-r--r--common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java24
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java57
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java2
-rw-r--r--common/src/test/resources/__files/grm/endpoints2.json145
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/endpoints2.json145
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java18
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java18
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java1
36 files changed, 619 insertions, 144 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.2__AddServiceTypeColumnToNorthBoundRequest.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.2__AddServiceTypeColumnToNorthBoundRequest.sql
new file mode 100644
index 0000000000..1ead94cd9c
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.2__AddServiceTypeColumnToNorthBoundRequest.sql
@@ -0,0 +1,7 @@
+use catalogdb;
+
+ALTER TABLE northbound_request_ref_lookup ADD COLUMN SERVICE_TYPE varchar(200) NULL;
+ALTER TABLE northbound_request_ref_lookup
+ DROP INDEX UK_northbound_request_ref_lookup;
+ALTER TABLE northbound_request_ref_lookup
+ADD UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC, `MACRO_ACTION` ASC, `CLOUD_OWNER` ASC, `SERVICE_TYPE` ASC); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 98d1917050..9eb3daa5ae 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -211,9 +211,15 @@ VALUES
('volumeGroup', 'createInstance', '1', 'Gr api recipe to create volume-group', '/mso/async/services/WorkflowActionBB', 180, '20c4431c-246d-11e7-93ae-92361f002671');
-INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER) VALUES
-('Service-Create', 'createInstance', 'Service', true, '7','7', 'my-custom-cloud-owner');
+INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER, SERVICE_TYPE) VALUES
+('Service-Create', 'createInstance', 'Service', true, '7','7', 'my-custom-cloud-owner','*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'my-custom-cloud-owner'));
+
+INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER, SERVICE_TYPE) VALUES
+('Service-Create', 'createInstance', 'Service', true, '7','7', 'my-custom-cloud-owner','TRANSPORT');
+
+INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
+('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'my-custom-cloud-owner' and SERVICE_TYPE = 'TRANSPORT'));
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index 270b1bd99c..deb39ac54e 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -60,7 +60,7 @@ public class SDNCServiceRequestTask {
private BPRestCallback bpRestCallback;
@Async
- public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix) throws SDNCAdapterException
+ public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix)
{
MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId);
MsoLogger.setServiceName(getClass().getSimpleName());
@@ -71,7 +71,13 @@ public class SDNCServiceRequestTask {
TypedRequestTunables rt = new TypedRequestTunables(sdncRequestId, myUrlSuffix);
rt.setServiceKey(sdncService, sdncOperation);
- TypedRequestTunables mappedTunables = mapTunables.setTunables(rt);
+ TypedRequestTunables mappedTunables;
+ try {
+ mappedTunables = mapTunables.setTunables(rt);
+ } catch(SDNCAdapterException e) {
+ bpRestCallback.send(request.getBPNotificationUrl(), e.getMessage());
+ return;
+ }
if (!mappedTunables.getError().isEmpty()) {
// Note that the error was logged and alarmed by setTunables()
SDNCServiceError error = new SDNCServiceError(request.getSdncRequestId(),
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index 934aea8241..abf53f96f5 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -308,7 +308,7 @@
<dependency>
<groupId>org.onap.appc.client</groupId>
<artifactId>client-lib</artifactId>
- <version>1.3.0</version>
+ <version>1.4.4</version>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
@@ -327,7 +327,7 @@
<dependency>
<groupId>org.onap.appc.client</groupId>
<artifactId>client-kit</artifactId>
- <version>1.3.0</version>
+ <version>1.4.4</version>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 9e71313e09..57af763ed5 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -20,8 +20,6 @@
package org.onap.so.bpmn.common.scripts;
-import groovy.json.JsonSlurper
-
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.camunda.bpm.engine.variable.VariableMap
@@ -30,11 +28,13 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats
import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder
-import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIResourcesClient
import org.springframework.web.util.UriUtils
+import groovy.json.JsonSlurper
+
public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
public MsoUtils utils = new MsoUtils()
@@ -767,4 +767,4 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
public AAIResourcesClient getAAIClient(){
return new AAIResourcesClient();
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index 9fd16340b6..f96e3bea0e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -174,7 +174,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId')
String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion')
- String personaModelVersionEntry = ""
+ String personaModelVersionEntry = null
if (newPersonaModelId != null || newPersonaModelVersion != null) {
if (newPersonaModelId != genericVnf.getModelInvariantId()) {
def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
@@ -188,7 +188,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Handle ipv4-oam-address
String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress')
- String ipv4OamAddressEntry = ""
+ String ipv4OamAddressEntry = null
if (ipv4OamAddress != null) {
// Construct payload
ipv4OamAddressEntry = updateGenericVnfNode(origRequest, 'ipv4-oam-address')
@@ -196,7 +196,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Handle management-v6-address
String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address')
- String managementV6AddressEntry = ""
+ String managementV6AddressEntry = null
if (managementV6Address != null) {
// Construct payload
managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address')
@@ -204,21 +204,19 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Handle orchestration-status
String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus')
- String orchestrationStatusEntry = ""
+ String orchestrationStatusEntry = null
if (orchestrationStatus != null) {
// Construct payload
orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status')
}
-
- String payload = """
- { ${personaModelVersionEntry}
- ${ipv4OamAddressEntry}
- ${managementV6AddressEntry}
- ${orchestrationStatusEntry}
- "vnf-id": "${vnfId}"
- }
- """
-
+
+ org.onap.aai.domain.yang.GenericVnf payload = new org.onap.aai.domain.yang.GenericVnf();
+ payload.setVnfId(vnfId)
+ payload.setPersonaModelVersion(personaModelVersionEntry)
+ payload.setIpv4OamAddress(ipv4OamAddressEntry)
+ payload.setManagementV6Address(managementV6AddressEntry)
+ payload.setOrchestrationStatus(orchestrationStatusEntry)
+
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
try {
@@ -246,16 +244,16 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
public String updateGenericVnfNode(String origRequest, String elementName) {
if (!utils.nodeExists(origRequest, elementName)) {
- return ""
+ return null
}
def elementValue = utils.getNodeText(origRequest, elementName)
if (elementValue == 'DELETE') {
- // Set the element being deleted to null
- return """"${elementName}": null,"""
+ // Set the element being deleted to empty string
+ return ""
}
else {
- return """"${elementName}": "${elementValue}","""
+ return elementValue
}
}
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 6c2df13c61..d2e0b07dd1 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
@@ -53,6 +53,7 @@ public class ExecuteBuildingBlockRainyDay {
@Autowired
private Environment environment;
protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier";
+ protected String defaultCode = "mso.rainyDay.defaultCode";
public void setRetryTimer(DelegateExecution execution) {
try {
@@ -149,7 +150,8 @@ public class ExecuteBuildingBlockRainyDay {
execution.setVariable(HANDLING_CODE, handlingCode);
} catch (Exception e) {
msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort");
- execution.setVariable(HANDLING_CODE, "Abort");
+ String code = this.environment.getProperty(defaultCode);
+ execution.setVariable(HANDLING_CODE, code);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index 9af9b2f2c9..cb5683dcc8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
index 1651f4f1fc..18f94f3b88 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
@@ -110,6 +110,7 @@ mso:
rollback: 'true'
rainyDay:
retryDurationMultiplier: '2'
+ defaultCode: Abort
site-name: localDevEnv
workflow:
default:
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 38a1ccdf35..70ae02b0fe 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
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -22,6 +22,7 @@
<camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" />
<camunda:out source="RetryDuration" target="RetryDuration" />
<camunda:in source="suppressRollback" target="suppressRollback" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
index c95704e51a..67fbb97797 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
@@ -451,10 +451,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
URL url = new URL(vnfAdapterUrl)
HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
+ httpClient.accept = "application/xml"
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(vnfAdapterRequest)
-
+ execution.setVariable(Prefix + "deleteNetworkResponse", response.readEntity(String.class))
execution.setVariable(Prefix + "networkReturnCode", response.getStatus())
} catch (Exception ex) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 173d5f7e73..a4ef28496e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
@@ -31,6 +30,7 @@ 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;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathNotFoundException;
@@ -64,15 +64,18 @@ public class SDNCRequestTasks {
String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
} catch(PathNotFoundException e) {
- logger.error("Error Parsing SDNC Response", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Error Parsing SDNC Response");
+ logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Recieved invalid response from SDNC, unable to read message content.");
} catch (MapperException e) {
- logger.error("Error Parsing SDNC Response", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Error Parsing SDNC Response");
+ logger.error("Failed to map SDNC object to JSON prior to POST.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Failed to map SDNC object to JSON prior to POST.");
} catch (BadResponseException e) {
- logger.error("Error Reading SDNC Response", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error Reading SDNC Response");
- }
+ logger.error("Did not receive a successful response from SDNC.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
+ } catch (HttpClientErrorException e){
+ logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
+ }
}
public void processCallback (DelegateExecution execution) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 50f2091ae2..d18fd006f4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -109,7 +109,9 @@ public class WorkflowAction {
private static final String USERPARAMSERVICE = "service";
private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances";
private static final String HOMINGSOLUTION = "Homing_Solution";
- private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String G_SERVICE_TYPE = "serviceType";
+ private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
@Autowired
@@ -146,6 +148,8 @@ public class WorkflowAction {
final String uri = (String) execution.getVariable(G_URI);
final String vnfType = (String) execution.getVariable(VNF_TYPE);
String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ final String serviceType = Optional.ofNullable((String) execution.getVariable(G_SERVICE_TYPE)).orElse("");
+
List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
@@ -192,7 +196,7 @@ public class WorkflowAction {
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner);
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
orchFlows = filterOrchFlows(orchFlows, resourceType, execution);
String key = "";
@@ -277,7 +281,7 @@ public class WorkflowAction {
logger.info("Found {}", foundObjects);
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner);
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId,
resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails);
@@ -1054,9 +1058,21 @@ public class WorkflowAction {
protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
+ return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
+ }
+
+ protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
+ WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
List<OrchestrationFlow> listToExecute = new ArrayList<>();
- NorthBoundRequest northBoundRequest = catalogDbClient
- .getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(requestAction, resourceName.toString(), aLaCarte, cloudOwner);
+ NorthBoundRequest northBoundRequest = null;
+ if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
+ northBoundRequest = catalogDbClient
+ .getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(requestAction,
+ resourceName.toString(), aLaCarte, cloudOwner, serviceType);
+ } else {
+ northBoundRequest = catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(
+ requestAction, resourceName.toString(), aLaCarte, cloudOwner);
+ }
if(northBoundRequest == null){
if(aLaCarte){
buildAndThrowException(execution,"The request: ALaCarte " + resourceName + " " + requestAction + " is not supported by GR_API.");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index 4fb480892a..1812e50328 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -25,6 +25,7 @@ import java.util.Optional;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.slf4j.Logger;
@@ -67,7 +68,7 @@ public class WorkflowActionBBFailure {
String errorMsg = "";
Boolean rollbackCompletedSuccessfully = (Boolean) execution.getVariable("isRollbackComplete");
Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
-
+ ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
if(rollbackCompletedSuccessfully==null)
rollbackCompletedSuccessfully = false;
@@ -97,6 +98,17 @@ public class WorkflowActionBBFailure {
request.setStatusMessage(errorMsg);
execution.setVariable("ErrorMessage", errorMsg);
}
+ if(ebb!=null && ebb.getBuildingBlock()!=null){
+ String flowStatus = "";
+ if(rollbackCompletedSuccessfully){
+ flowStatus = "All Rollback flows have completed successfully";
+ }else{
+ flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
+ }
+ request.setFlowStatus(flowStatus);
+ execution.setVariable("flowStatus", flowStatus);
+ }
+
request.setProgress(Long.valueOf(100));
request.setRequestStatus("FAILED");
request.setLastModifiedBy("CamundaBPMN");
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 917039b17b..78a84b1772 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
@@ -199,6 +199,7 @@ public class WorkflowActionBBTasks {
execution.setVariable("finalStatusMessage", macroAction);
Timestamp endTime = new Timestamp(System.currentTimeMillis());
request.setEndTime(endTime);
+ request.setFlowStatus("Successfully completed all Building Blocks");
request.setStatusMessage(macroAction);
request.setProgress(Long.valueOf(100));
request.setRequestStatus("COMPLETE");
@@ -269,7 +270,7 @@ public class WorkflowActionBBTasks {
int flowSize = rollbackFlows.size();
String handlingCode = (String) execution.getVariable("handlingCode");
if(handlingCode.equals("RollbackToAssigned")){
- for(int i = 0; i<flowSize -1; i++){
+ for(int i = 0; i<flowSize; i++){
if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")){
rollbackFlows.remove(i);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 7d92a5304a..7ad2ef00b2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -21,7 +21,6 @@
package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
-import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
@@ -36,9 +35,6 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
public class SDNCClient {
@@ -49,6 +45,7 @@ public class SDNCClient {
private SDNCProperties properties;
@Autowired
private SdnCommonTasks sdnCommonTasks;
+
/**
*
* @param request
@@ -59,13 +56,13 @@ public class SDNCClient {
* @throws BadResponseException
*/
public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNResponse(output);
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNResponse(output);
}
@@ -76,9 +73,8 @@ public class SDNCClient {
STOClient.setHttpHeader(httpHeader);
LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
return sdnCommonTasks.validateSDNResponse(output);
-}
+ }
-
/**
*
* @param queryLink
@@ -90,15 +86,14 @@ public class SDNCClient {
* @throws BadResponseException
*/
public String get(String queryLink) throws MapperException, BadResponseException {
-
- String request = "";
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNGetResponse(output);
+ String request = "";
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNGetResponse(output);
}
}
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 5c1485979e..f3b094f645 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
@@ -21,9 +21,9 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
@@ -258,33 +258,28 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
BuildingBlock bb1 = new BuildingBlock();
- bb1.setBpmnFlowName("AssignServiceInstanceBB");
+ bb1.setBpmnFlowName("AssignVfModuleBB");
ebb1.setBuildingBlock(bb1);
flowsToExecute.add(ebb1);
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
BuildingBlock bb2 = new BuildingBlock();
- bb2.setBpmnFlowName("CreateNetworkCollectionBB");
+ bb2.setBpmnFlowName("CreateVfModuleBB");
ebb2.setBuildingBlock(bb2);
flowsToExecute.add(ebb2);
ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
BuildingBlock bb3 = new BuildingBlock();
- bb3.setBpmnFlowName("AssignNetworkBB");
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
ebb3.setBuildingBlock(bb3);
flowsToExecute.add(ebb3);
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- BuildingBlock bb4 = new BuildingBlock();
- bb4.setBpmnFlowName("CreateNetworkBB");
- ebb4.setBuildingBlock(bb4);
- flowsToExecute.add(ebb4);
execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("gCurrentSequence", 3);
- doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
-
+ execution.setVariable("gCurrentSequence", 2);
+
workflowActionBBTasks.rollbackExecutionPath(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB");
+ assertEquals("DeleteVfModuleBB",ebbs.get(0).getBuildingBlock().getBpmnFlowName());
assertEquals(0,execution.getVariable("gCurrentSequence"));
+ assertEquals(1,ebbs.size());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 72f0ce4e6d..7b348c8cb3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -982,6 +982,17 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals(flows.get(8).getFlowName(),"SDNOVnfHealthCheckBB");
assertEquals(flows.get(9).getFlowName(),"AAIUnsetVnfInMaintBB");
}
+
+ @Test
+ public void queryNorthBoundRequestCatalogDbTransportTest() throws MalformedURLException {
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType("createInstance","Service",true,"my-custom-cloud-owner","TRANSPORT")).thenReturn(northBoundRequest);
+
+ List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "createInstance", WorkflowType.SERVICE, true,"my-custom-cloud-owner","TRANSPORT");
+ assertEquals(flows.get(0).getFlowName(),"AssignServiceInstanceBB");
+ }
@Test
public void extractResourceIdAndTypeFromUriTest(){
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 4008240203..297d75a104 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -144,7 +144,7 @@ public class WorkflowActionUnitTest {
flow.setFlowName("flow x");
List<OrchestrationFlow> flows = Arrays.asList(flow);
- doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any());
+ doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any(), any());
workflowAction.selectExecutionList(execution);
verify(workflowAction, times(1)).filterOrchFlows(eq(flows), any(), any());
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
index ac6e939e9e..4f235c35f1 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -20,25 +20,17 @@
package org.onap.so.client.aai;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-
import java.net.URI;
-import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.regex.Pattern;
import javax.ws.rs.core.Response;
import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.RestClientSSL;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
import org.onap.so.client.policy.CommonObjectMapperProvider;
-import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.utils.TargetEntity;
-import com.fasterxml.jackson.core.JsonProcessingException;
-
public class AAIRestClient extends RestClientSSL {
private final AAIProperties aaiProperties;
@@ -58,7 +50,7 @@ public class AAIRestClient extends RestClientSSL {
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("X-FromAppId", "MSO");
+ headerMap.put("X-FromAppId", aaiProperties.getSystemName());
headerMap.put("X-TransactionId", requestId);
String auth = aaiProperties.getAuth();
String key = aaiProperties.getKey();
diff --git a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
index 19bbe69cf2..2b7a81d590 100644
--- a/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
@@ -22,27 +22,21 @@ package org.onap.so.client.grm.beans;
import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({ "serviceEndPointList" })
+//@JsonIgnoreProperties(ignoreUnknown = true)
public class ServiceEndPointList {
- @JsonProperty("serviceEndPointList")
+ @JsonAlias("ServiceEndPointList")
private List<ServiceEndPoint> serviceEndPointList = null;
- @JsonProperty("serviceEndPointList")
public List<ServiceEndPoint> getServiceEndPointList() {
return serviceEndPointList;
}
- @JsonProperty("serviceEndPointList")
public void setServiceEndPointList(List<ServiceEndPoint> serviceEndPointList) {
this.serviceEndPointList = serviceEndPointList;
}
-
}
diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
index 5951928bf4..882a390c7b 100644
--- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
@@ -77,17 +77,17 @@ public class SDNOValidatorImpl implements SDNOValidator {
protected SDNO buildRequestDiagnostic(GenericVnf vnf, UUID uuid, String requestingUserId) {
- Optional<String> vnfType;
- if (vnf.getVnfType() == null) {
- vnfType = Optional.empty();
+ Optional<String> nfRole;
+ if (vnf.getNfRole() == null) {
+ nfRole = Optional.empty();
} else {
- vnfType = Optional.of(vnf.getVnfType());
+ nfRole = Optional.of(vnf.getNfRole());
}
Input input = new Input();
SDNO parentRequest = new SDNO();
Body body = new Body();
parentRequest.setBody(body);
- parentRequest.setNodeType(vnfType.orElse("NONE").toUpperCase());
+ parentRequest.setNodeType(nfRole.orElse("NONE").toUpperCase());
parentRequest.setOperation("health-diagnostic");
body.setInput(input);
@@ -97,6 +97,7 @@ public class SDNOValidatorImpl implements SDNOValidator {
request.setRequestClientName(clientName);
request.setRequestNodeName(vnf.getVnfName());
request.setRequestNodeUuid(vnf.getVnfId());
+ request.setRequestNodeType(nfRole.orElse("NONE").toUpperCase());
request.setRequestNodeIp(vnf.getIpv4OamAddress()); //generic-vnf oam ip
request.setRequestUserId(requestingUserId); //mech id?
request.setRequestId(uuid.toString()); //something to identify this request by for polling
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
index 8e7e5e945e..d39efddf43 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
@@ -22,6 +22,8 @@ package org.onap.so.serviceinstancebeans;
import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -31,6 +33,7 @@ public class Request {
protected String requestId;
protected String startTime;
+ protected String finishTime;
protected String requestScope;
protected String requestType;
protected RequestDetails requestDetails;
@@ -51,6 +54,12 @@ public class Request {
public void setStartTime(String startTime) {
this.startTime = startTime;
}
+ public String getFinishTime() {
+ return finishTime;
+ }
+ public void setFinishTime(String finishTime) {
+ this.finishTime = finishTime;
+ }
public String getRequestScope() {
return requestScope;
}
@@ -89,11 +98,9 @@ public class Request {
}
@Override
public String toString() {
- return "Request [requestId=" + requestId + ", startTime=" + startTime
- + ", requestScope=" + requestScope + ", requestType=" + requestType
- + ", requestDetails=" + requestDetails + ", instanceReferences=" + instanceReferences
- + ", requestStatus=" + requestStatus + ", requestProcessingData=" + requestProcessingData + "]";
+ return new ToStringBuilder(this).append("requestId", requestId).append("startTime", startTime)
+ .append("finishTime", finishTime).append("requestScope", requestScope).append("requestType", requestType)
+ .append("requestDetails", requestDetails).append("instanceReferences", instanceReferences)
+ .append("requestStatus", requestStatus).append("requestProcessingData", requestProcessingData).toString();
}
-
-
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index 8adce38ada..4c3597b2c1 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
@@ -30,7 +30,6 @@ public class RequestStatus {
protected String requestState;
protected String statusMessage;
protected Integer percentProgress;
- protected String finishTime;
protected String timeStamp;
@@ -52,12 +51,6 @@ public class RequestStatus {
public void setPercentProgress(Integer percentProgress) {
this.percentProgress = percentProgress;
}
- public String getFinishTime() {
- return finishTime;
- }
- public void setFinishTime(String finishTime) {
- this.finishTime = finishTime;
- }
public String getTimeStamp() {
return timeStamp;
}
@@ -67,6 +60,6 @@ public class RequestStatus {
@Override
public String toString() {
return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
- .append("percentProgress", percentProgress).append("finishTime", finishTime).append("timeStamp", timeStamp).toString();
+ .append("percentProgress", percentProgress).append("timeStamp", timeStamp).toString();
}
}
diff --git a/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
index a1fb43ea5e..d0d0e6701b 100644
--- a/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
@@ -58,6 +58,30 @@ public class ServiceEndPointListTest {
assertEquals("DEV", se.getProperties().get(0).getValue());
}
+ @Test
+ public void testUnmarshallServiceEndpointListStartsWithUppercase() throws Exception {
+ String endpointsJson = getFileContentsAsString("__files/grm/endpoints2.json");
+ ServiceEndPointList sel = mapper.readValue(endpointsJson, ServiceEndPointList.class);
+
+ List<ServiceEndPoint> list = sel.getServiceEndPointList();
+ ServiceEndPoint se = list.get(0);
+
+ assertEquals(3, list.size());
+ assertEquals("dummy.pod.ns.dummy-pod3", se.getName());
+ assertEquals(Integer.valueOf(1), Integer.valueOf(se.getVersion().getMajor()));
+ assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getMinor()));
+ assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getPatch()));
+ assertEquals("192.168.120.218", se.getHostAddress());
+ assertEquals("32004", se.getListenPort());
+ assertEquals("37.7022", se.getLatitude());
+ assertEquals("121.9358", se.getLongitude());
+ assertEquals("/", se.getContextPath());
+ assertEquals("edge", se.getOperationalInfo().getCreatedBy());
+ assertEquals("edge", se.getOperationalInfo().getUpdatedBy());
+ assertEquals("Environment", se.getProperties().get(0).getName());
+ assertEquals("DEV", se.getProperties().get(0).getValue());
+ }
+
protected String getFileContentsAsString(String fileName) {
String content = "";
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
new file mode 100644
index 0000000000..79ce196bd3
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdno;
+
+import static org.junit.Assert.assertEquals;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.client.sdno.beans.RequestHealthDiagnostic;
+import org.onap.so.client.sdno.beans.SDNO;
+
+public class SDNOValidatorImplTest {
+
+ @Test
+ public void buildRequestDiagnosticTest() throws Exception {
+ SDNOValidatorImpl validator = new SDNOValidatorImpl();
+ UUID uuid = UUID.randomUUID();
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfName("VNFNAME");
+ vnf.setVnfId("test");
+ vnf.setIpv4OamAddress("1.2.3.4");
+ vnf.setNfRole("VPE");
+ SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
+ assertEquals(request.getNodeType(), "VPE");
+ assertEquals(request.getOperation(), "health-diagnostic");
+
+ RequestHealthDiagnostic innerRequest = request.getBody().getInput().getRequestHealthDiagnostic();
+ assertEquals(innerRequest.getRequestClientName(), "MSO");
+ assertEquals(innerRequest.getRequestNodeName(), "VNFNAME");
+ assertEquals(innerRequest.getRequestNodeUuid(), "test");
+ assertEquals(innerRequest.getRequestNodeType(), "VPE");
+ assertEquals(innerRequest.getRequestNodeIp(), "1.2.3.4");
+ assertEquals(innerRequest.getRequestUserId(), "mechid");
+ assertEquals(innerRequest.getRequestId(), uuid.toString());
+ assertEquals(innerRequest.getHealthDiagnosticCode(), "default");
+
+ }
+}
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
index d66f5f64f7..9794c9b622 100644
--- a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
@@ -100,7 +100,7 @@ public class SDNOValidatorTest {
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("test");
vnf.setIpv4OamAddress("1.2.3.4");
- vnf.setVnfType("VPE");
+ vnf.setNfRole("VPE");
SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(request);
diff --git a/common/src/test/resources/__files/grm/endpoints2.json b/common/src/test/resources/__files/grm/endpoints2.json
new file mode 100644
index 0000000000..7c9816ff55
--- /dev/null
+++ b/common/src/test/resources/__files/grm/endpoints2.json
@@ -0,0 +1,145 @@
+{
+ "ServiceEndPointList": [
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.218",
+ "listenPort": "32004",
+ "latitude": "37.7022",
+ "longitude": "121.9358",
+ "registrationTime": "2017-07-18T15:39:17.367+0000",
+ "expirationTime": "9999-10-09T15:39:17.368+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.367+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.367+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.22",
+ "listenPort": "32004",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:17.816+0000",
+ "expirationTime": "9999-10-09T15:39:17.817+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.816+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.816+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod1",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.218",
+ "listenPort": "32002",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:14.443+0000",
+ "expirationTime": "9999-10-09T15:39:14.453+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:14.443+0000",
+ "updatedTimestamp": "2017-07-18T15:39:14.443+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ }
+ ]
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index 7ee8654013..b65b82a87d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -333,6 +333,10 @@ public class OrchestrationRequests {
String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getStartTime()) + " GMT";
request.setStartTime(startTimeStamp);
}
+ if(iar.getEndTime() != null){
+ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getEndTime()) + " GMT";
+ request.setFinishTime(endTimeStamp);
+ }
String statusMessages = null;
RequestStatus status = new RequestStatus();
if(iar.getStatusMessage() != null){
@@ -362,10 +366,6 @@ public class OrchestrationRequests {
if(statusMessages != null){
status.setStatusMessage(statusMessages);
}
- if(iar.getEndTime() != null){
- String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getEndTime()) + " GMT";
- status.setFinishTime(endTimeStamp);
- }
if(iar.getModifyTime() != null){
String timeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getModifyTime()) + " GMT";
status.setTimeStamp(timeStamp);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index 4a6a59bebb..28797d247b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -31,6 +31,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.io.IOException;
@@ -118,13 +119,14 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
assertThat(response.getBody(),
- sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.requestStatus.finishTime")
+ sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime")
.ignoring("request.requestStatus.timeStamp"));
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
assertEquals("00032ab7-na18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
+ assertNotNull(response.getBody().getRequest().getFinishTime());
}
@Test
@@ -149,8 +151,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
assertThat(response.getBody(),
- sameBeanAs(testResponse).ignoring("request.startTime")
- .ignoring("request.requestStatus.finishTime")
+ sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime")
.ignoring("request.requestStatus.timeStamp"));
}
@@ -177,8 +178,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
assertThat(response.getBody(),
- sameBeanAs(testResponse).ignoring("request.startTime")
- .ignoring("request.requestStatus.finishTime")
+ sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime")
.ignoring("request.requestStatus.timeStamp"));
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
@@ -227,8 +227,7 @@ public class OrchestrationRequestsTest extends BaseTest {
ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
HttpMethod.GET, entity, GetOrchestrationListResponse.class);
assertThat(response.getBody(),
- sameBeanAs(testResponse).ignoring("requestList.request.startTime")
- .ignoring("requestList.request.requestStatus.finishTime")
+ sameBeanAs(testResponse).ignoring("requestList.request.startTime").ignoring("requestList.request.finishTime")
.ignoring("requestList.request.requestStatus.timeStamp"));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
assertEquals(requests.size(), response.getBody().getRequestList().size());
@@ -482,4 +481,4 @@ public class OrchestrationRequestsTest extends BaseTest {
.withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
.withStatus(HttpStatus.SC_OK)));
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
index 809e39c772..100bc82f7a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
@@ -52,6 +52,7 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
private CloudOrchestrationRequest request;
private ServiceEndPointList serviceEndpoints;
+ private ServiceEndPointList serviceEndpoints2;
@Autowired
private CreateVnfOperationalEnvironment createVnfOpEnv;
@@ -63,6 +64,8 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
request = mapper.readValue(jsonRequest, CloudOrchestrationRequest.class);
String jsonServiceEndpoints = getFileContentsAsString("__files/vnfoperenv/endpoints.json");
serviceEndpoints = mapper.readValue(jsonServiceEndpoints, ServiceEndPointList.class);
+ String jsonServiceEndpoints2 = getFileContentsAsString("__files/vnfoperenv/endpoints2.json");
+ serviceEndpoints2 = mapper.readValue(jsonServiceEndpoints2, ServiceEndPointList.class);
}
@Test
public void testGetEcompManagingEnvironmentId() throws Exception {
@@ -83,6 +86,13 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
assertEquals("DEV", createVnfOpEnv.getEnvironmentName(props));
}
+ @Test
+ public void testGetEnvironmentNameEndpointListBeginWithUpperCase() {
+ createVnfOpEnv.setRequest(request);
+ List<Property> props = serviceEndpoints2.getServiceEndPointList().get(0).getProperties();
+ assertEquals("DEV", createVnfOpEnv.getEnvironmentName(props));
+ }
+
@Test
public void testBuildServiceNameForVnf() throws Exception {
createVnfOpEnv.setRequest(request);
@@ -141,4 +151,34 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
.withStatus(HttpStatus.SC_OK)));
createVnfOpEnv.execute(requestId, request);
}
+
+ @Test
+ public void testExecuteEndpointsListBeginWithUppercase() throws ApiException, JsonProcessingException {
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/findRunning"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/endpoints2.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/add"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ String requestId = UUID.randomUUID().toString();
+ InfraActiveRequests iar = new InfraActiveRequests();
+ iar.setRequestId(requestId);
+ iar.setOperationalEnvName("myOpEnv");
+ iar.setRequestScope("create");
+ iar.setRequestStatus("PENDING");
+ iar.setRequestAction("UNKNOWN");
+ ObjectMapper mapper = new ObjectMapper();
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+ createVnfOpEnv.execute(requestId, request);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
index 50654524f1..dde4392c38 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
@@ -29,7 +29,6 @@
"requestState": "COMPLETE",
"statusMessage": "STATUS: COMPLETED",
"percentProgress": 100,
- "finishTime": "Tue, 02 May 2017 06:33:34 GMT",
"timeStamp": "Fri, 01 Jul 2016 04:41:42 GMT"
}
}
@@ -64,7 +63,6 @@
"requestState": "COMPLETE",
"statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress": 100,
- "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT",
"timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
}
@@ -99,7 +97,6 @@
"requestState": "PENDING",
"statusMessage": "STATUS: Vf Module deletion pending.",
"percentProgress": 0,
- "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT",
"timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
}
@@ -184,7 +181,6 @@
"requestState": "UNLOCKED",
"statusMessage": "STATUS: Vf Module deletion pending.",
"percentProgress": 0,
- "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT",
"timeStamp": "Mon, 30 Jul 2018 06:09:01 GMT"
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/endpoints2.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/endpoints2.json
new file mode 100644
index 0000000000..7c9816ff55
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/endpoints2.json
@@ -0,0 +1,145 @@
+{
+ "ServiceEndPointList": [
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.218",
+ "listenPort": "32004",
+ "latitude": "37.7022",
+ "longitude": "121.9358",
+ "registrationTime": "2017-07-18T15:39:17.367+0000",
+ "expirationTime": "9999-10-09T15:39:17.368+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.367+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.367+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.22",
+ "listenPort": "32004",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:17.816+0000",
+ "expirationTime": "9999-10-09T15:39:17.817+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.816+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.816+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod1",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.218",
+ "listenPort": "32002",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:14.443+0000",
+ "expirationTime": "9999-10-09T15:39:14.453+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:14.443+0000",
+ "updatedTimestamp": "2017-07-18T15:39:14.443+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ }
+ ]
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java
index a7ce2da70d..4025e348f8 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java
@@ -87,6 +87,10 @@ public class NorthBoundRequest implements Serializable {
@Column(name = "CLOUD_OWNER")
private String cloudOwner;
+ @BusinessKey
+ @Column(name = "SERVICE_TYPE")
+ private String serviceType;
+
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "northBoundRequest")
private List<OrchestrationFlow> orchestrationFlowList;
@@ -95,7 +99,7 @@ public class NorthBoundRequest implements Serializable {
return new ToStringBuilder(this).append("id", id).append("action", action).append("requestScope", requestScope)
.append("isAlacarte", isAlacarte).append("isToplevelflow", isToplevelflow)
.append("minApiVersion", minApiVersion).append("maxApiVersion", maxApiVersion)
- .append("cloudOwner",cloudOwner).toString();
+ .append("cloudOwner",cloudOwner).append("serviceType",serviceType).toString();
}
@Override
@@ -107,14 +111,14 @@ public class NorthBoundRequest implements Serializable {
return new EqualsBuilder().append(action, castOther.action).append(requestScope, castOther.requestScope)
.append(isAlacarte, castOther.isAlacarte).append(isToplevelflow, castOther.isToplevelflow)
.append(minApiVersion, castOther.minApiVersion).append(maxApiVersion, castOther.maxApiVersion)
- .append(cloudOwner, castOther.cloudOwner)
+ .append(cloudOwner, castOther.cloudOwner).append(serviceType, castOther.serviceType)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(action).append(requestScope).append(isAlacarte).append(isToplevelflow)
- .append(minApiVersion).append(maxApiVersion).append(cloudOwner).toHashCode();
+ .append(minApiVersion).append(maxApiVersion).append(cloudOwner).append(serviceType).toHashCode();
}
public Integer getId() {
@@ -188,6 +192,14 @@ public class NorthBoundRequest implements Serializable {
public void setCloudOwner(String cloudOwner) {
this.cloudOwner = cloudOwner;
}
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
@LinkedResource
public List<OrchestrationFlow> getOrchestrationFlowList() {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 51c55bdfce..3612d83359 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -128,6 +128,7 @@ public class CatalogDbClient {
private static final String CLOUD_VERSION = "cloudVersion";
private static final String TARGET_ENTITY = "SO:CatalogDB";
+ private static final String ASTERISK = "*";
private String findExternalToInternalServiceByServiceName = "/findByServiceName";
private String findServiceByModelName = "/findOneByModelName";
@@ -153,6 +154,7 @@ public class CatalogDbClient {
private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte";
private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner";
+ private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
@@ -251,6 +253,7 @@ public class CatalogDbClient {
findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID;
findOneByActionAndRequestScopeAndIsAlacarte = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte;
findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner;
+ findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType;
findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
@@ -484,10 +487,21 @@ public class CatalogDbClient {
public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String requestAction,
String resourceName, boolean aLaCarte, String cloudOwner) {
return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
- .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner)
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
.queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
.queryParam(IS_ALACARTE, aLaCarte)
- .queryParam(CLOUD_OWNER, cloudOwner).build().toString()));
+ .queryParam(CLOUD_OWNER, cloudOwner)
+ .queryParam(SERVICE_TYPE, ASTERISK).build().toString()));
+ }
+
+ public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(String requestAction,
+ String resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
+ return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte)
+ .queryParam(CLOUD_OWNER, cloudOwner)
+ .queryParam(SERVICE_TYPE, serviceType).build().toString()));
}
public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
index 11a2a34aaf..09732c2d8b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
@@ -28,4 +28,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface NorthBoundRequestRepository extends JpaRepository<NorthBoundRequest, Integer> {
NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarte(String action, String requestScope, Boolean isALaCarte);
NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner(String action, String requestScope, Boolean isALaCarte, String cloudOwner);
+ NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType(String action, String requestScope, Boolean isALaCarte, String cloudOwner, String serviceType);
}