diff options
10 files changed, 85 insertions, 35 deletions
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 cb2887c0af..8a55e0717e 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 @@ -102,7 +102,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); 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"; + @Autowired private VFModuleCustomizationRepository vfModuleCustomRepo; @@ -116,7 +117,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private MsoHeatUtils heat; @Autowired private ValetClient vci; + /** + * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL. + * @see MsoVnfAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory) + */ + public MsoVnfAdapterImpl() { + // Do nothing + //DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL. + } + + /** * Health Check web method. Does nothing but return to show the adapter is deployed. */ @Override @@ -125,12 +136,6 @@ 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() {} - - /** * This is the "Create VNF" web service implementation. * It will create a new VNF of the requested type in the specified cloud * and tenant. The tenant must exist before this service is called. @@ -298,7 +303,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long subStartTime = System.currentTimeMillis (); try { heatStack = heat.queryStack (cloudSiteId, tenantId, vnfName); - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vnfName); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vnfName); } catch (MsoException me) { me.addContext ("QueryVNF"); // Failed to query the Stack due to an openstack exception. @@ -361,7 +366,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long subStartTime = System.currentTimeMillis (); try { heat.deleteStack (tenantId, cloudSiteId, vnfName, true); - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", vnfName); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "DeleteStack", vnfName); } catch (MsoException me) { me.addContext ("DeleteVNF"); // Failed to query the Stack due to an openstack exception. @@ -411,7 +416,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long subStartTime = System.currentTimeMillis (); try { heat.deleteStack (tenantId, cloudSiteId, vnfId, true); - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "DeleteStack", null); } catch (MsoException me) { // Failed to rollback the Stack due to an openstack exception. // Convert to a generic VnfException @@ -484,11 +489,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (IOException e) { LOGGER.debug(" HeatBridgeMain.py failed with IO Exception! " + e); return false; - } catch (InterruptedException e) { - LOGGER.debug(" HeatBridgeMain.py failed when interrupted! " + e); - return false; } catch (RuntimeException e) { - LOGGER.debug(" HeatBridgeMain.py failed for unknown reasons!" + e); + LOGGER.debug(" HeatBridgeMain.py failed during runtime!" + e); + return false; + } + catch (Exception e) { + LOGGER.debug(" HeatBridgeMain.py failed for unknown reasons! " + e); return false; } } @@ -641,7 +647,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long subStartTime1 = System.currentTimeMillis (); try { heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName); - LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName); + LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vfModuleName); } catch (MsoException me) { String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName); @@ -705,7 +711,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { try { LOGGER.debug("Querying for nestedStackId = " + nestedStackId); nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId); - LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName); + LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vfModuleName); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException @@ -737,7 +743,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { try { LOGGER.debug("Querying for nestedBaseStackId = " + nestedBaseStackId); nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId); - LOGGER.recordMetricEvent (subStartTime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName); + LOGGER.recordMetricEvent (subStartTime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vfModuleName); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException @@ -892,11 +898,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } // End Version check 1607 - // with VF_MODULE - we have both the non-vol and vol template/envs in that object - // with VNF_RESOURCE - we use the old methods. - //Integer heatTemplateId = null; - //Integer heatEnvtId = null; - + // By the time we get here - heatTemplateId and heatEnvtId should be populated (or null) @@ -1049,10 +1051,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Note this also removes any comments MsoHeatEnvironmentEntry mhee = null; if (heatEnvironment != null && heatEnvironment.getEnvironment() != null && heatEnvironment.getEnvironment().contains ("parameters:")) { - //LOGGER.debug ("Have an Environment argument with a parameters: section - will bypass checking for valid params - but will still check for aliases"); + LOGGER.debug("Enhanced environment checking enabled - 1604"); StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment()); - //LOGGER.debug("About to create MHEE with " + sb); + mhee = new MsoHeatEnvironmentEntry(sb); StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n"); for (HeatTemplateParam parm : heatTemplate.getParameters()) { @@ -1197,7 +1199,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug("heat is null!"); throw new MsoHeatNotFoundException(); } - LOGGER.recordMetricEvent (createStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "CreateStack", vfModuleName); + LOGGER.recordMetricEvent (createStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "CreateStack", vfModuleName); } catch (MsoException me) { me.addContext ("CreateVFModule"); String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; @@ -1301,7 +1303,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long subStartTime = System.currentTimeMillis (); try { heat.deleteStack (tenantId, cloudSiteId, vnfName, true); - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", vnfName); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "DeleteStack", vnfName); } catch (MsoException me) { me.addContext ("DeleteVNF"); // Failed to query the Stack due to an openstack exception. @@ -1378,7 +1380,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String mcu = modelCustomizationUuid; boolean useMCUuid = false; if (mcu != null && !mcu.isEmpty()) { - if (mcu.equalsIgnoreCase("null")) { + if ("null".equalsIgnoreCase(mcu)) { LOGGER.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: " + modelCustomizationUuid); useMCUuid = false; mcu = ""; diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 17214e5e10..57bfb4ed30 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -179,7 +179,6 @@ <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> - <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn index 51e12d21ca..5cf17d24fe 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn @@ -1,6 +1,6 @@ <?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> - <bpmn:process id="Delete3rdONAPE2EServiceInstance" name="Delete3rdONAPE2EServiceInstance" isExecutable="true"> + <bpmn:process id="Create3rdONAPE2EServiceInstance" name="Create3rdONAPE2EServiceInstance " isExecutable="true"> <bpmn:startEvent id="StartEvent_0hj12gh" name="Delete3rdONAPRES_Start"> <bpmn:outgoing>SequenceFlow_190fewc</bpmn:outgoing> </bpmn:startEvent> @@ -162,7 +162,7 @@ dcsi.checkLocallCall(execution)]]></bpmn:script> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1y4vypx" name="GoTo StartLocalONAPDeleteE2ESI"> <bpmn:incoming>SequenceFlow_1y8xkzy</bpmn:incoming> <bpmn:incoming>SequenceFlow_0h1rnsw</bpmn:incoming> - <bpmn:linkEventDefinition name=" StartLocalONAPDeleteE2ESI" /> + <bpmn:linkEventDefinition name="StartLocalONAPDeleteE2ESI" /> </bpmn:intermediateThrowEvent> <bpmn:endEvent id="EndEvent_0o0n3fa" name="Delete3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_131f1jj</bpmn:incoming> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn index 770df07bfd..116a8a6fb6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn @@ -156,7 +156,7 @@ dcsi.checkSPPartnerand LocallCall(execution)]]></bpmn:script> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0bmqdpg" name="GoTo StartLocalONAPDeleteE2ESI"> <bpmn:incoming>SequenceFlow_0u3tca8</bpmn:incoming> <bpmn:incoming>SequenceFlow_1pwflny</bpmn:incoming> - <bpmn:linkEventDefinition name=" StartLocalONAPDeleteE2ESI" /> + <bpmn:linkEventDefinition name="StartLocalONAPDeleteE2ESI" /> </bpmn:intermediateThrowEvent> <bpmn:endEvent id="EndEvent_1itzq8n" name="Delete3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_0vhbw8y</bpmn:incoming> diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java index 42fa1ad02a..8775a6a687 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java @@ -42,5 +42,11 @@ public interface AAIResourceUri extends AAIUri, GraphInventoryResourceUri { @Override public AAIResourceUri replaceQueryParam(String name, String... values); @Override + public AAIResourceUri resultIndex(int index); + @Override + public AAIResourceUri resultSize(int size); + @Override + public AAIResourceUri limit(int size); + @Override public AAIResourceUri clone(); } 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 14671b2f85..8731ae719a 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 @@ -82,6 +82,21 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri { } @Override + public AAISimpleUri resultIndex(int index) { + return (AAISimpleUri) super.resultIndex(index); + } + + @Override + public AAISimpleUri resultSize(int size) { + return (AAISimpleUri) super.resultSize(size); + } + + @Override + public AAISimpleUri limit(int size) { + return (AAISimpleUri) super.limit(size); + } + + @Override public AAISimpleUri clone() { if (this.type != null) { return new AAISimpleUri((AAIObjectType)this.type, this.internalURI.clone(), values); diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java index eb336d9219..fb43cda7a4 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java @@ -20,11 +20,7 @@ package org.onap.so.client.aai.entities.uri; -import java.net.URI; -import java.util.Map; - import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; @@ -53,6 +49,12 @@ public interface AAIUri extends GraphInventoryUri { @Override public AAIUri replaceQueryParam(String name, String... values); @Override + public AAIUri resultIndex(int index); + @Override + public AAIUri resultSize(int size); + @Override + public AAIUri limit(int size); + @Override public AAIUri clone(); @Override diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java index 08e7304978..2357d07fd4 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java @@ -40,5 +40,11 @@ public interface GraphInventoryResourceUri extends GraphInventoryUri { @Override public GraphInventoryResourceUri replaceQueryParam(String name, String... values); @Override + public GraphInventoryResourceUri resultIndex(int index); + @Override + public GraphInventoryResourceUri resultSize(int size); + @Override + public GraphInventoryResourceUri limit(int size); + @Override public GraphInventoryResourceUri clone(); } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java index 8a25c23895..42c478eff7 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java @@ -47,6 +47,9 @@ public interface GraphInventoryUri { public GraphInventoryUri nodesOnly(boolean nodesOnly); public GraphInventoryUri queryParam(String name, String... values); public GraphInventoryUri replaceQueryParam(String name, String... values); + public GraphInventoryUri resultIndex(int index); + public GraphInventoryUri resultSize(int size); + public GraphInventoryUri limit(int size); public GraphInventoryUri clone(); /** 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 9c86ec6348..975fa318e8 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 @@ -120,6 +120,23 @@ public class SimpleUri implements GraphInventoryResourceUri { } @Override + public SimpleUri resultIndex(int index) { + this.internalURI = internalURI.replaceQueryParam("resultIndex", index); + return this; + } + + @Override + public SimpleUri resultSize(int size) { + this.internalURI = internalURI.replaceQueryParam("resultSize", size); + return this; + } + + @Override + public SimpleUri limit(int size) { + return this.resultIndex(0).resultSize(size); + } + + @Override public URI build() { return build(this.values); } |