diff options
Diffstat (limited to 'models-interactions/model-simulators/src')
3 files changed, 101 insertions, 4 deletions
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java index d83f5a54e..019d6f116 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java @@ -73,7 +73,7 @@ public class SoSimulatorJaxRs { public String soPostQuery(@PathParam("serviceInstanceId") final String serviceInstanceId, @PathParam("vnfInstanceId") final String vnfInstanceId) { - return (requirePolling ? makeStarted() : makeComplete(UUID.randomUUID().toString())); + return (requirePolling ? makeStarted() : makeImmediateComplete()); } /** @@ -91,7 +91,7 @@ public class SoSimulatorJaxRs { @PathParam("vnfInstanceId") final String vnfInstanceId, @PathParam("vfModuleInstanceId") final String vfModuleInstanceId) { - return (requirePolling ? makeStarted() : makeComplete(UUID.randomUUID().toString())); + return (requirePolling ? makeStarted() : makeImmediateComplete()); } /** @@ -124,6 +124,11 @@ public class SoSimulatorJaxRs { return response.replace(REPLACE_ME, requestId); } + private String makeImmediateComplete() { + String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.immediate.success.json"); + return response.replace(REPLACE_ME, UUID.randomUUID().toString()); + } + private String makeComplete(String requestId) { String response = ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.complete.success.json"); return response.replace(REPLACE_ME, requestId); diff --git a/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.immediate.success.json b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.immediate.success.json new file mode 100644 index 000000000..ae40985fa --- /dev/null +++ b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.immediate.success.json @@ -0,0 +1,92 @@ +{ + "requestReferences": { + "requestId": "${replaceMe}", + "instanceId": "68804843-18e0-41a3-8838-a6d90a035e1a", + "requestSelfLink": "http://so.onap:8080/orchestrationRequests/v7/b789e4e6-0b92-42c3-a723-1879af9c799d" + }, + "request": { + "requestId": "${replaceMe}", + "startTime": "Fri, 15 May 2020 12:12:50 GMT", + "finishTime": "Fri, 15 May 2020 12:14:21 GMT", + "requestScope": "vfModule", + "requestType": "scaleOut", + "requestDetails": { + "modelInfo": { + "modelInvariantId": "2246ebc9-9b9f-42d0-a5e4-0248324fb884", + "modelType": "vfModule", + "modelName": "VlbCdsSb00..vdns..module-3", + "modelVersion": "1", + "modelCustomizationUuid": "3a74410a-6c74-4a32-94b2-71488be6da1a", + "modelVersionId": "1f94cedb-f656-4ddb-9f55-60ba1fc7d4b1", + "modelCustomizationId": "3a74410a-6c74-4a32-94b2-71488be6da1a", + "modelUuid": "1f94cedb-f656-4ddb-9f55-60ba1fc7d4b1", + "modelInvariantUuid": "2246ebc9-9b9f-42d0-a5e4-0248324fb884" + }, + "requestInfo": { + "source": "POLICY", + "instanceName": "vfModuleName", + "suppressRollback": false, + "requestorId": "policy" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "c14e61b5-1ee6-4925-b4a9-b9c8dbfe3f34", + "modelInfo": { + "modelInvariantId": "6418bb39-61e1-45fc-a36b-3f211bb846c7", + "modelType": "service", + "modelName": "vLB_CDS_SB00_02", + "modelVersion": "1.0", + "modelVersionId": "d01d9dec-afb6-4a53-bd9e-2eb10ca07a51", + "modelUuid": "d01d9dec-afb6-4a53-bd9e-2eb10ca07a51", + "modelInvariantUuid": "6418bb39-61e1-45fc-a36b-3f211bb846c7" + } + } + }, + { + "relatedInstance": { + "instanceId": "6636c4d5-f608-4376-b6d8-7977e98cb16d", + "modelInfo": { + "modelInvariantId": "827356a9-cb60-4976-9713-c30b4f850b41", + "modelType": "vnf", + "modelName": "vLB_CDS_SB00", + "modelVersion": "1.0", + "modelCustomizationUuid": "6478f94b-0b20-4b44-afc0-94e48070586a", + "modelVersionId": "ca3c4797-0cdd-4797-8bec-9a3ce78ac4da", + "modelCustomizationId": "6478f94b-0b20-4b44-afc0-94e48070586a", + "modelUuid": "ca3c4797-0cdd-4797-8bec-9a3ce78ac4da", + "modelInvariantUuid": "827356a9-cb60-4976-9713-c30b4f850b41" + } + } + } + ], + "cloudConfiguration": { + "tenantId": "41d6d38489bd40b09ea8a6b6b852dcbd", + "tenantName": "Integration-SB-00", + "cloudOwner": "CloudOwner", + "lcpCloudRegionId": "RegionOne" + }, + "requestParameters": { + "usePreload": false + }, + "configurationParameters": [ + { + "ip-addr": "$.vf-module-topology.vf-module-parameters.param[16].value", + "oam-ip-addr": "$.vf-module-topology.vf-module-parameters.param[30].value" + } + ] + }, + "instanceReferences": { + "serviceInstanceId": "c14e61b5-1ee6-4925-b4a9-b9c8dbfe3f34", + "vnfInstanceId": "6636c4d5-f608-4376-b6d8-7977e98cb16d", + "vfModuleInstanceId": "68804843-18e0-41a3-8838-a6d90a035e1a", + "vfModuleInstanceName": "vfModuleName" + }, + "requestStatus": { + "requestState": "COMPLETE", + "statusMessage": "STATUS: ALaCarte-VfModule-scaleOut request was executed correctly. FLOW STATUS: Successfully completed all Building Blocks RESOURCE STATUS: The vf module was found to already exist, thus no new vf module was created in the cloud via this request", + "percentProgress": 100, + "timestamp": "Fri, 15 May 2020 12:14:21 GMT" + } + } +} diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index d8613c8b7..fbeb08466 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -144,7 +144,7 @@ public class SoSimulatorTest { "username", "password", new HashMap<>(), "application/json", request); assertNotNull(httpDetails); - assertThat(httpDetails.second).contains("\"COMPLETE\"").doesNotContain("requestSelfLink"); + assertThat(httpDetails.second).contains("\"COMPLETE\"").contains("requestSelfLink"); /* * Repeat, but set the flag indicating that the request should yield incomplete. @@ -186,7 +186,7 @@ public class SoSimulatorTest { "username", "password", new HashMap<>(), "application/json", request); assertNotNull(httpDetails); - assertThat(httpDetails.second).contains("\"COMPLETE\"").doesNotContain("requestSelfLink"); + assertThat(httpDetails.second).contains("\"COMPLETE\"").contains("requestSelfLink"); /* * Repeat, but set the flag indicating that the request should yield incomplete. |