aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java16
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java2
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java4
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java24
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java18
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml15
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/application.yaml2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java41
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java36
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java13
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java6
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java54
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java8
-rw-r--r--asdc-controller/src/test/resources/schema.sql1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml12
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json46
-rw-r--r--common/src/main/java/org/onap/so/client/BaseClient.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java)3
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java48
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java11
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql1
43 files changed, 406 insertions, 175 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
index f717144562..35c928c3b5 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
@@ -72,9 +72,7 @@ public class KeystoneV3Authentication {
OpenStackRequest<Token> v3Request = keystoneTenantClient.tokens().authenticate(v3Credentials);
- KeystoneAuthHolder holder = makeRequest(v3Request, type, region);
-
- return holder;
+ return makeRequest(v3Request, type, region);
}
protected KeystoneAuthHolder makeRequest(OpenStackRequest<Token> v3Request, String type, String region) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
index 02ace5665d..072bf404e7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
@@ -72,22 +72,22 @@ public final class DeploymentInfoBuilder {
this.errorMessage = execution.getError();
// Compute the status based on the last workflow
- if (lastAction.equals("install")) {
- if (actionStatus.equals("terminated")) {
+ if (("install").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
}
- } else if (lastAction.equals("uninstall")) {
- if (actionStatus.equals("terminated")) {
+ } else if (("uninstall").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.CREATED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.UNINSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
index 5c2348dffa..2251575671 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
@@ -38,8 +38,8 @@ public class MsoCloudifyWorkflowException extends MsoCloudifyException {
super(0, "Workflow Exception",
"Workflow " + workflowId + " failed on deployment " + deploymentId + ": " + message);
this.workflowStatus = workflowStatus;
- if (workflowStatus.equals("pending") || workflowStatus.equals("started") || workflowStatus.equals("cancelling")
- || workflowStatus.equals("force_cancelling")) {
+ if (("pending").equals(workflowStatus) || ("started").equals(workflowStatus)
+ || ("cancelling").equals(workflowStatus) || ("force_cancelling").equals(workflowStatus)) {
workflowStillRunning = true;
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
index bb15e58c88..fc08201bcb 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"template_type", "workload_id", "template_response"})
public class MulticloudCreateResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("template_type")
private String templateType;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java
index 67cb73539d..67d1cbff4e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"stack"})
public class MulticloudCreateStackResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("stack")
private MulticloudCreateHeatResponse stack;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
index a22937aea3..ad37b39f30 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"template_type", "workload_id", "workload_status", "workload_status_reason"})
public class MulticloudQueryResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("template_type")
private String templateType;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
index b733552a2b..95dd48caa6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
@@ -33,7 +33,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
"vf-module-model-customization-id", "oof_directives", "sdnc_directives", "user_directives", "template_type",
"template_data"})
public class MulticloudRequest implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("generic-vnf-id")
private String genericVnfId;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java
index 23bbbb3f43..7a2d4ec3e1 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java
@@ -24,6 +24,8 @@ package org.onap.so.adapters.vnfrest;
import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -71,7 +73,7 @@ public abstract class VfResponseCommon {
public String toXmlString() {
try {
ByteArrayOutputStream bs = new ByteArrayOutputStream();
- JAXBContext context = JAXBContext.newInstance(this.getClass());
+ JAXBContext context = JAXBContext.newInstance(this.getClass(), ArrayList.class, HashMap.class);
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty print XML
marshaller.marshal(this, bs);
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
index d20d2b7758..0327fd67a3 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
@@ -20,9 +20,16 @@
package org.onap.so.openstack.mappers;
+import java.util.List;
+import java.util.Map;
import javax.xml.bind.annotation.XmlElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class MapElements {
+ private static final Logger logger = LoggerFactory.getLogger(MapElements.class);
@XmlElement
public String key;
@XmlElement
@@ -32,6 +39,21 @@ public class MapElements {
public MapElements(String key, Object value) {
this.key = key;
- this.value = value;
+ // this is required to handle marshalling raw json
+ // always write values as strings for XML
+ if (value != null) {
+ if (value instanceof List || value instanceof Map) {
+ try {
+ this.value = new ObjectMapper().writeValueAsString(value);
+ } catch (JsonProcessingException e) {
+ logger.warn("could not marshal value to json, calling toString");
+ this.value = value.toString();
+ }
+ } else {
+ this.value = value;
+ }
+ } else {
+ this.value = value;
+ }
}
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
index 8d27e54892..189d4cca3e 100644
--- a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
@@ -24,17 +24,19 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.Arrays;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import org.junit.Test;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class JAXBMarshallingTest {
@Test
- public void xmlMarshalTest() throws IOException, JAXBException {
+ public void xmlUnMarshalTest() throws IOException, JAXBException {
JAXBContext context = JAXBContext.newInstance(CreateVfModuleRequest.class);
CreateVfModuleRequest request = (CreateVfModuleRequest) context.createUnmarshaller().unmarshal(
@@ -43,6 +45,20 @@ public class JAXBMarshallingTest {
assertEquals("ubuntu-16-04-cloud-amd64", request.getVfModuleParams().get("vcpe_image_name"));
assertEquals("10.2.0.0/24", request.getVfModuleParams().get("cpe_public_net_cidr"));
assertEquals("", request.getVfModuleParams().get("workload_context"));
+ assertEquals("[\"a\",\"b\",\"c\"]", request.getVfModuleParams().get("raw-json-param"));
+ }
+
+ @Test
+ public void xmlMarshalTest() throws IOException, JAXBException {
+
+ CreateVfModuleRequest request = new CreateVfModuleRequest();
+ request.getVfModuleParams().put("test-null", null);
+ request.getVfModuleParams().put("test array", Arrays.asList("a", "b", "c"));
+
+ assertEquals("documents are equal",
+ new String(Files
+ .readAllBytes(Paths.get("src/test/resources/VfRequest-marshalled-with-complex-object.xml"))),
+ request.toXmlString());
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml b/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
new file mode 100644
index 0000000000..ce175127df
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<createVfModuleRequest>
+ <failIfExists>false</failIfExists>
+ <backout>true</backout>
+ <vfModuleParams>
+ <entry>
+ <key>test array</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">["a","b","c"]</value>
+ </entry>
+ <entry>
+ <key>test-null</key>
+ </entry>
+ </vfModuleParams>
+ <msoRequest/>
+</createVfModuleRequest>
diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
index 1ff24a50f6..2718f1df61 100644
--- a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
+++ b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
@@ -1,4 +1,4 @@
-<createVfModuleRequest>
+ <createVfModuleRequest>
<cloudSiteId>RegionOne</cloudSiteId>
<cloudOwner>CloudOwner</cloudOwner>
<tenantId>09d8566ea45e43aa974cf447ed591d77</tenantId>
@@ -196,7 +196,10 @@
<key>vf_module_index</key>
<value>0</value>
</entry>
-
+ <entry>
+ <key>raw-json-param</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">["a","b","c"]</value>
+ </entry>
</vfModuleParams>
<msoRequest>
<requestId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b</requestId>
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
index aa9317c920..b1528a0897 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
@@ -52,4 +52,4 @@ management:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
step: 1m # Step size (i.e. reporting frequency) to use.
- \ No newline at end of file
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
index fabb005567..16e6ecf4bf 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
@@ -1,3 +1,7 @@
use catalogdb;
+
ALTER TABLE vnf_resource_customization
-ADD VNFCINSTANCEGROUP_ORDER varchar(255); \ No newline at end of file
+ADD VNFCINSTANCEGROUP_ORDER varchar(255);
+
+ALTER TABLE vnfc_customization
+ADD RESOURCE_INPUT varchar(2000); \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index 38dd9089e1..b4cdcb45e2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -20,7 +20,6 @@
package org.onap.so.adapters.inventory.create;
-import java.io.IOException;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
@@ -47,17 +46,16 @@ public class CreateInventoryTask {
public Environment env;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
boolean success = true;
String auditInventoryString = externalTask.getVariable("auditInventoryResult");
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
AAIObjectAuditList auditInventory = null;
try {
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
auditInventory = objectMapper.getMapper().readValue(auditInventoryString, AAIObjectAuditList.class);
- } catch (IOException e1) {
- success = false;
+ } catch (Exception e) {
+ logger.error("Error Parsing Audit Results", e);
}
- setupMDC(externalTask);
-
if (auditInventory != null) {
try {
logger.info("Executing External Task Create Inventory, Retry Number: {} \n {}", auditInventory,
@@ -96,9 +94,13 @@ public class CreateInventoryTask {
}
private void setupMDC(ExternalTask externalTask) {
- String msoRequestId = (String) externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty())
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ try {
+ String msoRequestId = (String) externalTask.getVariable("mso-request-id");
+ if (msoRequestId != null && !msoRequestId.isEmpty())
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ } catch (Exception e) {
+ logger.error("Error in setting up MDC", e);
+ }
}
protected long calculateRetryDelay(int currentRetries) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index b59a1fa79a..bac41a1f8b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2019 IBM
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +67,6 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.ErrorCode;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeImpl;
-import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -189,7 +189,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String vfModuleId = "";
// Create a hook here to catch shortcut createVf requests:
if (requestType != null && requestType.startsWith("VFMOD")) {
- logger.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
+ logger.debug("Calling createVfModule from createVnf -- requestType={}", requestType);
String newRequestType = requestType.substring(5);
String vfVolGroupHeatStackId = "";
String vfBaseHeatStackId = "";
@@ -251,13 +251,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
Holder<Map<String, String>> outputs) throws VnfException {
- logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
+ logger.debug("Querying VNF {} in {}/{}", vnfName, cloudSiteId, tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- StackInfo heatStack = null;
- long subStartTime = System.currentTimeMillis();
+ StackInfo heatStack;
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
@@ -310,14 +308,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throws VnfException {
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
@@ -344,7 +335,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
@@ -437,13 +427,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug(" HeatBridgeMain.py returned {} with code {}", wait, p.exitValue());
return wait && p.exitValue() == 0;
} catch (IOException e) {
- logger.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
+ logger.debug(" HeatBridgeMain.py failed with IO Exception! {}", e);
return false;
} catch (RuntimeException e) {
- logger.debug(" HeatBridgeMain.py failed during runtime!" + e);
+ logger.debug(" HeatBridgeMain.py failed during runtime! {}", e);
return false;
} catch (Exception e) {
- logger.debug(" HeatBridgeMain.py failed for unknown reasons! " + e);
+ logger.debug(" HeatBridgeMain.py failed for unknown reasons! {}", e);
return false;
}
}
@@ -461,7 +451,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
HeatBridgeApi heatBridgeClient =
new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, cloudSiteId, tenantId);
- OpenstackClient openstackClient = heatBridgeClient.authenticate();
List<Resource> stackResources = heatBridgeClient.queryNestedHeatStackResources(heatStackId);
List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
@@ -590,7 +579,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
useMCUuid = false;
mcu = "";
} else {
- logger.debug("Found modelCustomizationUuid! Will use that: " + mcu);
+ logger.debug("Found modelCustomizationUuid! Will use that: {}", mcu);
useMCUuid = true;
}
}
@@ -1277,7 +1266,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("VF Module {} successfully created", vfModuleName);
// call heatbridge
heatbridge(heatStack, cloudOwner, cloudSiteId, tenantId, genericVnfName, vfModuleId);
- return;
} catch (Exception e) {
logger.debug("unhandled exception in create VF", e);
throw new VnfException("Exception during create VF " + e.getMessage());
@@ -1290,7 +1278,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// 1702 capture the output parameters on a delete
// so we'll need to query first
@@ -1323,11 +1310,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
msoRequest, failRequestOnValetFailure);
}
- // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
@@ -2033,7 +2015,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- return;
}
private String getVfModuleNameFromModuleStackId(String vfModuleStackId) {
@@ -2199,13 +2180,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> newInputs = vur.getParameters();
if (newInputs != null) {
Map<String, Object> oldGold = goldenInputs;
- logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<String, Object>();
+ logger.debug("parameters before being modified by valet:{}", oldGold);
+ goldenInputs = new HashMap<>();
for (String key : newInputs.keySet()) {
goldenInputs.put(key, newInputs.get(key));
}
valetModifiedParamsHolder.value = goldenInputs;
- logger.debug("parameters after being modified by valet:{}", goldenInputs.toString());
+ logger.debug("parameters after being modified by valet:{}", goldenInputs);
valetSucceeded = true;
}
} else {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
new file mode 100644
index 0000000000..03622db655
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
@@ -0,0 +1,36 @@
+package org.onap.so.adapters.inventory.create;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+
+public class CreateInventoryTaskTest {
+
+ @Mock
+ ExternalTask externalTask;
+
+ @Mock
+ ExternalTaskService externalTaskService;
+
+ @InjectMocks
+ CreateInventoryTask inventoryTask;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void test_Runtime_Parse_Exception() {
+ doReturn(null).when(externalTask).getVariable("auditInventoryResult");
+ inventoryTask.executeExternalTask(externalTask, externalTaskService);
+ Mockito.verify(externalTaskService, times(1)).handleBpmnError(externalTask, "AAIInventoryFailure");
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 5e986ab34d..1cf28be926 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -1134,6 +1134,7 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 21ce06eaf1..7d412b77ad 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -5,7 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -77,13 +77,12 @@ public class SDNCRestClient {
private static Logger logger = LoggerFactory.getLogger(SDNCRestClient.class);
private static final String EXCEPTION_MSG = "Exception while evaluate xpath";
- private static final String MSO_INTERNAL_ERROR = "MsoInternalError";
private static final String CAMUNDA = "Camunda";
@Async
public void executeRequest(SDNCAdapterRequest bpelRequest) {
- logger.debug("BPEL Request:" + bpelRequest.toString());
+ logger.debug("BPEL Request: {}", bpelRequest);
// Added delay to allow completion of create request to SDNC
// before executing activate of create request.
@@ -96,8 +95,6 @@ public class SDNCRestClient {
Thread.currentThread().interrupt();
}
- String action = bpelRequest.getRequestHeader().getSvcAction();
- String operation = bpelRequest.getRequestHeader().getSvcOperation();
String bpelReqId = bpelRequest.getRequestHeader().getRequestId();
String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl();
@@ -118,12 +115,9 @@ public class SDNCRestClient {
Document reqDoc = node.getOwnerDocument();
sdncReqBody = Utils.genSdncPutReq(reqDoc, rt);
}
- long sdncStartTime = System.currentTimeMillis();
SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt);
logger.debug("Got the SDNC Response: {}", sdncResp.getSdncRespXml());
- long bpelStartTime = System.currentTimeMillis();
sendRespToBpel(callbackUrl, sdncResp);
- return;
}
public SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt) {
@@ -288,7 +282,6 @@ public class SDNCRestClient {
try {
wsdlUrl = new URL(bpelUrl);
} catch (MalformedURLException e1) {
- error = "Caught exception initializing Callback wsdl " + e1.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
@@ -317,7 +310,6 @@ public class SDNCRestClient {
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put("Authorization", Collections.singletonList(basicAuth));
} catch (Exception e2) {
- error = "Unable to set authorization in callback request " + e2.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(),
"Exception - Unable to set authorization in callback request", e2);
@@ -333,6 +325,5 @@ public class SDNCRestClient {
MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e);
}
logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA);
- return;
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 87008f1d8f..43eb277d21 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -91,7 +91,7 @@ public class DeployActivitySpecs {
if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.size() == 0) {
return;
}
- List<String> categoryList = new ArrayList<String>();
+ List<String> categoryList = new ArrayList<>();
for (ActivitySpecActivitySpecCategories activitySpecCat : activitySpecActivitySpecCategories) {
if (activitySpecCat != null) {
if (activitySpecCat.getActivitySpecCategories() != null) {
@@ -107,8 +107,8 @@ public class DeployActivitySpecs {
if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.size() == 0) {
return;
}
- List<Input> inputs = new ArrayList<Input>();
- List<Output> outputs = new ArrayList<Output>();
+ List<Input> inputs = new ArrayList<>();
+ List<Output> outputs = new ArrayList<>();
for (ActivitySpecActivitySpecParameters activitySpecParam : activitySpecActivitySpecParameters) {
if (activitySpecParam != null) {
if (activitySpecParam.getActivitySpecParameters() != null) {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 9b838c4d98..fc0197dc52 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -77,6 +77,8 @@ public class ASDCController {
protected static final Logger logger = LoggerFactory.getLogger(ASDCController.class);
+ private static final String UNKNOWN = "Unknown";
+
protected boolean isAsdcClientAutoManaged = false;
protected String controllerName;
@@ -110,6 +112,25 @@ public class ASDCController {
@Autowired
DeployActivitySpecs deployActivitySpecs;
+ public ASDCController() {
+ this("");
+ }
+
+ public ASDCController(String controllerConfigName) {
+ isAsdcClientAutoManaged = true;
+ this.controllerName = controllerConfigName;
+ }
+
+ public ASDCController(String controllerConfigName, IDistributionClient asdcClient,
+ IVfResourceInstaller resourceinstaller) {
+ distributionClient = asdcClient;
+ }
+
+ public ASDCController(String controllerConfigName, IDistributionClient asdcClient) {
+ distributionClient = asdcClient;
+ this.controllerName = controllerConfigName;
+ }
+
public int getNbOfNotificationsOngoing() {
return nbOfNotificationsOngoing;
}
@@ -150,25 +171,6 @@ public class ASDCController {
return this.controllerStatus;
}
- public ASDCController() {
- this("");
- }
-
- public ASDCController(String controllerConfigName) {
- isAsdcClientAutoManaged = true;
- this.controllerName = controllerConfigName;
- }
-
- public ASDCController(String controllerConfigName, IDistributionClient asdcClient,
- IVfResourceInstaller resourceinstaller) {
- distributionClient = asdcClient;
- }
-
- public ASDCController(String controllerConfigName, IDistributionClient asdcClient) {
- distributionClient = asdcClient;
- this.controllerName = controllerConfigName;
- }
-
public String getControllerName() {
return controllerName;
}
@@ -356,7 +358,7 @@ public class ASDCController {
for (IArtifactInfo artifactInfo : resourceStructure.getResourceInstance().getArtifacts()) {
if ((DistributionStatusEnum.DEPLOY_OK.equals(distribStatus)
- && !artifactInfo.getArtifactType().equalsIgnoreCase("OTHER")
+ && !("OTHER").equalsIgnoreCase(artifactInfo.getArtifactType())
&& !resourceStructure.isAlreadyDeployed())
// This could be NULL if the artifact is a VF module artifact, this won't be present in the MAP
&& resourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null
@@ -442,7 +444,7 @@ public class ASDCController {
status.name(), artifactURL, "ASDC", "sendASDCNotification");
logger.debug(event);
- String action = "";
+
try {
IDistributionStatusMessage message =
new DistributionStatusMessage(artifactURL, consumerID, distributionID, status, timestamp);
@@ -454,7 +456,7 @@ public class ASDCController {
} else {
this.distributionClient.sendDownloadStatus(message);
}
- action = "sendDownloadStatus";
+
break;
case DEPLOY:
if (errorReason != null) {
@@ -462,7 +464,7 @@ public class ASDCController {
} else {
this.distributionClient.sendDeploymentStatus(message);
}
- action = "sendDeploymentdStatus";
+
break;
default:
break;
@@ -667,12 +669,12 @@ public class ASDCController {
String filePath =
msoConfigPath + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact.getArtifactName();
File csarFile = new File(filePath);
- String csarFilePath = csarFile.getAbsolutePath();
+
for (IResourceInstance resource : iNotif.getResources()) {
String resourceType = resource.getResourceType();
- String category = resource.getCategory();
+
logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID());
@@ -832,7 +834,7 @@ public class ASDCController {
}
}
- private static final String UNKNOWN = "Unknown";
+
/**
* @return the address of the ASDC we are connected to.
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
index f4d3e5ce48..20cd9801e9 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
@@ -33,16 +33,16 @@ public class JsonVfModuleMetaData implements IVfModuleData {
@JsonProperty("artifacts")
private List<String> artifacts;
@JsonProperty("properties")
- // private List<Map<String, Object>> properties = new ArrayList<>();
+
private Map<String, String> properties = new HashMap<>();
+ @JsonIgnore
+ private Map<String, Object> attributesMap = new HashMap<>();
+
public Map<String, String> getProperties() {
return properties;
}
- @JsonIgnore
- private Map<String, Object> attributesMap = new HashMap<>();
-
@Override
public List<String> getArtifacts() {
return artifacts;
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index a50b275c20..d143b52fe1 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1136,6 +1136,7 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
index 6c3a0c43ed..b9f5a6af8e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
@@ -78,6 +78,8 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
private ModelInfoServiceInstance modelInfoServiceInstance;
@JsonProperty("instance-groups")
private List<InstanceGroup> instanceGroups = new ArrayList<>();
+ @JsonProperty("service-proxies")
+ private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
public List<GenericVnf> getVnfs() {
return vnfs;
@@ -211,6 +213,10 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
this.instanceGroups = instanceGroups;
}
+ public List<ServiceProxy> getServiceProxies() {
+ return serviceProxies;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof ServiceInstance)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
index db5c11a954..4c91ad38a0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,6 @@ public class SolutionCandidates implements Serializable {
private List<Candidate> requiredCandidates = new ArrayList<Candidate>();
@JsonProperty("excludedCandidates")
private List<Candidate> excludedCandidates = new ArrayList<Candidate>();
- // TODO figure out best way to do this
@JsonProperty("existingCandidates")
private List<Candidate> existingCandidates = new ArrayList<Candidate>();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
index ee2c10ca4b..05af5f71f8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
@@ -29,6 +29,7 @@ import java.util.Map;
import javax.ws.rs.core.UriBuilder;
import org.junit.Test;
import org.onap.so.BaseTest;
+import org.onap.so.client.BaseClient;
import org.springframework.core.ParameterizedTypeReference;
import wiremock.org.apache.http.entity.ContentType;
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index 4dd7a467ea..e9ed15aa0f 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -152,12 +152,12 @@
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>${camunda.springboot.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.camunda.bpmn</groupId>
- <artifactId>camunda-engine-rest-core</artifactId>
- </exclusion>
- </exclusions>
+ <exclusions>
+ <exclusion>
+ <groupId>org.camunda.bpmn</groupId>
+ <artifactId>camunda-engine-rest-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
index a8e974d63a..2163e0b7a8 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
index b6faf1b806..c5ddd56880 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index 2f898b6697..2b9729f7c7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -334,6 +334,18 @@ public class SniroHomingV2 {
}
}
}
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
+ if (!serviceProxies.isEmpty()) {
+ logger.debug("Adding service proxies to placement demands list");
+ for (ServiceProxy sp : serviceProxies) {
+ if (isBlank(sp.getId())) {
+ sp.setId(UUID.randomUUID().toString());
+ }
+ Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ addCandidates(sp, demand);
+ placementDemands.add(demand);
+ }
+ }
return placementDemands;
}
@@ -400,6 +412,7 @@ public class SniroHomingV2 {
private void addCandidates(SolutionCandidates candidates, Demand demand) {
List<Candidate> required = candidates.getRequiredCandidates();
List<Candidate> excluded = candidates.getExcludedCandidates();
+ List<Candidate> existing = candidates.getExistingCandidates();
if (!required.isEmpty()) {
List<org.onap.so.client.sniro.beans.Candidate> cans =
new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
@@ -424,7 +437,18 @@ public class SniroHomingV2 {
}
demand.setExcludedCandidates(cans);
}
- // TODO support existing candidates
+ if (!existing.isEmpty()) {
+ List<org.onap.so.client.sniro.beans.Candidate> cans =
+ new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for (Candidate c : existing) {
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setExistingCandidates(cans);
+ }
}
/**
@@ -462,6 +486,7 @@ public class SniroHomingV2 {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
logger.debug("Processing placement solution " + i + 1);
for (int p = 0; p < placements.length(); p++) {
@@ -502,6 +527,12 @@ public class SniroHomingV2 {
break search;
}
}
+ for (ServiceProxy proxy : serviceProxies) {
+ if (placement.getString(SERVICE_RESOURCE_ID).equals(proxy.getId())) {
+ proxy.setServiceInstance(setSolution(solutionInfo, placement));
+ break search;
+ }
+ }
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
index e31285f044..e8a7fef1bd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
@@ -22,8 +22,8 @@ package org.onap.so.client.oof;
import org.camunda.bpm.engine.delegate.BpmnError;
-import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.oof.beans.OofProperties;
import org.onap.so.client.oof.beans.OofRequest;
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 b70caa149c..2e7877fe3b 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
@@ -24,7 +24,7 @@ package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
import javax.ws.rs.core.UriBuilder;
-import org.onap.so.bpmn.common.baseclient.BaseClient;
+import org.onap.so.client.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index f7aad558b2..21c0b971b8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -24,8 +24,8 @@ package org.onap.so.client.sniro;
import java.util.LinkedHashMap;
import org.camunda.bpm.engine.delegate.BpmnError;
-import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.sniro.beans.ManagerProperties;
import org.onap.so.client.sniro.beans.SniroConductorRequest;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
index 19378cdbfa..fe2b63ff92 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,6 +38,8 @@ public class Demand implements Serializable {
private List<Candidate> requiredCandidates;
@JsonProperty("excludedCandidates")
private List<Candidate> excludedCandidates;
+ @JsonProperty("existingCandidates")
+ private List<Candidate> existingCandidates;
public List<Candidate> getRequiredCandidates() {
@@ -80,4 +82,12 @@ public class Demand implements Serializable {
this.modelInfo = modelInfo;
}
+ public List<Candidate> getExistingCandidates() {
+ return existingCandidates;
+ }
+
+ public void setExistingCandidates(List<Candidate> existingCandidates) {
+ this.existingCandidates = existingCandidates;
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
index 8d51ceb65f..b5a8318ce9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.isA;
@@ -53,6 +53,7 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class SniroHomingV2IT extends BaseIntegrationTest {
@@ -107,6 +108,18 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
serviceInstance.getAllottedResources().add(setAllottedResource("3"));
}
+ public void beforeServiceProxy() {
+ ServiceProxy sp = setServiceProxy("1", "infrastructure");
+ Candidate requiredCandidate = new Candidate();
+ requiredCandidate.setIdentifierType(CandidateType.CLOUD_REGION_ID);
+ List<String> c = new ArrayList<String>();
+ c.add("testCloudRegionId");
+ requiredCandidate.setCloudOwner("att");
+ requiredCandidate.setIdentifiers(c);
+ sp.addRequiredCandidates(requiredCandidate);
+ serviceInstance.getServiceProxies().add(sp);
+ }
+
public void beforeVnf() {
setGenericVnf();
}
@@ -191,6 +204,23 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class));
}
+ @Test
+ public void testCallSniro_success_1ServiceProxy() throws JsonProcessingException, BadResponseException {
+ beforeServiceProxy();
+
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
+
+ sniroHoming.callSniro(execution);
+
+ String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest1SP.json");
+ request = request.replace("28080", wireMockPort);
+
+ ArgumentCaptor<SniroManagerRequest> argument = ArgumentCaptor.forClass(SniroManagerRequest.class);
+ verify(sniroClient, times(1)).postDemands(argument.capture());
+ assertEquals(request, argument.getValue().toJsonString());
+ }
+
@Test(expected = Test.None.class)
public void testProcessSolution_success_1VpnLink_1Solution() {
beforeVpnBondingLink("1");
@@ -563,10 +593,57 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
assertEquals(2, vnf.getLicense().getLicenseKeyGroupUuids().size());
assertEquals("f1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getEntitlementPoolUuids().get(0));
assertEquals("s1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getLicenseKeyGroupUuids().get(0));
+ }
+
+ @Test
+ public void testProcessSolution_success_1ServiceProxy_1Solutions() {
+ beforeServiceProxy();
+
+ JSONObject asyncResponse = new JSONObject();
+ asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState",
+ "completed");
+ JSONArray solution1 = new JSONArray();
+ solution1
+ .put(new JSONObject()
+ .put("serviceResourceId", "testProxyId1").put(
+ "solution",
+ new JSONObject()
+ .put("identifierType", "serviceInstanceId")
+ .put("identifiers", new JSONArray().put("testServiceInstanceId1")))
+ .put("assignmentInfo",
+ new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False"))
+ .put(new JSONObject().put("key", "cloudOwner").put("value", ""))
+ .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1"))
+ .put(new JSONObject().put("key", "aicVersion").put("value", "3"))
+ .put(new JSONObject().put("key", "cloudRegionId").put("value", ""))
+ .put(new JSONObject().put("key", "primaryPnfName").put("value",
+ "testPrimaryPnfName"))
+ .put(new JSONObject().put("key", "secondaryPnfName").put("value",
+ "testSecondaryPnfName"))));
+
+ asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1))
+ .put("licenseSolutions", new JSONArray()));
+ sniroHoming.processSolution(execution, asyncResponse.toString());
+ ServiceInstance si =
+ execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+
+ ServiceProxy sp = si.getServiceProxies().get(0);
+ assertNotNull(sp);
+ assertNotNull(sp.getServiceInstance());
+
+ assertEquals("testServiceInstanceId1", sp.getServiceInstance().getServiceInstanceId());
+ assertNotNull(sp.getServiceInstance().getSolutionInfo());
+
+ assertFalse(sp.getServiceInstance().getPnfs().isEmpty());
+ assertEquals("testPrimaryPnfName", sp.getServiceInstance().getPnfs().get(0).getPnfName());
+ assertEquals("primary", sp.getServiceInstance().getPnfs().get(0).getRole());
+ assertEquals("testSecondaryPnfName", sp.getServiceInstance().getPnfs().get(1).getPnfName());
+ assertEquals("secondary", sp.getServiceInstance().getPnfs().get(1).getRole());
}
+
@Test(expected = BpmnError.class)
public void testCallSniro_error_0Resources() throws BadResponseException, JsonProcessingException {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json
new file mode 100644
index 0000000000..27463350ab
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json
@@ -0,0 +1,46 @@
+{
+ "requestInfo" : {
+ "transactionId" : "testRequestId",
+ "requestId" : "testRequestId",
+ "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId",
+ "sourceId" : "mso",
+ "requestType" : "create",
+ "timeout" : 1800
+ },
+ "serviceInfo" : {
+ "modelInfo" : {
+ "modelName" : "testModelName1",
+ "modelVersionId" : "testModelUUID1",
+ "modelVersion" : "testModelVersion1",
+ "modelInvariantId" : "testModelInvariantUUID1"
+ },
+ "serviceRole" : "testServiceRole1",
+ "serviceInstanceId" : "testServiceInstanceId1",
+ "serviceName" : "testServiceType1"
+ },
+ "placementInfo" : {
+ "subscriberInfo" : {
+ "globalSubscriberId" : "testCustomerId",
+ "subscriberName" : "testCustomerName"
+ },
+ "placementDemands" : [ {
+ "serviceResourceId" : "testProxyId1",
+ "resourceModuleName" : "testProxyInstanceName1",
+ "resourceModelInfo" : {
+ "modelName" : "testProxyModelName1",
+ "modelVersionId" : "testProxyModelUuid1",
+ "modelVersion" : "testProxyModelVersion1",
+ "modelInvariantId" : "testProxyModelInvariantUuid1"
+ },
+ "requiredCandidates" : [ {
+ "identifierType" : "cloudRegionId",
+ "identifiers" : [ "testCloudRegionId" ],
+ "cloudOwner" : "att"
+ } ]
+ } ],
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
+ },
+ "licenseInfo" : {
+ "licenseDemands" : [ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/common/src/main/java/org/onap/so/client/BaseClient.java
index 73047cf961..d939a33358 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
+++ b/common/src/main/java/org/onap/so/client/BaseClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.baseclient;
+package org.onap.so.client;
import java.util.ArrayList;
import java.util.List;
@@ -34,7 +34,6 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
-// TODO move to common location
public class BaseClient<I, O> {
private HttpHeaders httpHeader;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
index 0aac35d5a9..9b7801711f 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
@@ -79,8 +79,7 @@ public abstract class RequestClient {
protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) {
try {
- String result = CryptoUtils.decrypt(prop, encryptionKey);
- return result;
+ return CryptoUtils.decrypt(prop, encryptionKey);
} catch (GeneralSecurityException e) {
logger.debug("Security exception", e);
}
@@ -89,14 +88,10 @@ public abstract class RequestClient {
protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) {
try {
- String result = CryptoUtils.decrypt(prop, encryptionKey);
- return result;
+ return CryptoUtils.decrypt(prop, encryptionKey);
} catch (GeneralSecurityException e) {
logger.debug("Security exception", e);
}
return defaultValue;
}
-
-
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index fff4c1d508..095182fe98 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -80,12 +80,8 @@ public class ResponseHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder("IOException getting Camunda response body",
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
}
ObjectMapper mapper = new ObjectMapper();
@@ -96,11 +92,8 @@ public class ResponseHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
}
if (response != null) {
responseBody = response.getResponse();
@@ -125,22 +118,16 @@ public class ResponseHandler {
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
- ValidateException validateException =
- new ValidateException.Builder("Could not convert BPEL response to string",
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
+
+ throw new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
}
if (status != HttpStatus.SC_ACCEPTED) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER,
ErrorCode.BusinessProcesssError).targetEntity("BPEL").targetServiceName("parseBpel").build();
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
- .errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
}
}
@@ -157,24 +144,17 @@ public class ResponseHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
-
- ValidateException validateException =
- new ValidateException.Builder("Could not convert CamundaTask response to string",
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("Could not convert CamundaTask response to string",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
}
if (status != HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER,
ErrorCode.BusinessProcesssError).targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask")
.build();
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
- .errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
index 7cf2046646..ec583645ae 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
@@ -41,12 +41,12 @@ public class Constants {
public static final String A_LA_CARTE = "aLaCarte";
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
- public final static String VNF_REQUEST_SCOPE = "vnf";
- public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
- public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
- public final static String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
+ public static final String VNF_REQUEST_SCOPE = "vnf";
+ public static final String SERVICE_INSTANCE_PATH = "/serviceInstances";
+ public static final String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
+ public static final String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
private Constants() {}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 6b748c1eb5..4cbb5de4ca 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -1135,6 +1135,7 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
index f6ae503c61..a7a31dcf89 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
@@ -70,6 +70,9 @@ public class VnfcCustomization implements Serializable {
@Column(name = "DESCRIPTION")
private String description;
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@Temporal(TemporalType.TIMESTAMP)
@@ -186,4 +189,12 @@ public class VnfcCustomization implements Serializable {
public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
this.cvnfcCustomization = cvnfcCustomization;
}
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
}
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 7a894692bf..97afcc04be 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -1133,6 +1133,7 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;