diff options
258 files changed, 4306 insertions, 1218 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/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 7bf68fff78..e16bf90d4d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -28,9 +28,7 @@ import com.woorea.openstack.heat.model.CreateStackParam; import com.woorea.openstack.heat.model.Stack; import java.net.MalformedURLException; import java.net.URL; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Scanner; import javax.ws.rs.core.Response; @@ -64,6 +62,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import com.google.common.collect.ImmutableSet; @Component public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { @@ -75,8 +74,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { public static final String VF_MODULE_ID = "vf_module_id"; public static final String TEMPLATE_TYPE = "template_type"; public static final String MULTICLOUD_QUERY_BODY_NULL = "multicloudQueryBody is null"; - public static final List<String> MULTICLOUD_INPUTS = - Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE); + public static final ImmutableSet<String> MULTICLOUD_INPUTS = + ImmutableSet.of(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE); private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class); 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/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java index e550394931..c1acc319f7 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java @@ -104,7 +104,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { first = false; - boolean arNull = o.getAllottedResource() == null ? true : false; + boolean arNull = o.getAllottedResource() == null; put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName()); put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID()); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java index 96ea797631..5573b23a8d 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java @@ -104,7 +104,7 @@ public class QueryServiceNetworks extends CatalogQuery { if (first) sb.append("\n"); first = false; - boolean nrNull = o.getNetworkResource() == null ? true : false; + boolean nrNull = o.getNetworkResource() == null; put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName()); put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID()); put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID()); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java index b1bdeda445..f786f25361 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java @@ -101,7 +101,7 @@ public class QueryServiceVnfs extends CatalogQuery { sb.append("\n"); first = false; - boolean vrNull = o.getVnfResources() == null ? true : false; + boolean vrNull = o.getVnfResources() == null; put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName()); put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID()); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java index 1dec9cecae..1604e99a72 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java @@ -97,7 +97,7 @@ public class QueryVfModule extends CatalogQuery { sb.append("\n"); first = false; - boolean vfNull = o.getVfModule() == null ? true : false; + boolean vfNull = o.getVfModule() == null; boolean hasVolumeGroup = false; HeatEnvironment envt = o.getVolumeHeatEnv(); if (envt != null) { @@ -109,10 +109,10 @@ public class QueryVfModule extends CatalogQuery { put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID()); put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion()); put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID()); - put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false); + put(valueMap, "IS_BASE", !vfNull && (o.getVfModule().getIsBase())); put(valueMap, "VF_MODULE_LABEL", o.getLabel()); put(valueMap, "INITIAL_COUNT", o.getInitialCount()); - put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup)); + put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup); sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap)); sep = ",\n"; 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 07b000875e..b1528a0897 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -28,7 +28,6 @@ spring: password: ${DB_ADMIN_PASSWORD} outOfOrder: true validateOnMigrate: false - repeatableSqlMigrationPrefix: RATT jpa: show-sql: true hibernate: @@ -53,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/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 3fdc3c31f9..238c4cf467 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -40,14 +40,16 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL ('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Assign', '6', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '7', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '8', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '7', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '9', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), @@ -59,15 +61,17 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL ('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '7', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '8', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '9', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '10', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '11', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '12', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '13', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '14', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '15', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '7', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '8', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '9', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '10', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '11', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '12', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '13', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '14', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '15', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '16', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '17', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), ('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), 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 new file mode 100644 index 0000000000..16e6ecf4bf --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql @@ -0,0 +1,7 @@ +use catalogdb; + +ALTER TABLE vnf_resource_customization +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-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql index e44a6b97ba..e44a6b97ba 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.1__WorkFlowDesignerTables.sql diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql new file mode 100644 index 0000000000..b39331234d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__Use_ID_Configuration_Customization.sql @@ -0,0 +1,75 @@ +USE catalogdb; + +/* Drop existing foreign key */ +ALTER TABLE `catalogdb`.`configuration_customization` +DROP FOREIGN KEY IF EXISTS `fk_configuration_customization__configuration_customization1`; + +ALTER TABLE `catalogdb`.`configuration_customization` +DROP FOREIGN KEY IF EXISTS `fk_configuration_resource_customization__configuration_resour1`; +/* Drop existing index */ +ALTER TABLE `catalogdb`.`configuration_customization` +DROP INDEX IF EXISTS `fk_configuration_customization__configuration_customization_idx` ; + +/* Create a new table */ +CREATE TABLE `tmp_configuration_customization` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) DEFAULT NULL, + `CONFIGURATION_ROLE` VARCHAR(200) DEFAULT NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) DEFAULT NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + `SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`) , + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`), + UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC), + CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE + +) ENGINE=INNODB DEFAULT CHARSET=LATIN1; + +/* Migrate the existing data */ +INSERT INTO tmp_configuration_customization +(`model_customization_uuid` , + `model_instance_name`, + `configuration_type` , + `configuration_role` , + `configuration_function` , + `creation_timestamp` , + `configuration_model_uuid` , + `service_proxy_customization_model_customization_uuid` , + `service_model_uuid`) +SELECT `config`.`model_customization_uuid`, + `config`.`model_instance_name`, + `config`.`configuration_type`, + `config`.`configuration_role`, + `config`.`configuration_function`, + `config`.`creation_timestamp`, + `config`.`configuration_model_uuid`, + `config`.`service_proxy_customization_model_customization_uuid`, + `svc`.`model_uuid` service_model_uuid FROM + configuration_customization config, + service svc, + configuration_customization_to_service config_svc +WHERE + config_svc.service_model_uuid = svc.model_uuid + AND config_svc.resource_model_customization_uuid = config.model_customization_uuid; + +/* Drop the old tables */ + +DROP TABLE `catalogdb`.`configuration_customization`; + +DROP TABLE `catalogdb`.`configuration_customization_to_service`; + +/* Rename the table */ +RENAME TABLE tmp_configuration_customization TO configuration_customization; + +
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index 088f9499ce..d174de7e2f 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -82,7 +82,7 @@ <keep>true</keep> </configuration> </execution> - + <execution> <id>generate-vnf-async-stubs</id> <phase>process-classes</phase> @@ -123,7 +123,7 @@ </configuration> </execution> </executions> - </plugin> + </plugin> --> <plugin> <groupId>org.jacoco</groupId> diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java index 52f5478f2f..2e62beb083 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java @@ -3,6 +3,8 @@ package org.onap.so.adapters.audit; import java.util.Optional; import org.camunda.bpm.client.task.ExternalTask; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java index d46229ae8e..77229919cd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java @@ -9,9 +9,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. @@ -27,14 +27,12 @@ import java.util.Map; import java.util.Optional; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -47,7 +45,7 @@ public class AuditCreateStackService extends AbstractAuditService { public HeatStackAudit heatStackAudit; @Autowired - public Environment env; + public Environment environment; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { AuditInventory auditInventory = externalTask.getVariable("auditInventory"); @@ -60,6 +58,8 @@ public class AuditCreateStackService extends AbstractAuditService { Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName()); if (auditListOpt.isPresent()) { + auditListOpt.get().setAuditType("create"); + auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName()); GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get())); success = !didCreateAuditFail(auditListOpt); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java index aca6e9e268..dcf61ed8a4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.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. @@ -25,12 +25,11 @@ import java.util.Map; import java.util.Optional; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -44,7 +43,7 @@ public class AuditDeleteStackService extends AbstractAuditService { public HeatStackAudit heatStackAudit; @Autowired - public Environment env; + public Environment environment; protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { AuditInventory auditInventory = externalTask.getVariable("auditInventory"); @@ -57,9 +56,11 @@ public class AuditDeleteStackService extends AbstractAuditService { Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName()); if (auditListOpt.isPresent()) { + auditListOpt.get().setAuditType("delete"); + auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName()); GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get())); - success = didDeleteAuditFail(auditListOpt); + success = !didDeleteAuditFail(auditListOpt); } } catch (Exception e) { logger.error("Error during audit of stack", e); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java index 8559fe5c36..e009c0e2fd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java @@ -28,6 +28,8 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -91,8 +93,6 @@ public class AuditVServer extends AbstractAudit { lInterfaceAudit.setDoesObjectExist(true); lInterface.setInterfaceName(lInterface.getInterfaceName()); } - LInterface lInterfaceShallow = new LInterface(); - BeanUtils.copyProperties(lInterface, lInterfaceShallow, "LInterfaces"); lInterfaceAudit.setAaiObject(lInterface); lInterfaceAudit.setResourceURI(linterfaceURI.build()); lInterfaceAudit.setAaiObjectType(AAIObjectType.L_INTERFACE.typeName()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java index 5c0d2d3019..2be87ff076 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java @@ -35,6 +35,7 @@ import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.Vlan; import org.onap.aai.domain.yang.Vlans; import org.onap.aai.domain.yang.Vserver; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.onap.so.openstack.utils.MsoHeatUtils; import org.onap.so.openstack.utils.MsoNeutronUtils; import org.slf4j.Logger; @@ -54,6 +55,8 @@ public class HeatStackAudit { protected static final Logger logger = LoggerFactory.getLogger(HeatStackAudit.class); + private static final String EXCEPTION_MSG = "Error finding Path from Self Link"; + @Autowired protected MsoHeatUtils heat; @@ -110,10 +113,10 @@ public class HeatStackAudit { processNestedResourceGroup(cloudRegion, tenantId, vServersWithLInterface, nestedResourceGroupResources); } else - throw new Exception("Error finding Path from Self Link"); + throw new Exception(EXCEPTION_MSG); } catch (Exception e) { logger.error("Error Parsing Link to obtain Path", e); - throw new Exception("Error finding Path from Self Link"); + throw new Exception(EXCEPTION_MSG); } } } @@ -143,7 +146,7 @@ public class HeatStackAudit { addSubInterfaceToVserver(vServersWithLInterface, subinterfaceStack, subinterfaceResources); } } else - throw new Exception("Error finding Path from Self Link"); + throw new Exception(EXCEPTION_MSG); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java index 4453071e06..69e16986da 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java @@ -22,12 +22,11 @@ package org.onap.so.adapters.inventory.create; import java.util.Optional; import java.util.stream.Stream; -import org.onap.aai.domain.yang.LInterface; -import org.onap.so.adapters.audit.AAIObjectAudit; -import org.onap.so.adapters.audit.AAIObjectAuditList; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.springframework.stereotype.Component; @Component 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 add3aac74d..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 @@ -9,7 +9,7 @@ * 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. @@ -20,17 +20,15 @@ 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; -import org.onap.so.adapters.audit.AAIObjectAuditList; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -48,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, @@ -97,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/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java index 0c55bd6945..25667efc71 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java @@ -66,7 +66,7 @@ public class ContrailSubnet { private List<ContrailSubnetPool> allocationPools = new ArrayList<>(); @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes") - private final ContrailSubnetHostRoutes host_routes = new ContrailSubnetHostRoutes(); + private final ContrailSubnetHostRoutes hostRoutes = new ContrailSubnetHostRoutes(); public ContrailSubnet() { super(); @@ -173,7 +173,7 @@ public class ContrailSubnet { } } if (inputSubnet.getHostRoutes() != null) { - List<ContrailSubnetHostRoute> hrList = host_routes.getHost_routes(); + List<ContrailSubnetHostRoute> hrList = hostRoutes.getHostRoutes(); for (HostRoute hr : inputSubnet.getHostRoutes()) { if (!msoCommonUtils.isNullOrEmpty(hr.getPrefix()) || !msoCommonUtils.isNullOrEmpty(hr.getNextHop())) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java index 76881bd58b..0802194b4a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java @@ -29,23 +29,23 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ContrailSubnetHostRoutes { @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route") - private List<ContrailSubnetHostRoute> host_routes = new ArrayList<ContrailSubnetHostRoute>(); + private List<ContrailSubnetHostRoute> hostRoutes = new ArrayList<>(); public ContrailSubnetHostRoutes() {} - public List<ContrailSubnetHostRoute> getHost_routes() { - return host_routes; + public List<ContrailSubnetHostRoute> getHostRoutes() { + return hostRoutes; } - public void setHost_routes(List<ContrailSubnetHostRoute> host_routes) { - this.host_routes = host_routes; + public void setHostRoutes(List<ContrailSubnetHostRoute> hostRoutes) { + this.hostRoutes = hostRoutes; } @Override public String toString() { StringBuilder buf = new StringBuilder(); - if (host_routes != null) { - for (ContrailSubnetHostRoute hr : host_routes) { + if (hostRoutes != null) { + for (ContrailSubnetHostRoute hr : hostRoutes) { buf.append(hr.toString()); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 4753b1c18d..429948cef1 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -71,6 +71,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { private static final String NETWORK_EXCEPTION_MSG = "Got a NetworkException on createNetwork: "; private static final String CREATE_NETWORK_ERROR_LOGMSG = "{} {} Error sending createNetwork notification {} "; private static final String FAULT_INFO_ERROR_LOGMSG = "{} {} Exception - fault info "; + private static final String SHARED = "shared"; + private static final String EXTERNAL = "external"; @Autowired private Environment environment; @@ -127,13 +129,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { HashMap<String, String> params = (HashMap<String, String>) networkParams; if (params == null) - params = new HashMap<String, String>(); + params = new HashMap<>(); String shared = null; String external = null; - if (params.containsKey("shared")) - shared = params.get("shared"); - if (params.containsKey("external")) - external = params.get("external"); + if (params.containsKey(SHARED)) + shared = params.get(SHARED); + if (params.containsKey(EXTERNAL)) + external = params.get(EXTERNAL); try { networkAdapter.createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, @@ -211,13 +213,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { HashMap<String, String> params = (HashMap<String, String>) networkParams; if (params == null) - params = new HashMap<String, String>(); + params = new HashMap<>(); String shared = null; String external = null; - if (params.containsKey("shared")) - shared = params.get("shared"); - if (params.containsKey("external")) - external = params.get("external"); + if (params.containsKey(SHARED)) + shared = params.get(SHARED); + if (params.containsKey(EXTERNAL)) + external = params.get(EXTERNAL); try { networkAdapter.updateNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, @@ -268,7 +270,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoRequest msoRequest, String notificationUrl) { logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); - String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} "; + String errorCreateNetworkMessage = CREATE_NETWORK_ERROR_LOGMSG; // Use the synchronous method to perform the actual Create diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index a79a6191cf..029da43f48 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -88,7 +88,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String NETWORK_ID = "network_id"; private static final String NETWORK_FQDN = "network_fqdn"; private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork"; - private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String NEUTRON_MODE = "NEUTRON"; private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class); @@ -115,6 +114,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { @Autowired private NetworkResourceRepository networkResourceRepo; + public MsoNetworkAdapterImpl() {} + /** * Health Check web method. Does nothing but return to show the adapter is deployed. */ @@ -128,7 +129,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { * * @see MsoNetworkAdapterImpl#MsoNetworkAdapterImpl(MsoPropertiesFactory) */ - public MsoNetworkAdapterImpl() {} @Override public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index b44704d1cf..b12d2397f9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -86,7 +86,8 @@ public class NetworkAdapterRest { private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; - private String EXCEPTION = "Exception:"; + private String exceptionMsg = "Exception:"; + private static final String SHARED = "shared"; @Autowired private MsoNetworkAdapterImpl adapter; @@ -170,7 +171,7 @@ public class NetworkAdapterRest { HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); if (params == null) { - params = new HashMap<String, String>(); + params = new HashMap<>(); } String shared = null; String external = null; @@ -192,8 +193,8 @@ public class NetworkAdapterRest { ctn = new ContrailNetwork(); req.setContrailNetwork(ctn); } - if (params.containsKey("shared")) { - shared = params.get("shared"); + if (params.containsKey(SHARED)) { + shared = params.get(SHARED); } else { if (ctn.getShared() != null) { shared = ctn.getShared(); @@ -218,8 +219,8 @@ public class NetworkAdapterRest { pvn = new ProviderVlanNetwork(); req.setProviderVlanNetwork(pvn); } - if (params.containsKey("shared")) - shared = params.get("shared"); + if (params.containsKey(SHARED)) + shared = params.get(SHARED); if (params.containsKey("external")) external = params.get("external"); adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), @@ -233,7 +234,7 @@ public class NetworkAdapterRest { rollback.value.getNetworkStackId(), networkFqdn.value, rollback.value.getNetworkCreated(), subnetIdMap.value, rollback.value, req.getMessageId()); } catch (NetworkException e) { - logger.debug(EXCEPTION, e); + logger.debug(exceptionMsg, e); eresp = new CreateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -328,7 +329,7 @@ public class NetworkAdapterRest { } response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId()); } catch (NetworkException e) { - logger.debug(EXCEPTION, e); + logger.debug(exceptionMsg, e); eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -467,7 +468,7 @@ public class NetworkAdapterRest { adapter.rollbackNetwork(nwr); response = new RollbackNetworkResponse(true, req.getMessageId()); } catch (NetworkException e) { - logger.debug(EXCEPTION, e); + logger.debug(exceptionMsg, e); eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -573,8 +574,8 @@ public class NetworkAdapterRest { ctn = new ContrailNetwork(); req.setContrailNetwork(ctn); } - if (params.containsKey("shared")) { - shared = params.get("shared"); + if (params.containsKey(SHARED)) { + shared = params.get(SHARED); } else { if (ctn.getShared() != null) { shared = ctn.getShared(); @@ -598,8 +599,8 @@ public class NetworkAdapterRest { pvn = new ProviderVlanNetwork(); req.setProviderVlanNetwork(pvn); } - if (params.containsKey("shared")) { - shared = params.get("shared"); + if (params.containsKey(SHARED)) { + shared = params.get(SHARED); } if (params.containsKey("external")) { external = params.get("external"); @@ -614,7 +615,7 @@ public class NetworkAdapterRest { // an update subnetIdMap.value, req.getMessageId()); } catch (NetworkException e) { - logger.debug(EXCEPTION, e); + logger.debug(exceptionMsg, e); eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java index c275073c46..68142e6cc9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java @@ -57,11 +57,11 @@ public class NetworkAdapterNotify_Service extends Service { } public NetworkAdapterNotify_Service() { - super(__getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME); + super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME); } public NetworkAdapterNotify_Service(WebServiceFeature... features) { - super(__getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features); + super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features); } public NetworkAdapterNotify_Service(URL wsdlLocation) { @@ -100,7 +100,7 @@ public class NetworkAdapterNotify_Service extends Service { return super.getPort(new QName(URL, "MsoNetworkAdapterAsyncImplPort"), NetworkAdapterNotify.class, features); } - private static URL __getWsdlLocation() { + private static URL getWsdlLocation() { if (NETWORKADAPTERNOTIFY_EXCEPTION != null) { throw NETWORKADAPTERNOTIFY_EXCEPTION; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java index 81ccd8aa04..a7a2974660 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java @@ -39,22 +39,22 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { - private static final String Url = "http://org.onap.so/networkNotify"; - private static final QName _RollbackNetworkNotification_QNAME = new QName(Url, "rollbackNetworkNotification"); - private static final QName _UpdateNetworkNotification_QNAME = new QName(Url, "updateNetworkNotification"); + private static final String URL = "http://org.onap.so/networkNotify"; + private static final QName _RollbackNetworkNotification_QNAME = new QName(URL, "rollbackNetworkNotification"); + private static final QName _UpdateNetworkNotification_QNAME = new QName(URL, "updateNetworkNotification"); private static final QName _QueryNetworkNotificationResponse_QNAME = - new QName(Url, "queryNetworkNotificationResponse"); + new QName(URL, "queryNetworkNotificationResponse"); private static final QName _UpdateNetworkNotificationResponse_QNAME = - new QName(Url, "updateNetworkNotificationResponse"); + new QName(URL, "updateNetworkNotificationResponse"); private static final QName _CreateNetworkNotificationResponse_QNAME = - new QName(Url, "createNetworkNotificationResponse"); - private static final QName _DeleteNetworkNotification_QNAME = new QName(Url, "deleteNetworkNotification"); + new QName(URL, "createNetworkNotificationResponse"); + private static final QName _DeleteNetworkNotification_QNAME = new QName(URL, "deleteNetworkNotification"); private static final QName _DeleteNetworkNotificationResponse_QNAME = - new QName(Url, "deleteNetworkNotificationResponse"); - private static final QName _CreateNetworkNotification_QNAME = new QName(Url, "createNetworkNotification"); - private static final QName _QueryNetworkNotification_QNAME = new QName(Url, "queryNetworkNotification"); + new QName(URL, "deleteNetworkNotificationResponse"); + private static final QName _CreateNetworkNotification_QNAME = new QName(URL, "createNetworkNotification"); + private static final QName _QueryNetworkNotification_QNAME = new QName(URL, "queryNetworkNotification"); private static final QName _RollbackNetworkNotificationResponse_QNAME = - new QName(Url, "rollbackNetworkNotificationResponse"); + new QName(URL, "rollbackNetworkNotificationResponse"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: @@ -211,7 +211,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotification }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "rollbackNetworkNotification") + @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotification") public JAXBElement<RollbackNetworkNotification> createRollbackNetworkNotification( RollbackNetworkNotification value) { return new JAXBElement<>(_RollbackNetworkNotification_QNAME, RollbackNetworkNotification.class, null, value); @@ -221,7 +221,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotification }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "updateNetworkNotification") + @XmlElementDecl(namespace = URL, name = "updateNetworkNotification") public JAXBElement<UpdateNetworkNotification> createUpdateNetworkNotification(UpdateNetworkNotification value) { return new JAXBElement<>(_UpdateNetworkNotification_QNAME, UpdateNetworkNotification.class, null, value); } @@ -230,7 +230,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotificationResponse }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "queryNetworkNotificationResponse") + @XmlElementDecl(namespace = URL, name = "queryNetworkNotificationResponse") public JAXBElement<QueryNetworkNotificationResponse> createQueryNetworkNotificationResponse( QueryNetworkNotificationResponse value) { return new JAXBElement<>(_QueryNetworkNotificationResponse_QNAME, QueryNetworkNotificationResponse.class, null, @@ -241,7 +241,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotificationResponse }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "updateNetworkNotificationResponse") + @XmlElementDecl(namespace = URL, name = "updateNetworkNotificationResponse") public JAXBElement<UpdateNetworkNotificationResponse> createUpdateNetworkNotificationResponse( UpdateNetworkNotificationResponse value) { return new JAXBElement<>(_UpdateNetworkNotificationResponse_QNAME, UpdateNetworkNotificationResponse.class, @@ -252,7 +252,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotificationResponse }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "createNetworkNotificationResponse") + @XmlElementDecl(namespace = URL, name = "createNetworkNotificationResponse") public JAXBElement<CreateNetworkNotificationResponse> createCreateNetworkNotificationResponse( CreateNetworkNotificationResponse value) { return new JAXBElement<>(_CreateNetworkNotificationResponse_QNAME, CreateNetworkNotificationResponse.class, @@ -263,7 +263,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotification }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "deleteNetworkNotification") + @XmlElementDecl(namespace = URL, name = "deleteNetworkNotification") public JAXBElement<DeleteNetworkNotification> createDeleteNetworkNotification(DeleteNetworkNotification value) { return new JAXBElement<>(_DeleteNetworkNotification_QNAME, DeleteNetworkNotification.class, null, value); } @@ -272,7 +272,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotificationResponse }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "deleteNetworkNotificationResponse") + @XmlElementDecl(namespace = URL, name = "deleteNetworkNotificationResponse") public JAXBElement<DeleteNetworkNotificationResponse> createDeleteNetworkNotificationResponse( DeleteNetworkNotificationResponse value) { return new JAXBElement<>(_DeleteNetworkNotificationResponse_QNAME, DeleteNetworkNotificationResponse.class, @@ -283,7 +283,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotification }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "createNetworkNotification") + @XmlElementDecl(namespace = URL, name = "createNetworkNotification") public JAXBElement<CreateNetworkNotification> createCreateNetworkNotification(CreateNetworkNotification value) { return new JAXBElement<>(_CreateNetworkNotification_QNAME, CreateNetworkNotification.class, null, value); } @@ -292,7 +292,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotification }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "queryNetworkNotification") + @XmlElementDecl(namespace = URL, name = "queryNetworkNotification") public JAXBElement<QueryNetworkNotification> createQueryNetworkNotification(QueryNetworkNotification value) { return new JAXBElement<>(_QueryNetworkNotification_QNAME, QueryNetworkNotification.class, null, value); } @@ -301,7 +301,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotificationResponse }{@code >}} * */ - @XmlElementDecl(namespace = Url, name = "rollbackNetworkNotificationResponse") + @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotificationResponse") public JAXBElement<RollbackNetworkNotificationResponse> createRollbackNetworkNotificationResponse( RollbackNetworkNotificationResponse value) { return new JAXBElement<>(_RollbackNetworkNotificationResponse_QNAME, RollbackNetworkNotificationResponse.class, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java index 4396fc035d..9fc5c979d8 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java @@ -89,7 +89,7 @@ public class CXFConfiguration { } @Bean - public ServletRegistrationBean SoapDispatcherServlet() { + public ServletRegistrationBean soapDispatcherServlet() { ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new CXFServlet(), "/services/*"); servletRegistrationBean.setName("services"); return servletRegistrationBean; @@ -149,7 +149,7 @@ public class CXFConfiguration { } @Bean - public Endpoint VnfAsyncAdapterEndpoint() { + public Endpoint vnfAsyncAdapterEndpoint() { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl); endpoint.publish("/VnfAsyncAdapter"); endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl"); @@ -160,7 +160,7 @@ public class CXFConfiguration { } @Bean - public Endpoint VnfCloudAdapterEndpoint() { + public Endpoint vnfCloudAdapterEndpoint() { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfCloudifyAdapterImpl); endpoint.publish("/VnfCloudifyAdapterImpl"); endpoint.setWsdlLocation("VnfCloudifyAdapterImpl.wsdl"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java index 97a2500c59..436836491d 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java @@ -22,7 +22,6 @@ package org.onap.so.adapters.openstack; import java.util.concurrent.Executor; import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index fe11fa07b4..9236945d37 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -64,6 +64,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; + private static final String UPDATE_VNFA = "{} UpdateVnfA"; + private static final String EXCEPTION_UPDATEVNF_NOTIFICATION = "{} {} Exception sending updateVnf notification "; @Autowired private Environment environment; @@ -173,7 +175,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs, String messageId, MsoRequest msoRequest, String notificationUrl) { - logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF); + logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; @@ -187,7 +189,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfAdapter.updateVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback); } catch (VnfException e) { - logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR, + logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_UPDATE_VNF_ERR, ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; @@ -204,10 +206,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl); notifyPort.updateVnfNotification(messageId, false, exCat, eMsg, null, null); } catch (Exception e1) { - logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR, ErrorCode.BusinessProcesssError.getValue(), e1); } - logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); + logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; } logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value); @@ -217,10 +219,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.updateVnfNotification(messageId, true, null, null, copyUpdateOutputs(outputs), copyVrb(vnfRollback)); } catch (Exception e) { - logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR, ErrorCode.BusinessProcesssError.getValue(), e); } - logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); + logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; } 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 5c7e70673b..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; @@ -107,7 +107,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterImpl.class); - private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; @@ -115,7 +114,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final String VALET_ENABLED = "org.onap.so.adapters.vnf.valet_enabled"; private static final String FAIL_REQUESTS_ON_VALET_FAILURE = "org.onap.so.adapters.vnf.fail_requests_on_valet_failure"; - private static final String SUCCESS_MSG = "Successfully received response from Open Stack"; + private static final String OPENSTACK = "OpenStack"; @Autowired private VFModuleCustomizationRepository vfModuleCustomRepo; @@ -133,7 +132,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { /** * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL. - * + * * @see MsoVnfAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory) */ public MsoVnfAdapterImpl() { @@ -190,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 = ""; @@ -252,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) { @@ -268,7 +265,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, - tenantId, "OpenStack", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me); + tenantId, OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); throw new VnfException(me); } @@ -311,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) { @@ -328,7 +318,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, "OpenStack", "DeleteVNF", ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, OPENSTACK, "DeleteVNF", ErrorCode.DataError.getValue(), "Exception - DeleteVNF", me); logger.debug(error); throw new VnfException(me); @@ -345,10 +335,9 @@ 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"); + logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf"); return; } @@ -373,7 +362,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Rollback VNF: " + vnfId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, - cloudSiteId, tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - DeleteStack", me); logger.debug(error); throw new VnfException(me); @@ -438,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; } } @@ -462,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); @@ -591,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; } } @@ -655,7 +643,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); // Failed to query the Stack due to an openstack exception. @@ -674,7 +662,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, @@ -685,7 +673,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in FAILED state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, @@ -697,7 +685,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, @@ -709,7 +697,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), - vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", + vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, @@ -741,7 +729,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException(me); @@ -750,7 +738,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "queryStack", + cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "queryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached heatStack ID " + "DOES NOT EXIST"); logger.debug(error); @@ -776,7 +764,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack", me); logger.debug("ERROR trying to query nested base stack= {}", error); @@ -786,7 +774,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", + cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached base heatStack ID DOES NOT EXIST"); logger.debug("Exception occurred", error); @@ -821,7 +809,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), - "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack", + "VF Module ModelCustomizationUuid", modelCustomizationUuid, OPENSTACK, ErrorCode.DataError.getValue(), "Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu); logger.debug(error); @@ -850,7 +838,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (vnfResource == null) { String error = "Create VNF: Unknown VNF Type: " + vnfType; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType, - "OpenStack", ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); + OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -923,7 +911,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion(); - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", + logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -966,7 +954,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", - vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error); + vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -980,7 +968,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - "OpenStack", ErrorCode.DataError.getValue(), error); + OPENSTACK, ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1161,7 +1149,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack", + logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1227,7 +1215,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, - cloudOwner, cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "MsoException - createStack", me); logger.debug(error); if (isValetEnabled && sendResponseToValet) { @@ -1246,7 +1234,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, - cloudOwner, cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "NullPointerException - createStack", npe); logger.debug(error); logger.debug("NULL POINTER EXCEPTION at heat.createStack"); @@ -1278,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()); @@ -1291,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 @@ -1305,7 +1291,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); throw new VnfException(me); @@ -1324,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) { @@ -1338,7 +1319,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me); logger.debug(error); if (isValetEnabled && valetDeleteRequestSucceeded) { @@ -1474,7 +1455,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); throw new VnfException(me); @@ -1486,8 +1467,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), - error); + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); throw new VnfNotFound(cloudSiteId, cloudOwner, tenantId, vfModuleName); } else { logger.debug("Found Existing stack, status={}", heatStack.getStatus()); @@ -1511,7 +1491,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), + cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException(me); @@ -1520,7 +1500,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, - cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", + cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1545,7 +1525,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException(me); @@ -1554,7 +1534,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", + cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1585,7 +1565,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (vf == null) { String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", - vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error); + vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } logger.debug("Got VF module definition from Catalog: {}", vf.toString()); @@ -1665,7 +1645,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "VNF Resource type: " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV; - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", + logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1697,7 +1677,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", - vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error); + vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate()); @@ -1706,7 +1686,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - "OpenStack", ErrorCode.DataError.getValue(), error); + OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { logger.debug("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment()); @@ -1913,7 +1893,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Problem - missing one or more required parameters if (checkRequiredParameters) { String error = "Update VNF: Missing Required inputs: " + missingParams; - logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack", + logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1936,7 +1916,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { extraParams.removeAll(paramList); if (!extraParams.isEmpty()) { logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType, - extraParams.toString(), "OpenStack", ErrorCode.DataError.getValue(), "Extra params"); + extraParams.toString(), OPENSTACK, ErrorCode.DataError.getValue(), "Extra params"); inputs.keySet().removeAll(extraParams); } } @@ -2000,7 +1980,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner, - cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); + cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "Exception - " + error, me); if (isValetEnabled && sendResponseToValet) { logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet"); try { @@ -2035,7 +2015,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { outputs.value = copyStringOutputs(heatStack.getOutputs()); rollback.value = vfRollback; - return; } private String getVfModuleNameFromModuleStackId(String vfModuleStackId) { @@ -2201,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/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index 2ea7ff417c..d092b49d8c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -79,15 +79,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static Logger logger = LoggerFactory.getLogger(MsoVnfCloudifyAdapterImpl.class); - private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; - private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; - private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN."; private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; - private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; - private static final String CLOUDIFY_RESPONSE_SUCCESS = "Successfully received response from Cloudify"; private static final String CLOUDIFY = "Cloudify"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); + private static final String BRACKETS = "{} {} {} {} {} {} {} {} {}"; + private static final String OPENSTACK = "OpenStack"; @Autowired protected CloudConfig cloudConfig; @@ -105,16 +102,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { protected MsoCloudifyUtils cloudifyUtils; /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheck() { - logger.debug("Health check call in VNF Cloudify Adapter"); - } - - /** * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL. - * + * * @see MsoVnfCloudifyAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory) */ public MsoVnfCloudifyAdapterImpl() { @@ -122,6 +111,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } /** + * Health Check web method. Does nothing but return to show the adapter is deployed. + */ + @Override + public void healthCheck() { + logger.debug("Health check call in VNF Cloudify Adapter"); + } + + /** * This is the "Create VNF" web service implementation. This function is now unsupported and will return an error. * */ @@ -195,9 +192,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext("QueryVNF"); String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), - "Exception - queryDeployment", me); + logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, + CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); logger.debug(error); throw new VnfException(me); } @@ -246,7 +242,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { 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"); + logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf"); return; } @@ -286,8 +282,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext("RollbackVNF"); String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, - cloudSiteId, tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(), + logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, + tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(), "Exception - DeleteDeployment", me); logger.debug(error); throw new VnfException(me); @@ -612,7 +608,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", + logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -652,9 +648,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (failIfExists != null && failIfExists) { String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), - vfModuleName, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", - ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already exists"); + logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + "Deployment " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); @@ -673,8 +669,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); @@ -682,8 +678,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a FAILED state String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in FAILED state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); @@ -692,8 +688,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in " + status.toString() + " state"); logger.debug(error); @@ -703,8 +699,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in an unknown state"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); @@ -726,9 +722,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to query the Volume GroupDeployment due to a cloudify exception. String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)", - ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me); + logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, cloudSiteId, + tenantId, CLOUDIFY, "queryDeployment(volume)", ErrorCode.DataError.getValue(), + "Exception - queryDeployment(volume)", me); logger.debug(error); // Convert to a generic VnfException me.addContext("CreateVFModule(QueryVolume)"); @@ -738,9 +734,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (volumeDeployment == null || volumeDeployment.getStatus() == DeploymentStatus.NOTFOUND) { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)", - ErrorCode.BusinessProcesssError.getValue(), + logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId, + error, CLOUDIFY, "queryDeployment(volume)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached Volume Group DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -776,9 +771,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to query the Volume GroupDeployment due to a cloudify exception. String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, - cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", - ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me); + logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner, + cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", ErrorCode.DataError.getValue(), + "Exception - queryDeployment(Base)", me); logger.debug(error); // Convert to a generic VnfException me.addContext("CreateVFModule(QueryBase)"); @@ -788,8 +783,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) { String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, - cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)", + logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId, + tenantId, error, CLOUDIFY, "queryDeployment(Base)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base " + "Module DOES NOT EXIST"); logger.debug(error); @@ -825,7 +820,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", - vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error); + vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate()); @@ -834,7 +829,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - "OpenStack", ErrorCode.DataError.getValue(), error); + OPENSTACK, ErrorCode.DataError.getValue(), error); // Alarm on this error, configuration must be fixed throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1113,9 +1108,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext("DeleteVFModule"); String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(), - "Exception - QueryDeployment", me); + logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, + CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(), "Exception - QueryDeployment", me); logger.debug(error); throw new VnfException(me); } @@ -1135,8 +1129,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, - cloudSiteId, tenantId, "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(), + logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, + "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(), "Exception - DeleteDeployment: " + me.getMessage()); logger.debug(error); throw new VnfException(me); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 7b48d0b07f..ed797f10d9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -68,7 +68,6 @@ import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; -import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoExceptionCategory; import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry; @@ -91,7 +90,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Transactional public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { - private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static Logger logger = LoggerFactory.getLogger(MsoVnfPluginAdapterImpl.class); private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; @@ -122,16 +120,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { protected VfModuleCustomizationToVduMapper vduMapper; /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheck() { - logger.debug("Health check call in VNF Plugin Adapter"); - } - - /** * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL. - * + * * @see MsoVnfPluginAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory) */ public MsoVnfPluginAdapterImpl() { @@ -139,6 +129,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } /** + * Health Check web method. Does nothing but return to show the adapter is deployed. + */ + @Override + public void healthCheck() { + logger.debug("Health check call in VNF Plugin Adapter"); + } + + /** * This is the "Create VNF" web service implementation. This function is now unsupported and will return an error. * */ diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 440b0dae0a..7c6d251263 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java @@ -82,6 +82,7 @@ public class VnfAdapterRestV2 { private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class); private static final String TESTING_KEYWORD = "___TESTING___"; private static final String RESP = ", resp="; + private static final String BRACKETS = "{} {} {} {}"; @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; @@ -134,7 +135,7 @@ public class VnfAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling delete, send generic failure as sync resp to caller - logger.error("{} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule", + logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e); return Response.serverError().build(); } @@ -178,7 +179,7 @@ public class VnfAdapterRestV2 { public void run() { try { String cloudsite = req.getCloudSiteId(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Map<String, String>> outputs = new Holder<>(); if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) { // vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), // req.getMsoRequest()); @@ -237,10 +238,10 @@ public class VnfAdapterRestV2 { try { int respStatus = HttpStatus.SC_OK; QueryVfModuleResponse qryResp = new QueryVfModuleResponse(aaiVnfId, aaiVfModuleId, null, null, null); - Holder<Boolean> vnfExists = new Holder<Boolean>(); - Holder<String> vfModuleId = new Holder<String>(); - Holder<VnfStatus> status = new Holder<VnfStatus>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vfModuleId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); // Support different Adapter Implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId); @@ -308,7 +309,7 @@ public class VnfAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule", + logger.error(BRACKETS, MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e); return Response.serverError().build(); } @@ -353,9 +354,9 @@ public class VnfAdapterRestV2 { logger.debug("CreateVfModuleTask start"); try { // Synchronous Web Service Outputs - Holder<String> vfModuleStackId = new Holder<String>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); - Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>(); + Holder<String> vfModuleStackId = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); + Holder<VnfRollback> vnfRollback = new Holder<>(); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType); @@ -423,7 +424,7 @@ public class VnfAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", + logger.error(BRACKETS, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); return Response.serverError().build(); } @@ -469,9 +470,9 @@ public class VnfAdapterRestV2 { // MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory); // Synchronous Web Service Outputs - Holder<String> vfModuleStackId = new Holder<String>(); - Holder<Map<String, String>> outputs = new Holder<Map<String, String>>(); - Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>(); + Holder<String> vfModuleStackId = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); + Holder<VnfRollback> vnfRollback = new Holder<>(); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType); @@ -535,7 +536,7 @@ public class VnfAdapterRestV2 { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", + logger.error(BRACKETS, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); return Response.serverError().build(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java index ced49e2313..bb2a9059b9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java @@ -9,9 +9,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. @@ -36,28 +36,28 @@ import javax.xml.namespace.QName; * The Java representation of XML content can consist of schema derived interfaces and classes representing the binding * of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in * this class. - * + * */ @XmlRegistry public class ObjectFactory { private static final String URL = "http://org.onap.so/vnfNotify"; - private final static QName _QueryVnfNotification_QNAME = new QName(URL, "queryVnfNotification"); - private final static QName _RollbackVnfNotification_QNAME = new QName(URL, "rollbackVnfNotification"); - private final static QName _CreateVnfNotification_QNAME = new QName(URL, "createVnfNotification"); - private final static QName _DeleteVnfNotification_QNAME = new QName(URL, "deleteVnfNotification"); - private final static QName _UpdateVnfNotification_QNAME = new QName(URL, "updateVnfNotification"); + private static final QName _QueryVnfNotification_QNAME = new QName(URL, "queryVnfNotification"); + private static final QName _RollbackVnfNotification_QNAME = new QName(URL, "rollbackVnfNotification"); + private static final QName _CreateVnfNotification_QNAME = new QName(URL, "createVnfNotification"); + private static final QName _DeleteVnfNotification_QNAME = new QName(URL, "deleteVnfNotification"); + private static final QName _UpdateVnfNotification_QNAME = new QName(URL, "updateVnfNotification"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: * org.onap.so.adapters.vnf.async.client - * + * */ public ObjectFactory() {} /** * Create an instance of {@link UpdateVnfNotification } - * + * */ public UpdateVnfNotification createUpdateVnfNotification() { return new UpdateVnfNotification(); @@ -65,7 +65,7 @@ public class ObjectFactory { /** * Create an instance of {@link UpdateVnfNotification.Outputs } - * + * */ public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() { return new UpdateVnfNotification.Outputs(); @@ -73,7 +73,7 @@ public class ObjectFactory { /** * Create an instance of {@link CreateVnfNotification } - * + * */ public CreateVnfNotification createCreateVnfNotification() { return new CreateVnfNotification(); @@ -81,7 +81,7 @@ public class ObjectFactory { /** * Create an instance of {@link CreateVnfNotification.Outputs } - * + * */ public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() { return new CreateVnfNotification.Outputs(); @@ -89,7 +89,7 @@ public class ObjectFactory { /** * Create an instance of {@link QueryVnfNotification } - * + * */ public QueryVnfNotification createQueryVnfNotification() { return new QueryVnfNotification(); @@ -97,7 +97,7 @@ public class ObjectFactory { /** * Create an instance of {@link QueryVnfNotification.Outputs } - * + * */ public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() { return new QueryVnfNotification.Outputs(); @@ -105,7 +105,7 @@ public class ObjectFactory { /** * Create an instance of {@link RollbackVnfNotification } - * + * */ public RollbackVnfNotification createRollbackVnfNotification() { return new RollbackVnfNotification(); @@ -113,7 +113,7 @@ public class ObjectFactory { /** * Create an instance of {@link DeleteVnfNotification } - * + * */ public DeleteVnfNotification createDeleteVnfNotification() { return new DeleteVnfNotification(); @@ -121,7 +121,7 @@ public class ObjectFactory { /** * Create an instance of {@link MsoRequest } - * + * */ public MsoRequest createMsoRequest() { return new MsoRequest(); @@ -129,7 +129,7 @@ public class ObjectFactory { /** * Create an instance of {@link VnfRollback } - * + * */ public VnfRollback createVnfRollback() { return new VnfRollback(); @@ -137,7 +137,7 @@ public class ObjectFactory { /** * Create an instance of {@link UpdateVnfNotification.Outputs.Entry } - * + * */ public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() { return new UpdateVnfNotification.Outputs.Entry(); @@ -145,7 +145,7 @@ public class ObjectFactory { /** * Create an instance of {@link CreateVnfNotification.Outputs.Entry } - * + * */ public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() { return new CreateVnfNotification.Outputs.Entry(); @@ -153,7 +153,7 @@ public class ObjectFactory { /** * Create an instance of {@link QueryVnfNotification.Outputs.Entry } - * + * */ public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() { return new QueryVnfNotification.Outputs.Entry(); @@ -161,52 +161,47 @@ public class ObjectFactory { /** * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} - * + * */ @XmlElementDecl(namespace = URL, name = "queryVnfNotification") public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) { - return new JAXBElement<QueryVnfNotification>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, - value); + return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} - * + * */ @XmlElementDecl(namespace = URL, name = "rollbackVnfNotification") public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) { - return new JAXBElement<RollbackVnfNotification>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, - null, value); + return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} - * + * */ @XmlElementDecl(namespace = URL, name = "createVnfNotification") public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) { - return new JAXBElement<CreateVnfNotification>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, - value); + return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} - * + * */ @XmlElementDecl(namespace = URL, name = "deleteVnfNotification") public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) { - return new JAXBElement<DeleteVnfNotification>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, - value); + return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} - * + * */ @XmlElementDecl(namespace = URL, name = "updateVnfNotification") public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) { - return new JAXBElement<UpdateVnfNotification>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, - value); + return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java index 8968851fe1..8681070972 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java @@ -310,7 +310,7 @@ public class QueryVnfNotification { */ public List<QueryVnfNotification.Outputs.Entry> getEntry() { if (entry == null) { - entry = new ArrayList<QueryVnfNotification.Outputs.Entry>(); + entry = new ArrayList<>(); } return this.entry; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java index b738d6dc64..968b3767c3 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java @@ -266,7 +266,7 @@ public class UpdateVnfNotification { */ public List<UpdateVnfNotification.Outputs.Entry> getEntry() { if (entry == null) { - entry = new ArrayList<UpdateVnfNotification.Outputs.Entry>(); + entry = new ArrayList<>(); } return this.entry; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java index e1a42706a9..402d0af8e4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.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. @@ -31,15 +31,16 @@ import javax.xml.ws.WebServiceFeature; /** * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b14002 Generated source version: 2.2 - * + * */ @WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") public class VnfAdapterNotify_Service extends Service { - private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; - private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; - private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify"); + private static final URL VNFADAPTERNOTIFY_WSDL_LOCATION; + private static final WebServiceException VNFADAPTERNOTIFY_EXCEPTION; + private static final String VNF_NOTIFY_URL = "http://org.onap.so/vnfNotify"; + private static final QName VNFADAPTERNOTIFY_QNAME = new QName(VNF_NOTIFY_URL, "vnfAdapterNotify"); static { VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service.class @@ -53,11 +54,11 @@ public class VnfAdapterNotify_Service extends Service { } public VnfAdapterNotify_Service() { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); + super(getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); } public VnfAdapterNotify_Service(WebServiceFeature... features) { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); + super(getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); } public VnfAdapterNotify_Service(URL wsdlLocation) { @@ -77,28 +78,26 @@ public class VnfAdapterNotify_Service extends Service { } /** - * + * * @return returns VnfAdapterNotify */ @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { - return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), - VnfAdapterNotify.class); + return super.getPort(new QName(VNF_NOTIFY_URL, "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); } /** - * + * * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features * not in the <code>features</code> parameter will have their default values. * @return returns VnfAdapterNotify */ @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { - return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), - VnfAdapterNotify.class, features); + return super.getPort(new QName(VNF_NOTIFY_URL, "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); } - private static URL __getWsdlLocation() { + private static URL getWsdlLocation() { if (VNFADAPTERNOTIFY_EXCEPTION != null) { throw VNFADAPTERNOTIFY_EXCEPTION; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java index dd64d53732..933b42e0b2 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java @@ -14,10 +14,6 @@ package org.onap.so.heatbridge.constants; public class HeatBridgeConstants { - private HeatBridgeConstants() { - throw new IllegalStateException("Trying to instantiate a constants class."); - } - /** * Openstack related constants */ @@ -70,4 +66,9 @@ public class HeatBridgeConstants { public static final String KEY_MSO_REQUEST_ID = "msoRequestId"; public static final String KEY_SO_WORKFLOW_EXCEPTION = "WorkflowException"; public static final String KEY_PROCESS_STATUS_MSG = "processStatusMsg"; + + private HeatBridgeConstants() { + throw new IllegalStateException("Trying to instantiate a constants class."); + } + } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java index d3faf1d7bf..788e038855 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java @@ -20,10 +20,6 @@ import javax.annotation.Nonnull; public class HeatBridgeUtils { - private HeatBridgeUtils() { - throw new IllegalStateException("Trying to instantiate a utility class."); - } - /** * IaaS naming convention for compute/p-interface to openstack/physical-network name mapping */ @@ -32,6 +28,10 @@ public class HeatBridgeUtils { private static final String COMPUTE_SIDE_SHARED_SRIOV_PREFIX = "sriov-s-"; private static final String COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX = "sriov-d-"; + private HeatBridgeUtils() { + throw new IllegalStateException("Trying to instantiate a utility class."); + } + public static Optional<String> getMatchingPserverPifName(@Nonnull final String physicalNetworkName) { Preconditions.checkState(!Strings.isNullOrEmpty(physicalNetworkName), "Physical network name is null or " + "empty!"); @@ -44,15 +44,4 @@ public class HeatBridgeUtils { } return Optional.empty(); } - - public static Optional<String> getMatchingPhysicalNetworkName(final String pserverPinterfaceName) { - if (pserverPinterfaceName.contains(COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX)) { - return Optional.of( - pserverPinterfaceName.replace(COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX, OS_SIDE_DEDICATED_SRIOV_PREFIX)); - } else if (pserverPinterfaceName.contains(COMPUTE_SIDE_SHARED_SRIOV_PREFIX)) { - return Optional - .of(pserverPinterfaceName.replace(COMPUTE_SIDE_SHARED_SRIOV_PREFIX, OS_SIDE_SHARED_SRIOV_PREFIX)); - } - return Optional.empty(); - } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java index 80b2a21419..f23486c45c 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java @@ -37,6 +37,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.springframework.core.env.Environment; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java index d43dbd99f9..2075557721 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java @@ -48,6 +48,7 @@ import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.skyscreamer.jsonassert.JSONAssert; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonParseException; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java index bc7ce53b8d..c995064ab2 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java @@ -43,6 +43,7 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.Vserver; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.onap.so.openstack.utils.MsoHeatUtils; import org.onap.so.openstack.utils.MsoNeutronUtils; import org.skyscreamer.jsonassert.JSONAssert; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java index 0fd2bd4b7f..8226f4fed8 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java @@ -38,12 +38,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.onap.so.adapters.audit.AAIObjectAuditList; import org.onap.so.audit.beans.AuditInventory; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.objects.audit.AAIObjectAuditList; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; 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/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java index eb8912f56d..830d94cf85 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java @@ -27,8 +27,8 @@ public class ContrailSubnetHostRoutesTest { @Test public void testContrailSubnetHostRoutes() { - cshr.setHost_routes(host_routes); - assertEquals(cshr.getHost_routes(), host_routes); + cshr.setHostRoutes(host_routes); + assertEquals(cshr.getHostRoutes(), host_routes); assert (cshr.toString() != null); } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java new file mode 100644 index 0000000000..701ed65d19 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Nokia. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.heatbridge.factory; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.heatbridge.HeatBridgeException; +import org.onap.so.heatbridge.openstack.api.OpenstackAccess; +import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactory; +import org.onap.so.utils.CryptoUtils; + +public class MsoCloudClientFactoryImplTest { + + private static final String URL_V2 = "http://localhost:8080/v2.0"; + private static final String URL_V3 = "http://localhost:8080/v3"; + private static final String URL_WITH_UNSUPPORTED_VERSION = "http://localhost:8080/v4"; + + private static final String MSO_ID = "testMsoId"; + private static final String ENCRYPTED_PASSWORD = CryptoUtils.encryptCloudConfigPassword("testPassword"); + private static final String CLOUD_REGION_ID = "testCloudRegionId"; + private static final String TENANT_ID = "testTenantId"; + + private MsoCloudClientFactoryImpl testedObject; + private OpenstackClientFactory openstackClientFactoryMock; + + @Before + public void setup() { + openstackClientFactoryMock = mock(OpenstackClientFactory.class); + testedObject = new MsoCloudClientFactoryImpl(openstackClientFactoryMock); + } + + @Test + public void getOpenstackClientWithVersion2() throws Exception { + testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID); + verify(openstackClientFactoryMock).createOpenstackV2Client(any(OpenstackAccess.class)); + } + + @Test + public void getOpenstackClientWithVersion3() throws Exception { + testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID); + verify(openstackClientFactoryMock).createOpenstackV3Client(any(OpenstackAccess.class)); + } + + @Test(expected = HeatBridgeException.class) + public void getOpenstackClient_unsupportedVersion() throws Exception { + testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, + TENANT_ID); + } + +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java new file mode 100644 index 0000000000..bbc99bd258 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java @@ -0,0 +1,31 @@ +package org.onap.so.heatbridge.utils; + +import static org.assertj.core.api.Assertions.assertThat; +import java.util.Optional; +import org.junit.Test; + +public class HeatBridgeUtilsTest { + + @Test(expected = IllegalStateException.class) + public void matchServerName_canNotBeNull() { + HeatBridgeUtils.getMatchingPserverPifName(null); + } + + @Test + public void matchServerName_isDedicated() { + Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("dedicated-testServer"); + assertThat(serverName).isNotEmpty().hasValue("sriov-d-testServer"); + } + + @Test + public void matchServerName_isShared() { + Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("shared-testServer"); + assertThat(serverName).isNotEmpty().hasValue("sriov-s-testServer"); + } + + @Test + public void matchServerName_unknown() { + Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("differentServerName"); + assertThat(serverName).isEmpty(); + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml index d1a5bd9fa3..20384465a1 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml @@ -113,3 +113,20 @@ management: endpoint: info: enabled: true + +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml index 694aedae10..058c1d2627 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -92,7 +92,7 @@ spring: generate-ddl: false show-sql: false hibernate: - ddl-auto: none + ddl-auto: validate database-platform: org.hibernate.dialect.MySQL5InnoDBDialect security: usercredentials: @@ -106,7 +106,6 @@ mariaDB4j: port: 3308 databaseName: catalogdb - #Actuator management: endpoints: @@ -121,3 +120,20 @@ management: prometheus: enabled: true # Whether exporting of metrics to Prometheus is enabled. step: 1m # Step size (i.e. reporting frequency) to use. + +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index 29a81e8fdf..1cf28be926 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -280,6 +280,7 @@ DROP TABLE IF EXISTS `configuration_customization`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `configuration_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, @@ -288,27 +289,18 @@ CREATE TABLE `configuration_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), - KEY `fk_configuration_customization__service_proxy_customization_idx` (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_customization_idx` (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - CONSTRAINT `fk_configuration_customization__configuration_customization1` FOREIGN KEY (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES `configuration_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `configuration_customization_to_service` --- - -DROP TABLE IF EXISTS `configuration_customization_to_service`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `configuration_customization_to_service` ( - `SERVICE_MODEL_UUID` varchar(200) NOT NULL, - `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, - PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + `SERVICE_MODEL_UUID` varchar(200), + PRIMARY KEY (`ID`), + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`), + UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC), + CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -725,6 +717,7 @@ CREATE TABLE `northbound_request_ref_lookup` ( `MAX_API_VERSION` double DEFAULT NULL, `IS_TOPLEVELFLOW` tinyint(1) DEFAULT NULL, `CLOUD_OWNER` varchar(200) NOT NULL, + `service_type` varchar(50) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_northbound_request_ref_lookup` (`MIN_API_VERSION`,`REQUEST_SCOPE`,`ACTION`,`IS_ALACARTE`,`MACRO_ACTION`,`CLOUD_OWNER`) ) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=latin1; @@ -1114,6 +1107,7 @@ CREATE TABLE `vnf_resource_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1140,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; @@ -1204,6 +1199,14 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` ( PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) )ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE IF NOT EXISTS `homing_instances` ( +`SERVICE_INSTANCE_ID` varchar(50) NOT NULL, +`CLOUD_OWNER` VARCHAR(200) NOT NULL, +`CLOUD_REGION_ID` VARCHAR(200) NOT NULL, +`OOF_DIRECTIVES` longtext NULL DEFAULT NULL, +PRIMARY KEY (`SERVICE_INSTANCE_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + CREATE TABLE IF NOT EXISTS `workflow` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `ARTIFACT_UUID` varchar(200) NOT NULL, @@ -1234,4 +1237,134 @@ CREATE TABLE IF NOT EXISTS `vnf_resource_to_workflow` ( CONSTRAINT `fk_vnf_resource_to_workflow__workflow1` FOREIGN KEY (`WORKFLOW_ID`) REFERENCES `workflow` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE IF NOT EXISTS `activity_spec` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NOT NULL, + `VERSION` DOUBLE NOT NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec` (`NAME` ASC, `VERSION` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `user_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + `PAYLOAD_LOCATION` VARCHAR(500) NULL, + `LABEL` VARCHAR(200) NOT NULL, + `TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `IS_REQUIRED` TINYINT(1) NOT NULL, + `MAX_LENGTH` INT(11) NULL, + `ALLOWABLE_CHARS` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_user_parameters` (`NAME` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `workflow_activity_spec_sequence` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `WORKFLOW_ID` INT(11) NOT NULL, + `ACTIVITY_SPEC_ID` INT(11) NOT NULL, + `SEQ_NO` INT(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_workflow_activity_spec_sequence` (`WORKFLOW_ID` ASC, `ACTIVITY_SPEC_ID` ASC, `SEQ_NO` ASC), + INDEX `fk_workflow_activity_spec_sequence__activity_spec_idx` (`ACTIVITY_SPEC_ID` ASC), + INDEX `fk_workflow_activity_spec_sequence__workflow_actifact_uuid_idx` (`WORKFLOW_ID` ASC), + CONSTRAINT `fk_workflow_activity_spec_sequence__activity_spec1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_workflow_activity_spec_sequence__workflow1` + FOREIGN KEY (`WORKFLOW_ID`) + REFERENCES `workflow` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + `TYPE` VARCHAR(200) NOT NULL, + `DIRECTION` VARCHAR(200) NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec_parameters` (`NAME` ASC, `DIRECTION` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; +CREATE TABLE IF NOT EXISTS `activity_spec_categories` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec_categories` (`NAME` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_to_activity_spec_categories` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `ACTIVITY_SPEC_ID` INT(11) NOT NULL, + `ACTIVITY_SPEC_CATEGORIES_ID` INT(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec_to_activity_spec_categories` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_CATEGORIES_ID` ASC), + INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx` (`ACTIVITY_SPEC_CATEGORIES_ID` ASC), + INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx1` (`ACTIVITY_SPEC_ID` ASC), + CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec_c1` + FOREIGN KEY (`ACTIVITY_SPEC_CATEGORIES_ID`) + REFERENCES `activity_spec_categories` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_to_activity_spec_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `ACTIVITY_SPEC_ID` INT(11) NOT NULL, + `ACTIVITY_SPEC_PARAMETERS_ID` INT(11) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_activity_spec_to_activity_spec_params__act_sp_param_id_idx` (`ACTIVITY_SPEC_PARAMETERS_ID` ASC), + UNIQUE INDEX `UK_activity_spec_to_activity_spec_parameters` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_PARAMETERS_ID` ASC), + INDEX `fk_activity_spec_to_activity_spec_parameters__act_spec_id_idx` (`ACTIVITY_SPEC_ID` ASC), + CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activity_spec_1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activ_spec_param1` + FOREIGN KEY (`ACTIVITY_SPEC_PARAMETERS_ID`) + REFERENCES `activity_spec_parameters` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `ACTIVITY_SPEC_ID` INT(11) NOT NULL, + `USER_PARAMETERS_ID` INT(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec_to_user_parameters` (`ACTIVITY_SPEC_ID` ASC, `USER_PARAMETERS_ID` ASC), + INDEX `fk_activity_spec_to_user_parameters__user_parameters1_idx` (`USER_PARAMETERS_ID` ASC), + INDEX `fk_activity_spec_to_user_parameters__activity_spec1_idx` (`ACTIVITY_SPEC_ID` ASC), + CONSTRAINT `fk_activity_spec_to_user_parameters__activity_spec1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_activity_spec_to_user_parameters__user_parameters1` + FOREIGN KEY (`USER_PARAMETERS_ID`) + REFERENCES `user_parameters` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = 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/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java index 1f66291283..a05eeea466 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java @@ -20,17 +20,25 @@ package org.onap.so.asdc; +import javax.annotation.PostConstruct; +import org.onap.so.asdc.activity.DeployActivitySpecs; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication(scanBasePackages = {"org.onap.so"}) @EnableScheduling +@EnableJpaRepositories("org.onap.so.db.catalog.data.repository") public class Application { private static final String MSO_CONFIG_PATH = "mso.config.path"; private static final String LOGS_DIR = "logs_dir"; + @Autowired + DeployActivitySpecs deployActivitySpecs; + private static void setLogsDir() { if (System.getProperty(LOGS_DIR) == null) { System.getProperties().setProperty(LOGS_DIR, "./logs/asdc/"); @@ -42,6 +50,15 @@ public class Application { System.getProperties().setProperty(MSO_CONFIG_PATH, "."); } + @PostConstruct + private void deployActivities() { + try { + deployActivitySpecs.deployActivities(); + } catch (Exception e) { + } + + } + public static void main(String[] args) { SpringApplication.run(Application.class, args); System.getProperties().setProperty("mso.db", "MARIADB"); 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 46d0f78e35..87008f1d8f 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 @@ -20,14 +20,18 @@ package org.onap.so.asdc.activity; -import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.onap.so.asdc.activity.beans.ActivitySpec; -import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.asdc.activity.beans.Input; +import org.onap.so.asdc.activity.beans.Output; +import org.onap.so.db.catalog.beans.ActivitySpecActivitySpecCategories; +import org.onap.so.db.catalog.beans.ActivitySpecActivitySpecParameters; +import org.onap.so.db.catalog.beans.ActivitySpecParameters; +import org.onap.so.db.catalog.data.repository.ActivitySpecRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,17 +43,24 @@ public class DeployActivitySpecs { @Autowired private Environment env; + @Autowired + private ActivitySpecRepository activitySpecRepository; + private static final String SDC_ENDPOINT = "mso.asdc.config.activity.endpoint"; + private static final String DIRECTION_INPUT = "input"; + private static final String DIRECTION_OUTPUT = "output"; protected static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class); - public void deployActivities() throws Exception { - String hostname = this.env.getProperty(SDC_ENDPOINT); - List<ActivitySpec> activitySpecs = new ArrayList<ActivitySpec>(); - // Initialize activitySpecs from Catalog DB - - for (ActivitySpec activitySpec : activitySpecs) { + public void deployActivities() throws Exception { + String hostname = env.getProperty(SDC_ENDPOINT); + if (hostname == null || hostname.isEmpty()) { + return; + } + List<org.onap.so.db.catalog.beans.ActivitySpec> activitySpecsFromCatalog = activitySpecRepository.findAll(); + for (org.onap.so.db.catalog.beans.ActivitySpec activitySpecFromCatalog : activitySpecsFromCatalog) { + ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog); String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec); if (activitySpecId != null) { logger.info("{} {}", "Successfully created activitySpec", activitySpec.getName()); @@ -64,4 +75,62 @@ public class DeployActivitySpecs { } } } + + public ActivitySpec mapActivitySpecFromCatalogToSdc( + org.onap.so.db.catalog.beans.ActivitySpec activitySpecFromCatalog) { + ActivitySpec activitySpec = new ActivitySpec(); + activitySpec.setName(activitySpecFromCatalog.getName()); + activitySpec.setDescription(activitySpecFromCatalog.getDescription()); + mapCategoryList(activitySpecFromCatalog.getActivitySpecActivitySpecCategories(), activitySpec); + mapInputsAndOutputs(activitySpecFromCatalog.getActivitySpecActivitySpecParameters(), activitySpec); + return activitySpec; + } + + private void mapCategoryList(List<ActivitySpecActivitySpecCategories> activitySpecActivitySpecCategories, + ActivitySpec activitySpec) { + if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.size() == 0) { + return; + } + List<String> categoryList = new ArrayList<String>(); + for (ActivitySpecActivitySpecCategories activitySpecCat : activitySpecActivitySpecCategories) { + if (activitySpecCat != null) { + if (activitySpecCat.getActivitySpecCategories() != null) { + categoryList.add(activitySpecCat.getActivitySpecCategories().getName()); + } + } + } + activitySpec.setCategoryList(categoryList); + } + + private void mapInputsAndOutputs(List<ActivitySpecActivitySpecParameters> activitySpecActivitySpecParameters, + ActivitySpec activitySpec) { + if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.size() == 0) { + return; + } + List<Input> inputs = new ArrayList<Input>(); + List<Output> outputs = new ArrayList<Output>(); + for (ActivitySpecActivitySpecParameters activitySpecParam : activitySpecActivitySpecParameters) { + if (activitySpecParam != null) { + if (activitySpecParam.getActivitySpecParameters() != null) { + ActivitySpecParameters activitySpecParameters = activitySpecParam.getActivitySpecParameters(); + if (activitySpecParameters != null) { + if (activitySpecParameters.getDirection().equals(DIRECTION_INPUT)) { + Input input = new Input(); + input.setName(activitySpecParameters.getName()); + input.setType(activitySpecParameters.getType()); + inputs.add(input); + } else if (activitySpecParameters.getDirection().equals(DIRECTION_OUTPUT)) { + Output output = new Output(); + output.setName(activitySpecParameters.getName()); + output.setType(activitySpecParameters.getType()); + outputs.add(output); + } + } + } + } + } + activitySpec.setInputs(inputs); + activitySpec.setOutputs(outputs); + return; + } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 7d92c637ad..2eace7587f 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -47,24 +47,6 @@ public class ASDCConfiguration implements IConfiguration { private String asdcControllerName; - public static final String MSO_PROP_ASDC = "MSO_PROP_ASDC"; - public static final String PARAMETER_PATTERN = "asdc-connections"; - public static final String MSG_BUS_ADDRESS_ATTRIBUTE_NAME = "messageBusAddress"; - public static final String WATCHDOG_TIMEOUT_NAME = "watchDogTimeout"; - - public static final String CONSUMER_GROUP_ATTRIBUTE_NAME = "consumerGroup"; - public static final String CONSUMER_ID_ATTRIBUTE_NAME = "consumerId"; - public static final String ENVIRONMENT_NAME_ATTRIBUTE_NAME = "environmentName"; - public static final String PASSWORD_ATTRIBUTE_NAME = "password"; - public static final String POLLING_INTERVAL_ATTRIBUTE_NAME = "pollingInterval"; - public static final String RELEVANT_ARTIFACT_TYPES_ATTRIBUTE_NAME = "relevantArtifactTypes"; - public static final String USER_ATTRIBUTE_NAME = "user"; - public static final String ASDC_ADDRESS_ATTRIBUTE_NAME = "asdcAddress"; - public static final String POLLING_TIMEOUT_ATTRIBUTE_NAME = "pollingTimeout"; - public static final String ACTIVATE_SERVER_TLS_AUTH = "activateServerTLSAuth"; - public static final String KEY_STORE_PASSWORD = "keyStorePassword"; - public static final String KEY_STORE_PATH = "keyStorePath"; - public static final String HEAT = "HEAT"; public static final String HEAT_ARTIFACT = "HEAT_ARTIFACT"; public static final String HEAT_ENV = "HEAT_ENV"; @@ -73,7 +55,7 @@ public class ASDCConfiguration implements IConfiguration { public static final String HEAT_VOL = "HEAT_VOL"; public static final String OTHER = "OTHER"; public static final String TOSCA_CSAR = "TOSCA_CSAR"; - public static final String WORKFLOWS = "Workflows"; + public static final String WORKFLOW = "WORKFLOW"; public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA"; private static final String[] SUPPORTED_ARTIFACT_TYPES = 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 f2e875fc0c..9b838c4d98 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 @@ -47,6 +47,7 @@ import org.onap.sdc.api.results.IDistributionClientResult; import org.onap.sdc.impl.DistributionClientFactory; import org.onap.sdc.utils.DistributionActionResultEnum; import org.onap.sdc.utils.DistributionStatusEnum; +import org.onap.so.asdc.activity.DeployActivitySpecs; import org.onap.so.asdc.client.exceptions.ASDCControllerException; import org.onap.so.asdc.client.exceptions.ASDCDownloadException; import org.onap.so.asdc.client.exceptions.ASDCParametersException; @@ -57,7 +58,6 @@ import org.onap.so.asdc.installer.ResourceStructure; import org.onap.so.asdc.installer.ResourceType; import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.asdc.installer.VfResourceStructure; -import org.onap.so.asdc.installer.bpmn.BpmnInstaller; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.asdc.tenantIsolation.DistributionStatus; import org.onap.so.asdc.tenantIsolation.WatchdogDistribution; @@ -89,9 +89,6 @@ public class ASDCController { private ToscaResourceInstaller toscaInstaller; @Autowired - private BpmnInstaller bpmnInstaller; - - @Autowired private WatchdogDistributionStatusRepository wdsRepo; @Autowired @@ -110,6 +107,9 @@ public class ASDCController { @Autowired private WatchdogDistribution wd; + @Autowired + DeployActivitySpecs deployActivitySpecs; + public int getNbOfNotificationsOngoing() { return nbOfNotificationsOngoing; } @@ -668,9 +668,6 @@ public class ASDCController { msoConfigPath + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact.getArtifactName(); File csarFile = new File(filePath); String csarFilePath = csarFile.getAbsolutePath(); - if (bpmnInstaller.containsWorkflows(csarFilePath)) { - bpmnInstaller.installBpmn(csarFilePath); - } for (IResourceInstance resource : iNotif.getResources()) { @@ -679,7 +676,7 @@ public class ASDCController { logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID()); - if ("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)) { + if ("VF".equals(resourceType)) { resourceStructure = new VfResourceStructure(iNotif, resource); } else if ("PNF".equals(resourceType)) { resourceStructure = new PnfResourceStructure(iNotif, resource); @@ -697,7 +694,7 @@ public class ASDCController { logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID()); - if ("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)) { + if ("VF".equals(resourceType)) { hasVFResource = true; for (IArtifactInfo artifact : resource.getArtifacts()) { IDistributionClientDownloadResult resultArtifact = @@ -711,8 +708,15 @@ public class ASDCController { .dumpVfModuleMetaDataList(((VfResourceStructure) resourceStructure) .decodeVfModuleArtifact(resultArtifact.getArtifactPayload()))); } - resourceStructure.addArtifactToStructure(distributionClient, artifact, - resultArtifact); + if (!ASDCConfiguration.WORKFLOW.equals(artifact.getArtifactType())) { + resourceStructure.addArtifactToStructure(distributionClient, artifact, + resultArtifact); + } else { + writeArtifactToFile(artifact, resultArtifact); + logger.debug( + "Adding workflow artifact to structure: " + artifact.getArtifactName()); + resourceStructure.addWorkflowArtifactToStructure(artifact, resultArtifact); + } } } @@ -801,7 +805,7 @@ public class ASDCController { "processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e); } - } else if (artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)) { + } else if (artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOW)) { try { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java index 8aa9684426..2a6e77ed40 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java @@ -39,6 +39,12 @@ public class PnfResourceStructure extends ResourceStructure { } @Override + public void addWorkflowArtifactToStructure(IArtifactInfo artifactinfo, + IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { + + } + + @Override public void prepareInstall() throws ArtifactInstallerException { } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java index 9965a05294..8be3d6ba06 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java @@ -68,10 +68,16 @@ public abstract class ResourceStructure { */ protected final Map<String, VfModuleArtifact> artifactsMapByUUID; + /** + * The list of workflow artifacts existing in this resource + */ + protected final Map<String, WorkflowArtifact> workflowArtifactsMapByUUID; + public ResourceStructure(INotificationData notificationData, IResourceInstance resourceInstance) { this.notificationData = notificationData; this.resourceInstance = resourceInstance; artifactsMapByUUID = new HashMap<>(); + workflowArtifactsMapByUUID = new HashMap<>(); } /** @@ -85,6 +91,9 @@ public abstract class ResourceStructure { public abstract void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException; + public abstract void addWorkflowArtifactToStructure(IArtifactInfo artifactinfo, + IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException; + /** * Prepare the resource for installation. * @@ -144,4 +153,8 @@ public abstract class ResourceStructure { return artifactsMapByUUID; } + public Map<String, WorkflowArtifact> getWorkflowArtifactsMapByUUID() { + return workflowArtifactsMapByUUID; + } + } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java index 62408be922..16e9fda7c4 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java @@ -98,6 +98,12 @@ public class VfResourceStructure extends ResourceStructure { } } + public void addWorkflowArtifactToStructure(IArtifactInfo artifactinfo, + IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { + WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactinfo, clientResult); + workflowArtifactsMapByUUID.put(artifactinfo.getArtifactUUID(), workflowArtifact); + } + protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult, VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/WorkflowArtifact.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/WorkflowArtifact.java new file mode 100644 index 0000000000..83b5614104 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/WorkflowArtifact.java @@ -0,0 +1,65 @@ +/*- + * ============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.asdc.installer; + + +import java.io.UnsupportedEncodingException; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.beans.HeatFiles; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.sdc.api.notification.IArtifactInfo; +import org.onap.sdc.api.results.IDistributionClientDownloadResult; + +/** + * The structure that contains the artifactInfo and its associated DownloadedResult. + * + */ +public final class WorkflowArtifact { + private final IArtifactInfo artifactInfo; + private int deployedInDb = 0; + private final String result; + + public WorkflowArtifact(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult) + throws UnsupportedEncodingException { + result = new String(clientResult.getArtifactPayload(), "UTF-8"); + artifactInfo = artifactinfo; + + } + + public IArtifactInfo getArtifactInfo() { + return artifactInfo; + } + + public String getResult() { + return result; + } + + public int getDeployedInDb() { + return deployedInDb; + } + + public void incrementDeployedInDB() { + ++deployedInDb; + } + + + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index c98fb9b619..7945ad0174 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -58,7 +58,7 @@ public class BpmnInstaller { protected static final Logger logger = LoggerFactory.getLogger(BpmnInstaller.class); private static final String BPMN_SUFFIX = ".bpmn"; private static final String CAMUNDA_URL = "mso.camundaURL"; - private static final String CREATE_DEPLOYMENT_PATH = "/sobpmnengine/deployment/create"; + private static final String CREATE_DEPLOYMENT_PATH = "sobpmnengine/deployment/create"; @Autowired private Environment env; @@ -78,7 +78,7 @@ public class BpmnInstaller { Path p = Paths.get(name); String fileName = p.getFileName().toString(); extractBpmnFileFromCsar(csarFile, fileName); - HttpResponse response = sendDeploymentRequest(fileName); + HttpResponse response = sendDeploymentRequest(fileName, ""); logger.debug("Response status line: {}", response.getStatusLine()); logger.debug("Response entity: {}", response.getEntity().toString()); if (response.getStatusLine().getStatusCode() != 200) { @@ -125,21 +125,21 @@ public class BpmnInstaller { return workflowsInCsar; } - protected HttpResponse sendDeploymentRequest(String bpmnFileName) throws Exception { + protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version) throws Exception { HttpClient client = HttpClientBuilder.create().build(); URI deploymentUri = new URI(this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH); HttpPost post = new HttpPost(deploymentUri); RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(1000000).setConnectTimeout(1000) .setConnectionRequestTimeout(1000).build(); post.setConfig(requestConfig); - HttpEntity requestEntity = buildMimeMultipart(bpmnFileName); + HttpEntity requestEntity = buildMimeMultipart(bpmnFileName, version); post.setEntity(requestEntity); return client.execute(post); } - protected HttpEntity buildMimeMultipart(String bpmnFileName) throws Exception { + protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception { FileInputStream bpmnFileStream = new FileInputStream( - Paths.get(System.getProperty("mso.config.path"), "ASDC", bpmnFileName).normalize().toString()); + Paths.get(System.getProperty("mso.config.path"), "ASDC", version, bpmnFileName).normalize().toString()); byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream); HttpEntity requestEntity = diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java new file mode 100644 index 0000000000..daeda2f976 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java @@ -0,0 +1,215 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * 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.asdc.installer.bpmn; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.http.HttpResponse; +import org.onap.sdc.api.notification.IArtifactInfo; +import org.onap.so.asdc.installer.VfResourceStructure; +import org.onap.so.asdc.installer.WorkflowArtifact; +import org.onap.so.db.catalog.beans.ActivitySpec; +import org.onap.so.db.catalog.beans.VnfResourceWorkflow; +import org.onap.so.db.catalog.beans.Workflow; +import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence; +import org.onap.so.db.catalog.data.repository.ActivitySpecRepository; +import org.onap.so.db.catalog.data.repository.WorkflowRepository; +import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.MessageEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class WorkflowResource { + protected static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class); + + private static final String pattern = ".*\\\"activity:(.*)\\\" .*"; + private static final String TARGET_RESOURCE_VNF = "vnf"; + private static final String SOURCE_SDC = "sdc"; + private static final String BPMN_SUFFIX = ".bpmn"; + + @Autowired + protected WorkflowRepository workflowRepo; + + @Autowired + protected ActivitySpecRepository activityRepo; + + @Autowired + private BpmnInstaller bpmnInstaller; + + public void processWorkflows(VfResourceStructure vfResourceStructure) throws Exception { + Map<String, WorkflowArtifact> artifactsMapByUUID = vfResourceStructure.getWorkflowArtifactsMapByUUID(); + String vfResourceModelUuid = vfResourceStructure.getResourceInstance().getResourceUUID(); + for (String uuid : artifactsMapByUUID.keySet()) { + WorkflowArtifact artifactToInstall = artifactsMapByUUID.get(uuid); + if (isLatestVersionAvailable(artifactsMapByUUID, artifactToInstall)) { + logger.debug("Installing the BPMN: " + artifactToInstall.getArtifactInfo().getArtifactName()); + deployWorkflowResourceToCamunda(artifactToInstall); + installWorkflowResource(artifactToInstall, vfResourceModelUuid); + } else { + logger.debug("Skipping installing - not the latest version: " + + artifactToInstall.getArtifactInfo().getArtifactName()); + } + } + } + + protected void deployWorkflowResourceToCamunda(WorkflowArtifact artifact) throws Exception { + String bpmnName = artifact.getArtifactInfo().getArtifactName(); + String version = artifact.getArtifactInfo().getArtifactVersion(); + logger.debug("BPMN Name: " + bpmnName); + try { + HttpResponse response = bpmnInstaller.sendDeploymentRequest(bpmnName, version); + logger.debug("Response status line: {}", response.getStatusLine()); + logger.debug("Response entity: {}", response.getEntity().toString()); + if (response.getStatusLine().getStatusCode() != 200) { + logger.debug("Failed deploying BPMN {}", bpmnName); + logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName, + bpmnName, Integer.toString(response.getStatusLine().getStatusCode()), + ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed"); + throw (new Exception("Error from Camunda on deploying the BPMN: " + bpmnName)); + } else { + logger.debug("Successfully deployed to Camunda: {}", bpmnName); + } + } catch (Exception e) { + logger.debug("Exception :", e); + logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName, + e.getMessage(), ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed"); + throw e; + } + } + + protected void installWorkflowResource(WorkflowArtifact artifact, String vfResourceModelUuid) throws Exception { + IArtifactInfo artifactInfo = artifact.getArtifactInfo(); + + Workflow workflow = new Workflow(); + + workflow.setArtifactChecksum(artifactInfo.getArtifactChecksum()); + workflow.setArtifactName(artifactInfo.getArtifactName()); + workflow.setArtifactUUID(artifactInfo.getArtifactUUID()); + workflow.setBody(artifact.getResult()); + workflow.setDescription(artifactInfo.getArtifactDescription()); + workflow.setName(getWorkflowNameFromArtifactName(artifactInfo.getArtifactName())); + workflow.setResourceTarget(TARGET_RESOURCE_VNF); + workflow.setSource(SOURCE_SDC); + workflow.setTimeoutMinutes(artifactInfo.getArtifactTimeout()); + workflow.setOperationName(getWorkflowNameFromArtifactName(artifactInfo.getArtifactName())); + workflow.setVersion(getWorkflowVersionFromArtifactName(artifactInfo.getArtifactName())); + + VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow(); + vnfResourceWorkflow.setVnfResourceModelUUID(vfResourceModelUuid); + List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<VnfResourceWorkflow>(); + vnfResourceWorkflows.add(vnfResourceWorkflow); + + workflow.setVnfResourceWorkflow(vnfResourceWorkflows); + + List<String> activityNames = getActivityNameList(artifact.getResult()); + List<WorkflowActivitySpecSequence> wfss = getWorkflowActivitySpecSequence(activityNames); + workflow.setWorkflowActivitySpecSequence(wfss); + + workflowRepo.save(workflow); + + } + + protected boolean isLatestVersionAvailable(Map<String, WorkflowArtifact> artifactsMapByUUID, + WorkflowArtifact artifact) { + String workflowName = getWorkflowNameFromArtifactName(artifact.getArtifactInfo().getArtifactName()); + Double workflowVersion = getWorkflowVersionFromArtifactName(artifact.getArtifactInfo().getArtifactName()); + if (workflowVersion == null) { + workflowVersion = 0.0; + } + for (WorkflowArtifact artifactInMap : artifactsMapByUUID.values()) { + Double versionInMap = getWorkflowVersionFromArtifactName(artifactInMap.getArtifactInfo().getArtifactName()); + if (versionInMap == null) { + versionInMap = 0.0; + } + if (workflowName.equals(getWorkflowNameFromArtifactName(artifactInMap.getArtifactInfo().getArtifactName())) + && Double.compare(workflowVersion, versionInMap) < 0) { + return false; + } + } + return true; + } + + protected List<String> getActivityNameList(String bpmnContent) { + List<String> activityNameList = new ArrayList<String>(); + + Pattern p = Pattern.compile(pattern); + Matcher m = p.matcher(bpmnContent); + while (m.find()) { + activityNameList.add(m.group(1)); + } + return activityNameList; + } + + protected List<WorkflowActivitySpecSequence> getWorkflowActivitySpecSequence(List<String> activityNames) + throws Exception { + if (activityNames == null || activityNames.size() == 0) { + return null; + } + List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<WorkflowActivitySpecSequence>(); + for (String activityName : activityNames) { + ActivitySpec activitySpec = activityRepo.findByName(activityName); + if (activitySpec != null) { + WorkflowActivitySpecSequence workflowActivitySpec = new WorkflowActivitySpecSequence(); + workflowActivitySpec.setActivitySpec(activitySpec); + workflowActivitySpecs.add(workflowActivitySpec); + } + } + return workflowActivitySpecs; + } + + public String getWorkflowNameFromArtifactName(String artifactName) { + if (artifactName == null) { + return null; + } else { + if (artifactName.contains(BPMN_SUFFIX)) { + return artifactName.substring(0, artifactName.lastIndexOf(BPMN_SUFFIX)).split("-")[0]; + } else { + return artifactName.split("-")[0]; + } + } + } + + public Double getWorkflowVersionFromArtifactName(String artifactName) { + if (artifactName == null) { + return null; + } else { + String[] workflowNameParts = null; + if (artifactName.contains(BPMN_SUFFIX)) { + workflowNameParts = artifactName.substring(0, artifactName.lastIndexOf(BPMN_SUFFIX)).split("-"); + } else { + workflowNameParts = artifactName.split("-"); + } + if (workflowNameParts.length < 2) { + return null; + } else { + return Double.valueOf(workflowNameParts[1].replaceAll("_", ".")); + } + } + } +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index f3a495825c..ddf1f3d84b 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -26,6 +26,7 @@ package org.onap.so.asdc.installer.heat; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -35,6 +36,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import org.hibernate.StaleObjectStateException; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.LockAcquisitionException; import org.onap.sdc.api.notification.IArtifactInfo; @@ -55,7 +57,6 @@ import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.RequirementAssignments; import org.onap.sdc.toscaparser.api.elements.Metadata; -import org.onap.sdc.toscaparser.api.elements.StatefulEntityType; import org.onap.sdc.toscaparser.api.functions.GetInput; import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.sdc.utils.DistributionStatusEnum; @@ -70,6 +71,7 @@ import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.asdc.installer.VfModuleArtifact; import org.onap.so.asdc.installer.VfModuleStructure; import org.onap.so.asdc.installer.VfResourceStructure; +import org.onap.so.asdc.installer.bpmn.WorkflowResource; import org.onap.so.asdc.util.YamlEditor; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; @@ -122,7 +124,6 @@ import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository; import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.data.repository.VFModuleRepository; -import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository; import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.data.repository.VnfcCustomizationRepository; import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository; @@ -142,6 +143,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.util.CollectionUtils; @Component public class ToscaResourceInstaller { @@ -247,6 +249,9 @@ public class ToscaResourceInstaller { @Autowired protected PnfCustomizationRepository pnfCustomizationRepository; + @Autowired + protected WorkflowResource workflowResource; + protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class); public boolean isResourceAlreadyDeployed(ResourceStructure vfResourceStruct, boolean serviceDeployed) @@ -308,6 +313,7 @@ public class ToscaResourceInstaller { } } + @Transactional(rollbackFor = {ArtifactInstallerException.class}) public void installTheResource(ToscaResourceStructure toscaResourceStruct, ResourceStructure resourceStruct) throws ArtifactInstallerException { @@ -400,6 +406,7 @@ public class ToscaResourceInstaller { vfCustomizationCategory); } + workflowResource.processWorkflows(vfResourceStructure); processResourceSequence(toscaResourceStruct, service); List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources(); processAllottedResources(toscaResourceStruct, service, allottedResourceList); @@ -408,8 +415,10 @@ public class ToscaResourceInstaller { processNetworkCollections(toscaResourceStruct, service); // Process Service Proxy & Configuration processServiceProxyAndConfiguration(toscaResourceStruct, service); + logger.info("Saving Service: {} ", service.getModelName()); - serviceRepo.save(service); + service = serviceRepo.save(service); + correlateConfigCustomResources(service); WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus( vfResourceStruct.getNotification().getDistributionID(), MSO); @@ -637,7 +646,8 @@ public class ToscaResourceInstaller { } protected ConfigurationResourceCustomization getConfigurationResourceCustomization(NodeTemplate nodeTemplate, - ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) { + ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization, + Service service) { Metadata metadata = nodeTemplate.getMetaData(); ConfigurationResource configResource = getConfigurationResource(nodeTemplate); @@ -660,31 +670,15 @@ public class ToscaResourceInstaller { .setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID()); configCustomizationResource.setConfigurationResource(configResource); + configCustomizationResource.setService(service); configResourceCustomizationSet.add(configCustomizationResource); configResource.setConfigurationResourceCustomization(configResourceCustomizationSet); + return configCustomizationResource; } - protected Optional<ConfigurationResourceCustomization> getVnrNodeTemplate( - List<NodeTemplate> configurationNodeTemplatesList, ToscaResourceStructure toscaResourceStructure, - ServiceProxyResourceCustomization spResourceCustomization) { - Optional<ConfigurationResourceCustomization> configurationResourceCust = Optional.empty(); - for (NodeTemplate nodeTemplate : configurationNodeTemplatesList) { - StatefulEntityType entityType = nodeTemplate.getTypeDefinition(); - String type = entityType.getType(); - - if (VLAN_NETWORK_RECEPTOR.equals(type)) { - configurationResourceCust = Optional.of(getConfigurationResourceCustomization(nodeTemplate, - toscaResourceStructure, spResourceCustomization)); - break; - } - } - - return configurationResourceCust; - } - protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) { List<NodeTemplate> serviceProxyResourceList = @@ -703,8 +697,6 @@ public class ToscaResourceInstaller { for (NodeTemplate spNode : serviceProxyResourceList) { serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct); serviceProxyList.add(serviceProxy); - Optional<ConfigurationResourceCustomization> vnrResourceCustomization = - getVnrNodeTemplate(configurationNodeTemplatesList, toscaResourceStruct, serviceProxy); for (NodeTemplate configNode : configurationNodeTemplatesList) { @@ -712,19 +704,21 @@ public class ToscaResourceInstaller { toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll(); for (RequirementAssignment requirement : requirementsList) { if (requirement.getNodeTemplateName().equals(spNode.getName())) { - ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, - toscaResourceStruct, serviceProxy, vnrResourceCustomization); - - Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList - .stream() - .filter(configurationResourceCustomization -> configNode.getMetaData() - .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID) - .equals(configurationResource.getModelCustomizationUUID())) - .findFirst(); + ConfigurationResourceCustomization configurationResource = + createConfiguration(configNode, toscaResourceStruct, serviceProxy, service); + + Optional<ConfigurationResourceCustomization> matchingObject = + configurationResourceList.stream() + .filter(configurationResourceCustomization -> configNode.getMetaData() + .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID) + .equals(configurationResource.getModelCustomizationUUID())) + .filter(configurationResourceCustomization -> configurationResourceCustomization + .getModelInstanceName() + .equals(configurationResource.getModelInstanceName())) + .findFirst(); if (!matchingObject.isPresent()) { configurationResourceList.add(configurationResource); } - break; } } @@ -737,6 +731,37 @@ public class ToscaResourceInstaller { service.setServiceProxyCustomizations(serviceProxyList); } + /* + * ConfigurationResourceCustomization objects have their IDs auto incremented in the database. Unless we know their + * IDs we cannot possibly associate their related records. So these ConfigResourceCustomizations are persisted first + * and subsequently correlated. + */ + + protected void correlateConfigCustomResources(Service service) { + /* Assuming that we have only one pair of VRF-VNR */ + ConfigurationResourceCustomization vrfConfigCustomResource = null; + ConfigurationResourceCustomization vnrConfigCustomResource = null; + List<ConfigurationResourceCustomization> configCustomList = service.getConfigurationCustomizations(); + for (ConfigurationResourceCustomization configResource : configCustomList) { + String nodeType = configResource.getConfigurationResource().getToscaNodeType(); + if (NODES_VRF_ENTRY.equalsIgnoreCase(nodeType)) { + vrfConfigCustomResource = configResource; + } else if (VLAN_NETWORK_RECEPTOR.equalsIgnoreCase(nodeType)) { + vnrConfigCustomResource = configResource; + } + } + + if (vrfConfigCustomResource != null) { + vrfConfigCustomResource.setConfigResourceCustomization(vnrConfigCustomResource); + configCustomizationRepo.save(vrfConfigCustomResource); + + } + if (vnrConfigCustomResource != null) { + vnrConfigCustomResource.setConfigResourceCustomization(vrfConfigCustomResource); + configCustomizationRepo.save(vnrConfigCustomResource); + } + } + protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) { List<NodeTemplate> networkCollectionList = @@ -960,8 +985,15 @@ public class ToscaResourceInstaller { vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); } - - service.getVnfCustomizations().add(vnfResource); + List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, groupList); + if (!CollectionUtils.isEmpty(seqResult)) { + String resultStr = seqResult.stream().collect(Collectors.joining(",")); + vnfResource.setVnfcInstanceGroupOrder(resultStr); + logger.debug( + "vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr); + } + // add this vnfResource with existing vnfResource for this service + addVnfCustomization(service, vnfResource); } else { logger.debug("Notification VF ResourceCustomizationUUID: " + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " @@ -970,6 +1002,85 @@ public class ToscaResourceInstaller { } } + private List<String> processVNFCGroupSequence(ToscaResourceStructure toscaResourceStructure, + List<Group> groupList) { + if (CollectionUtils.isEmpty(groupList)) { + return Collections.emptyList(); + } + + ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper(); + List<String> strSequence = new ArrayList<>(groupList.size()); + List<Group> tempGroupList = new ArrayList<>(groupList.size()); + List<NodeTemplate> nodes = new ArrayList<>(); + tempGroupList.addAll(groupList); + + for (Group group : groupList) { + List<NodeTemplate> nodeList = group.getMemberNodes(); + boolean hasRequirements = false; + for (NodeTemplate node : nodeList) { + RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(node); + if (requirements != null && requirements.getAll() != null && !requirements.getAll().isEmpty()) { + hasRequirements = true; + break; + } + } + + if (!hasRequirements) { + strSequence.add(group.getName()); + tempGroupList.remove(group); + nodes.addAll(nodeList); + } + } + + getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + + return strSequence; + + } + + private void getVNFCGroupSequenceList(List<String> strSequence, List<Group> groupList, List<NodeTemplate> nodes, + ISdcCsarHelper iSdcCsarHelper) { + if (CollectionUtils.isEmpty(groupList)) { + return; + } + + List<Group> tempGroupList = new ArrayList<>(); + tempGroupList.addAll(groupList); + + for (Group group : groupList) { + ArrayList<NodeTemplate> members = group.getMemberNodes(); + for (NodeTemplate memberNode : members) { + boolean isAllExists = true; + RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(memberNode); + if (requirements == null || requirements.getAll() == null || requirements.getAll().isEmpty()) { + continue; + } + List<RequirementAssignment> rqaList = requirements.getAll(); + for (RequirementAssignment rqa : rqaList) { + String name = rqa.getNodeTemplateName(); + for (NodeTemplate node : nodes) { + if (name.equals(node.getName())) { + break; + } + } + + isAllExists = false; + break; + } + + if (isAllExists) { + strSequence.add(group.getName()); + tempGroupList.remove(group); + nodes.addAll(group.getMemberNodes()); + } + } + + if (tempGroupList.size() != 0 && tempGroupList.size() < groupList.size()) { + getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + } + } + } + public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification, String consumerId) { WatchdogServiceModVerIdLookup modVerIdLookup = @@ -1229,22 +1340,15 @@ public class ToscaResourceInstaller { protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization, - Optional<ConfigurationResourceCustomization> vnrResourceCustomization) { + Service service) { - ConfigurationResourceCustomization configCustomizationResource = - getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, spResourceCustomization); + ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization( + nodeTemplate, toscaResourceStructure, spResourceCustomization, service); ConfigurationResource configResource = getConfigurationResource(nodeTemplate); Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>(); - StatefulEntityType entityType = nodeTemplate.getTypeDefinition(); - String type = entityType.getType(); - - if (NODES_VRF_ENTRY.equals(type)) { - configCustomizationResource.setConfigResourceCustomization(vnrResourceCustomization.orElse(null)); - } - configCustomizationResource.setConfigurationResource(configResource); configResourceCustomizationSet.add(configCustomizationResource); @@ -1353,6 +1457,7 @@ public class ToscaResourceInstaller { networkCustomizationRepo.saveAndFlush(networkResourceCustomization); + } else if (networkResourceCustomization == null) { networkResourceCustomization = createNetworkResourceCustomization(networkNodeTemplate, toscaResourceStructure); @@ -1686,12 +1791,37 @@ public class ToscaResourceInstaller { vfcInstanceGroupCustom.setFunction(toscaResourceStructure.getSdcCsarHelper() .getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName)); vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup); - + createVFCInstanceGroupMembers(vfcInstanceGroupCustom, group); return vfcInstanceGroupCustom; } + private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom, Group group) { + List<NodeTemplate> members = group.getMemberNodes(); + if (!CollectionUtils.isEmpty(members)) { + for (NodeTemplate vfcTemplate : members) { + VnfcCustomization vnfcCustomization = new VnfcCustomization(); + + Metadata metadata = vfcTemplate.getMetaData(); + vnfcCustomization + .setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + vnfcCustomization.setModelInstanceName(vfcTemplate.getName()); + vnfcCustomization.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + vnfcCustomization + .setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vnfcCustomization.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + vnfcCustomization.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType())); + vnfcCustomization + .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + + // @After vfcInstanceGroupCustom merged + // vfcInstanceGroupCustom.getVnfcCustomizations().add(vnfcCustomization); + } + } + } + protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, @@ -2123,19 +2253,24 @@ public class ToscaResourceInstaller { } protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate, - ToscaResourceStructure toscaResourceStructure, Service service) { + ToscaResourceStructure toscaResourceStructure, Service service) throws ArtifactInstallerException { VnfResourceCustomization vnfResourceCustomization = null; if (vnfResourceCustomization == null) { VnfResource vnfResource = findExistingVnfResource(service, vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - if (vnfResource == null) + if (vnfResource == null) { vnfResource = createVnfResource(vfNodeTemplate); + } vnfResourceCustomization = createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure, vnfResource); vnfResourceCustomization.setVnfResources(vnfResource); vnfResourceCustomization.setService(service); + + // setting resource input for vnf customization + vnfResourceCustomization.setResourceInput( + getResourceInput(toscaResourceStructure, vnfResourceCustomization.getModelCustomizationUUID())); vnfResource.getVnfResourceCustomizations().add(vnfResourceCustomization); } @@ -2206,6 +2341,13 @@ public class ToscaResourceInstaller { } + if (vnfResourceCustomization.getMinInstances() == null && vnfResourceCustomization.getMaxInstances() == null) { + vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() + .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() + .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + } + toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization); return vnfResourceCustomization; @@ -2418,6 +2560,19 @@ public class ToscaResourceInstaller { return inputName; } + // this method add provided vnfCustomization to service with + // existing customization available in db. + private void addVnfCustomization(Service service, VnfResourceCustomization vnfResourceCustomization) { + List<Service> services = serviceRepo.findByModelUUID(service.getModelUUID()); + if (services.size() > 0) { + // service exist in db + Service existingService = services.get(0); + List<VnfResourceCustomization> vnfCustomizations = existingService.getVnfCustomizations(); + vnfCustomizations.forEach(e -> service.getVnfCustomizations().add(e)); + } + service.getVnfCustomizations().add(vnfResourceCustomization); + } + protected static Timestamp getCurrentTimeStamp() { diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java index 86f6a89af5..aae5e5dc53 100644 --- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java @@ -19,20 +19,72 @@ */ package org.onap.asdc.activity; +import java.nio.file.Files; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; import org.junit.Test; -import org.onap.so.asdc.BaseTest; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.asdc.activity.ActivitySpecsActions; import org.onap.so.asdc.activity.DeployActivitySpecs; -import org.springframework.beans.factory.annotation.Autowired; +import org.onap.so.asdc.activity.beans.ActivitySpec; +import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; +import org.onap.so.db.catalog.data.repository.ActivitySpecRepository; +import org.springframework.core.env.Environment; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +@RunWith(MockitoJUnitRunner.class) +public class DeployActivitySpecsTest { + @Mock + protected Environment env; -public class DeployActivitySpecsTest extends BaseTest { + @Mock + protected ActivitySpecRepository activitySpecRepository; - @Autowired + @Mock + protected ActivitySpecsActions activitySpecsActions; + + @InjectMocks private DeployActivitySpecs deployActivitySpecs; @Test - public void DeployActivitySpecs_Test() throws Exception { - // Mock catalog DB results + public void deployActivitySpecs_Test() throws Exception { + boolean deploymentSuccessful = true; + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + ObjectMapper mapper = new ObjectMapper(); + org.onap.so.db.catalog.beans.ActivitySpec catalogActivitySpec = mapper.readValue( + new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpecFromCatalog.json"))), + org.onap.so.db.catalog.beans.ActivitySpec.class); + List<org.onap.so.db.catalog.beans.ActivitySpec> catalogActivitySpecList = + new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>(); + catalogActivitySpecList.add(catalogActivitySpec); + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("testEndpoint"); + when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList); + doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any()); + doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any()); deployActivitySpecs.deployActivities(); + assertTrue(deploymentSuccessful); + } + + @Test + public void mapActivitySpecFromCatalogToSdc_Test() throws Exception { + ObjectMapper mapper = new ObjectMapper(); + org.onap.so.db.catalog.beans.ActivitySpec catalogActivitySpec = mapper.readValue( + new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpecFromCatalog.json"))), + org.onap.so.db.catalog.beans.ActivitySpec.class); + ActivitySpec activitySpec = deployActivitySpecs.mapActivitySpecFromCatalogToSdc(catalogActivitySpec); + ActivitySpec expected = mapper.readValue( + new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpec.json"))), ActivitySpec.class); + assertThat(expected, sameBeanAs(activitySpec)); } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 2e5ad13c21..ac107f6449 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -22,12 +22,15 @@ package org.onap.so.asdc.client.test.rest; 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.urlPathEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; 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.assertNull; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.HashSet; import java.util.Set; import javax.transaction.Transactional; @@ -43,9 +46,11 @@ import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.Workflow; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; +import org.onap.so.db.catalog.data.repository.WorkflowRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; @@ -67,6 +72,9 @@ public class ASDCRestInterfaceTest extends BaseTest { private NetworkResourceRepository networkRepo; @Autowired + private WorkflowRepository workflowRepo; + + @Autowired private ASDCRestInterface asdcRestInterface; private TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); @@ -97,6 +105,10 @@ public class ASDCRestInterfaceTest extends BaseTest { wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + ObjectMapper mapper = new ObjectMapper(); NotificationDataImpl request = mapper.readValue(new File("src/test/resources/resource-examples/allottedresource/notif-portm.json"), @@ -146,6 +158,10 @@ public class ASDCRestInterfaceTest extends BaseTest { wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + ObjectMapper mapper = new ObjectMapper(); NotificationDataImpl request = mapper.readValue( new File("src/test/resources/resource-examples/vFW/notification.json"), NotificationDataImpl.class); @@ -176,15 +192,58 @@ public class ASDCRestInterfaceTest extends BaseTest { } @Test + @Transactional + public void testWorkflowDistribution() throws Exception { + + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + wireMockServer.stubFor( + post(urlPathEqualTo("/sobpmnengine/deployment/create")).willReturn(aResponse().withStatus(200))); + + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue( + new File("src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json"), + NotificationDataImpl.class); + headers.add("resource-location", "src/test/resources/resource-examples/WorkflowBpmn/"); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Workflow actualResponse = workflowRepo.findByArtifactUUID("a90f8eaa-7c20-422f-8c81-aacbca6fb9e7"); + + if (actualResponse == null) + throw new Exception("No Workflow Written to database"); + + String expectedBody = new String( + Files.readAllBytes(Paths.get("src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn"))); + assertEquals(actualResponse.getArtifactChecksum(), "ZjUzNjg1NDMyMTc4MWJmZjFlNDcyOGQ0Zjc1YWQwYzQ\u003d"); + assertEquals(actualResponse.getArtifactName(), "TestWF2-1_0.bpmn"); + assertEquals(actualResponse.getDescription(), "Workflow Artifact Description"); + assertEquals(actualResponse.getBody(), expectedBody); + + Workflow shouldNotBeFound = workflowRepo.findByArtifactUUID("f27066a1-c3a7-4672-b02e-1251b74b7b71"); + assertNull(shouldNotBeFound); + } + + @Test public void invokeASDCStatusDataNullTest() { String request = ""; + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); Response response = asdcRestInterface.invokeASDCStatusData(request); assertNull(response); } - - protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java index 6efb04fc35..7071a68a23 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java @@ -81,7 +81,7 @@ public class BpmnInstallerTest { public void buildMimeMultiPart_Test() throws Exception { Path tempFilePath = Paths.get(tempDirectoryPath.toAbsolutePath().toString(), "TestBB.bpmn"); Files.createFile(tempFilePath); - HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn"); + HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn", ""); String mimeMultipartBodyFilePath = "src/test/resources" + "/mime-multipart-body.txt"; File mimeMultipartBody = new File(mimeMultipartBodyFilePath); @@ -99,7 +99,7 @@ public class BpmnInstallerTest { HttpClient httpClient = mock(HttpClient.class); doReturn(response).when(httpClient).execute(any(HttpPost.class)); bpmnInstallerSpy.installBpmn(TEST_CSAR); - verify(bpmnInstallerSpy, times(1)).sendDeploymentRequest(anyString()); + verify(bpmnInstallerSpy, times(1)).sendDeploymentRequest(anyString(), anyString()); } @Test diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/WorkflowResourceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/WorkflowResourceTest.java new file mode 100644 index 0000000000..e655245c31 --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/WorkflowResourceTest.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * 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.asdc.installer.bpmn; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import javax.transaction.Transactional; +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.message.BasicHttpResponse; +import org.apache.http.message.BasicStatusLine; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.onap.sdc.api.notification.IArtifactInfo; + +@Transactional +public class WorkflowResourceTest { + + private WorkflowResource workflowResource = new WorkflowResource(); + + private static final String TEST_CSAR = "src/test/resources/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar"; + private Path tempDirectoryPath; + + @Test + public void getActivityNameList_Test() throws Exception { + String bpmnContent = new String(Files + .readAllBytes(Paths.get("src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn"))); + List<String> activityNames = workflowResource.getActivityNameList(bpmnContent); + assertEquals("VNFSetInMaintFlagActivity", activityNames.get(0)); + } + + @Test + public void getWorkflowNameStandard_Test() { + String workflowName = workflowResource.getWorkflowNameFromArtifactName("TestWF2-1_0.bpmn"); + assertEquals("TestWF2", workflowName); + } + + @Test + public void getWorkflowNameNoVersion_Test() { + String workflowName = workflowResource.getWorkflowNameFromArtifactName("TestWF2.bpmn"); + assertEquals("TestWF2", workflowName); + } + + @Test + public void getWorkflowNameNoSuffix_Test() { + String workflowName = workflowResource.getWorkflowNameFromArtifactName("TestWF2-1_0"); + assertEquals("TestWF2", workflowName); + } + + @Test + public void getWorkflowVersionStandard_Test() { + Double workflowVersion = workflowResource.getWorkflowVersionFromArtifactName("TestWF2-1_0.bpmn"); + assertTrue(workflowVersion == 1.0); + } + + @Test + public void getWorkflowVersionNoVersion_Test() { + Double workflowVersion = workflowResource.getWorkflowVersionFromArtifactName("TestWF2.bpmn"); + assertNull(workflowVersion); + } + + @Test + public void getWorkflowVersionNoSuffix_Test() { + Double workflowVersion = workflowResource.getWorkflowVersionFromArtifactName("TestWF2-1_0"); + assertTrue(workflowVersion == 1.0); + } + +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index d3c0bdef66..ce70a252c9 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -20,26 +20,24 @@ package org.onap.so.asdc.installer.heat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; 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 static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import org.hibernate.exception.LockAcquisitionException; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.sdc.api.notification.IResourceInstance; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; @@ -58,13 +56,17 @@ import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; +import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.util.ReflectionTestUtils; + public class ToscaResourceInstallerTest extends BaseTest { @Autowired @@ -99,6 +101,8 @@ public class ToscaResourceInstallerTest extends BaseTest { private ISdcCsarHelper csarHelper; @Mock private StatefulEntityType entityType; + @Mock + private Service service; private NotificationDataImpl notificationData; private JsonStatusData statusData; @@ -350,8 +354,9 @@ public class ToscaResourceInstallerTest extends BaseTest { public void getConfigurationResourceCustomizationTest() { prepareConfigurationResourceCustomization(); - ConfigurationResourceCustomization configurationResourceCustomization = toscaInstaller - .getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, spResourceCustomization); + ConfigurationResourceCustomization configurationResourceCustomization = + toscaInstaller.getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, + spResourceCustomization, service); assertNotNull(configurationResourceCustomization); assertNotNull(configurationResourceCustomization.getConfigurationResource()); assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID, @@ -359,16 +364,34 @@ public class ToscaResourceInstallerTest extends BaseTest { } @Test - public void getVnrNodeTemplateTest() { - prepareConfigurationResourceCustomization(); - List<NodeTemplate> nodeTemplateList = new ArrayList<>(); - doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(entityType).getType(); - doReturn(entityType).when(nodeTemplate).getTypeDefinition(); - nodeTemplateList.add(nodeTemplate); - Optional<ConfigurationResourceCustomization> vnrResourceCustomization = - toscaInstaller.getVnrNodeTemplate(nodeTemplateList, toscaResourceStructure, spResourceCustomization); - assertTrue(vnrResourceCustomization.isPresent()); - assertEquals(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR, entityType.getType()); + public void correlateConfigCustomResourcesTest() { + ConfigurationResource vrfConfigResource = mock(ConfigurationResource.class); + ConfigurationResourceCustomization vrfConfigCustom = mock(ConfigurationResourceCustomization.class); + doReturn(ToscaResourceInstaller.NODES_VRF_ENTRY).when(vrfConfigResource).getToscaNodeType(); + doReturn(vrfConfigResource).when(vrfConfigCustom).getConfigurationResource(); + + ConfigurationResource vnrConfigResource = mock(ConfigurationResource.class); + ConfigurationResourceCustomization vnrConfigCustom = mock(ConfigurationResourceCustomization.class); + doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(vnrConfigResource).getToscaNodeType(); + doReturn(vnrConfigResource).when(vnrConfigCustom).getConfigurationResource(); + + ConfigurationResourceCustomizationRepository configCustomizationRepo = + spy(ConfigurationResourceCustomizationRepository.class); + ReflectionTestUtils.setField(toscaInstaller, "configCustomizationRepo", configCustomizationRepo); + doReturn(vrfConfigCustom).when(configCustomizationRepo).save(vrfConfigCustom); + doReturn(vnrConfigCustom).when(configCustomizationRepo).save(vnrConfigCustom); + + List<ConfigurationResourceCustomization> configList = new ArrayList<>(); + configList.add(vrfConfigCustom); + configList.add(vnrConfigCustom); + doReturn(configList).when(service).getConfigurationCustomizations(); + + toscaInstaller.correlateConfigCustomResources(service); + verify(vrfConfigCustom, times(1)).getConfigurationResource(); + verify(vrfConfigCustom, times(1)).setConfigResourceCustomization(vnrConfigCustom); + verify(service, times(1)).getConfigurationCustomizations(); + verify(vnrConfigCustom, times(1)).getConfigurationResource(); + verify(vnrConfigCustom, times(1)).setConfigResourceCustomization(vrfConfigCustom); } class MockConstants { @@ -381,5 +404,6 @@ public class ToscaResourceInstallerTest extends BaseTest { public final static String TEMPLATE_TYPE = "org.openecomp.nodes.VLANNetworkReceptor"; public final static String TEMPLATE_NAME = "VLAN Network Receptor Configuration 0"; + } } diff --git a/asdc-controller/src/test/resources/ActivitySpec.json b/asdc-controller/src/test/resources/ActivitySpec.json new file mode 100644 index 0000000000..66e1b1355f --- /dev/null +++ b/asdc-controller/src/test/resources/ActivitySpec.json @@ -0,0 +1,23 @@ +{ + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "categoryList": [ + "VNF" + ], + "inputs": [ + { + "name": "parameter1", + "type": "string" + }, + { + "name": "parameter2", + "type": "string" + } + ], + "outputs": [ + { + "name": "parameter3", + "type": "string" + } + ] +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json b/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json new file mode 100644 index 0000000000..0864a2cba9 --- /dev/null +++ b/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json @@ -0,0 +1,41 @@ +{ + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": [ + { + "activitySpecCategories": { + "name": "VNF" + } + } + ], + "activitySpecActivitySpecParameters": [ + { + "activitySpecParameters": { + "name": "parameter1", + "type": "string", + "direction": "input", + "description": "Parameter 1" + } + }, + { + "activitySpecParameters": { + "name": "parameter2", + "type": "string", + "direction": "input", + "description": "Parameter 2" + } + }, + { + "activitySpecParameters": { + "name": "parameter3", + "type": "string", + "direction": "output", + "description": "Parameter 3" + } + } + ] + +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/ActivitySpecList.json b/asdc-controller/src/test/resources/ActivitySpecList.json new file mode 100644 index 0000000000..c3530a2e7e --- /dev/null +++ b/asdc-controller/src/test/resources/ActivitySpecList.json @@ -0,0 +1,398 @@ +{ + "activitySpecList": [ + { + "activitySpec": { + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null + }, + { + "activitySpecId": null, + "workflowId": null, + "activitySpec": { + "name": "VNFHealthCheckActivity", + "description": "Activity to HealthCheck VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null + }, + { + "activitySpecId": null, + "workflowId": null, + "activitySpec": { + "name": "FlowCompleteActivity", + "description": "Activity to Complete the BPMN Flow", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null + } + ] +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml index ec536491a1..9fa20550db 100644 --- a/asdc-controller/src/test/resources/application-test.yaml +++ b/asdc-controller/src/test/resources/application-test.yaml @@ -66,6 +66,7 @@ mso: db: spring: endpoint: "http://localhost:" + camundaURL: http://localhost:${wiremock.server.port}/ db: auth: Basic YnBlbDptc28tZGItMTUwNyE= site-name: siteName diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql index 7cd972ca63..47e6c4c982 100644 --- a/asdc-controller/src/test/resources/data.sql +++ b/asdc-controller/src/test/resources/data.sql @@ -22,6 +22,196 @@ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES ('SRIOV_PROVIDER_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL); +insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values +('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null); + +insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values +('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); + +insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values +('ff2ae348-214a-11e7-93ae-92361f002671', '1'); + +insert into activity_spec(name, description, version) values +('testActivity1', 'Test Activity 1', 1.0); + +insert into workflow_activity_spec_sequence(workflow_id, activity_spec_id, seq_no) values +(1, 1, 1); + +INSERT INTO activity_spec (NAME, DESCRIPTION, VERSION) +VALUES +('VNFSetInMaintFlagActivity','Activity to Set InMaint Flag in A&AI',1.0), +('VNFCheckPserversLockedFlagActivity','Activity Check Pservers Locked Flag VNF',1.0), +('VNFCheckInMaintFlagActivity','Activity CheckIn Maint Flag on VNF',1.0), +('VNFCheckClosedLoopDisabledFlagActivity','Activity Check Closed Loop Disabled Flag on VNF',1.0), +('VNFSetClosedLoopDisabledFlagActivity','Activity Set Closed Loop Disabled Flag on VNF',1.0), +('VNFUnsetClosedLoopDisabledFlagActivity','Activity Unset Closed Loop Disabled Flag on VNF',1.0), +('VNFLockActivity','Activity Lock on VNF',1.0), +('VNFUnlockActivity','Activity UnLock on VNF',1.0), +('VNFStopActivity','Activity Stop on VNF',1.0), +('VNFStartActivity','Activity Start on VNF',1.0), +('VNFSnapShotActivity','Activity Snap Shot on VNF',1.0), +('FlowCompleteActivity','Activity Complete on VNF',1.0), +('PauseForManualTaskActivity','Activity Pause For Manual Task on VNF',1.0), +('DistributeTrafficActivity','Activity Distribute Traffic on VNF',1.0), +('DistributeTrafficCheckActivity','Activity Distribute Traffic Check on VNF',1.0), +('VNFHealthCheckActivity','Activity Health Check on VNF',1.0), +('VNFQuiesceTrafficActivity','Activity Quiesce Traffic on VNF',1.0), +('VNFResumeTrafficActivity','Activity Resume Traffic on VNF',1.0), +('VNFUnsetInMaintFlagActivity','Activity Unset InMaint Flag on VNF',1.0), +('VNFUpgradeBackupActivity','Activity Upgrade Backup on VNF',1.0), +('VNFUpgradePostCheckActivity','Activity Upgrade Post Check on VNF',1.0), +('VNFUpgradePreCheckActivity','Activity Upgrade PreCheck on VNF',1.0), +('VNFUpgradeSoftwareActivity','Activity UpgradeS oftware on VNF',1.0), +('VnfInPlaceSoftwareUpdate','Activity InPlace Software Update on VNF',1.0); + +INSERT INTO activity_spec_categories (NAME) +VALUES ('VNF'); + +INSERT INTO activity_spec_to_activity_spec_categories(ACTIVITY_SPEC_ID, ACTIVITY_SPEC_CATEGORIES_ID) +VALUES +((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VnfInPlaceSoftwareUpdate' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')); + +INSERT INTO activity_spec_parameters (NAME, TYPE, DIRECTION, DESCRIPTION) +VALUES('WorkflowException','WorkflowException','output','Description'); + +INSERT INTO activity_spec_to_activity_spec_parameters( ACTIVITY_SPEC_ID, ACTIVITY_SPEC_PARAMETERS_ID) +VALUES +((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')); + +INSERT INTO `user_parameters`(`NAME`,`PAYLOAD_LOCATION`,`LABEL`,`TYPE`,`DESCRIPTION`,`IS_REQUIRED`,`MAX_LENGTH`,`ALLOWABLE_CHARS`) +VALUES +('cloudOwner','cloudConfiguration','Cloud Owner','text','',1,7,''), +('operations_timeout','userParams','Operations Timeout','text','',1,50,''), +('existing_software_version','userParams','Existing Software Version','text','',1,50,''), +('tenantId','cloudConfiguration','Tenant/Project ID','text','',1,36,''), +('new_software_version','userParams','New Software Version','text','',1,50,''), +('lcpCloudRegionId','cloudConfiguration','Cloud Region ID','text','',1,7,''); + +INSERT INTO `activity_spec_to_user_parameters`(`ACTIVITY_SPEC_ID`,`USER_PARAMETERS_ID`) +VALUES +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='operations_timeout')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')); + --------START Request DB INSERTS -------- insert into requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS,LOCK_VERSION) values @@ -61,4 +251,4 @@ insert into requestdb.watchdog_per_component_distribution_status(DISTRIBUTION_ID insert into requestdb.watchdog_service_mod_ver_id_lookup(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID, DISTRIBUTION_NOTIFICATION, CONSUMER_ID) values ('watchdogTestStatusSuccess', '5df8b6de-2083-11e7-93ae-92361f002671', NULL, NULL), -('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000', NULL, NULL); +('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000', NULL, NULL);
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn new file mode 100644 index 0000000000..f3a5c7cc68 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="customWorkflowtest1" name="TestBpmnFromSDC" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:startEvent id="StartEvent_0wtabee"> + <bpmn2:outgoing>SequenceFlow_1v7ptqz</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:serviceTask id="Task_1kxbei4" name="VNFSetInMaintFlagActivity" implementation="activity:VNFSetInMaintFlagActivity" camunda:expression="${ExecuteActivity.execute(execution)}"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1v7ptqz</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_16i7mid</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0tgyvzw"> + <bpmn2:incoming>SequenceFlow_16i7mid</bpmn2:incoming> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_16i7mid" sourceRef="Task_1kxbei4" targetRef="IntermediateThrowEvent_0tgyvzw" /> + <bpmn2:sequenceFlow id="SequenceFlow_1v7ptqz" sourceRef="StartEvent_0wtabee" targetRef="Task_1kxbei4" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="customWorkflowtest1"> + <bpmndi:BPMNShape id="StartEvent_0wtabee_di" bpmnElement="StartEvent_0wtabee"> + <dc:Bounds x="256" y="134" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1cgg6ym_di" bpmnElement="Task_1kxbei4" bioc:fill="white"> + <dc:Bounds x="386" y="112" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0tgyvzw_di" bpmnElement="IntermediateThrowEvent_0tgyvzw"> + <dc:Bounds x="536" y="134" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_16i7mid_di" bpmnElement="SequenceFlow_16i7mid"> + <di:waypoint x="486" y="152" /> + <di:waypoint x="536" y="152" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1v7ptqz_di" bpmnElement="SequenceFlow_1v7ptqz"> + <di:waypoint x="292" y="152" /> + <di:waypoint x="386" y="152" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn new file mode 100644 index 0000000000..11378cfbb6 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf2" name="TestWF2" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:endEvent id="EndEvent_1naezi3" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf2"> + <bpmndi:BPMNShape id="EndEvent_1naezi3_di" bpmnElement="EndEvent_1naezi3"> + <dc:Bounds x="219" y="285" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn new file mode 100644 index 0000000000..4e21a47a27 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf" name="TestWF" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:startEvent id="StartEvent_1loupvi" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf"> + <bpmndi:BPMNShape id="StartEvent_1loupvi_di" bpmnElement="StartEvent_1loupvi"> + <dc:Bounds x="274" y="212" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn new file mode 100644 index 0000000000..e54d79aee4 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf" name="TestWF" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:startEvent id="StartEvent_1loupvi" /> + <bpmn2:startEvent id="StartEvent_0z42dnp" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf"> + <bpmndi:BPMNShape id="StartEvent_1loupvi_di" bpmnElement="StartEvent_1loupvi"> + <dc:Bounds x="274" y="212" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0z42dnp_di" bpmnElement="StartEvent_0z42dnp"> + <dc:Bounds x="454" y="364" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn new file mode 100644 index 0000000000..11378cfbb6 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf2" name="TestWF2" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:endEvent id="EndEvent_1naezi3" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf2"> + <bpmndi:BPMNShape id="EndEvent_1naezi3_di" bpmnElement="EndEvent_1naezi3"> + <dc:Bounds x="219" y="285" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar Binary files differnew file mode 100644 index 0000000000..fe99318fe3 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json new file mode 100644 index 0000000000..9f49be5bbb --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json @@ -0,0 +1,76 @@ +{ + "distributionID": "48cc0f04-1d42-4fb4-a5ab-9fa62f8d64c1", + "serviceName": "TestParentService", + "serviceVersion": "1.0", + "serviceUUID": "2f55da47-c58a-453e-909f-172c94765fba", + "serviceDescription": "TestParentService", + "serviceInvariantUUID": "13b817ae-6388-40cf-9261-1619b607f1de", + "resources": [ + { + "resourceInstanceName": "TestVF 0", + "resourceName": "TestVF", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "5185253e-4bef-4eb4-bbf9-8c328c787ebd", + "resourceInvariantUUID": "ea8264db-3e24-4324-87cc-12c6903ed43d", + "resourceCustomizationUUID": "a959a3cb-4988-435c-9cb7-5a40ef2ef2ac", + "category": "Allotted Resource", + "subcategory": "Contrail Route", + "artifacts": [ + { + "artifactName": "TestWF2-1_0.bpmn", + "artifactType": "WORKFLOW", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn", + "artifactChecksum": "ZjUzNjg1NDMyMTc4MWJmZjFlNDcyOGQ0Zjc1YWQwYzQ\u003d", + "artifactDescription": "Workflow Artifact Description", + "artifactTimeout": 120, + "artifactUUID": "a90f8eaa-7c20-422f-8c81-aacbca6fb9e7", + "artifactVersion": "1" + }, + { + "artifactName": "TestWF-1_0.bpmn", + "artifactType": "WORKFLOW", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn", + "artifactChecksum": "YzA4NDY3M2E3Njk3Y2FjMmViZjRlODIzNTY1NDY3MDY\u003d", + "artifactDescription": "Workflow Artifact Description", + "artifactTimeout": 120, + "artifactUUID": "f27066a1-c3a7-4672-b02e-1251b74b7b71", + "artifactVersion": "1" + }, + { + "artifactName": "TestWF-2_0.bpmn", + "artifactType": "WORKFLOW", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn", + "artifactChecksum": "MTE0MDA2ZGNjZmY3YWEyNzNlNjUwZDQ2OGU4YTM5ZjU\u003d", + "artifactDescription": "Workflow Artifact Description", + "artifactTimeout": 120, + "artifactUUID": "f51d2203-d1f5-43f1-9492-e59d12facb8f", + "artifactVersion": "1" + } + ] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Testparentservice-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/artifacts/service-Testparentservice-template.yml", + "artifactChecksum": "YWZlYWMwMjNkODBlYTI2MzZlNjg3YzEzODZiNzNkNTg\u003d", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "8ec96c3f-d527-48bd-8dc5-1e7682bda676", + "artifactVersion": "1" + }, + { + "artifactName": "service-Testparentservice-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "service-Testparentservice-csar.csar", + "artifactChecksum": "MTc4OWU0MGRhOTE4OGZiM2JiMjM3YmI3NzI2YWZjNjI\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "8dac522d-8e00-4794-819e-88e559ebc170", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 0b48b2e35f..d143b52fe1 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -283,6 +283,7 @@ DROP TABLE IF EXISTS `configuration_customization`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `configuration_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, @@ -291,27 +292,18 @@ CREATE TABLE `configuration_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), - KEY `fk_configuration_customization__service_proxy_customization_idx` (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_customization_idx` (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - CONSTRAINT `fk_configuration_customization__configuration_customization1` FOREIGN KEY (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES `configuration_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `configuration_customization_to_service` --- - -DROP TABLE IF EXISTS `configuration_customization_to_service`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `configuration_customization_to_service` ( - `SERVICE_MODEL_UUID` varchar(200) NOT NULL, - `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, - PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + `SERVICE_MODEL_UUID` varchar(200), + PRIMARY KEY (`ID`), + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`), + UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC), + CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1117,6 +1109,7 @@ CREATE TABLE `vnf_resource_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1143,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; @@ -1204,9 +1198,10 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` ( `SERVICE_MODEL_UUID` varchar(200) NOT NULL, `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, - PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) )ENGINE=InnoDB DEFAULT CHARSET=latin1; + CREATE TABLE IF NOT EXISTS `workflow` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `ARTIFACT_UUID` varchar(200) NOT NULL, @@ -1370,7 +1365,6 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; USE requestdb; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java index c087d586e7..83a44cfe8b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java @@ -9,7 +9,7 @@ * 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/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java index 31fef7c6f7..734262aa55 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java @@ -112,10 +112,6 @@ public class DelegateExecutionImpl implements BuildingBlockExecution, Serializab return this.get("flowToBeCalled"); } - @JsonIgnore - public DelegateExecution getDelegateExecution() { - return this.execution; - } public void setDelegateExecution(final DelegateExecution execution) { this.execution = execution; @@ -126,6 +122,11 @@ public class DelegateExecutionImpl implements BuildingBlockExecution, Serializab }); } + @JsonIgnore + public DelegateExecution getDelegateExecution() { + return this.execution; + } + @SuppressWarnings("unchecked") protected <T> T get(final String key) { final Object value = this.execution.getVariable(key); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index 4332a6cf4e..86bbead9a4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -47,7 +47,7 @@ public class ExtractPojosForBB { return extractByKey(execution, key, execution.getLookupMap().get(key)); } - public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) + protected <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) throws BBObjectNotFoundException { Optional<T> result = Optional.empty(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java index 2e84f384dc..e386fdebda 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import java.io.Serializable; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java index cb0b5663e6..b2e6ead36b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import java.util.HashMap; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java index bd894e3e7f..592b349215 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import java.util.HashMap; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java index 33b7187ac8..2eab53222b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java index 8512c4017f..984b5a9af9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java @@ -1,3 +1,22 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java index a9a3b0db15..945ed947e2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java index a3ac91ab9d..bba919f2f7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java index 817729ba4f..ec1dd0735e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java index c5fc0307b2..2cea502603 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index ae5e41f7ce..b69ab151c4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -22,21 +22,40 @@ package org.onap.so.client.exception; +import java.io.IOException; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.aai.domain.yang.LInterface; +import org.onap.aai.domain.yang.Vserver; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.logger.ErrorCode; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.logger.MessageEnum; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; + @Component public class ExceptionBuilder { private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class); + + protected ExtractPojosForBB getExtractPojosForBB() { + return new ExtractPojosForBB(); + } + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { String msg = "Exception in %s.%s "; try { @@ -132,4 +151,63 @@ public class ExceptionBuilder { return execution.getProcessEngineServices().getRepositoryService() .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); } + + public void processAuditException(DelegateExecutionImpl execution) { + logger.info("Building a WorkflowException for Subflow"); + + StringBuilder errorMessage = new StringBuilder(); + String processKey = getProcessKey(execution.getDelegateExecution()); + try { + ExtractPojosForBB extractPojosForBB = getExtractPojosForBB(); + VfModule module = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + String cloudRegionId = execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId(); + + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + String auditListString = (String) execution.getVariable("auditInventoryResult"); + AAIObjectAuditList auditList = + objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class); + + errorMessage = errorMessage.append(auditList.getAuditType() + " VF-Module " + module.getVfModuleId() + + " failed due to incomplete A&AI vserver inventory population after stack " + + auditList.getHeatStackName() + " was successfully " + auditList.getAuditType() + + "d in cloud region " + cloudRegionId + ". MSO Audit indicates that AIC RO did not " + + auditList.getAuditType() + " "); + + Stream<AAIObjectAudit> vServerLInterfaceAuditStream = auditList.getAuditList().stream() + .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName()) + || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())); + List<AAIObjectAudit> filteredAuditStream = + vServerLInterfaceAuditStream.filter(a -> !a.isDoesObjectExist()).collect(Collectors.toList()); + + for (AAIObjectAudit object : filteredAuditStream) { + if (object.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())) { + LInterface li = objectMapper.getMapper().convertValue(object.getAaiObject(), LInterface.class); + errorMessage = errorMessage + .append(AAIObjectType.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", "); + } else { + Vserver vs = objectMapper.getMapper().convertValue(object.getAaiObject(), Vserver.class); + errorMessage = + errorMessage.append(AAIObjectType.VSERVER.typeName() + " " + vs.getVserverId() + ", "); + } + } + + if (errorMessage.length() > 0) { + errorMessage.setLength(errorMessage.length() - 2); + errorMessage = errorMessage.append(" in AAI. "); + } + + } catch (IOException | BBObjectNotFoundException e) { + errorMessage = errorMessage.append("process objects in AAI. "); + } + + errorMessage.append( + "Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops."); + + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString()); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("AAIInventoryFailure"); + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index 79a94d5298..3bb417741f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -325,6 +325,7 @@ public class BuildingBlockTestDataSetup { gBBInput.setCustomer(buildCustomer()); } gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + gBBInput.setServiceInstance(serviceInstance); lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); return serviceInstance; 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/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java index 3eadd800ad..68974d5e91 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java index 4b91cdf803..d3d367a06d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java index da82721e5e..e3fe25a1c1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java index a73fa6c01e..35941c3647 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java index 771196d53c..c7d5f8c1a3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java index 6039bd649c..948b5d57c4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java index a977f8dd9e..3f4e37118e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java index 4b86eeb438..14c22d9a8e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 TechMahindra + * ================================================================================ + * 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.cds.beans; import static org.junit.Assert.assertEquals; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index ef066853ca..4ade9dbe32 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.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. @@ -21,17 +21,66 @@ package org.onap.so.client.exception; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; import org.junit.Test; -import org.onap.so.bpmn.mock.FileUtil; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.onap.aai.domain.yang.Vserver; import org.onap.so.BaseTest; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; +import org.springframework.beans.BeanUtils; +import com.fasterxml.jackson.core.JsonProcessingException; public class ExceptionBuilderTest extends BaseTest { private static final String RESOURCE_PATH = "__files/"; private static final String VALID_ERROR_MESSAGE = "{test error message}"; + @Mock + protected ExtractPojosForBB extractPojosForBB; + + @Spy + @InjectMocks + private ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); + + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + + @Before + public void before() throws BBObjectNotFoundException, JsonProcessingException { + setCloudRegion(); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))) + .thenReturn(buildVfModule()); + AAIObjectAuditList auditList = new AAIObjectAuditList(); + auditList.setAuditType("create"); + auditList.setHeatStackName("testStackName"); + AAIObjectAudit vserver = new AAIObjectAudit(); + vserver.setAaiObjectType(AAIObjectType.VSERVER.typeName()); + vserver.setDoesObjectExist(false); + Vserver vs = new Vserver(); + vs.setVserverId("testVServerId"); + Vserver vServerShallow = new Vserver(); + BeanUtils.copyProperties(vs, vServerShallow, "LInterfaces"); + vserver.setAaiObject(vServerShallow); + auditList.getAuditList().add(vserver); + + execution.setVariable("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditList)); + } + @Test public void buildAndThrowWorkflowExceptionTest() { @@ -77,4 +126,20 @@ public class ExceptionBuilderTest extends BaseTest { assertEquals("MSOWorkflowException", bpmnException.getErrorCode()); } } + + @Test + public void processAuditExceptionTest() { + try { + Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB(); + exceptionBuilder.processAuditException((DelegateExecutionImpl) execution); + } catch (BpmnError bpmnException) { + assertEquals("AAIInventoryFailure", bpmnException.getErrorCode()); + WorkflowException we = execution.getVariable("WorkflowException"); + assertNotNull(we); + assertEquals( + "create VF-Module testVfModuleId1 failed due to incomplete A&AI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that AIC RO did not create vserver testVServerId in AAI. Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops.", + we.getErrorMessage()); + } + } + } 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/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index 289ab6e155..435d85d032 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.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.7.1"> +<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="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="ActivateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> @@ -9,9 +9,7 @@ <bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="ActivateVfModule" name=" SDNC Activate (vf module) " camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming> - <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1b63lv4</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="UpdateVfModuleActiveStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -40,13 +38,8 @@ <bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ee42yq</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_1v8bmbu" default="SequenceFlow_07ybdik"> - <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_07ybdik" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ActivateVfModule" /> - <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit"> + <bpmn:sequenceFlow id="SequenceFlow_07ybdik" name="No" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ExclusiveGateway_0sqvzll" /> + <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" name="Yes" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ExclusiveGateway_1h8avxn" /> @@ -55,154 +48,252 @@ <bpmn:outgoing>SequenceFlow_1xqyur9</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1xqyur9" sourceRef="CheckAuditVariable" targetRef="ExclusiveGateway_1v8bmbu" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_1h8avxn" default="SequenceFlow_1bo83qk"> - <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_109oxx2" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ActivateVfModule"> + <bpmn:sequenceFlow id="SequenceFlow_109oxx2" name="No" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ExclusiveGateway_0y0ek7t"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful")== true }]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="If Audit Fails" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" /> - <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="Yes" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" /> + <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ExclusiveGateway_0y0ek7t" /> <bpmn:serviceTask id="Create_AAI_Inventory" name="Create A&AI Inventory" camunda:type="external" camunda:topic="InventoryCreate"> <bpmn:incoming>SequenceFlow_1bo83qk</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0arwo1o</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1b63lv4" sourceRef="ExclusiveGateway_0sqvzll" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_18faffa" sourceRef="ExclusiveGateway_0y0ek7t" targetRef="ExclusiveGateway_0sqvzll" /> + <bpmn:subProcess id="SubProcess_0bpsptg" name="Audit Exception Sub Process" triggeredByEvent="true"> + <bpmn:startEvent id="catchInventoryException"> + <bpmn:outgoing>SequenceFlow_19gbhlj</bpmn:outgoing> + <bpmn:errorEventDefinition errorRef="Error_1s3kxze" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_067jv1n"> + <bpmn:incoming>SequenceFlow_0l4jzc5</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_19gbhlj" sourceRef="catchInventoryException" targetRef="processAuditException" /> + <bpmn:sequenceFlow id="SequenceFlow_0l4jzc5" sourceRef="processAuditException" targetRef="EndEvent_067jv1n" /> + <bpmn:serviceTask id="processAuditException" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_19gbhlj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0l4jzc5</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:subProcess> + <bpmn:inclusiveGateway id="ExclusiveGateway_1v8bmbu" name="Audit Enabled?" default="SequenceFlow_07ybdik"> + <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_0sqvzll"> + <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming> + <bpmn:incoming>SequenceFlow_18faffa</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1b63lv4</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_1h8avxn" name="Audit Failed?" default="SequenceFlow_1bo83qk"> + <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing> + </bpmn:inclusiveGateway> + <bpmn:inclusiveGateway id="ExclusiveGateway_0y0ek7t"> + <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18faffa</bpmn:outgoing> + </bpmn:inclusiveGateway> </bpmn:process> <bpmn:error id="Error_0q258vt" errorCode="7000" /> + <bpmn:error id="Error_0zgccif" name="org.onap.so.adapters.inventory.create.InventoryException" errorCode="org.onap.so.adapters.inventory.create.InventoryException" /> + <bpmn:error id="Error_1s3kxze" name="Error_3q664s5" errorCode="AAIInventoryFailure" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateVfModuleBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="ActivateVfModuleBB_Start"> - <dc:Bounds x="73" y="102" width="36" height="36" /> + <dc:Bounds x="85" y="234" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="46" y="138" width="90" height="12" /> + <dc:Bounds x="58" y="270" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> - <di:waypoint xsi:type="dc:Point" x="109" y="120" /> - <di:waypoint xsi:type="dc:Point" x="161" y="120" /> + <di:waypoint xsi:type="dc:Point" x="121" y="252" /> + <di:waypoint xsi:type="dc:Point" x="201" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="90" y="99" width="90" height="12" /> + <dc:Bounds x="116" y="231" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End"> - <dc:Bounds x="1104" y="102" width="36" height="36" /> + <dc:Bounds x="1404" y="235" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="935" y="142" width="90" height="12" /> + <dc:Bounds x="1235" y="275" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule"> - <dc:Bounds x="647" y="80" width="100" height="80" /> + <dc:Bounds x="958" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus"> - <dc:Bounds x="952" y="80" width="100" height="80" /> + <dc:Bounds x="1214" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="1052" y="120" /> - <di:waypoint xsi:type="dc:Point" x="1104" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1314" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1404" y="253" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1033" y="99" width="90" height="12" /> + <dc:Bounds x="1314" y="231.5" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_03jkesd_di" bpmnElement="CallActivity_sdncHandler"> - <dc:Bounds x="794" y="80" width="100" height="80" /> + <dc:Bounds x="1086" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm"> - <di:waypoint xsi:type="dc:Point" x="747" y="120" /> - <di:waypoint xsi:type="dc:Point" x="794" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1058" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1086" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="725.5" y="99" width="90" height="12" /> + <dc:Bounds x="1027" y="231" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej"> - <di:waypoint xsi:type="dc:Point" x="894" y="120" /> - <di:waypoint xsi:type="dc:Point" x="952" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1186" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1214" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="878" y="99" width="90" height="12" /> + <dc:Bounds x="1155" y="231" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xndboi_di" bpmnElement="SequenceFlow_0xndboi"> - <di:waypoint xsi:type="dc:Point" x="365" y="256" /> - <di:waypoint xsi:type="dc:Point" x="408" y="256" /> + <di:waypoint xsi:type="dc:Point" x="491" y="175" /> + <di:waypoint xsi:type="dc:Point" x="513" y="175" /> <bpmndi:BPMNLabel> - <dc:Bounds x="341.5" y="234.5" width="90" height="13" /> + <dc:Bounds x="457" y="153.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0krf1ur_di" bpmnElement="Setup_AAI_Inventory_Audit"> - <dc:Bounds x="265" y="216" width="100" height="80" /> + <dc:Bounds x="391" y="135" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_08rxjeb_di" bpmnElement="Audit_AAI_Inventory"> - <dc:Bounds x="408" y="216" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1v8bmbu_di" bpmnElement="ExclusiveGateway_1v8bmbu" isMarkerVisible="true"> - <dc:Bounds x="290" y="95" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="315" y="148" width="0" height="13" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="513" y="135" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_07ybdik_di" bpmnElement="SequenceFlow_07ybdik"> - <di:waypoint xsi:type="dc:Point" x="340" y="120" /> - <di:waypoint xsi:type="dc:Point" x="647" y="120" /> + <di:waypoint xsi:type="dc:Point" x="355" y="277" /> + <di:waypoint xsi:type="dc:Point" x="355" y="315" /> + <di:waypoint xsi:type="dc:Point" x="881" y="315" /> + <di:waypoint xsi:type="dc:Point" x="881" y="277" /> <bpmndi:BPMNLabel> - <dc:Bounds x="448.5" y="98.5" width="90" height="13" /> + <dc:Bounds x="364" y="294" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ghzwlo_di" bpmnElement="SequenceFlow_0ghzwlo"> - <di:waypoint xsi:type="dc:Point" x="315" y="145" /> - <di:waypoint xsi:type="dc:Point" x="315" y="216" /> + <di:waypoint xsi:type="dc:Point" x="355" y="227" /> + <di:waypoint xsi:type="dc:Point" x="355" y="175" /> + <di:waypoint xsi:type="dc:Point" x="391" y="175" /> <bpmndi:BPMNLabel> - <dc:Bounds x="330" y="174" width="0" height="13" /> + <dc:Bounds x="362" y="185" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ee42yq_di" bpmnElement="SequenceFlow_0ee42yq"> - <di:waypoint xsi:type="dc:Point" x="508" y="256" /> - <di:waypoint xsi:type="dc:Point" x="566" y="256" /> + <di:waypoint xsi:type="dc:Point" x="613" y="175" /> + <di:waypoint xsi:type="dc:Point" x="638" y="175" /> <bpmndi:BPMNLabel> - <dc:Bounds x="492" y="234.5" width="90" height="13" /> + <dc:Bounds x="580.5" y="153.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1eg5ryx_di" bpmnElement="CheckAuditVariable"> - <dc:Bounds x="161" y="80" width="100" height="80" /> + <dc:Bounds x="201" y="212" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xqyur9_di" bpmnElement="SequenceFlow_1xqyur9"> - <di:waypoint xsi:type="dc:Point" x="261" y="120" /> - <di:waypoint xsi:type="dc:Point" x="290" y="120" /> + <di:waypoint xsi:type="dc:Point" x="301" y="252" /> + <di:waypoint xsi:type="dc:Point" x="330" y="252" /> <bpmndi:BPMNLabel> - <dc:Bounds x="275.5" y="98.5" width="0" height="13" /> + <dc:Bounds x="270.5" y="230.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1h8avxn_di" bpmnElement="ExclusiveGateway_1h8avxn" isMarkerVisible="true"> - <dc:Bounds x="566" y="231" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="591" y="284" width="0" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_109oxx2_di" bpmnElement="SequenceFlow_109oxx2"> - <di:waypoint xsi:type="dc:Point" x="616" y="256" /> - <di:waypoint xsi:type="dc:Point" x="670" y="256" /> - <di:waypoint xsi:type="dc:Point" x="670" y="160" /> + <di:waypoint xsi:type="dc:Point" x="663" y="200" /> + <di:waypoint xsi:type="dc:Point" x="663" y="230" /> + <di:waypoint xsi:type="dc:Point" x="834" y="230" /> + <di:waypoint xsi:type="dc:Point" x="834" y="200" /> <bpmndi:BPMNLabel> - <dc:Bounds x="643" y="234.5" width="0" height="13" /> + <dc:Bounds x="670" y="207" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1bo83qk_di" bpmnElement="SequenceFlow_1bo83qk"> - <di:waypoint xsi:type="dc:Point" x="591" y="281" /> - <di:waypoint xsi:type="dc:Point" x="591" y="345" /> - <di:waypoint xsi:type="dc:Point" x="656" y="345" /> + <di:waypoint xsi:type="dc:Point" x="663" y="150" /> + <di:waypoint xsi:type="dc:Point" x="663" y="101" /> + <di:waypoint xsi:type="dc:Point" x="691" y="101" /> <bpmndi:BPMNLabel> - <dc:Bounds x="560" y="358" width="61" height="12" /> + <dc:Bounds x="667" y="111" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0arwo1o_di" bpmnElement="SequenceFlow_0arwo1o"> - <di:waypoint xsi:type="dc:Point" x="706" y="305" /> - <di:waypoint xsi:type="dc:Point" x="706" y="160" /> + <di:waypoint xsi:type="dc:Point" x="791" y="101" /> + <di:waypoint xsi:type="dc:Point" x="834" y="101" /> + <di:waypoint xsi:type="dc:Point" x="834" y="150" /> <bpmndi:BPMNLabel> - <dc:Bounds x="721" y="226" width="0" height="13" /> + <dc:Bounds x="767.5" y="79.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1eb09gr_di" bpmnElement="Create_AAI_Inventory"> - <dc:Bounds x="656" y="305" width="100" height="80" /> + <dc:Bounds x="691" y="61" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1b63lv4_di" bpmnElement="SequenceFlow_1b63lv4"> + <di:waypoint xsi:type="dc:Point" x="906" y="252" /> + <di:waypoint xsi:type="dc:Point" x="958" y="252" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="887" y="231" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18faffa_di" bpmnElement="SequenceFlow_18faffa"> + <di:waypoint xsi:type="dc:Point" x="859" y="175" /> + <di:waypoint xsi:type="dc:Point" x="881" y="175" /> + <di:waypoint xsi:type="dc:Point" x="881" y="227" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="825" y="154" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0mbkb7v_di" bpmnElement="SubProcess_0bpsptg" isExpanded="true"> + <dc:Bounds x="293" y="449" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_12r96di_di" bpmnElement="catchInventoryException"> + <dc:Bounds x="324" y="532" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="341.15269461077844" y="571.6127744510978" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_067jv1n_di" bpmnElement="EndEvent_067jv1n"> + <dc:Bounds x="572.1526946107784" y="532" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="590.1526946107784" y="572" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_19gbhlj_di" bpmnElement="SequenceFlow_19gbhlj"> + <di:waypoint xsi:type="dc:Point" x="360" y="550" /> + <di:waypoint xsi:type="dc:Point" x="415" y="550" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="387.5" y="529" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0l4jzc5_di" bpmnElement="SequenceFlow_0l4jzc5"> + <di:waypoint xsi:type="dc:Point" x="515" y="550" /> + <di:waypoint xsi:type="dc:Point" x="572" y="550" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="543.5" y="529" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_08xffml_di" bpmnElement="processAuditException"> + <dc:Bounds x="415" y="510" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_03pi9y4_di" bpmnElement="ExclusiveGateway_1v8bmbu"> + <dc:Bounds x="330" y="227" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="383" y="246" width="73" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_16ap4e3_di" bpmnElement="ExclusiveGateway_0sqvzll"> + <dc:Bounds x="856" y="227" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="836" y="281" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_00n600s_di" bpmnElement="ExclusiveGateway_1h8avxn"> + <dc:Bounds x="638" y="150" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="693" y="169" width="63" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_0xx6c29_di" bpmnElement="ExclusiveGateway_0y0ek7t"> + <dc:Bounds x="809" y="150" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="789" y="204" width="0" height="12" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index e1b36cfe65..8be07a165c 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.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.7.1"> +<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="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true"> <bpmn:startEvent id="DeleteVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing> @@ -51,22 +51,22 @@ <bpmn:sequenceFlow id="SequenceFlow_01vfwtp" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleDeleteStatus" /> <bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" /> <bpmn:sequenceFlow id="SequenceFlow_0xyu3pk" sourceRef="DeleteNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" /> - <bpmn:serviceTask id="DeleteNetworkPolicies" name="AAI Delete (network policies)" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming> + <bpmn:serviceTask id="DeleteNetworkPolicies" name=" AAI Delete (net policies) " camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_179btn2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xyu3pk</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVnfManagementV6Address" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0jtem3b</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0khqfnc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0jtem3b" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" /> - <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0xyu3pk</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0jtem3b</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0khqfnc" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" /> <bpmn:sequenceFlow id="SequenceFlow_0yuz21z" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" /> - <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing> </bpmn:serviceTask> @@ -80,7 +80,7 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0qfmmgt" sourceRef="Audit_Inventory" targetRef="ExclusiveGateway_1pydilb" /> - <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="DeleteNetworkPolicies" /> + <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="aaiThrow" /> <bpmn:parallelGateway id="ExclusiveGateway_1yvh16a"> <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming> <bpmn:incoming>SequenceFlow_1ut7n32</bpmn:incoming> @@ -113,7 +113,32 @@ <bpmn:incoming>SequenceFlow_1mgunf3</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ut7n32</bpmn:outgoing> </bpmn:exclusiveGateway> + <bpmn:subProcess id="SubProcess_0grvkj2" name="Audit Exception Sub Process" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_1euiddy"> + <bpmn:outgoing>SequenceFlow_0xuodpy</bpmn:outgoing> + <bpmn:errorEventDefinition errorRef="Error_0jjnve8" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1gzq57j"> + <bpmn:incoming>SequenceFlow_1fhst92</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="ServiceTask_1isbxvo" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0xuodpy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fhst92</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0xuodpy" sourceRef="StartEvent_1euiddy" targetRef="ServiceTask_1isbxvo" /> + <bpmn:sequenceFlow id="SequenceFlow_1fhst92" sourceRef="ServiceTask_1isbxvo" targetRef="EndEvent_1gzq57j" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_179btn2" sourceRef="aaiCatch" targetRef="DeleteNetworkPolicies" /> + <bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI"> + <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming> + <bpmn:linkEventDefinition name="AAI" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI"> + <bpmn:outgoing>SequenceFlow_179btn2</bpmn:outgoing> + <bpmn:linkEventDefinition name="AAI" /> + </bpmn:intermediateCatchEvent> </bpmn:process> + <bpmn:error id="Error_0jjnve8" name="Error_3k24na6" errorCode="AAIInventoryFailure" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start"> @@ -133,7 +158,7 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> - <dc:Bounds x="840" y="443" width="100" height="80" /> + <dc:Bounds x="907" y="443" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf"> <di:waypoint xsi:type="dc:Point" x="482" y="318" /> @@ -143,9 +168,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> - <dc:Bounds x="1087" y="465" width="36" height="36" /> + <dc:Bounds x="1136" y="465" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1060" y="505" width="90" height="0" /> + <dc:Bounds x="1109" y="505" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> @@ -153,94 +178,90 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87"> <di:waypoint xsi:type="dc:Point" x="611" y="318" /> - <di:waypoint xsi:type="dc:Point" x="836" y="318" /> - <di:waypoint xsi:type="dc:Point" x="836" y="284" /> + <di:waypoint xsi:type="dc:Point" x="847" y="318" /> + <di:waypoint xsi:type="dc:Point" x="847" y="284" /> <bpmndi:BPMNLabel> - <dc:Bounds x="678.5" y="303" width="90" height="0" /> + <dc:Bounds x="684" y="303" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true"> - <dc:Bounds x="294" y="618" width="231" height="135" /> + <dc:Bounds x="290" y="857" width="231" height="135" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt"> - <dc:Bounds x="337" y="680" width="36" height="36" /> + <dc:Bounds x="333" y="919" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="265" y="716" width="90" height="0" /> + <dc:Bounds x="261" y="955" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau"> - <dc:Bounds x="466" y="680" width="36" height="36" /> + <dc:Bounds x="462" y="919" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="394" y="716" width="90" height="0" /> + <dc:Bounds x="390" y="955" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0"> - <di:waypoint xsi:type="dc:Point" x="373" y="698" /> - <di:waypoint xsi:type="dc:Point" x="466" y="698" /> + <di:waypoint xsi:type="dc:Point" x="369" y="937" /> + <di:waypoint xsi:type="dc:Point" x="462" y="937" /> <bpmndi:BPMNLabel> - <dc:Bounds x="375" y="677" width="90" height="0" /> + <dc:Bounds x="371" y="916" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId"> - <dc:Bounds x="706" y="443" width="100" height="80" /> + <dc:Bounds x="779" y="443" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp"> - <di:waypoint xsi:type="dc:Point" x="806" y="483" /> - <di:waypoint xsi:type="dc:Point" x="840" y="483" /> + <di:waypoint xsi:type="dc:Point" x="879" y="483" /> + <di:waypoint xsi:type="dc:Point" x="907" y="483" /> <bpmndi:BPMNLabel> - <dc:Bounds x="778" y="468" width="90" height="0" /> + <dc:Bounds x="848" y="468" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg"> - <di:waypoint xsi:type="dc:Point" x="940" y="483" /> - <di:waypoint xsi:type="dc:Point" x="1087" y="483" /> + <di:waypoint xsi:type="dc:Point" x="1007" y="483" /> + <di:waypoint xsi:type="dc:Point" x="1136" y="483" /> <bpmndi:BPMNLabel> - <dc:Bounds x="968.5" y="468" width="90" height="0" /> + <dc:Bounds x="1026.5" y="468" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk"> - <di:waypoint xsi:type="dc:Point" x="998" y="259" /> - <di:waypoint xsi:type="dc:Point" x="1072" y="259" /> - <di:waypoint xsi:type="dc:Point" x="1072" y="399" /> - <di:waypoint xsi:type="dc:Point" x="233" y="399" /> - <di:waypoint xsi:type="dc:Point" x="233" y="483" /> - <di:waypoint xsi:type="dc:Point" x="280" y="483" /> + <di:waypoint xsi:type="dc:Point" x="376" y="483" /> + <di:waypoint xsi:type="dc:Point" x="404" y="483" /> <bpmndi:BPMNLabel> - <dc:Bounds x="607.5" y="384" width="90" height="0" /> + <dc:Bounds x="345" y="468" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies"> - <dc:Bounds x="898" y="219" width="100" height="80" /> + <dc:Bounds x="276" y="443" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address"> - <dc:Bounds x="421" y="443" width="100" height="80" /> + <dc:Bounds x="531" y="443" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b"> - <di:waypoint xsi:type="dc:Point" x="380" y="483" /> - <di:waypoint xsi:type="dc:Point" x="421" y="483" /> + <di:waypoint xsi:type="dc:Point" x="504" y="483" /> + <di:waypoint xsi:type="dc:Point" x="531" y="483" /> <bpmndi:BPMNLabel> - <dc:Bounds x="355.5" y="468" width="90" height="0" /> + <dc:Bounds x="472.5" y="468" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress"> - <dc:Bounds x="280" y="443" width="100" height="80" /> + <dc:Bounds x="404" y="443" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc"> - <di:waypoint xsi:type="dc:Point" x="521" y="483" /> - <di:waypoint xsi:type="dc:Point" x="561" y="483" /> + <di:waypoint xsi:type="dc:Point" x="631" y="483" /> + <di:waypoint xsi:type="dc:Point" x="654" y="483" /> <bpmndi:BPMNLabel> - <dc:Bounds x="496" y="468" width="90" height="0" /> + <dc:Bounds x="597.5" y="468" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z"> - <di:waypoint xsi:type="dc:Point" x="661" y="483" /> - <di:waypoint xsi:type="dc:Point" x="706" y="483" /> + <di:waypoint xsi:type="dc:Point" x="754" y="483" /> + <di:waypoint xsi:type="dc:Point" x="779" y="483" /> <bpmndi:BPMNLabel> - <dc:Bounds x="638.5" y="468" width="90" height="0" /> + <dc:Bounds x="721.5" y="468" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> - <dc:Bounds x="561" y="443" width="100" height="80" /> + <dc:Bounds x="654" y="443" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1n8gab5_di" bpmnElement="SequenceFlow_1n8gab5"> <di:waypoint xsi:type="dc:Point" x="307" y="284" /> @@ -266,32 +287,32 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qfmmgt_di" bpmnElement="SequenceFlow_0qfmmgt"> <di:waypoint xsi:type="dc:Point" x="754" y="108" /> - <di:waypoint xsi:type="dc:Point" x="784" y="108" /> - <di:waypoint xsi:type="dc:Point" x="784" y="149" /> + <di:waypoint xsi:type="dc:Point" x="790" y="108" /> + <di:waypoint xsi:type="dc:Point" x="790" y="149" /> <bpmndi:BPMNLabel> - <dc:Bounds x="724" y="86.5" width="90" height="13" /> + <dc:Bounds x="727" y="86.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14bu4ys_di" bpmnElement="SequenceFlow_14bu4ys"> - <di:waypoint xsi:type="dc:Point" x="861" y="259" /> - <di:waypoint xsi:type="dc:Point" x="898" y="259" /> + <di:waypoint xsi:type="dc:Point" x="872" y="259" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="258" /> <bpmndi:BPMNLabel> - <dc:Bounds x="834.5" y="237.5" width="90" height="13" /> + <dc:Bounds x="902" y="237" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ParallelGateway_02fjfb8_di" bpmnElement="ExclusiveGateway_1yvh16a"> - <dc:Bounds x="811" y="234" width="50" height="50" /> + <dc:Bounds x="822" y="234" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="790" y="287" width="90" height="13" /> + <dc:Bounds x="801" y="287" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1mgunf3_di" bpmnElement="SequenceFlow_1mgunf3"> <di:waypoint xsi:type="dc:Point" x="492" y="199" /> <di:waypoint xsi:type="dc:Point" x="492" y="232" /> - <di:waypoint xsi:type="dc:Point" x="784" y="232" /> - <di:waypoint xsi:type="dc:Point" x="784" y="199" /> + <di:waypoint xsi:type="dc:Point" x="790" y="232" /> + <di:waypoint xsi:type="dc:Point" x="790" y="199" /> <bpmndi:BPMNLabel> - <dc:Bounds x="499" y="212" width="15" height="13" /> + <dc:Bounds x="500.3082191780822" y="212" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1vmz3zo_di" bpmnElement="Check_Audit"> @@ -326,11 +347,11 @@ <dc:Bounds x="531" y="68" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ut7n32_di" bpmnElement="SequenceFlow_1ut7n32"> - <di:waypoint xsi:type="dc:Point" x="809" y="174" /> - <di:waypoint xsi:type="dc:Point" x="836" y="174" /> - <di:waypoint xsi:type="dc:Point" x="836" y="234" /> + <di:waypoint xsi:type="dc:Point" x="815" y="174" /> + <di:waypoint xsi:type="dc:Point" x="847" y="174" /> + <di:waypoint xsi:type="dc:Point" x="847" y="234" /> <bpmndi:BPMNLabel> - <dc:Bounds x="777.5" y="152.5" width="90" height="13" /> + <dc:Bounds x="786" y="152.5" width="90" height="13" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1olwkdn_di" bpmnElement="ExclusiveGateway_1h2ystu" isMarkerVisible="true"> @@ -340,9 +361,60 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1d1pmqz_di" bpmnElement="ExclusiveGateway_1pydilb" isMarkerVisible="true"> - <dc:Bounds x="759" y="149" width="50" height="50" /> + <dc:Bounds x="765" y="149" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="655" y="202" width="90" height="13" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0grvkj2_di" bpmnElement="SubProcess_0grvkj2" isExpanded="true"> + <dc:Bounds x="231" y="617" width="350" height="200" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1euiddy_di" bpmnElement="StartEvent_1euiddy"> + <dc:Bounds x="262" y="700" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="234" y="740" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1gzq57j_di" bpmnElement="EndEvent_1gzq57j"> + <dc:Bounds x="510" y="700" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="483" y="740" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1isbxvo_di" bpmnElement="ServiceTask_1isbxvo"> + <dc:Bounds x="353" y="678" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xuodpy_di" bpmnElement="SequenceFlow_0xuodpy"> + <di:waypoint xsi:type="dc:Point" x="298" y="718" /> + <di:waypoint xsi:type="dc:Point" x="353" y="718" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="281.5" y="697" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fhst92_di" bpmnElement="SequenceFlow_1fhst92"> + <di:waypoint xsi:type="dc:Point" x="453" y="718" /> + <di:waypoint xsi:type="dc:Point" x="510" y="718" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="437.5" y="697" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_179btn2_di" bpmnElement="SequenceFlow_179btn2"> + <di:waypoint xsi:type="dc:Point" x="195" y="483" /> + <di:waypoint xsi:type="dc:Point" x="276" y="483" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="235.5" y="462" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1sftyjz_di" bpmnElement="aaiThrow"> + <dc:Bounds x="1022" y="241" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1014" y="280" width="55" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_13y483m_di" bpmnElement="aaiCatch"> + <dc:Bounds x="159" y="465" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="694" y="202" width="0" height="13" /> + <dc:Bounds x="150" y="505" width="55" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> 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/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java index 513ff74180..4e74e5d414 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java @@ -55,7 +55,7 @@ public class HomingV2 { private boolean isOof(BuildingBlockExecution execution) { for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters() .getUserParams()) { - if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) { + if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) { return true; } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java index 2696313daf..d5a085aba7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java @@ -81,6 +81,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; @Component("OofHoming") public class OofHomingV2 { + public static final String ERROR_WHILE_PREPARING_OOF_REQUEST = " Error - while preparing oof request: "; private static final Logger logger = LoggerFactory.getLogger(OofHomingV2.class); private JsonUtils jsonUtils = new JsonUtils(); @Autowired @@ -91,13 +92,9 @@ public class OofHomingV2 { private OofValidator oofValidator; @Autowired private ExceptionBuilder exceptionUtil; - private static final String MODEL_NAME = "modelName"; private static final String MODEL_INVARIANT_ID = "modelInvariantId"; private static final String MODEL_VERSION_ID = "modelVersionId"; - private static final String MODEL_VERSION = "modelVersion"; private static final String SERVICE_RESOURCE_ID = "serviceResourceId"; - private static final String RESOURCE_MODULE_NAME = "resourceModuleName"; - private static final String RESOURCE_MODEL_INFO = "resourceModelInfo"; private static final String IDENTIFIER_TYPE = "identifierType"; private static final String SOLUTIONS = "solutions"; private static final String RESOURCE_MISSING_DATA = "Resource does not contain: "; @@ -128,7 +125,7 @@ public class OofHomingV2 { OofRequest oofRequest = new OofRequest(); - RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout); + RequestInfo requestInfo = buildRequestInfo(requestId, timeout); oofRequest.setRequestInformation(requestInfo); ServiceInfo serviceInfo = buildServiceInfo(serviceInstance); @@ -157,13 +154,13 @@ public class OofHomingV2 { logger.trace("Completed Oof Homing Call Oof"); } catch (BpmnError e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); } catch (BadResponseException e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); } catch (Exception e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while " + "preparing oof request: " + e + " Stack:" + ExceptionUtils.getFullStackTrace(e)); } 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 a927767ec7..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 @@ -562,7 +562,7 @@ public class SniroHomingV2 { si.setServiceInstanceId(identifierValue); si.setOrchestrationStatus(OrchestrationStatus.CREATED); cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId")); - if (assignmentsMap.containsKey("vnfHostName")) { + if (assignmentsMap.containsKey("vnfHostName") && !assignmentsMap.get("vnfHostName").isEmpty()) { logger.debug("Resources has been homed to a vnf"); GenericVnf vnf = setVnf(assignmentsMap); vnf.setCloudRegion(cloud); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 28186528e4..18ba91263b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -9,9 +9,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. @@ -58,8 +58,8 @@ import org.springframework.stereotype.Component; public class AAIDeleteTasks { private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class); - private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; - private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn"; + private static String contrailNetworkPolicyFqdnList = "contrailNetworkPolicyFqdnList"; + private static String networkPolicyFqdnParam = "network-policy-fqdn"; @Autowired private ExceptionBuilder exceptionUtil; @@ -176,15 +176,15 @@ public class AAIDeleteTasks { public void deleteNetworkPolicies(BuildingBlockExecution execution) { try { - String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST); + String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList); if (fqdns != null && !fqdns.isEmpty()) { - String fqdnList[] = fqdns.split(","); + String[] fqdnList = fqdns.split(","); int fqdnCount = fqdnList.length; if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); - uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); + uri.queryParam(networkPolicyFqdnParam, fqdn); Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri); if (oNetPolicies.isPresent()) { NetworkPolicies networkPolicies = oNetPolicies.get(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 3304d1b113..01bdc09419 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -481,6 +481,16 @@ public class AAIUpdateTasks { } } + public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); + aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, + OrchestrationStatus.ASSIGNED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 05d4f56fdc..a37f43727e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -85,7 +85,7 @@ public class ExecuteActivity implements JavaDelegate { Map<String, Object> variables = new HashMap<>(); variables.put("buildingBlock", executeBuildingBlock); - variables.put("mso-request-id", requestId); + variables.put(G_REQUEST_ID, requestId); variables.put("retryCount", 1); variables.put("aLaCarte", true); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java index 77898dd5cc..428f5e703d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java @@ -32,7 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.client.orchestration.NetworkAdapterResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +39,6 @@ import org.springframework.stereotype.Component; @Component public class NetworkAdapterUpdateTasks { - private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class); @Autowired private ExtractPojosForBB extractPojosForBB; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index 849465e787..b257e91165 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -47,7 +47,7 @@ import static org.apache.commons.lang3.StringUtils.*; @Component public class VnfAdapterCreateTasks { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class); + public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_"; private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired @@ -73,7 +73,7 @@ public class VnfAdapterCreateTasks { try { vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { - sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); + sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId()); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); @@ -109,8 +109,8 @@ public class VnfAdapterCreateTasks { CloudRegion cloudRegion = gBBInput.getCloudRegion(); RequestContext requestContext = gBBInput.getRequestContext(); OrchestrationContext orchestrationContext = gBBInput.getOrchContext(); - String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); - String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()); + String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId()); + String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId()); CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest( requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java index 116dc30d63..5fe80b79f9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java @@ -42,7 +42,7 @@ import org.springframework.stereotype.Component; @Component public class VnfAdapterDeleteTasks { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class); + private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index bfa76c5053..48426fa725 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -63,6 +63,7 @@ public class VnfAdapterImpl { private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address"; private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address"; private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; + public static final String HEAT_STACK_ID = "heatStackId"; @Autowired private ExtractPojosForBB extractPojosForBB; @@ -77,7 +78,7 @@ public class VnfAdapterImpl { extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId()); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null); execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null); execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null); @@ -97,7 +98,7 @@ public class VnfAdapterImpl { String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId(); if (!StringUtils.isEmpty(heatStackId)) { vfModule.setHeatStackId(heatStackId); - execution.setVariable("heatStackId", heatStackId); + execution.setVariable(HEAT_STACK_ID, heatStackId); } Map<String, String> vfModuleOutputs = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); @@ -110,7 +111,7 @@ public class VnfAdapterImpl { Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted(); if (null != vfModuleDelete && vfModuleDelete) { vfModule.setHeatStackId(null); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); Map<String, String> vfModuleOutputs = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); if (vfModuleOutputs != null) { @@ -134,7 +135,7 @@ public class VnfAdapterImpl { String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId(); if (!StringUtils.isEmpty(heatStackId)) { volumeGroup.setHeatStackId(heatStackId); - execution.setVariable("heatStackId", heatStackId); + execution.setVariable(HEAT_STACK_ID, heatStackId); } else { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response."); @@ -144,7 +145,7 @@ public class VnfAdapterImpl { Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted(); if (null != volumeGroupDelete && volumeGroupDelete) { volumeGroup.setHeatStackId(null); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); } } } @@ -184,7 +185,7 @@ public class VnfAdapterImpl { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>(); + List<String> contrailNetworkPolicyFqdnList = new ArrayList<>(); Iterator<String> keys = vfModuleOutputs.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java index 01519fab6e..4cf5131747 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java @@ -2,6 +2,8 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,8 +22,7 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; -import static com.google.common.collect.Sets.newHashSet; -import java.util.Set; +import com.google.common.collect.ImmutableSet; import org.onap.vnfmadapter.v1.model.OperationStateEnum; import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum; @@ -51,11 +52,11 @@ public class Constants { public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/"; - public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES = - newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK); + public static final ImmutableSet<OperationStateEnum> OPERATION_FINISHED_STATES = + ImmutableSet.of(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK); - public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet( - OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS); + public static final ImmutableSet<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = ImmutableSet + .of(OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS); public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus"; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java index f193967a32..e0176eb802 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java @@ -42,6 +42,7 @@ import com.google.common.base.Optional; public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider { private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class); + public static final String RECEIVED_RESPONSE_WITHOUT_BODY = "Received response without body: {}"; private final VnfmAdapterUrlProvider urlProvider; private final HttpRestServiceProvider httpServiceProvider; @@ -69,7 +70,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } @@ -107,7 +108,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } final DeleteVnfResponse deleteVnfResponse = response.getBody(); @@ -139,7 +140,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } return Optional.of(response.getBody()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index ef882b4694..f9bd8c546f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -47,6 +47,9 @@ import org.springframework.stereotype.Component; @Component public class AppcRunTasks { private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class); + public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop"; + public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock"; + public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -71,9 +74,9 @@ public class AppcRunTasks { execution.setVariable("actionHealthCheck", Action.HealthCheck); execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic); execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck); - execution.setVariable("rollbackVnfStop", false); - execution.setVariable("rollbackVnfLock", false); - execution.setVariable("rollbackQuiesceTraffic", false); + execution.setVariable(ROLLBACK_VNF_STOP, false); + execution.setVariable(ROLLBACK_VNF_LOCK, false); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false); } public void runAppcCommand(BuildingBlockExecution execution, Action action) { @@ -153,17 +156,17 @@ public class AppcRunTasks { protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) { if (appcCode.equals("0") && action != null) { if (action.equals(Action.Lock)) { - execution.setVariable("rollbackVnfLock", true); + execution.setVariable(ROLLBACK_VNF_LOCK, true); } else if (action.equals(Action.Unlock)) { - execution.setVariable("rollbackVnfLock", false); + execution.setVariable(ROLLBACK_VNF_LOCK, false); } else if (action.equals(Action.Start)) { - execution.setVariable("rollbackVnfStop", false); + execution.setVariable(ROLLBACK_VNF_STOP, false); } else if (action.equals(Action.Stop)) { - execution.setVariable("rollbackVnfStop", true); + execution.setVariable(ROLLBACK_VNF_STOP, true); } else if (action.equals(Action.QuiesceTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", true); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, true); } else if (action.equals(Action.ResumeTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", false); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java index ab8818f682..4b88f741de 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java @@ -54,9 +54,9 @@ public class AssignNetworkBBUtils { * @return */ public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception { - boolean found = false; + // TODO - populate logic after iTrack MSO-2143 implemented - return found; + return false; } /** @@ -71,7 +71,7 @@ public class AssignNetworkBBUtils { CloudRegion cloudRegion = gBBInput.getCloudRegion(); String cloudRegionSdnc; String cloudRegionPo = cloudRegion.getLcpCloudRegionId(); - if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")) { + if ("2.5".equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) { cloudRegionSdnc = "AAIAIC25"; } else { cloudRegionSdnc = cloudRegionPo; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java index 359f19285f..4ec8b932c0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java @@ -40,9 +40,9 @@ import org.springframework.stereotype.Component; @Component public class ConfigDeployVnf { private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class); - private final static String ORIGINATOR_ID = "SO"; - private final static String ACTION_NAME = "config-deploy"; - private final static String MODE = "async"; + private static final String ORIGINATOR_ID = "SO"; + private static final String ACTION_NAME = "config-deploy"; + private static final String MODE = "async"; @Autowired private ExceptionBuilder exceptionUtil; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index 1925d8b69f..0ad88d0676 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -160,7 +160,7 @@ public class ConfigurationScaleOut { logger.error("Error Message: " + appcMessage); logger.error("ERROR CODE: " + appcCode); logger.trace("End of runAppCommand "); - if (appcCode != null && !appcCode.equals("0")) { + if (appcCode != null && !("0").equals(appcCode)) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java index c2d9c6e7bb..b7ddc11f35 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java @@ -39,7 +39,7 @@ import org.springframework.stereotype.Component; @Component public class CreateNetwork { - private static final Logger logger = LoggerFactory.getLogger(CreateNetwork.class); + @Autowired private ExceptionBuilder exceptionUtil; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java index 4eaec381e9..36eab8f981 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java @@ -36,7 +36,7 @@ import org.springframework.stereotype.Component; @Component public class CreateNetworkCollection { - private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class); + @Autowired private ExceptionBuilder exceptionUtil; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index 98b602eca1..8f0c809e1f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -45,6 +45,9 @@ import org.springframework.stereotype.Component; public class GenericVnfHealthCheck { private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class); + public static final String VNF_NAME = "vnfName"; + public static final String OAM_IP_ADDRESS = "oamIpAddress"; + public static final String VNF_HOST_IP_ADDRESS = "vnfHostIpAddress"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -71,9 +74,9 @@ public class GenericVnfHealthCheck { String controllerName = controllerSelectionReference.getControllerName(); execution.setVariable("vnfId", vnfId); - execution.setVariable("vnfName", vnfName); - execution.setVariable("oamIpAddress", oamIpAddress); - execution.setVariable("vnfHostIpAddress", oamIpAddress); + execution.setVariable(VNF_NAME, vnfName); + execution.setVariable(OAM_IP_ADDRESS, oamIpAddress); + execution.setVariable(VNF_HOST_IP_ADDRESS, oamIpAddress); execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("action", actionCategory); execution.setVariable("controllerType", controllerName); @@ -98,11 +101,11 @@ public class GenericVnfHealthCheck { payload = Optional.of(pay); } String controllerType = execution.getVariable("controllerType"); - HashMap<String, String> payloadInfo = new HashMap<String, String>(); - payloadInfo.put("vnfName", execution.getVariable("vnfName")); + HashMap<String, String> payloadInfo = new HashMap<>(); + payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME)); payloadInfo.put("vfModuleId", execution.getVariable("vfModuleId")); - payloadInfo.put("oamIpAddress", execution.getVariable("oamIpAddress")); - payloadInfo.put("vnfHostIpAddress", execution.getVariable("vnfHostIpAddress")); + payloadInfo.put(OAM_IP_ADDRESS, execution.getVariable(OAM_IP_ADDRESS)); + payloadInfo.put(VNF_HOST_IP_ADDRESS, execution.getVariable(VNF_HOST_IP_ADDRESS)); logger.debug("Running APP-C action: {}", action.toString()); logger.debug("VNFID: {}", vnfId); @@ -133,7 +136,7 @@ public class GenericVnfHealthCheck { logger.error("Error Message: " + appcMessage); logger.error("ERROR CODE: " + appcCode); logger.trace("End of runAppCommand "); - if (appcCode != null && !appcCode.equals("0")) { + if (appcCode != null && !("0").equals(appcCode)) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index 27415190cc..7466df53b2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -38,11 +38,10 @@ import org.springframework.stereotype.Component; @Component public class UnassignNetworkBB { - private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class); - private static String MESSAGE_CANNOT_PERFORM_UNASSIGN = + private static String messageCannotPerformUnassign = "Cannot perform Unassign Network. Network is still related to "; - private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually."; + private static String messageErrorRollback = " Rollback is not possible. Please restore data manually."; @Autowired private ExceptionBuilder exceptionUtil; @@ -72,7 +71,7 @@ public class UnassignNetworkBB { Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) { - String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue; + String msg = messageCannotPerformUnassign + relatedToValue; execution.setVariable("ErrorUnassignNetworkBB", msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } @@ -109,7 +108,7 @@ public class UnassignNetworkBB { boolean isRollbackNeeded = execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false; if (isRollbackNeeded == true) { - msg = execution.getVariable("ErrorUnassignNetworkBB") + MESSAGE_ERROR_ROLLBACK; + msg = execution.getVariable("ErrorUnassignNetworkBB") + messageErrorRollback; } else { msg = execution.getVariable("ErrorUnassignNetworkBB"); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java index b906b8a662..61fc8ffc48 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java @@ -23,6 +23,14 @@ public class ManualHandlingTasks { private static final String TASK_TYPE_PAUSE = "pause"; private static final String TASK_TYPE_FALLOUT = "fallout"; + public static final String VNF_TYPE = "vnfType"; + public static final String SERVICE_TYPE = "serviceType"; + public static final String MSO_REQUEST_ID = "msoRequestId"; + public static final String REQUESTOR_ID = "requestorId"; + public static final String ERROR_CODE = "errorCode"; + public static final String VALID_RESPONSES = "validResponses"; + public static final String DESCRIPTION = "description"; + public static final String BPMN_EXCEPTION = "BPMN exception: "; @Autowired private ExceptionBuilder exceptionUtil; @@ -37,39 +45,39 @@ public class ManualHandlingTasks { String taskId = task.getId(); logger.debug("taskId is: " + taskId); String type = TASK_TYPE_FALLOUT; - String nfRole = (String) execution.getVariable("vnfType"); - String subscriptionServiceType = (String) execution.getVariable("serviceType"); - String originalRequestId = (String) execution.getVariable("msoRequestId"); - String originalRequestorId = (String) execution.getVariable("requestorId"); + String nfRole = (String) execution.getVariable(VNF_TYPE); + String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE); + String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID); + String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID); String description = ""; String timeout = ""; String errorSource = (String) execution.getVariable("failedActivity"); - String errorCode = (String) execution.getVariable("errorCode"); + String errorCode = (String) execution.getVariable(ERROR_CODE); String errorMessage = (String) execution.getVariable("errorText"); String buildingBlockName = (String) execution.getVariable("currentActivity"); String buildingBlockStep = (String) execution.getVariable("workStep"); - String validResponses = (String) execution.getVariable("validResponses"); + String validResponses = (String) execution.getVariable(VALID_RESPONSES); - Map<String, String> taskVariables = new HashMap<String, String>(); + Map<String, String> taskVariables = new HashMap<>(); taskVariables.put("type", type); taskVariables.put("nfRole", nfRole); taskVariables.put("subscriptionServiceType", subscriptionServiceType); taskVariables.put("originalRequestId", originalRequestId); taskVariables.put("originalRequestorId", originalRequestorId); taskVariables.put("errorSource", errorSource); - taskVariables.put("errorCode", errorCode); + taskVariables.put(ERROR_CODE, errorCode); taskVariables.put("errorMessage", errorMessage); taskVariables.put("buildingBlockName", buildingBlockName); taskVariables.put("buildingBlockStep", buildingBlockStep); - taskVariables.put("validResponses", validResponses); + taskVariables.put(VALID_RESPONSES, validResponses); taskVariables.put("tmeout", timeout); - taskVariables.put("description", description); + taskVariables.put(DESCRIPTION, description); TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); logger.debug("successfully created fallout task: " + taskId); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in setFalloutTaskVariables " + ex.getMessage(); @@ -86,39 +94,39 @@ public class ManualHandlingTasks { String taskId = task.getId(); logger.debug("taskId is: " + taskId); String type = TASK_TYPE_PAUSE; - String nfRole = (String) execution.getVariable("vnfType"); - String subscriptionServiceType = (String) execution.getVariable("serviceType"); - String originalRequestId = (String) execution.getVariable("msoRequestId"); - String originalRequestorId = (String) execution.getVariable("requestorId"); - String description = (String) execution.getVariable("description"); + String nfRole = (String) execution.getVariable(VNF_TYPE); + String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE); + String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID); + String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID); + String description = (String) execution.getVariable(DESCRIPTION); String timeout = (String) execution.getVariable("taskTimeout"); String errorSource = ""; String errorCode = ""; String errorMessage = ""; String buildingBlockName = ""; String buildingBlockStep = ""; - String validResponses = (String) execution.getVariable("validResponses"); + String validResponses = (String) execution.getVariable(VALID_RESPONSES); - Map<String, String> taskVariables = new HashMap<String, String>(); + Map<String, String> taskVariables = new HashMap<>(); taskVariables.put("type", type); taskVariables.put("nfRole", nfRole); - taskVariables.put("description", description); + taskVariables.put(DESCRIPTION, description); taskVariables.put("timeout", timeout); taskVariables.put("subscriptionServiceType", subscriptionServiceType); taskVariables.put("originalRequestId", originalRequestId); taskVariables.put("originalRequestorId", originalRequestorId); taskVariables.put("errorSource", errorSource); - taskVariables.put("errorCode", errorCode); + taskVariables.put(ERROR_CODE, errorCode); taskVariables.put("errorMessage", errorMessage); taskVariables.put("buildingBlockName", buildingBlockName); taskVariables.put("buildingBlockStep", buildingBlockStep); - taskVariables.put("validResponses", validResponses); + taskVariables.put(VALID_RESPONSES, validResponses); TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); logger.debug("successfully created pause task: " + taskId); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in setPauseTaskVariables " + ex.getMessage(); @@ -149,7 +157,7 @@ public class ManualHandlingTasks { execution.setVariable("responseValueTask", responseValueUppercaseStart); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in completeManualTask " + ex.getMessage(); @@ -164,15 +172,15 @@ public class ManualHandlingTasks { try { ExternalTicket ticket = new ExternalTicket(); - ticket.setRequestId((String) execution.getVariable("msoRequestId")); + ticket.setRequestId((String) execution.getVariable(MSO_REQUEST_ID)); ticket.setCurrentActivity((String) execution.getVariable("currentActivity")); - ticket.setNfRole((String) execution.getVariable("vnfType")); - ticket.setDescription((String) execution.getVariable("description")); - ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType")); - ticket.setRequestorId((String) execution.getVariable("requestorId")); + ticket.setNfRole((String) execution.getVariable(VNF_TYPE)); + ticket.setDescription((String) execution.getVariable(DESCRIPTION)); + ticket.setSubscriptionServiceType((String) execution.getVariable(SERVICE_TYPE)); + ticket.setRequestorId((String) execution.getVariable(REQUESTOR_ID)); ticket.setTimeout((String) execution.getVariable("taskTimeout")); ticket.setErrorSource((String) execution.getVariable("failedActivity")); - ticket.setErrorCode((String) execution.getVariable("errorCode")); + ticket.setErrorCode((String) execution.getVariable(ERROR_CODE)); ticket.setErrorMessage((String) execution.getVariable("errorText")); ticket.setWorkStep((String) execution.getVariable("workStep")); @@ -191,7 +199,7 @@ public class ManualHandlingTasks { public void updateRequestDbStatus(DelegateExecution execution, String status) { try { - String requestId = (String) execution.getVariable("msoRequestId"); + String requestId = (String) execution.getVariable(MSO_REQUEST_ID); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); request.setRequestStatus(status); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index 7a0008d5a2..32276891c7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -50,7 +50,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCActivateTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCVnfResources sdncVnfResources; @Autowired @@ -77,7 +78,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -103,7 +104,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -126,7 +127,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index d3878f06b7..111f008159 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -54,6 +54,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCAssignTasks { private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class); + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired @@ -79,7 +80,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -99,7 +100,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -126,7 +127,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -152,7 +153,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java index 50cf0fb074..4ffb397707 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java @@ -47,6 +47,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCChangeAssignTasks { + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @Autowired @@ -70,7 +71,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -87,7 +88,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -104,7 +105,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -125,7 +126,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index 3a1528946d..e587830c74 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -51,7 +51,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCDeactivateTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @Autowired @@ -80,7 +81,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -107,7 +108,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -132,7 +133,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -157,7 +158,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 7ae6117c61..fcc67d0ef7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -39,7 +39,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCQueryTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class); + + public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_"; @Autowired private SDNCVnfResources sdncVnfResources; @Autowired @@ -61,7 +62,7 @@ public class SDNCQueryTasks { genericVnf.setSelflink(selfLink); } String response = sdncVnfResources.queryVnf(genericVnf); - execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -82,7 +83,7 @@ public class SDNCQueryTasks { } if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); - execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); @@ -97,7 +98,7 @@ public class SDNCQueryTasks { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); - execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index e9848d1646..fba189fcfc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -51,7 +51,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCUnassignTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired @@ -77,7 +78,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -94,7 +95,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -114,7 +115,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -136,7 +137,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } 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 4514d24c54..f0a102dfeb 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 @@ -37,6 +37,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; @@ -83,6 +84,25 @@ public class WorkflowActionBBTasks { execution.setVariable("MacroRollback", false); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence); + + if (ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigAssignVnfBB") + || ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigDeployVnfBB")) { + String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId(); + String vnfCustomizationUUID = ebb.getBuildingBlock().getKey(); + + List<VnfResourceCustomization> vnfResourceCustomizations = + catalogDbClient.getVnfResourceCustomizationByModelUuid(serviceInstanceId); + if (vnfResourceCustomizations != null && vnfResourceCustomizations.size() >= 1) { + VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, + vnfResourceCustomizations); + boolean skipConfigVNF = vrc.isSkipPostInstConf(); + if (skipConfigVNF) { + currentSequence++; + ebb = flowsToExecute.get(currentSequence); + } + } + } + boolean homing = (boolean) execution.getVariable("homing"); boolean calledHoming = (boolean) execution.getVariable("calledHoming"); if (homing && !calledHoming) { 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/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index 746f136e96..1453e40653 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -49,7 +49,7 @@ public class AAIConfigurationResources { public void createConfiguration(Configuration configuration) { AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); - configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index e391349d2c..f84afbe4a2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -61,9 +61,9 @@ public class AAIServiceInstanceResources { AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId()); serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); - injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(AAIServiceInstance)); + injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(aaiServiceInstance)); } /** @@ -87,24 +87,24 @@ public class AAIServiceInstanceResources { public void createProject(Project project) { AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); - org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); - injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)); + org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); + injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)); } public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) { AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName()); AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); - org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); - injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)).connect(projectURI, + org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project); + injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI, serviceInstanceURI); } public void createOwningEntity(OwningEntity owningEntity) { AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); - org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); - injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity)); + org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); + injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)); } public boolean existsOwningEntity(OwningEntity owningEntity) { @@ -134,8 +134,8 @@ public class AAIServiceInstanceResources { AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId()); AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); - org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); - injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity)) + org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity); + injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity)) .connect(owningEntityURI, serviceInstanceURI); } @@ -152,9 +152,9 @@ public class AAIServiceInstanceResources { public void updateServiceInstance(ServiceInstance serviceInstance) { AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId()); - org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); - injectionHelper.getAaiClient().update(serviceInstanceURI, AAIServiceInstance); + injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index 83fe31a116..514f48ffc8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -40,7 +40,6 @@ import org.springframework.stereotype.Component; @Component public class AAIVfModuleResources { - private static final Logger logger = LoggerFactory.getLogger(AAIVfModuleResources.class); @Autowired private InjectionHelper injectionHelper; @@ -97,8 +96,8 @@ public class AAIVfModuleResources { public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); - org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); - injectionHelper.getAaiClient().update(vfModuleURI, AAIVfModule); + org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule); + injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); } public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index fc61d862aa..eb66f6bef5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -43,7 +43,6 @@ import org.springframework.stereotype.Component; @Component public class AAIVnfResources { - private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index c24d1483e2..f4c285fdb3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -38,7 +38,6 @@ import org.springframework.stereotype.Component; @Component public class AAIVolumeGroupResources { - private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java index 3ac61dff60..168d370521 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java @@ -21,7 +21,6 @@ package org.onap.so.client.orchestration; import java.util.Optional; -import javax.ws.rs.NotFoundException; import org.onap.aai.domain.yang.VpnBindings; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java index ca32130c23..4aa6a1026a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java @@ -28,9 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; -import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java index 54a9cabb57..d4a4cfbd8a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java @@ -39,7 +39,6 @@ import org.springframework.stereotype.Component; @Component public class SDNCNetworkResources { - private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class); @Autowired private NetworkTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index 954cbc1b1d..0e32955eed 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -42,7 +42,6 @@ import org.springframework.stereotype.Component; @Component public class SDNCVnfResources { - private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class); @Autowired private VnfTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java index 939f53727d..efe5f34824 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java @@ -40,7 +40,6 @@ import org.springframework.stereotype.Component; @Component public class VnfAdapterVfModuleResources { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class); @Autowired private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java index c97ca8e0ea..2ec63182a0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java @@ -39,7 +39,6 @@ import org.springframework.stereotype.Component; @Component public class VnfAdapterVolumeGroupResources { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVolumeGroupResources.class); @Autowired private VnfAdapterObjectMapper vnfAdapterObjectMapper; 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 732bba8489..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; @@ -39,8 +39,6 @@ import org.springframework.stereotype.Component; @Component public class SDNCClient { - private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class); - @Autowired private SDNCProperties properties; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index e21f64accd..fe1f3f4308 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -52,6 +52,7 @@ public class SdnCommonTasks { private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s"; private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON = "ERROR: Could not convert SDNC pojo to json string."; + private static final String BRACKETS = "{} {} {} {} {}"; /*** * @@ -66,8 +67,8 @@ public class SdnCommonTasks { try { jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request); } catch (JsonProcessingException e) { - logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, - "BPMN", ErrorCode.DataError.getValue(), e.getMessage()); + logger.error(BRACKETS, MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN", + ErrorCode.DataError.getValue(), e.getMessage()); throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON); } jsonRequest = "{\"input\":" + jsonRequest + "}"; @@ -84,7 +85,7 @@ public class SdnCommonTasks { HttpHeaders httpHeader = new HttpHeaders(); httpHeader.set("Authorization", auth); httpHeader.setContentType(MediaType.APPLICATION_JSON); - List<MediaType> acceptMediaTypes = new ArrayList<MediaType>(); + List<MediaType> acceptMediaTypes = new ArrayList<>(); acceptMediaTypes.add(MediaType.APPLICATION_JSON); httpHeader.setAccept(acceptMediaTypes); return httpHeader; @@ -98,7 +99,7 @@ public class SdnCommonTasks { */ public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } @@ -125,7 +126,7 @@ public class SdnCommonTasks { return jsonResponse; } else { String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } @@ -139,7 +140,7 @@ public class SdnCommonTasks { */ public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } @@ -149,7 +150,7 @@ public class SdnCommonTasks { try { stringOutput = objMapper.writeValueAsString(output); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN", + logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN", ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC); throw new BadResponseException(BAD_RESPONSE_FROM_SDNC); } 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/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java index a448082cfe..eb73001f42 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java @@ -49,7 +49,7 @@ public class SniroValidator { JSONObject jsonResponse = new JSONObject(response); if (jsonResponse.has("requestStatus")) { String status = jsonResponse.getString("requestStatus"); - if (status.equals("accepted")) { + if ("accepted".equals(status)) { logger.debug("Sniro Managers synchronous response indicates accepted"); } else { String message = jsonResponse.getString("statusMessage"); @@ -111,7 +111,7 @@ public class SniroValidator { if (!response.isEmpty()) { String status = (String) response.get("status"); if (isNotBlank(status)) { - if (status.equals("success")) { + if ("success".equals(status)) { logger.debug("Sniro Conductors synchronous response indicates success"); } else { String message = (String) response.get("message"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java index d71b4ec5fc..9ab3ae673a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java @@ -30,7 +30,7 @@ public class LicenseInfo implements Serializable { private static final long serialVersionUID = 6878164369491185856L; @JsonProperty("licenseDemands") - private List<Demand> demands = new ArrayList<Demand>(); + private List<Demand> demands = new ArrayList<>(); public List<Demand> getDemands() { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java index ae13903a22..bbbbf9cfd6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java @@ -37,7 +37,7 @@ public class PlacementInfo implements Serializable { @JsonProperty("subscriberInfo") private SubscriberInfo subscriberInfo; @JsonProperty("placementDemands") - private List<Demand> demands = new ArrayList<Demand>(); + private List<Demand> demands = new ArrayList<>(); @JsonRawValue @JsonProperty("requestParameters") private String requestParameters; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java index f632424c26..b8896a2bab 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java @@ -40,7 +40,7 @@ public class SniroConductorRequest implements Serializable { private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class); @JsonProperty("release-locks") - private List<Resource> resources = new ArrayList<Resource>(); + private List<Resource> resources = new ArrayList<>(); public List<Resource> getResources() { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java index eaf8b6e379..35a4cac459 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java @@ -22,7 +22,6 @@ package org.onap.so.client.sniro.beans; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("subscriberInfo") diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 7109ac8826..905f244278 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -666,6 +666,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test + public void updateOrchestrationStatusAssignedFabricConfigurationTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, + OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignFabricConfiguration(execution); + + verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, + OrchestrationStatus.ASSIGNED); + } + + @Test public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception { execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn"); doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); 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 029562a6e9..a60927d694 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 @@ -40,10 +40,13 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; +import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; import org.springframework.core.env.Environment; @@ -90,7 +93,30 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { execution.setVariable("calledHoming", false); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + + String vnfCustomizationUUID = "1234567"; + String serviceInstanceId = "1234567"; + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName("ConfigAssignVnfBB"); + buildingBlock.setKey(vnfCustomizationUUID); + ebb.setBuildingBlock(buildingBlock); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstanceId); + ebb.setWorkflowResourceIds(workflowResourceIds); flowsToExecute.add(ebb); + + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + VnfResourceCustomization vrc = new VnfResourceCustomization(); + vrc.setSkipPostInstConf(false); + vrc.setModelCustomizationUUID(vnfCustomizationUUID); + vnfResourceCustomizations.add(vrc); + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setModelCustomizationId(vnfCustomizationUUID); + doReturn(vnfResourceCustomizations).when(catalogDbClient) + .getVnfResourceCustomizationByModelUuid(serviceInstanceId); + doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID, + vnfResourceCustomizations); + execution.setVariable("flowsToExecute", flowsToExecute); workflowActionBBTasks.selectBB(execution); boolean success = (boolean) execution.getVariable("completed"); @@ -110,7 +136,30 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + + String vnfCustomizationUUID = "1234567"; + String serviceInstanceId = "1234567"; + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName("ConfigDeployVnfBB"); + buildingBlock.setKey(vnfCustomizationUUID); + ebb.setBuildingBlock(buildingBlock); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstanceId); + ebb.setWorkflowResourceIds(workflowResourceIds); flowsToExecute.add(ebb); + + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + VnfResourceCustomization vrc = new VnfResourceCustomization(); + vrc.setSkipPostInstConf(false); + vrc.setModelCustomizationUUID(vnfCustomizationUUID); + vnfResourceCustomizations.add(vrc); + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setModelCustomizationId(vnfCustomizationUUID); + doReturn(vnfResourceCustomizations).when(catalogDbClient) + .getVnfResourceCustomizationByModelUuid(serviceInstanceId); + doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID, + vnfResourceCustomizations); + flowsToExecute.add(ebb2); execution.setVariable("flowsToExecute", flowsToExecute); workflowActionBBTasks.selectBB(execution); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 2e1a40dd22..be58ccb046 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -98,7 +98,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup { aaiConfigurationResources.createConfiguration(configuration); - assertEquals(OrchestrationStatus.ASSIGNED, configuration.getOrchestrationStatus()); + assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus()); verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java index 0f9ad2da39..df63bd18d3 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.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. @@ -31,20 +31,6 @@ public class CloudifyRequest<R> { private CloudifyClient client; - public CloudifyRequest() { - - } - - public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity, - Class<R> returnType) { - this.client = client; - this.method = method; - this.path = new StringBuilder(path); - this.entity = entity; - this.returnType = returnType; - header("Accept", "application/json"); - } - private String endpoint; private HttpMethod method; @@ -61,6 +47,20 @@ public class CloudifyRequest<R> { private String user = null; private String password = null; + public CloudifyRequest() { + + } + + public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity, + Class<R> returnType) { + this.client = client; + this.method = method; + this.path = new StringBuilder(path); + this.entity = entity; + this.returnType = returnType; + header("Accept", "application/json"); + } + public CloudifyRequest<R> endpoint(String endpoint) { this.endpoint = endpoint; return this; @@ -151,7 +151,7 @@ public class CloudifyRequest<R> { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java index 3eae02bcee..9877eb9f43 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java @@ -31,6 +31,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest; public class BlueprintsResource { private final CloudifyClient client; + private static final String BLUEPRINTS_PATH = "/api/v3/blueprints/"; public BlueprintsResource(CloudifyClient client) { this.client = client; @@ -72,7 +73,7 @@ public class BlueprintsResource { // If a URL is provided, add it to the query string // If a Stream is provided, set it as the Entity body super(client, HttpMethod.PUT, - "/api/v3/blueprints/" + blueprintId + "?application_file_name=" + mainFileName + BLUEPRINTS_PATH + blueprintId + "?application_file_name=" + mainFileName + ((blueprintUrl != null) ? "&blueprint_archive=" + blueprintUrl : ""), ((blueprint != null) ? Entity.stream(blueprint) : null), Blueprint.class); } @@ -80,13 +81,13 @@ public class BlueprintsResource { public class DeleteBlueprint extends CloudifyRequest<Blueprint> { public DeleteBlueprint(String blueprintId) { - super(client, HttpMethod.DELETE, "/api/v3/blueprints/" + blueprintId, null, Blueprint.class); + super(client, HttpMethod.DELETE, BLUEPRINTS_PATH + blueprintId, null, Blueprint.class); } } public class GetBlueprint extends CloudifyRequest<Blueprint> { public GetBlueprint(String id, String queryArgs) { - super(client, HttpMethod.GET, "/api/v3/blueprints/" + id + queryArgs, null, Blueprint.class); + super(client, HttpMethod.GET, BLUEPRINTS_PATH + id + queryArgs, null, Blueprint.class); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java index 262045a367..335f6b1697 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java @@ -32,6 +32,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest; public class DeploymentsResource { private final CloudifyClient client; + private static final String DEPLOYMENT_PATH = "/api/v3/deployments/"; public DeploymentsResource(CloudifyClient client) { this.client = client; @@ -59,25 +60,25 @@ public class DeploymentsResource { public class CreateDeployment extends CloudifyRequest<Deployment> { public CreateDeployment(String deploymentId, CreateDeploymentParams body) { - super(client, HttpMethod.PUT, "/api/v3/deployments/" + deploymentId, Entity.json(body), Deployment.class); + super(client, HttpMethod.PUT, DEPLOYMENT_PATH + deploymentId, Entity.json(body), Deployment.class); } } public class DeleteDeployment extends CloudifyRequest<Deployment> { public DeleteDeployment(String deploymentId) { - super(client, HttpMethod.DELETE, "/api/v3/deployments/" + deploymentId, null, Deployment.class); + super(client, HttpMethod.DELETE, DEPLOYMENT_PATH + deploymentId, null, Deployment.class); } } public class GetDeployment extends CloudifyRequest<Deployment> { public GetDeployment(String id) { - super(client, HttpMethod.GET, "/api/v3/deployments/" + id, null, Deployment.class); + super(client, HttpMethod.GET, DEPLOYMENT_PATH + id, null, Deployment.class); } } public class GetDeploymentOutputs extends CloudifyRequest<DeploymentOutputs> { public GetDeploymentOutputs(String id) { - super(client, HttpMethod.GET, "/api/v3/deployments/" + id + "/outputs", null, DeploymentOutputs.class); + super(client, HttpMethod.GET, DEPLOYMENT_PATH + id + "/outputs", null, DeploymentOutputs.class); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java index 51aaea94bb..34251bfe52 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java @@ -33,6 +33,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest; public class ExecutionsResource { private final CloudifyClient client; + private static final String EXECUTIONS_PATH = "/api/v3/executions/"; public ExecutionsResource(CloudifyClient client) { this.client = client; @@ -76,7 +77,7 @@ public class ExecutionsResource { public class GetExecution extends CloudifyRequest<Execution> { public GetExecution(String id) { - super(client, HttpMethod.GET, "/api/v3/executions/" + id, null, Execution.class); + super(client, HttpMethod.GET, EXECUTIONS_PATH + id, null, Execution.class); } } @@ -95,13 +96,13 @@ public class ExecutionsResource { public class UpdateExecution extends CloudifyRequest<Execution> { public UpdateExecution(String executionId, UpdateExecutionParams body) { - super(client, HttpMethod.PATCH, "/api/v3/executions/" + executionId, Entity.json(body), Execution.class); + super(client, HttpMethod.PATCH, EXECUTIONS_PATH + executionId, Entity.json(body), Execution.class); } } public class CancelExecution extends CloudifyRequest<Execution> { public CancelExecution(String executionId, CancelExecutionParams body) { - super(client, HttpMethod.POST, "/api/v3/executions/" + executionId, Entity.json(body), Execution.class); + super(client, HttpMethod.POST, EXECUTIONS_PATH + executionId, Entity.json(body), Execution.class); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java index 0fbe1fc33d..7f96b8f7c6 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java @@ -30,8 +30,8 @@ public class CancelExecutionParams implements Serializable { @JsonProperty("action") private String action; - public final static String CANCEL_ACTION = "cancel"; - public final static String FORCE_CANCEL_ACTION = "force-cancel"; + public static final String CANCEL_ACTION = "cancel"; + public static final String FORCE_CANCEL_ACTION = "force-cancel"; public String getAction() { return action; 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/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java index 0b10d85bbf..0b3aa651a0 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -28,7 +28,6 @@ import java.net.URL; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Base64; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java index abef417325..f5737b862c 100644 --- a/common/src/main/java/org/onap/so/client/RestClientSSL.java +++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java @@ -33,9 +33,8 @@ import javax.ws.rs.client.ClientBuilder; public abstract class RestClientSSL extends RestClient { private static final String TRUE = "true"; - public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore"; - public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword"; - public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore"; + private static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore"; + private static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore"; protected RestClientSSL(RestProperties props, Optional<URI> path) { @@ -55,8 +54,7 @@ public abstract class RestClientSSL extends RestClient { if (loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase(TRUE)) { KeyStore ks = getKeyStore(); if (ks != null) { - client = ClientBuilder.newBuilder() - .keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build(); + client = ClientBuilder.newBuilder().keyStore(ks, getSSlKeyStorePassword()).build(); logger.info("RestClientSSL not using default SSL context - setting keystore here."); return client; } @@ -72,7 +70,7 @@ public abstract class RestClientSSL extends RestClient { private KeyStore getKeyStore() { KeyStore ks = null; - char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray(); + char[] password = getSSlKeyStorePassword().toCharArray(); try (FileInputStream fis = new FileInputStream( Paths.get(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY)).normalize().toString())) { ks = KeyStore.getInstance(KeyStore.getDefaultType()); @@ -84,4 +82,8 @@ public abstract class RestClientSSL extends RestClient { return ks; } + + private String getSSlKeyStorePassword() { + return System.getProperty("javax.net.ssl.keyStorePassword"); + } } diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java index 131bc27783..a1e0d7c102 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java @@ -25,7 +25,6 @@ import javax.ws.rs.NotFoundException; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.RestClient; import org.onap.so.client.graphinventory.GraphInventoryClient; -import org.onap.so.client.graphinventory.GraphInventoryVersion; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; import org.slf4j.Logger; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java index 7029ffe5e4..66ea8f950e 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java @@ -24,8 +24,6 @@ import java.io.IOException; import java.util.Optional; import javax.annotation.Priority; import javax.ws.rs.ext.Provider; -import javax.annotation.Priority; -import javax.ws.rs.ext.Provider; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.aai.entities.AAIError; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index cd4e1125ce..6b2b6f2b3e 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -36,9 +36,7 @@ import org.onap.aai.domain.yang.Configuration; import org.onap.aai.domain.yang.Connector; import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.Device; -import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.aai.domain.yang.EsrVnfm; -import org.onap.aai.domain.yang.EsrVnfmList; import org.onap.aai.domain.yang.ExtAaiNetwork; import org.onap.aai.domain.yang.Flavor; import org.onap.aai.domain.yang.GenericVnf; 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 6eafb965a2..b546aaa23e 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 @@ -23,11 +23,9 @@ package org.onap.so.client.aai; import java.net.URI; import java.util.Map; import java.util.Optional; -import javax.ws.rs.core.Response; import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; import org.onap.so.client.graphinventory.GraphInventoryRestClient; -import org.onap.so.client.policy.CommonObjectMapperProvider; import org.onap.so.utils.TargetEntity; public class AAIRestClient extends GraphInventoryRestClient { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java index 0d400339f9..b2223be688 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java @@ -21,7 +21,6 @@ package org.onap.so.client.aai; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; public class AAIUpdatorImpl implements AAIUpdator { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java index 3987d7375a..95ed01ee94 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java @@ -25,7 +25,6 @@ import java.util.List; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.Pserver; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; public class AAIValidatorImpl implements AAIValidator { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java index 499246d7d1..91030d831a 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java @@ -25,7 +25,7 @@ import org.onap.so.client.graphinventory.GraphInventoryVersion; public enum AAIVersion implements GraphInventoryVersion { V13("v13"), V14("v14"), V15("v15"); - public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; + public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; private final String value; private AAIVersion(String value) { diff --git a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java index af7ccf661e..3433e36151 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java @@ -34,15 +34,6 @@ public class CustomQuery { private String query; private String gremlin; - public String getGremlin() { - return gremlin; - } - - public void setGremlin(String gremlin) { - this.gremlin = gremlin; - } - - public CustomQuery(List<AAIResourceUri> start) { this.setStart(start); } @@ -56,6 +47,14 @@ public class CustomQuery { this.gremlin = gremlin; } + public String getGremlin() { + return gremlin; + } + + public void setGremlin(String gremlin) { + this.gremlin = gremlin; + } + public List<String> getStart() { return start; } diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java index 16a4c178e5..45f2c965f9 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java @@ -23,7 +23,6 @@ package org.onap.so.client.aai.entities.bulkprocess; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java index 5d28013c85..b2d67af156 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java @@ -23,7 +23,6 @@ package org.onap.so.client.aai.entities.singletransaction; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java index 7572541206..f2f99050db 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java @@ -25,9 +25,7 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; import org.onap.so.client.graphinventory.entities.uri.SimpleUri; public class AAISimpleUri extends SimpleUri implements AAIResourceUri { diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java index a1e58c6a08..37a5c0bc18 100644 --- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java +++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java @@ -1,15 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * 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_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ + * 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.cds; import org.onap.so.client.RestProperties; diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java index 3dd0c751e3..4de546e9da 100644 --- a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java +++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java @@ -28,6 +28,7 @@ import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime; import org.onap.so.client.dmaap.rest.RestConsumer; public abstract class DmaapConsumer extends DmaapClient { + static final int MAX_ELAPSED_TIME = 180000; public DmaapConsumer() throws IOException { super("dmaap/default-consumer.properties"); @@ -125,7 +126,7 @@ public abstract class DmaapConsumer extends DmaapClient { * time in milliseconds */ public int getMaximumElapsedTime() { - return 180000; + return MAX_ELAPSED_TIME; } diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java index 1d85dac7dc..68b4e84448 100644 --- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java +++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java @@ -23,7 +23,6 @@ package org.onap.so.client.dmaap.rest; import java.net.URL; import java.util.Map; import org.onap.so.client.RestClient; -import org.onap.so.utils.CryptoUtils; import org.onap.so.utils.TargetEntity; public class DMaaPRestClient extends RestClient { diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java index 992d1f017b..5fc8726427 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java @@ -27,8 +27,6 @@ import java.util.Optional; import javax.ws.rs.NotFoundException; import javax.ws.rs.core.GenericType; import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.aai.AAIVersion; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest; import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java index bf33e8f8d3..f7f5d78604 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java @@ -56,9 +56,9 @@ public class DSLNodeKey implements QueryStep { result.append("('").append(keyName).append("', "); List<String> temp = new ArrayList<>(); for (String item : values) { - if (item.equals("null")) { + if ("null".equals(item)) { temp.add(String.format("' %s '", item)); - } else if (item.equals("")) { + } else if ("".equals(item)) { temp.add("' '"); } else { temp.add(String.format("'%s'", item)); diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java index 892951f950..6703416832 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java @@ -27,10 +27,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Predicate; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.client.graphinventory.GraphInventoryObjectName; import org.onap.so.client.graphinventory.GraphInventoryObjectType; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java index 5d0a33909a..41ba07ad6c 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java @@ -44,8 +44,8 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable { private static final long serialVersionUID = -337701171277616439L; protected transient UriBuilder internalURI; - protected final static String relationshipAPI = "/relationship-list/relationship"; - protected final static String relatedTo = "/related-to"; + protected static final String relationshipAPI = "/relationship-list/relationship"; + protected static final String relatedTo = "/related-to"; protected final Object[] values; protected final GraphInventoryObjectType type; protected final GraphInventoryObjectPlurals pluralType; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java index 14a46c243b..71afdb83d9 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java @@ -20,7 +20,6 @@ package org.onap.so.client.graphinventory.entities.uri.parsers; -import java.io.UnsupportedEncodingException; import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java index fa155de6a2..507f1130b5 100644 --- a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java +++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java @@ -22,11 +22,9 @@ package org.onap.so.client.grm; import java.net.URI; -import java.util.Base64; import java.util.Map; import java.util.Optional; import org.onap.so.client.RestClient; -import org.onap.so.client.RestProperties; import org.onap.so.utils.TargetEntity; public class GRMRestClient extends RestClient { 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 4aafd145b7..8e674fb77b 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 @@ -28,7 +28,6 @@ import javax.ws.rs.NotFoundException; import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAIVersion; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.dmaap.DmaapConsumer; diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java index 84dd83ea6f..8c40b749a6 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java @@ -37,8 +37,8 @@ public class Body implements Serializable { @JsonProperty("input") private Input input; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - private final static long serialVersionUID = 9101706044452851559L; + private Map<String, Object> additionalProperties = new HashMap<>(); + private static final long serialVersionUID = 9101706044452851559L; @JsonProperty("input") public Input getInput() { diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java index ea537bba09..c8122c06f6 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java @@ -40,7 +40,7 @@ public class Input implements Serializable { private RequestHdCustom requestHdCustom; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + private Map<String, Object> additionalProperties = new HashMap<>(); private final static long serialVersionUID = 7155546785389227528L; @JsonProperty("request-healthdiagnostic") diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java index c08d1ef386..485f64673f 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java @@ -49,7 +49,7 @@ public class RequestHdCustom implements Serializable { @JsonProperty("send-detailed-cmd-response") private String sendDetailedCmdResponse = "false"; @JsonProperty("aai-param-list") - private List<AAIParamList> aaiParamList = new ArrayList<AAIParamList>(); + private List<AAIParamList> aaiParamList = new ArrayList<>(); /** * No args constructor for use in serialization diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java index c05b470b0e..b1b75ab412 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java @@ -52,8 +52,8 @@ public class RequestHealthDiagnostic implements Serializable { @JsonProperty("health-diagnostic-code") private String healthDiagnosticCode; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - private final static long serialVersionUID = 1166788526178388021L; + private Map<String, Object> additionalProperties = new HashMap<>(); + private static final long serialVersionUID = 1166788526178388021L; @JsonProperty("request-client-name") public String getRequestClientName() { diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java index 93826c752f..8b84cf6659 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java @@ -44,7 +44,7 @@ public class ResultInfo { @JsonProperty("status") private String status; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + private Map<String, Object> additionalProperties = new HashMap<>(); @JsonProperty("client-name") public String getClientName() { diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java index 09f408c967..46e2c1d1fc 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java @@ -43,8 +43,8 @@ public class SDNO implements Serializable { @JsonProperty("body") private Body body; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - private final static long serialVersionUID = -5303297382564282650L; + private Map<String, Object> additionalProperties = new HashMap<>(); + private static final long serialVersionUID = -5303297382564282650L; @JsonProperty("operation") public String getOperation() { diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java index 975f6bb9d8..5dbf88d346 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java @@ -21,34 +21,24 @@ package org.onap.so.logging.jaxrs.filter; -import org.apache.commons.io.IOUtils; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.utils.TargetEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; -import org.slf4j.MarkerFactory; import org.springframework.stereotype.Component; import javax.annotation.Priority; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.client.ClientResponseContext; import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Providers; -import java.io.*; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; -import java.util.Map; import java.util.UUID; @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java index 635d95be2e..4741f7f099 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java @@ -46,7 +46,6 @@ import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.databind.ObjectMapper; @Priority(1) @Provider diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java index 8e7a95b581..fa5a5d5da4 100644 --- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java +++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java @@ -30,7 +30,6 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.ext.Providers; import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.logger.LogConstants; import org.onap.so.logging.jaxrs.filter.MDCSetup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java index 149de0b698..a27e8fbbd1 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java +++ b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java @@ -1,14 +1,13 @@ -package org.onap.so.adapters.audit; +package org.onap.so.objects.audit; import java.io.Serializable; import java.net.URI; -import org.onap.so.client.aai.AAIObjectType; import org.apache.commons.lang3.builder.ToStringBuilder; public class AAIObjectAudit implements Serializable { /** - * + * */ private static final long serialVersionUID = -4560928512855386021L; private boolean doesObjectExist = false; @@ -53,4 +52,5 @@ public class AAIObjectAudit implements Serializable { public void setResourceURI(URI resourceURI) { this.resourceURI = resourceURI; } + } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java index f3a2cfea9b..675701d598 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java +++ b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java @@ -1,17 +1,20 @@ -package org.onap.so.adapters.audit; +package org.onap.so.objects.audit; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder; + public class AAIObjectAuditList implements Serializable { /** - * + * */ private static final long serialVersionUID = 6712662349909726930L; private List<AAIObjectAudit> auditList = new ArrayList<>(); + private String auditType; + private String heatStackName; @Override public String toString() { @@ -22,4 +25,22 @@ public class AAIObjectAuditList implements Serializable { return auditList; } + + public String getAuditType() { + return auditType; + } + + + public void setAuditType(String auditType) { + this.auditType = auditType; + } + + public String getHeatStackName() { + return heatStackName; + } + + public void setHeatStackName(String heatStackName) { + this.heatStackName = heatStackName; + } + } diff --git a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java index e63e226457..6e2bc97ee9 100644 --- a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java +++ b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java @@ -73,9 +73,9 @@ public class EqualsAndHashCodeTester implements Tester { boolean hasEquals = false; boolean hasHashcode = false; for (Method method : methods) { - if (method.getName().equals("equals")) { + if ("equals".equals(method.getName())) { hasEquals = true; - } else if (method.getName().equals("hashCode")) { + } else if ("hashCode".equals(method.getName())) { hasHashcode = true; } } @@ -114,7 +114,7 @@ public class EqualsAndHashCodeTester implements Tester { Affirm.affirmTrue("HashCode test failed for [" + classInstanceOne.getClass().getName() + "]", classInstanceOne.hashCode() == classInstanceTwo.hashCode()); - Affirm.affirmFalse("Expected false for comparison of two unlike objects", classInstanceOne.equals("test")); + Affirm.affirmFalse("Expected false for comparison of two unlike objects", "test".equals(classInstanceOne)); } } diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java index fc9bb388f4..42dda850f5 100644 --- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java +++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java @@ -22,7 +22,6 @@ package org.onap.so.openpojo.rules; import static org.hamcrest.CoreMatchers.anything; import java.lang.annotation.Annotation; -import java.lang.reflect.AnnotatedElement; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; @@ -65,6 +64,6 @@ public class HasAnnotationMatcher<T extends PojoField> extends TypeSafeDiagnosin public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) { - return new HasAnnotationMatcher<T>(annotationType, annotationMatcher); + return new HasAnnotationMatcher<>(annotationType, annotationMatcher); } } diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java index 8a47299c73..a55113b0d0 100644 --- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java +++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java @@ -78,6 +78,6 @@ public class HasAnnotationPropertyWithValueMatcher<T extends PojoField> extends public static <T extends PojoField> Matcher<T> hasAnnotationPropertyWithValue(Class<? extends Annotation> clazz, String attribute, final Matcher<?> annotationMatcher) { - return new HasAnnotationPropertyWithValueMatcher<T>(clazz, attribute, annotationMatcher); + return new HasAnnotationPropertyWithValueMatcher<>(clazz, attribute, annotationMatcher); } } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java index 53ce3884e9..7c1df67903 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java @@ -23,7 +23,6 @@ package org.onap.so.serviceinstancebeans; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; @JsonInclude(Include.NON_DEFAULT) public class GetOrchestrationResponse { diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java index f239774d57..2123b2f6fc 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java @@ -24,7 +24,6 @@ package org.onap.so.serviceinstancebeans; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java index e233db48b0..2834d37f1f 100644 --- a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java +++ b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java @@ -1,15 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * 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_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ + * 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.cds; import java.net.URL; diff --git a/docs/Developer_Info.rst b/docs/Developer_Info.rst index 579a12d77f..59dc9d6f1c 100644 --- a/docs/Developer_Info.rst +++ b/docs/Developer_Info.rst @@ -10,4 +10,5 @@ Developer Information Install_Configure_SO.rst
architecture.rst
+ FAQs.rst
\ No newline at end of file diff --git a/docs/architecture/SO Internal Arc.pptx b/docs/architecture/SO Internal Arc.pptx Binary files differnew file mode 100644 index 0000000000..bff3e352e0 --- /dev/null +++ b/docs/architecture/SO Internal Arc.pptx diff --git a/docs/architecture/architecture.rst b/docs/architecture/architecture.rst index 681e9dbfe5..52eb38cfe4 100644 --- a/docs/architecture/architecture.rst +++ b/docs/architecture/architecture.rst @@ -101,6 +101,14 @@ SO Sub-Components * Service statistic * Service Process Instance Rendering and Detail +**SO VNFM Adapter** + + Support external SVNFMs through SOL003 APIs + * Create, Instantiate, Terminate and Delete VNF, including Granting, Subscription and Lifecycle Notifications + * Tracking capability which VNFM instance has handled with which VNF instance + * BPMN Building Block workflows and Java-based recipes for VNF LCM + * VNFM Simulator for validating SO VNFM Adapter NBI and SBI for integration testing + Third Party and Open Source --------------------------- diff --git a/docs/developer_info/BBUnderstanding.rst b/docs/developer_info/BBUnderstanding.rst new file mode 100644 index 0000000000..2aa7097ad9 --- /dev/null +++ b/docs/developer_info/BBUnderstanding.rst @@ -0,0 +1,7 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+Building Block Understanding
+============================
+
diff --git a/docs/developer_info/FAQs.rst b/docs/developer_info/FAQs.rst new file mode 100644 index 0000000000..cd6784071c --- /dev/null +++ b/docs/developer_info/FAQs.rst @@ -0,0 +1,102 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright 2018 Huawei Technologies Co., Ltd. + +Frequently Asked Questions SO +============================= + +Casablanca Release throws java.sql.SQLDataException: (conn:85) Data too long for column 'RESOURCE_INPUT' at row 1 +----------------------------------------------------------------------------------------------------------------- + + This issue could be solved either using the SO-1.3.7 release or through a manual patch to update the lenght of the column 'RESOURCE_INPUT'. + + Following are the sql statements to update length of resource_input: + + use catalogdb; + + ALTER TABLE vnf_resource_customization + MODIFY IF EXISTS RESOURCE_INPUT varchar(20000); + + ALTER TABLE network_resource_customization + MODIFY IF EXISTS RESOURCE_INPUT varchar(20000); + + ALTER TABLE allotted_resource_customization + MODIFY IF EXISTS RESOURCE_INPUT varchar(20000); + + in so mariadb pod (username/password root/password) + +Integrate SO with MultiCloud +---------------------------- +.. toctree:: + :maxdepth: 1 + + SOMCIntegrate.rst + +Building Block Understanding +---------------------------- +.. toctree:: + :maxdepth: 1 + + BBUnderstanding.rst + +How to Build software without unit tests +---------------------------------------- + +.. code-block:: bash + + cd $HOME/onap/workspace/SO/libs + + $HOME/onap/apache-maven-3.3.9/bin/mvn -s $HOME/onap/.m2/settings.xml -DskipTests -Dmaven.test.skip=true clean install + + cd $HOME/onap/workspace/SO/so + + $HOME/onap/apache-maven-3.3.9/bin/mvn -s $HOME/onap/.m2/settings.xml -DskipTests -Dmaven.test.skip=true clean install + +How to Build docker images +-------------------------- + +SO docker images are built using the "docker" maven profile. + +During the build, the chef-repo and so-docker repositories are cloned from gerrit into the "so" directory structure. Extra definitions are required in the build environment to make this happen. You may need to adjust the definition of mso.chef.git.url.prefix to match the way you authenticate yourself when performing git clone. + +If you are behind a corporate firewall, you can specify proxy definitions for the constructed docker images. + +**Remove existing docker containers and images** + +.. code-block:: bash + + docker stop $(docker ps -qa) + + docker rm $(docker ps -aq) + + docker rmi -f $(docker images -q) + +**Build docker images (without proxy definition):** + +.. code-block:: bash + + cd $HOME/onap/workspace/SO/so/packages + + $HOME/onap/apache-maven-3.3.9/bin/mvn -s $HOME/onap/.m2/settings.xml clean install -P docker + -Dmso.chef.git.url.prefix=ssh://$USER@gerrit.onap.org:29418 -Dmso.chef.git.branchname=master + -Dmso.chef.git.url.suffix.chef.repo=so/chef-repo -Dmso.chef.git.url.suffix.chef.config=so/so-config + -Ddocker.buildArg.http_proxy=http://one.proxy.att.com:8080 + -Ddocker.buildArg.https_proxy=http://one.proxy.att.com:8080 + +**Build docker images (with proxy definition):** + +.. code-block:: bash + + cd $HOME/onap/workspace/SO/so/packages + + $HOME/onap/apache-maven-3.3.9/bin/mvn -s $HOME/onap/.m2/settings.xml clean install -P docker + -Dmso.chef.git.url.prefix=ssh://$USER@gerrit.onap.org:29418 -Dmso.chef.git.branchname=master + -Dmso.chef.git.url.suffix.chef.repo=so/chef-repo -Dmso.chef.git.url.suffix.chef.config=so/so-config + -Ddocker.buildArg.http_proxy=http://proxyhost:port -Ddocker.buildArg.https_proxy=http://proxyhost:port + +How to Build with Integration Tests +----------------------------------- + +This is done exactly as described for building docker images, except that the maven profile to use is "with-integration-tests" instead of "docker". Integration tests are executed inside docker containers constructed by the build. + + diff --git a/docs/developer_info/SOMCIntegrate.rst b/docs/developer_info/SOMCIntegrate.rst new file mode 100644 index 0000000000..cae2d54f41 --- /dev/null +++ b/docs/developer_info/SOMCIntegrate.rst @@ -0,0 +1,142 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+Integrate SO with MultiCloud
+=============================
+
+There are 2 SO tables that you need to modify if you want to use Multicloud. They are in the MariaDB container in the dev-so service. Here are the credentials to access the DB (through mysql command line): cataloguser/catalog123. The table you need to use is called catalogdb.
+
+
+
+The 2 tables are cloud_sites and identity_services. cloud_sites contains information about the cloud (region name and keystone for example). The keystone name (IDENTITY_SERVICE_ID) is the key of identity_services table, which contains specific information about cloud authentication. In the example below, you can see my configuration for a cloud region called RegionTwo, in which SO uses Multicoud for talking to the underlying cloud platfrorm. Note indeed that the IDENTITY_URL in identity_services redirects to Multicloud. In practice, SO reads cloud and authentication information from this two tables, and uses the provided keystone authentication given an identity URL.
+
+
+
+MariaDB [catalogdb]> select * from cloud_sites;
+
++-------------------+-----------+---------------------+---------------+-----------+-------------+----------+--------------+-----------------+---------------------+---------------------+
+
+| ID | REGION_ID | IDENTITY_SERVICE_ID | CLOUD_VERSION | CLLI | CLOUDIFY_ID | PLATFORM | ORCHESTRATOR | LAST_UPDATED_BY | CREATION_TIMESTAMP | UPDATE_TIMESTAMP |
+
++-------------------+-----------+---------------------+---------------+-----------+-------------+----------+--------------+-----------------+---------------------+---------------------+
+
+| Chicago | ORD | RAX_KEYSTONE | 2.5 | ORD | NULL | NULL | NULL | FLYWAY | 2018-12-28 22:58:34 | 2018-12-28 22:58:34 |
+
+| Dallas | DFW | RAX_KEYSTONE | 2.5 | DFW | NULL | NULL | NULL | FLYWAY | 2018-12-28 22:58:34 | 2018-12-28 22:58:34 |
+
+| DEFAULT | RegionOne | DEFAULT_KEYSTONE | 2.5 | RegionOne | NULL | NULL | NULL | FLYWAY | 2018-12-28 22:58:34 | 2018-12-28 22:58:34 |
+
+| Northern Virginia | IAD | RAX_KEYSTONE | 2.5 | IAD | NULL | NULL | NULL | FLYWAY | 2018-12-28 22:58:34 | 2018-12-28 22:58:34 |
+
+| RegionOne | RegionOne | DEFAULT_KEYSTONE | 2.5 | RegionOne | NULL | NULL | NULL | FLYWAY | 2018-12-28 22:58:34 | 2018-12-28 22:58:34 |
+
+| RegionTwo | RegionTwo | KEYSTONE_REGION_TWO | 2.5 | RegionTwo | NULL | NULL | NULL | FLYWAY | 2019-01-02 20:07:28 | 2019-01-02 20:07:28 |
+
++-------------------+-----------+---------------------+---------------+-----------+-------------+----------+--------------+-----------------+---------------------+---------------------+
+
+
+
+
+
+MariaDB [catalogdb]> select * from identity_services;
+
++---------------------+--------------------------------------------------------------------------------+----------------------+----------------------------------+--------------+-------------+-----------------+----------------------+------------------------------+-----------------+---------------------+---------------------+
+
+| ID | IDENTITY_URL | MSO_ID | MSO_PASS | ADMIN_TENANT | MEMBER_ROLE | TENANT_METADATA | IDENTITY_SERVER_TYPE | IDENTITY_AUTHENTICATION_TYPE | LAST_UPDATED_BY | CREATION_TIMESTAMP | UPDATE_TIMESTAMP |
+
++---------------------+--------------------------------------------------------------------------------+----------------------+----------------------------------+--------------+-------------+-----------------+----------------------+------------------------------+-----------------+---------------------+---------------------+
+
+| DEFAULT_KEYSTONE | http://135.197.225.10:5000/v2.0 | admin | a83e2b8446193c5ac450d84f0f1dc711 | service | admin | 1 | KEYSTONE | USERNAME_PASSWORD | FLYWAY | 2018-12-28 22:58:34 | 2018-12-28 22:58:34 |
+
+| KEYSTONE_REGION_TWO | http://10.43.117.142:9001/api/multicloud/v0/CloudOwner_RegionTwo/identity/v2.0 | username | <encrypted pwd> | service | admin | 1 | KEYSTONE | USERNAME_PASSWORD | FLYWAY | 2019-01-02 20:03:26 | 2019-01-02 20:03:26 |
+
+| RAX_KEYSTONE | https://identity.api.rackspacecloud.com/v2.0 | RACKSPACE_ACCOUNT_ID | RACKSPACE_ACCOUNT_APIKEY | service | admin | 1 | KEYSTONE | RACKSPACE_APIKEY | FLYWAY | 2018-12-28 22:58:34 | 2018-12-28 22:58:34 |
+
++---------------------+--------------------------------------------------------------------------------+----------------------+----------------------------------+--------------+-------------+-----------------+----------------------+------------------------------+-----------------+---------------------+---------------------+
+
+
+
+One thing to know is that the actual IP 10.43.117.142:9001 is the MSB (iag) container. Multicloud registers with MSB, so you can use MSB to fetch the Multicloud endpoint (I think you can use the K8S cluster IP and MSB node port for that instead of the actual MSB container IP and port).
+
+
+
+One final thing: you may need to add identity URL to the AAI cloud region as well, like this:
+
+
+
+curl -X PUT \
+
+ https://135.197.220.117:30233/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionTwo \
+
+ -H 'Accept: application/json' \
+
+ -H 'Content-Type: application/json' \
+
+ -H 'Postman-Token: b05ff02d-78c7-4e1e-9457-d9fa9cc5da65' \
+
+ -H 'X-FromAppId: AAI' \
+
+ -H 'X-TransactionId: get_aai_subscr' \
+
+ -H 'cache-control: no-cache' \
+
+ -d '{
+
+ "cloud-owner": "CloudOwner",
+
+ "cloud-region-id": "RegionTwo",
+
+ "cloud-type": "openstack",
+
+ "cloud-region-version": "v2.5",
+
+ "identity-url": "http://10.43.111.6/api/multicloud/v0/CloudOwner_RegionTwo/identity/v2.0/tokens",
+
+ "cloud-zone": "bm-2",
+
+ "complex-name": "complex-2",
+
+ "tenants": {
+
+ "tenant": [{
+
+ "tenant-id": "c236140a3dff4911bb4c7c86940616cc",
+
+ "tenant-name": "ONAP_Casablanca"
+
+ }]
+
+ },
+
+ "esr-system-info-list": {
+
+ "esr-system-info": [{
+
+ "esr-system-info-id": "1",
+
+ "system-name": "OpenStack-2",
+
+ "type": "vim",
+
+ "service-url": "http://XXX:5000/v3",
+
+ "user-name": "username",
+
+ "password": "password",
+
+ "system-type": "VIM",
+
+ "ssl-insecure": true,
+
+ "cloud-domain": "default",
+
+ "default-tenant": "ONAP_Casablanca"
+
+ }]
+
+ }
+
+}'
+
+
\ No newline at end of file diff --git a/docs/images/SO_Architecture_1.png b/docs/images/SO_Architecture_1.png Binary files differindex 0d84829c61..a973bb1cfe 100644 --- a/docs/images/SO_Architecture_1.png +++ b/docs/images/SO_Architecture_1.png diff --git a/docs/images/SO_Architecture_Internal.png b/docs/images/SO_Architecture_Internal.png Binary files differindex 9c30c4d7b5..1c1f76e568 100644 --- a/docs/images/SO_Architecture_Internal.png +++ b/docs/images/SO_Architecture_Internal.png diff --git a/docs/images/SO_VNFM_Adapter_Architecture_Dublin.png b/docs/images/SO_VNFM_Adapter_Architecture_Dublin.png Binary files differnew file mode 100644 index 0000000000..cb1a812678 --- /dev/null +++ b/docs/images/SO_VNFM_Adapter_Architecture_Dublin.png diff --git a/docs/images/SO_VNFM_Adapter_Runtime_Components.png b/docs/images/SO_VNFM_Adapter_Runtime_Components.png Binary files differnew file mode 100644 index 0000000000..0878f70761 --- /dev/null +++ b/docs/images/SO_VNFM_Adapter_Runtime_Components.png diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java index 8977f11e36..7fb5df7af6 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java @@ -40,6 +40,8 @@ public class CamundaResponse { @JsonProperty("variables") private String variables; + public CamundaResponse() {} + public String getProcessInstanceID() { return processInstanceID; } @@ -56,8 +58,6 @@ public class CamundaResponse { this.variables = variables; } - public CamundaResponse() {} - public String getResponse() { return response; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index d11f1706e9..e6e81671cf 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -49,6 +49,9 @@ import com.fasterxml.jackson.databind.SerializationFeature; public class CamundaClient extends RequestClient { private static Logger logger = LoggerFactory.getLogger(CamundaClient.class); private static final String CAMUNDA_URL_MESAGE = "Camunda url is: "; + private static final String CAMUNDA_RESPONSE = "Response is: {}"; + private static final String AUTHORIZATION = "Authorization"; + private static final String BASIC = "Basic "; public CamundaClient() { super(CommonConstants.CAMUNDA); @@ -71,7 +74,7 @@ public class CamundaClient extends RequestClient { setupHeaders(post); HttpResponse response = client.execute(post); - logger.debug("Response is: {}", response); + logger.debug(CAMUNDA_RESPONSE, response); return response; } @@ -88,8 +91,8 @@ public class CamundaClient extends RequestClient { String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP)); if (userCredentials != null) { - post.addHeader("Authorization", - "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader(AUTHORIZATION, + BASIC + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); } } } @@ -111,8 +114,8 @@ public class CamundaClient extends RequestClient { String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP)); if (userCredentials != null) { - post.addHeader("Authorization", - "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader(AUTHORIZATION, + BASIC + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); } } } @@ -120,7 +123,7 @@ public class CamundaClient extends RequestClient { post.setEntity(input); HttpResponse response = client.execute(post); - logger.debug("Response is: {}", response); + logger.debug(CAMUNDA_RESPONSE, response); return response; } @@ -151,15 +154,15 @@ public class CamundaClient extends RequestClient { String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP)); if (userCredentials != null) { - post.addHeader("Authorization", - "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader(AUTHORIZATION, + BASIC + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); } } } post.setEntity(input); HttpResponse response = client.execute(post); - logger.debug("Response is: {}", response); + logger.debug(CAMUNDA_RESPONSE, response); return response; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java index 468fe61562..7400c0aaae 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java @@ -22,8 +22,6 @@ package org.onap.so.apihandler.common; public final class ErrorNumbers { - private ErrorNumbers() {} - public static final String REQUEST_FAILED_SCHEMA_VALIDATION = "1000"; public static final String RECIPE_DOES_NOT_EXIST = "1010"; public static final String VFMODULE_TYPE_DOES_NOT_EXIST = "1011"; @@ -73,4 +71,6 @@ public final class ErrorNumbers { public static final String SVC_NO_SERVER_RESOURCES = "SVC1000"; public static final String SVC_DETAILED_SERVICE_ERROR = "SVC2000"; + private ErrorNumbers() {} + } 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 0bbc3e336f..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 @@ -23,8 +23,6 @@ package org.onap.so.apihandlerinfra; public class Constants { - private Constants() {} - public static final String REQUEST_ID_PATH = "/{request-id}"; public static final String STATUS_SUCCESS = "SUCCESS"; @@ -43,11 +41,13 @@ 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/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index 449aa4ba3f..3996d511a7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -928,21 +928,14 @@ public class E2EServiceInstances { // subscriptionServiceType requestParameters.setSubscriptionServiceType("MOG"); - // Userparams - // List<E2EUserParam> userParams; - // userParams = - // e2eSir.getService().getParameters().getRequestParameters().getUserParams(); + List<Map<String, Object>> userParamList = new ArrayList<>(); Map<String, Object> userParamMap = new HashMap<>(); // complete json request updated in the camunda userParamMap.put("UUIRequest", requestJSON); userParamMap.put("ServiceInstanceName", e2eSir.getService().getName()); - // Map<String, String> userParamMap3 = null; - // for (E2EUserParam userp : userParams) { - // userParamMap.put(userp.getName(), userp.getValue()); - // - // } + userParamList.add(userParamMap); requestParameters.setUserParams(userParamList); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java index 277675f310..401a6a9db6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java @@ -574,7 +574,7 @@ public class MsoRequest { throws JsonGenerationException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(Include.NON_NULL); - // mapper.configure(Feature.WRAP_ROOT_VALUE, true); + logger.debug("building sir from object {}", sir); String requestJSON = mapper.writeValueAsString(sir); @@ -636,7 +636,7 @@ public class MsoRequest { public String getVfModuleType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) { String serviceInstanceType = null; - String networkType = null; + String vnfType = null; String vfModuleType = null; String vfModuleModelName = null; @@ -800,6 +800,7 @@ public class MsoRequest { selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath)); } catch (Exception e) { selfLinkUrl = Optional.empty(); // ignore + logger.info(e.getMessage()); } return selfLinkUrl; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java index 8b3b91ae1a..d9db5713a7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java @@ -42,7 +42,7 @@ import org.springframework.stereotype.Component; @Component public class AAIClientHelper { - private static Logger logger = LoggerFactory.getLogger(AAIClientHelper.class); + /** * Get managing ECOMP Environment Info from A&AI diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java index da37be98b2..5da16f4326 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java @@ -28,10 +28,12 @@ import javax.transaction.Transactional; import org.junit.After; import org.junit.BeforeClass; import org.junit.runner.RunWith; +import org.onap.so.db.request.client.RequestsDbClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; @@ -52,6 +54,9 @@ public abstract class BaseTest { protected Logger logger = LoggerFactory.getLogger(BaseTest.class); protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); + @SpyBean + protected RequestsDbClient requestsDbClient; + @Autowired protected Environment env; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 1bb3932cff..db6273dc4a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -55,6 +55,7 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; @@ -124,6 +125,7 @@ public class ServiceInstancesTest extends BaseTest { } wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")).willReturn(aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK))); + Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any()); } public String inputStream(String JsonInput) throws IOException { 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 2c03173b16..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 @@ -283,6 +283,7 @@ DROP TABLE IF EXISTS `configuration_customization`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `configuration_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, @@ -291,29 +292,20 @@ CREATE TABLE `configuration_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), - KEY `fk_configuration_customization__service_proxy_customization_idx` (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_customization_idx` (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - CONSTRAINT `fk_configuration_customization__configuration_customization1` FOREIGN KEY (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES `configuration_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + `SERVICE_MODEL_UUID` varchar(200), + PRIMARY KEY (`ID`), + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`), + UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC), + CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `configuration_customization_to_service` --- - -DROP TABLE IF EXISTS `configuration_customization_to_service`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `configuration_customization_to_service` ( - `SERVICE_MODEL_UUID` varchar(200) NOT NULL, - `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, - PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET character_set_client = @saved_cs_client */;/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `controller_selection_reference` @@ -1116,6 +1108,7 @@ CREATE TABLE `vnf_resource_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1142,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-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java index b3d57b0137..3c4b1fa66b 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java @@ -89,6 +89,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep protected static final String REQUEST_ID = "requestId"; protected static final String REQUESTOR_ID = "requestorId"; protected static final String ACTION = "action"; + protected static final String OPENV = "operationalEnvironment"; private static final List<String> VALID_COLUMNS = Arrays.asList(REQUEST_ID, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, ACTION, REQUEST_STATUS); @@ -173,13 +174,13 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep predicates.add(cb.equal(tableRoot.get(NETWORK_INSTANCE_NAME), instanceName)); } else if (requestScope.equals("configuration")) { predicates.add(cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_NAME), instanceName)); - } else if (requestScope.equals("operationalEnvironment")) { + } else if (requestScope.equals(OPENV)) { predicates.add(cb.equal(tableRoot.get(OPERATIONAL_ENV_NAME), instanceName)); } } else { if (instanceIdMap != null) { - if ("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null) { + if ("service".equals(requestScope) && instanceIdMap.get(SERVICE_INSTANCE_ID) != null) { predicates .add(cb.equal(tableRoot.get(SERVICE_INSTANCE_ID), instanceIdMap.get("serviceInstanceId"))); } @@ -208,8 +209,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep instanceIdMap.get("configurationInstanceId"))); } - if (requestScope.equals("operationalEnvironment") - && instanceIdMap.get("operationalEnvironmentId") != null) { + if (requestScope.equals(OPENV) && instanceIdMap.get("operationalEnvironmentId") != null) { predicates.add( cb.equal(tableRoot.get(OPERATIONAL_ENV_ID), instanceIdMap.get("operationalEnvironmentId"))); } @@ -336,7 +336,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep // as the same requestorId can also match on different API methods final String resourceType = orchestrationMap.get("resourceType"); if (resourceType == null) { - predicates.add(cb.equal(tableRoot.get("requestScope"), "operationalEnvironment")); + predicates.add(cb.equal(tableRoot.get("requestScope"), OPENV)); } for (final Map.Entry<String, String> entry : orchestrationMap.entrySet()) { diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java index 00eff8f0c9..9a9564023d 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java @@ -1,7 +1,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Column; @@ -10,9 +9,6 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -22,8 +18,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java index 3518805b0d..f1ee006b60 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,15 +31,11 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @IdClass(ActivitySpecActivitySpecCategoriesId.class) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java index f0c9bd99ce..49c5d98943 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,15 +31,11 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @IdClass(ActivitySpecActivitySpecParametersId.class) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java index a42a73aac9..56aecc4a98 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java @@ -1,8 +1,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -10,20 +8,12 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java index be32da379e..6a7b5ba0be 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,15 +31,11 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @IdClass(ActivitySpecUserParametersId.class) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java index 54e2144c81..f94b8155f8 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java @@ -21,22 +21,17 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.List; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.OneToMany; import javax.persistence.Table; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import com.openpojo.business.annotation.BusinessKey; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java index 059935fff3..4599c978ec 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java @@ -22,16 +22,15 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.Date; -import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.MapsId; -import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -52,8 +51,12 @@ public class ConfigurationResourceCustomization implements Serializable { */ private static final long serialVersionUID = 1230671937560638856L; - @BusinessKey @Id + @BusinessKey + @Column(name = "ID") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + @Column(name = "MODEL_CUSTOMIZATION_UUID") private String modelCustomizationUUID; @@ -77,18 +80,30 @@ public class ConfigurationResourceCustomization implements Serializable { private String serviceProxyResourceCustomizationUUID; @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID") + @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID") private ConfigurationResourceCustomization configResourceCustomization; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "CONFIGURATION_MODEL_UUID") private ConfigurationResource configurationResource; + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "SERVICE_MODEL_UUID") + private Service service; + @PrePersist protected void onCreate() { this.created = new Date(); } + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + public String getModelCustomizationUUID() { return modelCustomizationUUID; } @@ -141,6 +156,7 @@ public class ConfigurationResourceCustomization implements Serializable { this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID; } + @LinkedResource public ConfigurationResourceCustomization getConfigResourceCustomization() { return configResourceCustomization; @@ -159,14 +175,22 @@ public class ConfigurationResourceCustomization implements Serializable { this.configurationResource = configurationResource; } + public Service getService() { + return service; + } + + public void setService(Service service) { + this.service = service; + } + @Override public String toString() { - return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID) .append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction) .append("nfType", nfType).append("nfRole", nfRole).append("created", created) // .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization) .append("configResourceCustomization", configResourceCustomization) - .append("configurationResource", configurationResource).toString(); + .append("configurationResource", configurationResource).append("service", service).toString(); } @Override @@ -175,12 +199,12 @@ public class ConfigurationResourceCustomization implements Serializable { return false; } ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other; - return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + return new EqualsBuilder().append(id, castOther.id).isEquals(); } @Override public int hashCode() { - return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + return new HashCodeBuilder().append(id).toHashCode(); } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java index 9287fbcf84..21b1550cb5 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java @@ -44,33 +44,6 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource; public class NetworkResourceCustomization implements Serializable { public static final long serialVersionUID = -1322322139926390329L; - @Override - public String toString() { - return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) - .append("modelInstanceName", modelInstanceName).append("created", created) - .append("networkTechnology", networkTechnology).append("networkType", networkType) - .append("networkScope", networkScope).append("networkRole", networkRole) - .append("networkResource", networkResource).toString(); - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof NetworkResourceCustomization)) { - return false; - } - NetworkResourceCustomization castOther = (NetworkResourceCustomization) other; - return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); - } - - public NetworkResourceCustomization() { - super(); - } - @BusinessKey @Id @Column(name = "MODEL_CUSTOMIZATION_UUID") @@ -102,6 +75,10 @@ public class NetworkResourceCustomization implements Serializable { @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID") private NetworkResource networkResource = null; + public NetworkResourceCustomization() { + super(); + } + @PrePersist protected void onCreate() { this.created = new Date(); @@ -175,4 +152,27 @@ public class NetworkResourceCustomization implements Serializable { public void setResourceInput(String resourceInput) { this.resourceInput = resourceInput; } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("created", created) + .append("networkTechnology", networkTechnology).append("networkType", networkType) + .append("networkScope", networkScope).append("networkRole", networkRole) + .append("networkResource", networkResource).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkResourceCustomization)) { + return false; + } + NetworkResourceCustomization castOther = (NetworkResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java index c333033ba2..ffcc8e9717 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java @@ -119,9 +119,7 @@ public class Service implements Serializable { inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) private List<ServiceProxyResourceCustomization> serviceProxyCustomizations; - @OneToMany(cascade = CascadeType.ALL) - @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), - inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) + @OneToMany(cascade = CascadeType.ALL, mappedBy = "service") private List<ConfigurationResourceCustomization> configurationCustomizations; @OneToMany(cascade = CascadeType.ALL) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java index af99aa8c80..36c9251d59 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java @@ -121,6 +121,9 @@ public class VnfResourceCustomization implements Serializable { @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") private Boolean skipPostInstConf; + @Column(name = "VNFCINSTANCEGROUP_ORDER") + private String vnfcInstanceGroupOrder; + @Override public boolean equals(final Object other) { if (!(other instanceof VnfResourceCustomization)) { @@ -148,6 +151,7 @@ public class VnfResourceCustomization implements Serializable { .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode) .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources) .append("vfModuleCustomizations", vfModuleCustomizations) + .append("vnfcInstanceGroupOrder", vnfcInstanceGroupOrder) .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString(); } @@ -324,4 +328,12 @@ public class VnfResourceCustomization implements Serializable { public void setSkipPostInstConf(Boolean skipPostInstConf) { this.skipPostInstConf = skipPostInstConf; } + + public String getVnfcInstanceGroupOrder() { + return vnfcInstanceGroupOrder; + } + + public void setVnfcInstanceGroupOrder(String vnfcInstanceGroupOrder) { + this.vnfcInstanceGroupOrder = vnfcInstanceGroupOrder; + } } 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/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 a2ca4a3814..19200468ae 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 @@ -191,6 +191,7 @@ public class CatalogDbClient { private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid"; private String findWorkflowByArtifactUUID = "/findByArtifactUUID"; private String findWorkflowByModelUUID = "/findWorkflowByModelUUID"; + private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid"; private String serviceURI; private String vfModuleURI; @@ -333,6 +334,9 @@ public class CatalogDbClient { findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID; findWorkflowByModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByModelUUID; + findVnfResourceCustomizationByModelUuid = + endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findVnfResourceCustomizationByModelUuid; + serviceURI = endpoint + SERVICE + URI_SEPARATOR; vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR; vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR; @@ -503,6 +507,12 @@ public class CatalogDbClient { } } + public List<VnfResourceCustomization> getVnfResourceCustomizationByModelUuid(String modelUuid) { + return this.getMultipleResources(vnfResourceCustomizationClient, + getUri(UriBuilder.fromUri(findVnfResourceCustomizationByModelUuid) + .queryParam("SERVICE_MODEL_UUID", modelUuid).build().toString())); + } + public PnfResource getPnfResourceByModelUUID(String modelUUID) { PnfResource PnfResource = this.getSingleResource(pnfResourceClient, getUri(pnfResourceURI + modelUUID)); if (PnfResource != null) { @@ -816,7 +826,7 @@ public class CatalogDbClient { return vfModuleCust.getCvnfcCustomization().stream().collect(Collectors.toList()); } - private VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID, + public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID, List<VnfResourceCustomization> vnfResourceCusts) { List<VnfResourceCustomization> filtered = vnfResourceCusts.stream() .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID())) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java new file mode 100644 index 0000000000..aa474238fd --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java @@ -0,0 +1,32 @@ +/*- + * ============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.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ActivitySpec; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "activitySpec", path = "activitySpec") +public interface ActivitySpecRepository extends JpaRepository<ActivitySpec, String> { + + ActivitySpec findByName(String name); + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java index 43104986ff..74c4c8cb04 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java @@ -26,6 +26,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "configurationResourceCustomization", path = "configurationResourceCustomization") public interface ConfigurationResourceCustomizationRepository - extends JpaRepository<ConfigurationResourceCustomization, String> { + extends JpaRepository<ConfigurationResourceCustomization, Integer> { } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java index c72fade411..c38ffcbbf3 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java @@ -40,4 +40,17 @@ public interface VnfCustomizationRepository extends JpaRepository<VnfResourceCus @Param("MODEL_INSTANCE_NAME") String modelInstanceName, @Param("VNF_RESOURCE_MODEL_UUID") String vnfResourceModelUUID); + /** + * Used to fetch the @{link VnfResourceCustomization} by the Model UUID. + * + * This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide + * VnfResourceCustomization based on model UUID without projection. + * + * @param serviceModelUuid model UUID + * @return List of VnfResourceCustomization + */ + @Query(value = "select * from vnf_resource_customization where SERVICE_MODEL_UUID = ?1", nativeQuery = true) + List<VnfResourceCustomization> findVnfResourceCustomizationByModelUuid( + @Param("SERVICE_MODEL_UUID") String serviceModelUuid); + } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java index a7610fec92..98db12c288 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java @@ -90,8 +90,8 @@ public class MavenLikeVersioning implements Serializable { public boolean isTheSameVersion(String versionToCompare) { if (versionToCompare == null && this.version == null) { return true; - } else if (versionToCompare == null || versionToCompare.trim().equals("") || this.version == null - || this.version.trim().equals("")) { + } else if (versionToCompare == null || "".equals(versionToCompare.trim()) || this.version == null + || "".equals(this.version.trim())) { return false; } String[] currentVersionArray = this.version.split("\\."); diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepositoryTest.java new file mode 100644 index 0000000000..024940f68d --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepositoryTest.java @@ -0,0 +1,35 @@ +/* + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ Licensed under the + * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may + * obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions and limitations under the + * License. + * + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import java.util.List; +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.db.catalog.BaseTest; +import org.onap.so.db.catalog.beans.ActivitySpec; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; + +public class ActivitySpecRepositoryTest extends BaseTest { + + @Autowired + private ActivitySpecRepository activitySpecRepository; + + @Test + public void findAllTest() throws Exception { + List<ActivitySpec> activitySpecList = activitySpecRepository.findAll(); + Assert.assertFalse(CollectionUtils.isEmpty(activitySpecList)); + } +} diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 5e43f8f3e2..97afcc04be 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -280,6 +280,7 @@ DROP TABLE IF EXISTS `configuration_customization`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `configuration_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, @@ -288,27 +289,18 @@ CREATE TABLE `configuration_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), - KEY `fk_configuration_customization__service_proxy_customization_idx` (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_customization_idx` (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - CONSTRAINT `fk_configuration_customization__configuration_customization1` FOREIGN KEY (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES `configuration_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `configuration_customization_to_service` --- - -DROP TABLE IF EXISTS `configuration_customization_to_service`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `configuration_customization_to_service` ( - `SERVICE_MODEL_UUID` varchar(200) NOT NULL, - `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, - PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + `SERVICE_MODEL_UUID` varchar(200), + PRIMARY KEY (`ID`), + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`), + UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC), + CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1114,6 +1106,7 @@ CREATE TABLE `vnf_resource_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1140,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; diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index 88a5001f17..611e2d293d 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -64,7 +64,7 @@ <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> - <version>0.19.1</version> + <version>0.28.0</version> <configuration> <verbose>true</verbose> diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image index cf50868ca5..c0b298e778 100644 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image @@ -1,4 +1,4 @@ -FROM openjdk:8-jdk-alpine +FROM docker.io/openjdk:8-jdk-alpine ARG http_proxy ARG https_proxy @@ -444,6 +444,7 @@ <goals> <goal>format</goal> </goals> + <phase>process-sources</phase> <configuration> <skip>${format.skipExecute}</skip> <configFile>${base-path}/project-configs/code-tools/onap-eclipse-format.xml</configFile> @@ -454,6 +455,7 @@ <goals> <goal>format</goal> </goals> + <phase>process-sources</phase> <configuration> <skip>${format.skipExecute}</skip> <sourceDirectory>${project.basedir}</sourceDirectory> @@ -501,7 +503,7 @@ <plugin> <groupId>io.fabric8</groupId> <artifactId>fabric8-maven-plugin</artifactId> - <version>3.5.33</version> + <version>4.0.0-M2</version> <configuration> <skip>${docker.skip}</skip> <skipBuild>${docker.skip.build}</skipBuild> diff --git a/version.properties b/version.properties index 668657e962..99af34261b 100644 --- a/version.properties +++ b/version.properties @@ -3,7 +3,7 @@ # because they are used in Jenkins, whose plug-in doesn't support major=1 -minor=4 +minor=5 patch=0 base_version=${major}.${minor}.${patch} |