1 package org.onap.so.simulator.scenarios.openstack;
 
   3 import org.onap.so.simulator.actions.aai.DeleteVServers;
 
   4 import org.springframework.core.io.ClassPathResource;
 
   5 import org.springframework.http.HttpStatus;
 
   6 import org.springframework.web.bind.annotation.RequestMapping;
 
   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;
 
  12 @Scenario("Openstack-Replace-VF-Module-Get")
 
  13 @RequestMapping(value = "/sim/v1/tenantOne/stacks/replace_module/*")
 
  14 public class QueryStackByIdReplaceModule extends AbstractSimulatorScenario {
 
  18     public void run(ScenarioDesigner scenario) {
 
  19         // Get to see if stack exists
 
  20         scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
 
  22         scenario.echo("${correlationId}");
 
  23         scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
 
  26         scenario.variable("stackName", "replace_module");
 
  27         scenario.variable("cloudOwner", "cloudOwner");
 
  28         scenario.variable("cloudRegion", "regionOne");
 
  29         scenario.variable("tenantId", "0422ffb57ba042c0800a29dc85ca70f8");
 
  30         scenario.variable("vServerId", "92272b67-d23f-42ca-87fa-7b06a9ec81f3");
 
  32         scenario.http().send().response(HttpStatus.OK)
 
  33                 .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
 
  35         // Initial Get from Openstack Adapter prior to deletion of the stack
 
  36         scenario.http().receive().get();
 
  37         scenario.http().send().response(HttpStatus.OK)
 
  38                 .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
 
  40         // Delete of the stack
 
  41         scenario.http().receive().delete();
 
  42         scenario.action(new DeleteVServers());
 
  43         scenario.http().send().response(HttpStatus.NO_CONTENT);
 
  45         // Final Get from Openstack Adapter after the deletion of the stack
 
  46         scenario.http().receive().get();
 
  47         scenario.http().send().response(HttpStatus.OK)
 
  48                 .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));