149794fb3c60dd2ce9845fb390a880418f1331b5
[so.git] /
1 package org.onap.so.simulator.scenarios.openstack;
2
3 import org.springframework.core.io.ClassPathResource;
4 import org.springframework.http.HttpStatus;
5 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.onap.so.simulator.actions.aai.DeleteVServers;
7 import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver;
8 import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
9 import com.consol.citrus.simulator.scenario.Scenario;
10 import com.consol.citrus.simulator.scenario.ScenarioDesigner;
11
12 @Scenario("Openstack-QueryBaseVfModuleStackById")
13 @RequestMapping(value = "/sim/v1/872f331350c54e59991a8de2cbffb40c/stacks/base_module_id/stackId")
14 public class QueryBaseVfModuleStackById extends AbstractSimulatorScenario {
15
16     @Override
17     public void run(ScenarioDesigner scenario) {
18         // Get to see if stack exists
19         scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
20                 "correlationId");
21         scenario.echo("${correlationId}");
22         scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
23                 "${correlationId}");
24
25         scenario.variable("stackName", "base_module_id");
26         scenario.variable("cloudOwner", "cloudOwner");
27         scenario.variable("cloudRegion", "regionTwo");
28         scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c");
29         scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236");
30         scenario.http().send().response(HttpStatus.OK)
31                 .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
32
33         // Initial Get from Openstack Adapter prior to deletion of the stack
34         scenario.http().receive().get();
35         scenario.http().send().response(HttpStatus.OK)
36                 .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
37
38         // Delete of the stack
39         scenario.http().receive().delete();
40         scenario.action(new DeleteVServers());
41         scenario.http().send().response(HttpStatus.NO_CONTENT);
42
43         // Poll Deletion of stack for status
44         scenario.http().receive().get();
45         scenario.http().send().response(HttpStatus.OK)
46                 .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
47     }
48 }