diff options
author | Boslet, Cory <cory.boslet@att.com> | 2020-03-25 16:04:41 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-03-26 11:44:39 -0400 |
commit | cd4e5b408603a13dabc58f832e4aae4194e81995 (patch) | |
tree | a53701a308644c0469b5242f7f8370766bd5a453 /bpmn/so-bpmn-tasks/src | |
parent | f5420060c758308df18a0e316d6ae214ef9eb5c6 (diff) |
convert openstack to external tasks
Use external tasks to communicate with openstack adapter
Will be more resilient to failures
Refactored all flows to use external tasks not REST calls
Rollback is now an external task
Ensured backwards compatibility
Issue-ID: SO-2767
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I8afdb89c688d756aed0f25f7d9a7fb898142554d
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
8 files changed, 35 insertions, 35 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index 8b78560521..97d78b5ee8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -91,7 +91,7 @@ public class VnfAdapterImpl { public void postProcessVnfAdapter(BuildingBlockExecution execution) { try { - String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response"); + String vnfAdapterResponse = execution.getVariable("WorkflowResponse"); if (!StringUtils.isEmpty(vnfAdapterResponse)) { Object vnfRestResponse = unMarshal(vnfAdapterResponse); if (vnfRestResponse instanceof CreateVfModuleResponse) { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java index 97a9388f8d..16e8c2de7d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -103,7 +103,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateResponseTest() { - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn()); @@ -119,20 +119,20 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>"); + execution.setVariable("WorkflowResponse", "<vfModuleStackId></vfModuleStackId>"); vnfAdapterImpl.postProcessVnfAdapter(execution); } @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() { - execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>"); + execution.setVariable("WorkflowResponse", "<createVfModuleResponse></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() { - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); @@ -140,7 +140,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() { - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); @@ -156,7 +156,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest() { vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); assertEquals(vfModule.getContrailServiceInstanceFqdn(), ""); @@ -170,7 +170,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() { - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); @@ -183,14 +183,14 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_ResponseNullTest() { - execution.setVariable("vnfAdapterRestV1Response", null); + execution.setVariable("WorkflowResponse", null); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } @Test public void postProcessVnfAdapter_ResponseEmptyTest() { - execution.setVariable("vnfAdapterRestV1Response", ""); + execution.setVariable("WorkflowResponse", ""); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); } @@ -198,7 +198,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() { vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); @@ -207,14 +207,14 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>"); + execution.setVariable("WorkflowResponse", "<vfModuleDeleted></vfModuleDeleted>"); vnfAdapterImpl.postProcessVnfAdapter(execution); } @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() { vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>"); + execution.setVariable("WorkflowResponse", "<deleteVfModuleResponse></deleteVfModuleResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); } @@ -230,7 +230,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateVolumeResponseTest() { - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_CREATE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); } @@ -238,7 +238,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>"); + execution.setVariable("WorkflowResponse", "<createVolumeGroupResponse></createVolumeGroupResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(volumeGroup.getHeatStackId()); } @@ -246,7 +246,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() { volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(volumeGroup.getHeatStackId()); } @@ -255,7 +255,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() { volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", + execution.setVariable("WorkflowResponse", "<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); @@ -264,14 +264,14 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() { expectedException.expect(BpmnError.class); - execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>"); + execution.setVariable("WorkflowResponse", "<volumeGroupDeleted></volumeGroupDeleted>"); vnfAdapterImpl.postProcessVnfAdapter(execution); } @Test public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() { volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID); - execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>"); + execution.setVariable("WorkflowResponse", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>"); vnfAdapterImpl.postProcessVnfAdapter(execution); assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); } @@ -281,7 +281,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)); - execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE); expectedException.expect(BpmnError.class); vnfAdapterImpl.postProcessVnfAdapter(execution); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 109dc55294..ccd4376a10 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java index a482da5158..9dfc245f68 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json index 19d42dddb9..4c97dbc53c 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json @@ -19,7 +19,7 @@ "allocationPools": [{ "start": "107.244.64.2", "end": "107.244.64.16" - }] + }] } ], "providerVlanNetwork": { diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json index b57c8341f1..3ba5627b38 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json @@ -14,13 +14,13 @@ "backout": false, "failIfExists": false, "enableBridge": true, - "msoRequest": + "msoRequest": { "requestId": "requestId", "serviceInstanceId": "serviceInstanceId" }, - "vfModuleParams": + "vfModuleParams": { "vnf_id": "vnfId", "vnf_name": "vnfName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json index da826b8a89..3fbf026176 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json @@ -12,13 +12,13 @@ "backout": false, "failIfExists": false, "enableBridge": true, - "msoRequest": + "msoRequest": { "requestId": "requestId", "serviceInstanceId": "serviceInstanceId" }, - "vfModuleParams": + "vfModuleParams": { "environment_context": "environmentContext", "key1": "value1", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json index 54f6e403ed..9f554490bd 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json @@ -14,13 +14,13 @@ "backout": false, "failIfExists": false, "enableBridge": true, - "msoRequest": + "msoRequest": { "requestId": "requestId", "serviceInstanceId": "serviceInstanceId" }, - "vfModuleParams": + "vfModuleParams": { "vnf_id": "vnfId", "vnf_name": "vnfName", |