summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-simulators/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-05-15 14:46:15 -0400
committerJim Hahn <jrh3@att.com>2020-05-15 14:52:15 -0400
commit5210055db2f00f42fea4717b2726dda52e1c1a59 (patch)
tree435bf700d4f5096b23126f899ab36fe3cc0de888 /models-interactions/model-simulators/src
parentafe5abed95c6cbfe239066e267d9c10a71f20623 (diff)
Cannot parse finishTime in legacy SO responses
Adding the actual sample responses to the SO simulator broke the drools-apps junit for usecases. Fixed (in theory) by updating the legacy SO actor to properly decode the finishTime. Refactored the new SO actor, extracting the type adapter into its own class file so it could be shared between the new and legacy actors. Issue-ID: POLICY-2570 Change-Id: I061b603172440b1a91da16d09b4f2a0d289dfc41 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-simulators/src')
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java9
-rw-r--r--models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.immediate.success.json92
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java4
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.