1 package org.onap.so.simulator.scenarios.openstack;
 
   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;
 
  12 @Scenario("Openstack-QueryBaseVfModuleStackById")
 
  13 @RequestMapping(value = "/sim/v1/872f331350c54e59991a8de2cbffb40c/stacks/base_module_id/stackId")
 
  14 public class QueryBaseVfModuleStackById extends AbstractSimulatorScenario {
 
  17     public void run(ScenarioDesigner scenario) {
 
  18         // Get to see if stack exists
 
  19         scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
 
  21         scenario.echo("${correlationId}");
 
  22         scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
 
  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"));
 
  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"));
 
  38         // Delete of the stack
 
  39         scenario.http().receive().delete();
 
  40         scenario.action(new DeleteVServers());
 
  41         scenario.http().send().response(HttpStatus.NO_CONTENT);
 
  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"));