aboutsummaryrefslogtreecommitdiffstats
path: root/so-simulator
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2020-03-25 16:04:41 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-03-26 11:44:39 -0400
commitcd4e5b408603a13dabc58f832e4aae4194e81995 (patch)
treea53701a308644c0469b5242f7f8370766bd5a453 /so-simulator
parentf5420060c758308df18a0e316d6ae214ef9eb5c6 (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 'so-simulator')
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java52
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java16
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java32
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java15
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java16
5 files changed, 119 insertions, 12 deletions
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
index 2311c4c44e..2fa8725d56 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
@@ -17,10 +17,11 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
- // Get to see if stack exists
+ // Create Poll Service
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
- scenario.echo("${correlationId}");
+ scenario.echo("${correlationId}"); // step 2
scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"${correlationId}");
@@ -30,20 +31,63 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario {
scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c");
scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236");
scenario.variable("stack_failure_message", "The Flavor ID (nd.c6r16d20) could not be found.");
+ scenario.http().send().response(HttpStatus.OK) // step 4
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Create Poll Retry
+ scenario.http().receive().get(); // step 5
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Delete of the stack
+ scenario.http().receive().delete(); // step 7
+ scenario.action(new DeleteVServers());
+ scenario.http().send().response(HttpStatus.NO_CONTENT);
+
+ // Rollback Poll
+ scenario.http().receive().get(); // step 10
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Rollback Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Create Poll
+ scenario.http().receive().get(); // step 14
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
- // Delete of the stack
+ // Create Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Delete
scenario.http().receive().delete();
scenario.action(new DeleteVServers());
scenario.http().send().response(HttpStatus.NO_CONTENT);
- // Poll Deletion of stack for status
+ // Rollback Poll
+ scenario.http().receive().get(); // step 18
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Poll Retry
scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Delete
+ scenario.http().receive().delete();
+ scenario.http().send().response(HttpStatus.NO_CONTENT);
+
+ // Delete Poll
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+
}
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
index 4d0d578831..7f995f2930 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
@@ -3,8 +3,6 @@ package org.onap.so.simulator.scenarios.openstack;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.onap.so.simulator.actions.aai.DeleteVServers;
import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver;
import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
@@ -17,7 +15,9 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
- // Get to see if stack exists
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Create Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -33,13 +33,13 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Create Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
- // Delete of the stack
- scenario.http().receive().delete();
- scenario.action(new DeleteVServers());
- scenario.http().send().response(HttpStatus.NO_CONTENT);
- // Poll Deletion of stack for status
+ // Rollback Poll
scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
index ba6a1a1185..c8c81ebecf 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro1")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_1/*", method = RequestMethod.GET)
public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
@@ -16,6 +20,9 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -27,8 +34,33 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ // Create (module_2)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Create (module_3)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Create (module_2 recreate)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Delete
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+
+ // Delete
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
index efd420486d..aca5fe8194 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro2")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_2/*", method = RequestMethod.GET)
public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
@@ -16,6 +20,9 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -27,11 +34,19 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ // Delete
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
}
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
index 4d3ba8697a..9fc6fafdb3 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro3")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_3/*", method = RequestMethod.GET)
public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
@@ -16,6 +20,8 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -24,11 +30,21 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
scenario.variable("stackName", "macro_module_3");
+ // Poll
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Delete
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));