diff options
31 files changed, 1009 insertions, 235 deletions
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 e5daf24d6c..b70d409cd8 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 @@ -30,7 +30,8 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I ('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'), ('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'), ('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'DEFAULT', '*'), -('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'); +('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'), +('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES @@ -198,9 +199,16 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL ('VNF-InPlaceUpdate', '15', 'VNFResumeTrafficActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')), ('VNF-InPlaceUpdate', '16', 'VNFUnlockActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')), ('VNF-InPlaceUpdate', '17', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')), -('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')); - - +('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '1', 'VNFCheckPserversLockedFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '2', 'VNFCheckInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '3', 'VNFSetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '4', 'VNFSetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '5', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '6', 'VNFConfigModifyActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '7', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '8', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Config-Update', '9', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')); INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) VALUES @@ -860,7 +868,8 @@ VALUES ('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'), ('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'), ('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'), -('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'); +('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'), +('VNFConfigModifyActivity', 'NO_VALIDATE', 'CUSTOM'); UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE IS NULL; @@ -881,6 +890,10 @@ UPDATE vnf_recipe SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB' WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'inPlaceSoftwareUpdate'; +UPDATE vnf_recipe +SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB' +WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig'; + INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE) VALUES ('VNFCheckPserversLockedFlagActivity','*','*','*','*','Manual','Abort','*', '*'), diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java index 440270e047..0ffc213a4e 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java @@ -30,13 +30,13 @@ import java.util.List; import javax.transaction.Transactional; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.adapters.catalogdb.CatalogDBApplication; import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClientPortChanger; @@ -44,9 +44,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTest { @@ -149,4 +146,16 @@ public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTes assertNotNull(collectionNetworkCust); logger.debug(collectionNetworkCust.getModelCustomizationUUID()); } + + @Test + public void getCvnfcCustomization() { + client.getServiceByID(serviceUUID); + String vfId = "cb82ffd8-252a-11e7-93ae-92361f002671"; + String vnfId = "68dc9a92-214c-11e7-93ae-92361f002671"; + + CvnfcConfigurationCustomization fabricConfig = + client.getCvnfcCustomization(serviceUUID, vnfId, vfId, "dadc2c8c-2bab-11e9-b210-d663bd873d95"); + assertEquals("386c9aa7-9318-48ee-a6d1-1bf0f85de385", fabricConfig.getModelCustomizationUUID()); + } + } diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql index 32c51293c2..8fd171bf64 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -213,8 +213,30 @@ VALUES ( '1', 'testNfcFunction', 'testNfcNamingCode', '2018-07-17 14:05:08', + '9bcce658-9b37-11e8-98d0-529269fb1459',1), + ( '2', + 'dadc2c8c-2bab-11e9-b210-d663bd873d95', + 'testModelInstanceName', + 'b25735fe-9b37-11e8-98d0-529269fb1459', + 'ba7e6ef0-9b37-11e8-98d0-529269fb1459', + 'testModelVersion', + 'testModelName', + 'testToscaNodeType', + 'testCvnfcCustomzationDescription', + 'testNfcFunction', + 'testNfcNamingCode', + '2018-07-17 14:05:08', '9bcce658-9b37-11e8-98d0-529269fb1459',1); + + +INSERT IGNORE INTO `configuration` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `TOSCA_NODE_TYPE`, `DESCRIPTION`, `CREATION_TIMESTAMP`) VALUES + ('d2195b0e-307a-4d30-b82f-9c82001d965e', '2f0a4b7a-dfdb-4f82-a2ab-b65d1ddd5e8e', '13.0', 'Fabric Configuration', 'org.openecomp.nodes.FabricConfiguration', 'A fabric Configuration object', '2019-06-04 20:12:20'); + +INSERT IGNORE INTO `cvnfc_configuration_customization` (`MODEL_CUSTOMIZATION_UUID`, `MODEL_INSTANCE_NAME`, `CONFIGURATION_TYPE`, `CONFIGURATION_ROLE`, `CONFIGURATION_FUNCTION`, `POLICY_NAME`, `CREATION_TIMESTAMP`, `CONFIGURATION_MODEL_UUID`, `CVNFC_CUSTOMIZATION_ID`) VALUES + ('386c9aa7-9318-48ee-a6d1-1bf0f85de385', 'Fabric Configuration 0', '5G', 'Fabric Config', 'Network Cloud', 'Config_MS_fabric_configuration_FRWL.1.xml', '2019-06-04 20:12:20', 'd2195b0e-307a-4d30-b82f-9c82001d965e', '2'); + + insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values ('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen'); @@ -231,4 +253,4 @@ insert into workflow(artifact_uuid, artifact_name, name, operation_name, version ('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', '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'); +('ff2ae348-214a-11e7-93ae-92361f002671', '1');
\ No newline at end of file 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 257374fdb2..4728effdca 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 @@ -97,7 +97,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String NETWORK_CREATED_STATUS_MESSAGE = "The new network was successfully created in the cloud"; private static final String NETWORK_NOT_EXIST_STATUS_MESSAGE = - "The network as not found, thus no network was deleted in the cloud via this request"; + "The network was not found, thus no network was deleted in the cloud via this request"; private static final String NETWORK_DELETED_STATUS_MESSAGE = "The network was successfully deleted in the cloud"; private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class); 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 3a2d3bc5eb..5951fda16e 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 @@ -104,8 +104,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final String DELETE_VNF = "DeleteVNF"; private static final String QUERY_STACK = "QueryStack"; private static final String CREATE_VFM_MODULE = "CreateVFModule"; - private static final String CREATE_VF_STACK = "Create VF: Stack"; - private static final String STACK = "Stack"; private static final String USER_ERROR = "USER ERROR"; private static final String VERSION_MIN = "VersionMin"; private static final String VERSION_MAX = "VersionMax"; @@ -113,7 +111,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { "The vf module was found to already exist, thus no new vf module was created in the cloud via this request"; private static final String VF_CREATED_STATUS_MESSAGE = "The new vf module was successfully created in the cloud"; private static final String VF_NOT_EXIST_STATUS_MESSAGE = - "The vf module was not, thus no vf module was deleted in the cloud via this request"; + "The vf module was not found, thus no vf module was deleted in the cloud via this request"; private static final String VF_DELETED_STATUS_MESSAGE = "The vf module was successfully deleted in the cloud"; @Autowired @@ -1092,7 +1090,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { failIfExists); if (msoRequest.getRequestId() != null) { msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(), - heatStack.isOperationPerformed() ? VF_EXIST_STATUS_MESSAGE : VF_CREATED_STATUS_MESSAGE); + heatStack.isOperationPerformed() ? VF_CREATED_STATUS_MESSAGE : VF_EXIST_STATUS_MESSAGE); } } else { throw new MsoHeatNotFoundException(); diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java index b065e9a0c3..e5321067ac 100644 --- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java +++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java @@ -1,5 +1,10 @@ package org.onap.so.adapters.appc.orchestrator.client.beans; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,6 +19,8 @@ public class ConfigurationParameters { private String nodeList; @JsonProperty("file_parameter_content") private String fileParameterContent; + @JsonIgnore + private Map<String, String> additionalProperties = new HashMap<>(); @JsonProperty("vnf_name") @@ -50,4 +57,18 @@ public class ConfigurationParameters { this.fileParameterContent = fileParameterContent; } + @JsonAnyGetter + public Map<String, String> getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, String value) { + this.additionalProperties.put(name, value); + } + + public void setAdditionalProperties(Map<String, String> map) { + this.additionalProperties = map; + } + } diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java index a174ccb05a..99d6b4dc12 100644 --- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java +++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java @@ -32,10 +32,10 @@ public class ApplicationControllerTaskImpl { Optional<String> vserverId = Optional.empty(); Parameters parameters = new Parameters(); ConfigurationParameters configParams = new ConfigurationParameters(); + RequestParameters requestParams = new RequestParameters(); switch (request.getAction()) { case HealthCheck: - RequestParameters requestParams = new RequestParameters(); requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress()); parameters.setRequestParameters(requestParams); payload = Optional.of((mapper.getMapper().writeValueAsString(parameters))); @@ -75,6 +75,12 @@ public class ApplicationControllerTaskImpl { payload = Optional.of((mapper.getMapper().writeValueAsString(parameters))); break; case ConfigModify: + requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress()); + configParams.setAdditionalProperties(request.getConfigParams()); + parameters.setRequestParameters(requestParams); + parameters.setConfigurationParameters(configParams); + payload = Optional.of((mapper.getMapper().writeValueAsString(parameters))); + break; case ConfigScaleOut: break; case UpgradePreCheck: @@ -97,6 +103,7 @@ public class ApplicationControllerTaskImpl { vserverId = Optional .of(request.getApplicationControllerVnf().getApplicationControllerVm().getVserverId()); } + break; default: // errorMessage = "Unable to idenify Action request for AppCClient"; break; diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java index 640e2dbd6e..973430c37e 100644 --- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java +++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java @@ -1,5 +1,7 @@ package org.onap.so.adapters.appc.orchestrator.service; +import java.util.HashMap; +import java.util.Map; import java.util.Optional; import org.junit.Before; import org.junit.Test; @@ -50,6 +52,10 @@ public class ApplicationControllerTaskImplTest { request.setNewSoftwareVersion("2.0"); request.setExistingSoftwareVersion("1.0"); request.setOperationsTimeout("30"); + Map<String, String> reqConfigParams = new HashMap<>(); + reqConfigParams.put("name1", "value1"); + reqConfigParams.put("name2", "value2"); + request.setConfigParams(reqConfigParams); ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf(); applicationControllerVnf.setVnfHostIpAddress("100.100"); applicationControllerVnf.setVnfId("testVnfId"); @@ -228,6 +234,33 @@ public class ApplicationControllerTaskImplTest { } @Test + public void testExcute_configModify() throws JsonProcessingException, ApplicationControllerOrchestratorException { + request.setAction(Action.ConfigModify); + + Parameters parameters = new Parameters(); + RequestParameters requestParams = new RequestParameters(); + requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress()); + parameters.setRequestParameters(requestParams); + ConfigurationParameters configParams = new ConfigurationParameters(); + Map<String, String> configParamMap = new HashMap<>(); + configParamMap.put("name1", "value1"); + configParamMap.put("name2", "value2"); + configParams.setAdditionalProperties(configParamMap); + parameters.setConfigurationParameters(configParams); + Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters))); + + Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId", + request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", + listener)).thenReturn(new Status()); + + Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener); + + Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId", + request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", + listener); + } + + @Test public void testListener() throws Exception { request.setAction(Action.QuiesceTraffic); Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener); 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 f524b96fa9..d023df3b79 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 @@ -2036,7 +2036,7 @@ public class ToscaResourceInstaller { // ****************************************************************************************************************** List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>(); - Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<>(); + List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<>(); Set<VnfcCustomization> vnfcCustomizations = new HashSet<>(); // Only set the CVNFC if this vfModule group is a member of it. diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index ff628346b5..a86e1de772 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -104,7 +104,8 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { infraRequest.setVfModuleId(utils.getNodeText(xml, "vfModuleId")) }else if(utils.nodeExists(xml, "volumeGroupId")){ infraRequest.setVolumeGroupId(utils.getNodeText(xml, "volumeGroupId")) - + }else if(utils.nodeExists(xml, "pnfName")){ + infraRequest.setPnfName(utils.getNodeText(xml, "pnfName")) } dbClient.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint")) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn new file mode 100644 index 0000000000..d77b1cebb1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn @@ -0,0 +1,67 @@ +<?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.9.0"> + <bpmn:process id="VNFConfigModifyActivity" name="VNFConfigModifyActivity" isExecutable="true"> + <bpmn:startEvent id="Start_VNFConfigModifyActivity" name="Start"> + <bpmn:outgoing>SequenceFlow_0d87xrn</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="ConfigModify" name="VNF Config Modify " camunda:type="external" camunda:topic="AppcService"> + <bpmn:incoming>SequenceFlow_05oatn2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1pg83wr</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0d87xrn" sourceRef="Start_VNFConfigModifyActivity" targetRef="PreProcessActivity" /> + <bpmn:endEvent id="End_VNFConfigModifyActivity" name="End"> + <bpmn:incoming>SequenceFlow_1pg83wr</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1pg83wr" sourceRef="ConfigModify" targetRef="End_VNFConfigModifyActivity" /> + <bpmn:serviceTask id="PreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcOrchestratorPreProcessor.buildAppcTaskRequest(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),"ConfigModify")}"> + <bpmn:incoming>SequenceFlow_0d87xrn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05oatn2</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_05oatn2" sourceRef="PreProcessActivity" targetRef="ConfigModify" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFConfigModifyActivity"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_VNFConfigModifyActivity"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="138" width="25" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1q3bjtz_di" bpmnElement="ConfigModify"> + <dc:Bounds x="532" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0d87xrn_di" bpmnElement="SequenceFlow_0d87xrn"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="257" y="120" /> + <di:waypoint xsi:type="dc:Point" x="257" y="120" /> + <di:waypoint xsi:type="dc:Point" x="304" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="272" y="114" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_15t8iwk_di" bpmnElement="End_VNFConfigModifyActivity"> + <dc:Bounds x="756" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="764" y="142" width="20" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1pg83wr_di" bpmnElement="SequenceFlow_1pg83wr"> + <di:waypoint xsi:type="dc:Point" x="632" y="120" /> + <di:waypoint xsi:type="dc:Point" x="756" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="694" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0h60lbz_di" bpmnElement="PreProcessActivity"> + <dc:Bounds x="308" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05oatn2_di" bpmnElement="SequenceFlow_05oatn2"> + <di:waypoint xsi:type="dc:Point" x="408" y="120" /> + <di:waypoint xsi:type="dc:Point" x="532" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="470" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java new file mode 100644 index 0000000000..99ee8d9fcb --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java @@ -0,0 +1,54 @@ +/*- + * ============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.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doThrow; +import java.util.List; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.externaltask.LockedExternalTask; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.BaseBPMNTest; + +public class VNFConfigModifyActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFConfigModifyActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables); + assertThat(pi).isNotNull(); + processExternalTasks(pi, "ConfigModify"); + assertThat(pi).isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity", + "ConfigModify", "End_VNFConfigModifyActivity"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFConfigModifyActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcOrchestratorPreProcessor) + .buildAppcTaskRequest(any(BuildingBlockExecution.class), any(String.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity") + .hasNotPassed("ConfigModify", "End_VNFConfigModifyActivity"); + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy index 89490ff620..89490ff620 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy new file mode 100644 index 0000000000..8e7a4f727d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.workflow.context.WorkflowContext +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder +import org.onap.so.bpmn.core.WorkflowException +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.* + +class PNFSoftwareUpgrade extends AbstractServiceTaskProcessor { + private static final Logger logger = LoggerFactory.getLogger(PNFSoftwareUpgrade.class) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + String prefix = "PnfSwUpgrade_" + + @Override + void preProcessRequest(DelegateExecution execution) { + } + + void sendResponse(DelegateExecution execution) { + def requestId = execution.getVariable(REQUEST_ID) + def instanceId = execution.getVariable(PNF_CORRELATION_ID) + logger.debug("Send response for requestId: {}, instanceId: {}", requestId, instanceId) + + String response = """{"requestReferences":{"requestId":"${requestId}", "instanceId":"${instanceId}"}}""".trim() + sendWorkflowResponse(execution, 200, response) + } + + static WorkflowContext getWorkflowContext(DelegateExecution execution) { + String requestId = execution.getVariable(REQUEST_ID) + return WorkflowContextHolder.getInstance().getWorkflowContext(requestId) + } + + void prepareCompletion(DelegateExecution execution) { + try { + String requestId = execution.getVariable(REQUEST_ID) + logger.debug("Prepare Completion of PNF Software Upgrade for requestId: {}", requestId) + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>UPDATE</action> + <source>VID</source> + </request-info> + <aetgt:status-message>PNF has been upgraded successfully.</aetgt:status-message> + <aetgt:mso-bpel-name>PNF_SOFTWARE_UPGRADE</aetgt:mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable(prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + + logger.debug("CompleteMsoProcessRequest of PNF Software Upgrade - " + "\n" + xmlMsoCompletionRequest) + } catch (Exception e) { + String msg = "Prepare Completion error for PNF software upgrade - " + e.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + void prepareFalloutHandler(DelegateExecution execution) { + WorkflowContext workflowContext = getWorkflowContext(execution) + if (workflowContext == null) { + logger.debug("Error occurred before sending response to API handler, and send it now") + sendResponse(execution) + } + + try { + String requestId = execution.getVariable(REQUEST_ID) + logger.debug("Prepare FalloutHandler of PNF Software Upgrade for requestId: {}", requestId) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + String errorCode = String.valueOf(workflowException.getErrorCode()) + String errorMessage = workflowException.getErrorMessage() + String falloutHandlerRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>UPDATE</action> + <source>VID</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + String xmlFalloutHandlerRequest = utils.formatXml(falloutHandlerRequest) + + execution.setVariable(prefix + "FalloutHandlerRequest", xmlFalloutHandlerRequest) + + logger.debug("FalloutHandlerRequest of PNF Software Upgrade - " + "\n" + xmlFalloutHandlerRequest) + } catch (Exception e) { + String msg = "Prepare FalloutHandler error for PNF software upgrade - " + e.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy index 6b7944cc6e..46f061d89c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy @@ -159,4 +159,79 @@ class CreateSliceServiceTest extends MsoGroovyTest { assertNotNull(values) } + @Test + void testPrepareDecomposeService() { + when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest) + when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) + CreateSliceService sliceService = new CreateSliceService() + sliceService.prepareDecomposeService(mockExecution) + + String serviceModelInfoExcept = """{ + "modelInvariantUuid":"123456", + "modelUuid":"123456", + "modelVersion":"" + }""" + Mockito.verify(mockExecution, times(1)).setVariable(eq("ssServiceModelInfo"), captor.capture()) + String serviceModelInfo = captor.getValue() + assertEquals(serviceModelInfoExcept.replaceAll("\\s+", ""), + serviceModelInfo.replaceAll("\\s+", "")) + } + + @Test + void testProcessDecomposition() { + when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest) + when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) + when(mockExecution.getVariable("nstSolution")).thenReturn(nstSolution) + + CreateSliceService sliceService = new CreateSliceService() + sliceService.processDecomposition(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("subscriptionServiceType"), captor.capture()) + assertEquals(captor.getValue(), "5G") + Mockito.verify(mockExecution, times(1)).setVariable(eq("serviceType"), captor.capture()) + assertEquals(captor.getValue(), "embb") + Mockito.verify(mockExecution, times(1)).setVariable(eq("resourceSharingLevel"), captor.capture()) + assertEquals(captor.getValue(), "shared") + Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelUuid"), captor.capture()) + assertEquals(captor.getValue(), "aaaaaa") + Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelInvariantUuid"), captor.capture()) + assertEquals(captor.getValue(), "bbbbbb") + } + + @Test + void testPrepareCreateOrchestrationTask() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("test") + when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile) + + CreateSliceService sliceService = new CreateSliceService() + sliceService.prepareCreateOrchestrationTask(mockExecution) + + SliceTaskParams sliceTaskParamsExpect = new SliceTaskParams() + sliceTaskParamsExpect.setServiceId("123456") + sliceTaskParamsExpect.setServiceName("test") + sliceTaskParamsExpect.setServiceProfile(serviceProfile) + String paramJsonExpect = sliceTaskParamsExpect.convertToJson() + + Mockito.verify(mockExecution, times(2)).setVariable(eq("subscriptionServiceType"), captor.capture()) + List allValues = captor.getAllValues() + SliceTaskParams sliceTaskParams = allValues.get(0) + String paramJson = allValues.get(1) + assertEquals(sliceTaskParams.getServiceId(), sliceTaskParams.getServiceId()) + assertEquals(sliceTaskParams.getServiceName(), sliceTaskParams.getServiceName()) + assertEquals(sliceTaskParams.getServiceProfile(), sliceTaskParams.getServiceProfile()) + assertEquals(paramJsonExpect, paramJson) + } + + @Test + void testSendSyncResponse() { + when(mockExecution.getVariable("operationId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + CreateSliceService sliceService = new CreateSliceService() + sliceService.sendSyncResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture()) + def catchSyncResponse = captor.getValue() + assertEquals(catchSyncResponse, true) + } + } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn index 24ca7104a7..5d523194bb 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn @@ -1,15 +1,15 @@ <?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4"> +<bpmn:definitions xmlns:bpmn="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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0"> <bpmn:process id="PNFSWUPDownload" name="PNFSWUPDownload" isExecutable="true"> <bpmn:startEvent id="download_StartEvent" name="Start Flow"> <bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}"> <bpmn:incoming>SequenceFlow_1fdclh0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0kusy70</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="download_EndEvent" name="End"> - <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0mjjdia</bpmn:incoming> <bpmn:terminateEventDefinition id="TerminateEventDefinition_1kiurmf" /> </bpmn:endEvent> <bpmn:exclusiveGateway id="ExclusiveGateway_1ja7grm" default="SequenceFlow_078xmlz"> @@ -32,8 +32,8 @@ </bpmn:endEvent> <bpmn:exclusiveGateway id="ExclusiveGateway_08lusga" default="SequenceFlow_1gawssm"> <bpmn:incoming>SequenceFlow_1kaikh5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1gawssm</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:endEvent id="EndEvent_11hee4g"> <bpmn:incoming>SequenceFlow_1gawssm</bpmn:incoming> @@ -73,10 +73,7 @@ <bpmn:outgoing>SequenceFlow_1ccldpp</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1fdclh0" sourceRef="download_StartEvent" targetRef="ServiceTask_1mpt2eq" /> - <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ServiceTask_1mpt2eq" targetRef="ServiceTask_1nl90ao" /> - <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="download_EndEvent"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ScriptTask_1ankfw8" targetRef="ServiceTask_1nl90ao" /> <bpmn:sequenceFlow id="SequenceFlow_0o6b6a8" sourceRef="ServiceTask_0yavde3" targetRef="ExclusiveGateway_1ja7grm" /> <bpmn:sequenceFlow id="SequenceFlow_078xmlz" name="Failure" sourceRef="ExclusiveGateway_1ja7grm" targetRef="EndEvent_1j64ij1" /> <bpmn:sequenceFlow id="SequenceFlow_1ccldpp" sourceRef="ServiceTask_1nl90ao" targetRef="ExclusiveGateway_1rj84ne" /> @@ -89,113 +86,229 @@ <bpmn:sequenceFlow id="SequenceFlow_0qznt4u" name="Success" sourceRef="ExclusiveGateway_1ja7grm" targetRef="ServiceTask_1wxo7xz"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> </bpmn:sequenceFlow> + <bpmn:subProcess id="SubProcess_02e59i3" name="Subprocess for FalloutHandler" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0uftj43" name="Catch All Errors"> + <bpmn:outgoing>SequenceFlow_0swi04u</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_061iekb" /> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_1yzq4u7" name="Prepare FalloutHandler" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0swi04u</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ppn4a8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0ikcgtm" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1ppn4a8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ahmdun</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_1xtb63b" name="End"> + <bpmn:incoming>SequenceFlow_1ahmdun</bpmn:incoming> + <bpmn:terminateEventDefinition id="TerminateEventDefinition_1vngo0e" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1ahmdun" sourceRef="CallActivity_0ikcgtm" targetRef="EndEvent_1xtb63b" /> + <bpmn:sequenceFlow id="SequenceFlow_1ppn4a8" sourceRef="ScriptTask_1yzq4u7" targetRef="CallActivity_0ikcgtm" /> + <bpmn:sequenceFlow id="SequenceFlow_0swi04u" sourceRef="StartEvent_0uftj43" targetRef="ScriptTask_1yzq4u7" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_1ankfw8" name="Send Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0kusy70</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.sendResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0kusy70" sourceRef="ServiceTask_1mpt2eq" targetRef="ScriptTask_1ankfw8" /> + <bpmn:scriptTask id="ScriptTask_17f7m2t" name="Prepare Completion" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_183s0wo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareCompletion(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_0tq2dug" name="Complete Process" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_183s0wo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mjjdia</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_183s0wo" sourceRef="ScriptTask_17f7m2t" targetRef="CallActivity_0tq2dug" /> + <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="ScriptTask_17f7m2t"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0mjjdia" sourceRef="CallActivity_0tq2dug" targetRef="download_EndEvent" /> </bpmn:process> <bpmn:error id="Error_1q14dnd" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSWUPDownload"> <bpmndi:BPMNShape id="StartEvent_1k8gssq_di" bpmnElement="download_StartEvent"> - <dc:Bounds x="162" y="102" width="36" height="36" /> + <dc:Bounds x="172" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="157" y="145" width="50" height="14" /> + <dc:Bounds x="167" y="146" width="50" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1mpt2eq_di" bpmnElement="ServiceTask_1mpt2eq"> - <dc:Bounds x="280" y="80" width="100" height="80" /> + <dc:Bounds x="270" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1e4dq7w_di" bpmnElement="download_EndEvent"> - <dc:Bounds x="1312" y="102" width="36" height="36" /> + <dc:Bounds x="512" y="463" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1321" y="145" width="20" height="14" /> + <dc:Bounds x="522" y="506" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1ja7grm_di" bpmnElement="ExclusiveGateway_1ja7grm" isMarkerVisible="true"> - <dc:Bounds x="895" y="95" width="50" height="50" /> + <dc:Bounds x="615" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1j64ij1_di" bpmnElement="EndEvent_1j64ij1"> - <dc:Bounds x="902" y="252" width="36" height="36" /> + <dc:Bounds x="622" y="344" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1rj84ne_di" bpmnElement="ExclusiveGateway_1rj84ne" isMarkerVisible="true"> - <dc:Bounds x="635" y="95" width="50" height="50" /> + <dc:Bounds x="355" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1ubpef4_di" bpmnElement="EndEvent_1ubpef4"> - <dc:Bounds x="642" y="252" width="36" height="36" /> + <dc:Bounds x="362" y="344" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_08lusga_di" bpmnElement="ExclusiveGateway_08lusga" isMarkerVisible="true"> - <dc:Bounds x="1155" y="95" width="50" height="50" /> + <dc:Bounds x="875" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_11hee4g_di" bpmnElement="EndEvent_11hee4g"> - <dc:Bounds x="1162" y="252" width="36" height="36" /> + <dc:Bounds x="882" y="344" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0yavde3_di" bpmnElement="ServiceTask_0yavde3"> - <dc:Bounds x="760" y="80" width="100" height="80" /> + <dc:Bounds x="480" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1wxo7xz_di" bpmnElement="ServiceTask_1wxo7xz"> - <dc:Bounds x="1000" y="80" width="100" height="80" /> + <dc:Bounds x="720" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1nl90ao_di" bpmnElement="ServiceTask_1nl90ao"> - <dc:Bounds x="480" y="80" width="100" height="80" /> + <dc:Bounds x="200" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0"> - <di:waypoint x="198" y="120" /> - <di:waypoint x="280" y="120" /> + <di:waypoint x="208" y="121" /> + <di:waypoint x="270" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6"> - <di:waypoint x="380" y="120" /> - <di:waypoint x="480" y="120" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx"> - <di:waypoint x="1205" y="120" /> - <di:waypoint x="1312" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1214" y="102" width="43" height="14" /> - </bpmndi:BPMNLabel> + <di:waypoint x="540" y="121" /> + <di:waypoint x="570" y="121" /> + <di:waypoint x="570" y="190" /> + <di:waypoint x="160" y="190" /> + <di:waypoint x="160" y="260" /> + <di:waypoint x="200" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8"> - <di:waypoint x="860" y="120" /> - <di:waypoint x="895" y="120" /> + <di:waypoint x="580" y="260" /> + <di:waypoint x="615" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz"> - <di:waypoint x="920" y="145" /> - <di:waypoint x="920" y="252" /> + <di:waypoint x="640" y="285" /> + <di:waypoint x="640" y="344" /> <bpmndi:BPMNLabel> - <dc:Bounds x="918" y="217" width="34" height="14" /> + <dc:Bounds x="650" y="291" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp"> - <di:waypoint x="580" y="120" /> - <di:waypoint x="635" y="120" /> + <di:waypoint x="300" y="260" /> + <di:waypoint x="355" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9"> - <di:waypoint x="685" y="120" /> - <di:waypoint x="760" y="120" /> + <di:waypoint x="405" y="260" /> + <di:waypoint x="480" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="678" y="102" width="43" height="14" /> + <dc:Bounds x="398" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1"> - <di:waypoint x="660" y="145" /> - <di:waypoint x="660" y="252" /> + <di:waypoint x="380" y="285" /> + <di:waypoint x="380" y="344" /> <bpmndi:BPMNLabel> - <dc:Bounds x="658" y="217" width="34" height="14" /> + <dc:Bounds x="384" y="292" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5"> - <di:waypoint x="1100" y="120" /> - <di:waypoint x="1155" y="120" /> + <di:waypoint x="820" y="260" /> + <di:waypoint x="875" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm"> - <di:waypoint x="1180" y="145" /> - <di:waypoint x="1180" y="252" /> + <di:waypoint x="900" y="285" /> + <di:waypoint x="900" y="344" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1178" y="172" width="34" height="14" /> + <dc:Bounds x="912" y="290" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u"> - <di:waypoint x="945" y="120" /> - <di:waypoint x="1000" y="120" /> + <di:waypoint x="665" y="260" /> + <di:waypoint x="720" y="260" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="671" y="242" width="43" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_02e59i3_di" bpmnElement="SubProcess_02e59i3" isExpanded="true"> + <dc:Bounds x="190" y="580" width="650" height="190" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0uftj43_di" bpmnElement="StartEvent_0uftj43"> + <dc:Bounds x="262" y="662" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="242" y="703" width="76" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1yzq4u7_di" bpmnElement="ScriptTask_1yzq4u7"> + <dc:Bounds x="360" y="640" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0ikcgtm_di" bpmnElement="CallActivity_0ikcgtm"> + <dc:Bounds x="530" y="640" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1xtb63b_di" bpmnElement="EndEvent_1xtb63b"> + <dc:Bounds x="702" y="662" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="951" y="102" width="43" height="14" /> + <dc:Bounds x="712" y="705" width="18" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun"> + <di:waypoint x="630" y="680" /> + <di:waypoint x="702" y="680" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8"> + <di:waypoint x="460" y="680" /> + <di:waypoint x="530" y="680" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u"> + <di:waypoint x="298" y="680" /> + <di:waypoint x="360" y="680" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ankfw8_di" bpmnElement="ScriptTask_1ankfw8"> + <dc:Bounds x="440" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70"> + <di:waypoint x="370" y="121" /> + <di:waypoint x="440" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_17f7m2t_di" bpmnElement="ScriptTask_17f7m2t"> + <dc:Bounds x="202" y="441" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0tq2dug_di" bpmnElement="CallActivity_0tq2dug"> + <dc:Bounds x="355" y="441" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo"> + <di:waypoint x="302" y="481" /> + <di:waypoint x="355" y="481" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx"> + <di:waypoint x="925" y="260" /> + <di:waypoint x="970" y="260" /> + <di:waypoint x="970" y="410" /> + <di:waypoint x="160" y="410" /> + <di:waypoint x="160" y="481" /> + <di:waypoint x="202" y="481" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="938" y="242" width="43" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia"> + <di:waypoint x="455" y="481" /> + <di:waypoint x="512" y="481" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn index 8d59dac8ac..4ff0af4549 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4"> +<bpmn:definitions xmlns:bpmn="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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0"> <bpmn:process id="PNFSoftwareUpgrade" name="PNFSoftwareUpgrade" isExecutable="true"> <bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow"> <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing> @@ -8,9 +8,9 @@ <bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming> <bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ServiceTask_0slpahe" /> + <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ScriptTask_10klpg8" /> <bpmn:endEvent id="softwareUpgrade_endEvent" name="End"> - <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0tle5zb</bpmn:incoming> <bpmn:terminateEventDefinition /> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1ng4b6l" sourceRef="softwareUpgrade_startEvent" targetRef="ServiceTask_042uz7n" /> @@ -60,7 +60,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1eljvek" name="Success" sourceRef="ExclusiveGateway_0v3l3wv" targetRef="ServiceTask_02lxf48"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="softwareUpgrade_endEvent"> + <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="ScriptTask_1igtc83"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0eiif6e" name="Success" sourceRef="ExclusiveGateway_0ch3fef" targetRef="ServiceTask_1jo8vn7"> @@ -110,7 +110,7 @@ <camunda:inputParameter name="mode">async</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ks3p41</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0j26xlx</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0j26xlx" sourceRef="ServiceTask_0slpahe" targetRef="ExclusiveGateway_0x6h0ni" /> @@ -119,9 +119,59 @@ <bpmn:outgoing>SequenceFlow_084orr1</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_084orr1" sourceRef="ServiceTask_1jo8vn7" targetRef="ServiceTask_0y2uysu" /> + <bpmn:scriptTask id="ScriptTask_10klpg8" name="Send Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ks3p41</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.sendResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ks3p41" sourceRef="ScriptTask_10klpg8" targetRef="ServiceTask_0slpahe" /> + <bpmn:scriptTask id="ScriptTask_1igtc83" name="Prepare Completion" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ipc3nt</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareCompletion(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ipc3nt" sourceRef="ScriptTask_1igtc83" targetRef="CallActivity_0o1mi8u" /> + <bpmn:callActivity id="CallActivity_0o1mi8u" name="Complete Process" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0ipc3nt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0tle5zb</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0tle5zb" sourceRef="CallActivity_0o1mi8u" targetRef="softwareUpgrade_endEvent" /> + <bpmn:subProcess id="SubProcess_02p6q4s" name="Subprocess for FalloutHandler" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_149ecdm" name="Catch All Errors"> + <bpmn:outgoing>SequenceFlow_05haut5</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1" /> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_0gov132" name="Prepare FalloutHandler" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_05haut5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09y0mpc</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new PNFSoftwareUpgrade() +pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_00psvtk" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_09y0mpc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tcjlty</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_1vq2glg" name="End"> + <bpmn:incoming>SequenceFlow_1tcjlty</bpmn:incoming> + <bpmn:terminateEventDefinition id="TerminateEventDefinition_0994ojb" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_05haut5" sourceRef="StartEvent_149ecdm" targetRef="ScriptTask_0gov132" /> + <bpmn:sequenceFlow id="SequenceFlow_09y0mpc" sourceRef="ScriptTask_0gov132" targetRef="CallActivity_00psvtk" /> + <bpmn:sequenceFlow id="SequenceFlow_1tcjlty" sourceRef="CallActivity_00psvtk" targetRef="EndEvent_1vq2glg" /> + </bpmn:subProcess> </bpmn:process> <bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> - <bpmn:error id="Error_0nmskzh" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSoftwareUpgrade"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="softwareUpgrade_startEvent"> @@ -131,142 +181,204 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7n"> - <dc:Bounds x="280" y="80" width="100" height="80" /> + <dc:Bounds x="270" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m"> - <di:waypoint x="380" y="120" /> - <di:waypoint x="480" y="120" /> + <di:waypoint x="370" y="120" /> + <di:waypoint x="440" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="softwareUpgrade_endEvent"> - <dc:Bounds x="1662" y="102" width="36" height="36" /> + <dc:Bounds x="532" y="462" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1671" y="145" width="20" height="14" /> + <dc:Bounds x="542" y="505" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l"> <di:waypoint x="198" y="120" /> - <di:waypoint x="280" y="120" /> + <di:waypoint x="270" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0v3l3wv_di" bpmnElement="ExclusiveGateway_0v3l3wv" isMarkerVisible="true"> - <dc:Bounds x="895" y="95" width="50" height="50" /> + <dc:Bounds x="615" y="235" width="50" height="50" /> <bpmndi:BPMNLabel> <dc:Bounds x="1040" y="65" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0bnbfds_di" bpmnElement="EndEvent_0bnbfds"> - <dc:Bounds x="902" y="252" width="36" height="36" /> + <dc:Bounds x="622" y="342" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="1044" y="295" width="34" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0ni" isMarkerVisible="true"> - <dc:Bounds x="635" y="95" width="50" height="50" /> + <dc:Bounds x="355" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5"> - <di:waypoint x="685" y="120" /> - <di:waypoint x="760" y="120" /> + <di:waypoint x="405" y="260" /> + <di:waypoint x="460" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="678" y="102" width="43" height="14" /> + <dc:Bounds x="408" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y"> - <dc:Bounds x="642" y="252" width="36" height="36" /> + <dc:Bounds x="362" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91"> - <di:waypoint x="660" y="145" /> - <di:waypoint x="660" y="252" /> + <di:waypoint x="380" y="285" /> + <di:waypoint x="380" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="658" y="217" width="34" height="14" /> + <dc:Bounds x="384" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu"> - <di:waypoint x="920" y="145" /> - <di:waypoint x="920" y="252" /> + <di:waypoint x="640" y="285" /> + <di:waypoint x="640" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="918" y="217" width="34" height="14" /> + <dc:Bounds x="644" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0ch3fef_di" bpmnElement="ExclusiveGateway_0ch3fef" isMarkerVisible="true"> - <dc:Bounds x="1125" y="95" width="50" height="50" /> + <dc:Bounds x="845" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1ms4wdz_di" bpmnElement="EndEvent_1ms4wdz"> - <dc:Bounds x="1132" y="252" width="36" height="36" /> + <dc:Bounds x="852" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c"> - <di:waypoint x="1150" y="145" /> - <di:waypoint x="1150" y="252" /> + <di:waypoint x="870" y="285" /> + <di:waypoint x="870" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1148" y="230" width="34" height="14" /> + <dc:Bounds x="874" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1ny9b1z_di" bpmnElement="ExclusiveGateway_1ny9b1z" isMarkerVisible="true"> - <dc:Bounds x="1505" y="95" width="50" height="50" /> + <dc:Bounds x="1225" y="235" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0l6n6x5_di" bpmnElement="EndEvent_0l6n6x5"> - <dc:Bounds x="1512" y="252" width="36" height="36" /> + <dc:Bounds x="1232" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph"> - <di:waypoint x="1530" y="145" /> - <di:waypoint x="1530" y="252" /> + <di:waypoint x="1250" y="285" /> + <di:waypoint x="1250" y="342" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1528" y="172" width="34" height="14" /> + <dc:Bounds x="1254" y="293" width="32" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek"> - <di:waypoint x="945" y="120" /> - <di:waypoint x="1010" y="120" /> + <di:waypoint x="665" y="260" /> + <di:waypoint x="720" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="938" y="102" width="43" height="14" /> + <dc:Bounds x="668" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu"> - <di:waypoint x="1555" y="120" /> - <di:waypoint x="1662" y="120" /> + <di:waypoint x="1275" y="260" /> + <di:waypoint x="1320" y="260" /> + <di:waypoint x="1320" y="410" /> + <di:waypoint x="180" y="410" /> + <di:waypoint x="180" y="480" /> + <di:waypoint x="220" y="480" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1564" y="102" width="43" height="14" /> + <dc:Bounds x="1277" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e"> - <di:waypoint x="1175" y="120" /> - <di:waypoint x="1210" y="120" /> + <di:waypoint x="895" y="260" /> + <di:waypoint x="950" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1169" y="102" width="43" height="14" /> + <dc:Bounds x="898" y="242" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0x5cje8_di" bpmnElement="ServiceTask_0x5cje8"> - <dc:Bounds x="760" y="80" width="100" height="80" /> + <dc:Bounds x="460" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih"> - <di:waypoint x="860" y="120" /> - <di:waypoint x="895" y="120" /> + <di:waypoint x="560" y="260" /> + <di:waypoint x="615" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_02lxf48_di" bpmnElement="ServiceTask_02lxf48"> - <dc:Bounds x="1010" y="80" width="100" height="80" /> + <dc:Bounds x="720" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785"> - <di:waypoint x="1110" y="120" /> - <di:waypoint x="1125" y="120" /> + <di:waypoint x="820" y="260" /> + <di:waypoint x="845" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0y2uysu_di" bpmnElement="ServiceTask_0y2uysu"> - <dc:Bounds x="1370" y="80" width="100" height="80" /> + <dc:Bounds x="1090" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0"> - <di:waypoint x="1470" y="120" /> - <di:waypoint x="1505" y="120" /> + <di:waypoint x="1190" y="260" /> + <di:waypoint x="1225" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpahe"> - <dc:Bounds x="480" y="80" width="100" height="80" /> + <dc:Bounds x="220" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx"> - <di:waypoint x="580" y="120" /> - <di:waypoint x="635" y="120" /> + <di:waypoint x="320" y="260" /> + <di:waypoint x="355" y="260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1jo8vn7_di" bpmnElement="ServiceTask_1jo8vn7"> - <dc:Bounds x="1210" y="80" width="100" height="80" /> + <dc:Bounds x="950" y="220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1"> - <di:waypoint x="1310" y="120" /> - <di:waypoint x="1370" y="120" /> + <di:waypoint x="1050" y="260" /> + <di:waypoint x="1090" y="260" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_10klpg8_di" bpmnElement="ScriptTask_10klpg8"> + <dc:Bounds x="440" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41"> + <di:waypoint x="540" y="120" /> + <di:waypoint x="570" y="120" /> + <di:waypoint x="570" y="190" /> + <di:waypoint x="180" y="190" /> + <di:waypoint x="180" y="260" /> + <di:waypoint x="220" y="260" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1igtc83_di" bpmnElement="ScriptTask_1igtc83"> + <dc:Bounds x="220" y="440" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt"> + <di:waypoint x="320" y="480" /> + <di:waypoint x="380" y="480" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0o1mi8u_di" bpmnElement="CallActivity_0o1mi8u"> + <dc:Bounds x="380" y="440" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb"> + <di:waypoint x="480" y="480" /> + <di:waypoint x="532" y="480" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132"> + <dc:Bounds x="540" y="630" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk"> + <dc:Bounds x="710" y="630" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg"> + <dc:Bounds x="882" y="652" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="892" y="695" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_09y0mpc_di" bpmnElement="SequenceFlow_09y0mpc"> + <di:waypoint x="640" y="670" /> + <di:waypoint x="710" y="670" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty"> + <di:waypoint x="810" y="670" /> + <di:waypoint x="882" y="670" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_1r4h504_di" bpmnElement="StartEvent_149ecdm"> + <dc:Bounds x="442" y="652" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="422" y="693" width="76" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true"> + <dc:Bounds x="370" y="570" width="650" height="190" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5"> + <di:waypoint x="478" y="670" /> + <di:waypoint x="540" y="670" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java index a9bf4352bf..2993ed6724 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +61,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { private static final String TEST_PROCESSINSTANCE_KEY = "PNFSoftwareUpgrade"; private static final AAIVersion VERSION = AAIVersion.LATEST; private static final Map<String, Object> executionVariables = new HashMap(); + private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5"; private final String[] actionNames = new String[4]; private String requestObject; private String responseObject; @@ -80,6 +82,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json"); executionVariables.put("bpmnRequest", requestObject); + executionVariables.put("requestId", REQUEST_ID); /** * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}. @@ -99,6 +102,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { public void workflow_validInput_expectedOutput() throws InterruptedException { mockCatalogDb(); + mockRequestDb(); mockAai(); final String msoRequestId = UUID.randomUUID().toString(); @@ -118,9 +122,9 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { // Layout is to reflect the bpmn visual layout assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", - "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", - "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", - "softwareUpgrade_endEvent"); + "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", + "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", + "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); assertThat(detailedMessages.size() == 4); @@ -202,6 +206,14 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest { wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo"))); } + private void mockRequestDb() { + /** + * Update Request DB + */ + wireMockServer.stubFor(put(urlEqualTo("/infraActiveRequests/" + REQUEST_ID))); + + } + /** * Mock the catalobdb rest interface. */ diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java index 9697246b03..9c55d0a922 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java @@ -1,7 +1,9 @@ package org.onap.so.bpmn.infrastructure.appc.tasks; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; import org.onap.appc.client.lcm.model.Action; @@ -29,6 +31,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class AppcOrchestratorPreProcessor { @@ -84,8 +88,16 @@ public class AppcOrchestratorPreProcessor { appcTaskRequest.setNewSoftwareVersion(newSoftwareVersion); String operationsTimeout = JsonUtils.getJsonValue(payload, "operations_timeout"); appcTaskRequest.setOperationsTimeout(operationsTimeout); - } + Map<String, String> configMap = new HashMap<>(); + ObjectMapper objectMapper = new ObjectMapper(); + String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters"); + if (configParamsStr != null) { + configMap = + objectMapper.readValue(configParamsStr, new TypeReference<HashMap<String, String>>() {}); + } + appcTaskRequest.setConfigParams(configMap); + } ControllerSelectionReference controllerSelectionReference = catalogDbClient .getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString()); String controllerType = null; @@ -229,8 +241,13 @@ public class AppcOrchestratorPreProcessor { .isEmpty()) { errorMessage = "APPC action Snapshot is missing vserverId parameter. "; } - break; } + break; + case ConfigModify: + if (appcTaskRequest.getConfigParams().isEmpty() || appcTaskRequest.getConfigParams() == null) { + errorMessage = "APPC action ConfigModify is missing Configuration parameters. "; + } + break; default: break; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java index 8499b6f7d1..ea3405d423 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix - * Modifications Copyright (C) 2020 Huawei + * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.PayloadGenerationException; import org.onap.so.client.sdnc.common.SDNCConstants; import org.onap.so.client.sdnc.lcm.*; import org.onap.so.client.sdnc.lcm.beans.*; @@ -59,26 +61,20 @@ public class SdncControllerDE extends LcmControllerDE { logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(), execution.getCurrentActivityName()); - boolean result; try { LcmInput lcmInput = buildLcmInput(execution); - if (lcmInput != null) { - result = sendLcmRequest(execution, lcmInput); - } else { - logger.error("Build LCM Input error"); - result = false; - } - } catch (Exception e) { - logger.error("Call SDNC LCM Client failure: ", e); - result = false; - } + sendLcmRequest(execution, lcmInput); - if (result) { execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success"); - } else { + } catch (Exception e) { execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure"); + + exceptionUtil.buildAndThrowWorkflowException(execution, SDNC_DELEGATE_EXECUTION_ERROR_CODE, e); } + logger.debug("Finish activity for id: {}, name: {}", execution.getCurrentActivityId(), + execution.getCurrentActivityName()); + return 0; } @@ -87,17 +83,24 @@ public class SdncControllerDE extends LcmControllerDE { return SDNC_DELEGATE_EXECUTION_ERROR_CODE; } - private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) { + private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) throws BadResponseException { SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); SDNCLcmRestClient sdncLcmRestClient; try { sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation); } catch (SDNCLcmClientBuilderException e) { logger.error("Create SDNCLcmRestClient error: ", e); - return null; + throw new BadResponseException("Can not send request to SDNC."); } - return sdncLcmRestClient.sendRequest(lcmInput); + LcmOutput lcmOutput; + try { + lcmOutput = sdncLcmRestClient.sendRequest(lcmInput); + } catch (Exception e) { + logger.error("SDNCLcmRestClient sends request failure: ", e); + throw new BadResponseException("Send request to SDNC failure."); + } + return lcmOutput; } private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) { @@ -115,22 +118,22 @@ public class SdncControllerDE extends LcmControllerDE { return null; } - private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) { + private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) throws BadResponseException { SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); SDNCLcmDmaapClient sdncLcmDmaapClient; try { sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient(); } catch (SDNCLcmClientBuilderException e) { logger.error("Create SDNCLcmDmaapClient error: ", e); - return null; + throw new BadResponseException("Can not send request to SDNC."); } LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput); try { sdncLcmDmaapClient.sendRequest(lcmDmaapRequest); } catch (Exception e) { - logger.error("SDNCLcmDmaapClient sends request error: ", e); - return null; + logger.error("SDNCLcmDmaapClient sends request failure: ", e); + throw new BadResponseException("Send request to SDNC failure."); } long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout(); @@ -146,8 +149,9 @@ public class SdncControllerDE extends LcmControllerDE { long stopTime = System.currentTimeMillis(); if ((stopTime - startTime) > timeout) { - logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction()); - return null; + String msg = "Timeout for SDNC LCM action " + lcmInput.getAction(); + logger.error(msg); + throw new BadResponseException(msg); } } } @@ -158,7 +162,15 @@ public class SdncControllerDE extends LcmControllerDE { return lcmAction.replaceAll(regex, replacement).toLowerCase(); } - private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException { + private String convertToSting(Object msgObject) throws PayloadGenerationException { + try { + return SDNCLcmPayloadBuilder.convertToSting(msgObject); + } catch (JsonProcessingException e) { + throw new PayloadGenerationException(e.getMessage()); + } + } + + private LcmInput buildLcmInput(DelegateExecution execution) throws PayloadGenerationException { String requestId = String.valueOf(execution.getVariable(REQUEST_ID)); String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION)); String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID)); @@ -176,32 +188,33 @@ public class SdncControllerDE extends LcmControllerDE { UpgradePreCheckPayload upgradePreCheckPayload; upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload); + lcmPayload = convertToSting(upgradePreCheckPayload); break; case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW: lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW; DownloadNESwPayload downloadNESwPayload; downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload); + lcmPayload = convertToSting(downloadNESwPayload); break; case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW: lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW; ActivateNESwPayload activateNESwPayload; activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload); + lcmPayload = convertToSting(activateNESwPayload); break; case SoPropertyConstants.ACTION_POST_CHECK: lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK; UpgradePostCheckPayload upgradePostCheckPayload; upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload); + lcmPayload = convertToSting(upgradePostCheckPayload); break; default: - logger.error("Unsupported SO Action: " + requestAction); - return null; + String msg = "Unsupported SO Action: " + requestAction; + logger.error(msg); + throw new PayloadGenerationException(msg); } String subRequestId = UUID.randomUUID().toString(); @@ -209,32 +222,33 @@ public class SdncControllerDE extends LcmControllerDE { SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload); ObjectMapper mapper = new ObjectMapper(); - String lcmInputMsg = mapper.writeValueAsString(lcmInput); - logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg); + try { + String lcmInputMsg = mapper.writeValueAsString(lcmInput); + logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg); + } catch (JsonProcessingException e) { + throw new PayloadGenerationException(e.getMessage()); + } return lcmInput; } - private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) { - if (lcmOutput == null) { - logger.error("Call SDNC LCM API failure"); - return false; - } - + private void parseLcmOutput(LcmOutput lcmOutput, String lcmAction) throws BadResponseException { LcmStatus lcmStatus = lcmOutput.getStatus(); + int lcmStatusCode = lcmStatus.getCode(); String outputPayload = lcmOutput.getPayload(); - logger.debug("SDNC LCM output payload of action {}: {}", lcmAction, outputPayload); - if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) { - logger.debug("Call SDNC LCM API for {} success, message: {}", lcmAction, lcmStatus.getMessage()); - return true; + if (lcmStatusCode == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) { + logger.debug("Call SDNC LCM API for {} success, code: {}, message: {}, payload: {}", lcmAction, + lcmStatusCode, lcmStatus.getMessage(), outputPayload); } else { - logger.error("Call SDNC LCM API for {} failure, message: {}", lcmAction, lcmStatus.getMessage()); - return false; + String msg = String.format("Call SDNC LCM API for %s failure, code: %d, message: %s, payload: %s", + lcmAction, lcmStatusCode, lcmStatus.getMessage(), outputPayload); + logger.error(msg); + throw new BadResponseException(msg); } } - private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) { + private void sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) throws BadResponseException { String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE)); String lcmOperation = toLowerHyphen(lcmInput.getAction()); @@ -245,6 +259,6 @@ public class SdncControllerDE extends LcmControllerDE { lcmOutput = sendSyncRequest(lcmOperation, lcmInput); } - return parseLcmOutput(lcmOutput, lcmInput.getAction()); + parseLcmOutput(lcmOutput, lcmInput.getAction()); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index eead1761ea..e01149f981 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -83,7 +83,6 @@ import org.onap.so.serviceinstancebeans.Networks; import org.onap.so.serviceinstancebeans.Pnfs; import org.onap.so.serviceinstancebeans.RelatedInstance; import org.onap.so.serviceinstancebeans.RequestDetails; -import org.onap.so.serviceinstancebeans.RequestInfo; import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.serviceinstancebeans.VfModules; @@ -169,18 +168,6 @@ public class WorkflowAction { } public void selectExecutionList(DelegateExecution execution) throws Exception { - final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION); - final String vnfType = (String) execution.getVariable(VNF_TYPE); - String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); - final String createInstanceAction = "createInstance"; - final String serviceType = - Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse(""); - - List<OrchestrationFlow> orchFlows = - (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW); - WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); - List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); - List<Resource> resourceList = new ArrayList<>(); execution.setVariable("sentSyncResponse", false); execution.setVariable("homing", false); execution.setVariable("calledHoming", false); @@ -205,8 +192,9 @@ public class WorkflowAction { WorkflowType resourceType = resource.getResourceType(); execution.setVariable("resourceName", resourceType.toString()); String resourceId = ""; - final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION); - if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction) + String requestAction = (String) execution.getVariable(BBConstants.G_ACTION); + WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); + if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance") && sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) { resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType, sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(), @@ -214,6 +202,7 @@ public class WorkflowAction { } else { resourceId = resource.getResourceId(); } + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) { serviceInstanceId = resourceId; } @@ -232,10 +221,16 @@ public class WorkflowAction { "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found"); } } else { + String vnfType = (String) execution.getVariable(VNF_TYPE); String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration()); + List<OrchestrationFlow> orchFlows = + (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW); + final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION); + final String serviceType = + Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse(""); if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { - orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, + orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true, cloudOwner, serviceType); } String key = ""; @@ -248,12 +243,12 @@ public class WorkflowAction { } } boolean isConfiguration = isConfiguration(orchFlows); - Resource resourceKey = new Resource(resourceType, key, aLaCarte); + Resource resourceKey = new Resource(resourceType, key, true); if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) { List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks( new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows) .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion) - .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte) + .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true) .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds) .setRequestDetails(requestDetails).setExecution(execution)); @@ -269,19 +264,21 @@ public class WorkflowAction { orchFlows = getVfModuleReplaceBuildingBlocks( new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows) .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion) - .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte) + .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true) .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds) .setRequestDetails(requestDetails).setExecution(execution)); } for (OrchestrationFlow orchFlow : orchFlows) { ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, - apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, + apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, requestDetails, false, null, null, false); flowsToExecute.add(ebb); } } else { boolean foundRelated = false; boolean containsService = false; + List<Resource> resourceList = new ArrayList<>(); + List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) { // SERVICE-MACRO-ASSIGN will always get user params with a // service. @@ -440,13 +437,6 @@ public class WorkflowAction { return environment.getProperty(defaultCloudOwner); } - private boolean isSuppressRollback(RequestInfo requestInfo) { - if (requestInfo != null) { - return requestInfo.getSuppressRollback(); - } - return false; - } - protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectType type) { List<T> vnfcs = new ArrayList<>(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java index c78b652bd0..ea1f7b47ad 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java @@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.policy.JettisonStyleMapperProvider; @@ -163,4 +164,46 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest { genericVnf.setIpv4OamAddress("127.0.0.1"); return genericVnf; } + + @Test + public void buildAppcTaskRequestConfigModifyTest() throws Exception { + final String expectedRequestJson = + new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "appcTaskRequestConfigModify.json"))); + ApplicationControllerTaskRequest expectedTaskRequest = + mapper.readValue(expectedRequestJson, ApplicationControllerTaskRequest.class); + execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "-TEST"); + fillRequiredAppcExecutionFieldsConfigModify(); + GenericVnf genericVnf = getTestGenericVnf(); + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + mockReferenceResponseForConfigModify(); + execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST"); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("VF-MODULE-ID"); + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + appcOrchestratorPreProcessor.buildAppcTaskRequest(execution, "ConfigModify"); + ApplicationControllerTaskRequest actualTaskRequest = execution.getVariable("appcOrchestratorRequest"); + assertThat(actualTaskRequest, sameBeanAs(expectedTaskRequest)); + } + + private void fillRequiredAppcExecutionFieldsConfigModify() { + RequestContext context = new RequestContext(); + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setPayload( + "{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}"); + context.setRequestParameters(requestParameters); + context.setMsoRequestId("TEST-MSO-ID"); + execution.setVariable("aicIdentity", "AIC-TEST"); + execution.setVariable("vmIdList", "VM-ID-LIST-TEST"); + execution.setVariable("vserverIdList", "VSERVER-ID-LIST"); + execution.setVariable("identityUrl", "IDENTITY-URL-TEST"); + execution.getGeneralBuildingBlock().setRequestContext(context); + } + + private void mockReferenceResponseForConfigModify() { + ControllerSelectionReference reference = new ControllerSelectionReference(); + reference.setControllerName("APPC"); + when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"), + eq(Action.ConfigModify.toString()))).thenReturn(reference); + } + } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json new file mode 100644 index 0000000000..040c680d1c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json @@ -0,0 +1,13 @@ +{ + "ApplicationControllerTaskRequest": { + "controllerType": "APPC", + "action": "ConfigModify", + "identityUrl": "IDENTITY-URL-TEST", + "applicationControllerVnf": { + "vnfId": "TEST-VNF-ID", + "vnfName": "TEST-VNF-NAME", + "vnfHostIpAddress": "127.0.0.1" + }, + "configParams": {"name1":"value1", "name2":"value2"} +} +} diff --git a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java index 3811b52551..c240957ae9 100644 --- a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java +++ b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java @@ -1,6 +1,8 @@ package org.onap.so.appc.orchestrator.service.beans; import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; import org.onap.appc.client.lcm.model.Action; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf; @@ -18,6 +20,15 @@ public class ApplicationControllerTaskRequest implements Serializable { private String existingSoftwareVersion; private String newSoftwareVersion; private ApplicationControllerVnf applicationControllerVnf; + private Map<String, String> configParams = new HashMap<String, String>(); + + public Map<String, String> getConfigParams() { + return configParams; + } + + public void setConfigParams(Map<String, String> configParams) { + this.configParams = configParams; + } public Action getAction() { return action; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java index 05d43d093c..33994bae8b 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java @@ -78,11 +78,11 @@ public class CvnfcConfigurationCustomization implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "CONFIGURATION_MODEL_UUID") private ConfigurationResource configurationResource; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "CVNFC_CUSTOMIZATION_ID") private CvnfcCustomization cvnfcCustomization; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java index 7fb328fdb5..9bf0cdd6a7 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java @@ -92,11 +92,11 @@ public class CvnfcCustomization implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "VF_MODULE_CUSTOMIZATION_ID") private VfModuleCustomization vfModuleCustomization; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "VNFC_CUST_MODEL_CUSTOMIZATION_UUID") private VnfcCustomization vnfcCustomization; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java index 3420682900..83de95874c 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java @@ -21,10 +21,9 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; -import java.util.HashSet; import java.util.List; -import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -41,7 +40,6 @@ 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 org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import com.fasterxml.jackson.annotation.JsonFormat; import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @@ -98,7 +96,7 @@ public class VfModuleCustomization implements Serializable { private VnfResourceCustomization vnfCustomization; @OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization") - private Set<CvnfcCustomization> cvnfcCustomization; + private List<CvnfcCustomization> cvnfcCustomization; @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") private Boolean skipPostInstConf; @@ -233,13 +231,13 @@ public class VfModuleCustomization implements Serializable { } @LinkedResource - public Set<CvnfcCustomization> getCvnfcCustomization() { + public List<CvnfcCustomization> getCvnfcCustomization() { if (cvnfcCustomization == null) - cvnfcCustomization = new HashSet<>(); + cvnfcCustomization = new ArrayList<>(); return cvnfcCustomization; } - public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) { + public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) { this.cvnfcCustomization = cvnfcCustomization; } 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 26c33941ed..b130835062 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 @@ -915,7 +915,7 @@ public class CatalogDbClient { findVnfResourceCustomizationInList(vnfCustomizationUUID, service.getVnfCustomizations()); VfModuleCustomization vfModuleCust = findVfModuleCustomizationInList(vfModuleCustomizationUUID, vnfResourceCust.getVfModuleCustomizations()); - return vfModuleCust.getCvnfcCustomization().stream().collect(Collectors.toList()); + return vfModuleCust.getCvnfcCustomization(); } public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID, @@ -971,10 +971,9 @@ public class CatalogDbClient { List<CvnfcCustomization> cvnfcCustomization = getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid, vfModuleCustomizationUuid); CvnfcCustomization cvnfc = findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcCustomization); - List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc - .getCvnfcConfigurationCustomization().stream().filter(cvnfcCustom -> cvnfcCustom - .getConfigurationResource().getToscaNodeType().contains("FabricConfiguration")) - .collect(Collectors.toList()); + List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc.getCvnfcConfigurationCustomization(); + fabricConfigs.stream().filter(cvnfcCustom -> cvnfcCustom.getConfigurationResource().getToscaNodeType() + .contains("FabricConfiguration")).collect(Collectors.toList()); if (fabricConfigs != null && !fabricConfigs.isEmpty() && fabricConfigs.size() == 1) { logger.debug("Found Fabric Configuration: {}", fabricConfigs.get(0)); return fabricConfigs.get(0); diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java index e8addc4aa8..a13deae159 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java @@ -23,14 +23,10 @@ package org.onap.so.db.catalog.data.repository; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import org.junit.Assert; import org.junit.Test; import org.onap.so.db.catalog.BaseTest; -import org.onap.so.db.catalog.beans.ConfigurationResource; -import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; @@ -45,6 +41,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { @Autowired private CvnfcCustomizationRepository cvnfcCustomizationRepository; + @Test public void findAllTest() throws Exception { List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findAll(); @@ -125,14 +122,12 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { vnfResourceCustomization.setVnfResources(vnfResource); - VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); - - cvnfcCustomizationRepository.save(cvnfcCustomization); + List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); boolean matchFound = false; @@ -173,7 +168,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); vnfResourceCustomizations.add(vnfResourceCustomization); vnfResourceCustomization.setVnfResources(vnfResource); diff --git a/releases/1.6.0.yaml b/releases/1.6.0.yaml new file mode 100644 index 0000000000..8e1e371e5b --- /dev/null +++ b/releases/1.6.0.yaml @@ -0,0 +1,33 @@ +--- +distribution_type: 'container' +container_release_tag: '1.6.0' +project: 'so' +log_dir: 'so-maven-docker-stage-elalto/2/' +ref: '3c1f70e434b23e8bda331837c1e4ed8506f0166d' +containers: + - name: 'so/vnfm-adapter' + version: '1.6.0-20200326T0421' + - name: 'so/catalog-db-adapter' + version: '1.6.0-20200326T0421' + - name: 'so/request-db-adapter' + version: '1.6.0-20200326T0421' + - name: 'so/openstack-adapter' + version: '1.6.0-20200326T0421' + - name: 'so/sdnc-adapter' + version: '1.6.0-20200326T0421' + - name: 'so/vfc-adapter' + version: '1.6.0-20200326T0421' + - name: 'so/sdc-controller' + version: '1.6.0-20200326T0421' + - name: 'so/bpmn-infra' + version: '1.6.0-20200326T0421' + - name: 'so/so-monitoring' + version: '1.6.0-20200326T0421' + - name: 'so/api-handler-infra' + version: '1.6.0-20200326T0421' + - name: 'so/so-appc-orchestrator' + version: '1.6.0-20200326T0421' + - name: 'so/nssmf-adapter' + version: '1.6.0-20200326T0421' + - name: 'so/ve-vnfm-adapter' + version: '1.6.0-20200326T0421'
\ No newline at end of file diff --git a/version.properties b/version.properties index a0756adf2b..922c4fa961 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=6 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |