diff options
Diffstat (limited to 'so-simulator/src/main/java')
7 files changed, 70 insertions, 20 deletions
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java index edf212429c..d8d62d99bc 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java @@ -29,8 +29,7 @@ public class ProcessVnfc extends AbstractTestAction { AAIResourcesClient aaiResourceClient = new AAIResourcesClient(); if (context.getVariable("requestAction").equals("CreateVfModuleInstance") - && context.getVariable("serviceAction").equals("assign") - && context.getVariable("vfModuleName").equals("nc_dummy_id")) { + && context.getVariable("serviceAction").equals("assign")) { AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc("ssc_server_1")); @@ -47,14 +46,14 @@ public class ProcessVnfc extends AbstractTestAction { vnfc.setModelVersionId("9e314c37-2258-4572-a399-c0dd7d5f1aec"); vnfc.setModelCustomizationId("2bd95cd4-d7ff-4af0-985d-2adea0339921"); - if (!aaiResourceClient.exists(vnfcURI)) { - logger.debug("creating VNFC"); - aaiResourceClient.create(vnfcURI, vnfc); + if (aaiResourceClient.exists(vnfcURI)) { + logger.debug("cleaning up VNFC"); + aaiResourceClient.delete(vnfcURI); + } + logger.debug("creating new VNFC"); + aaiResourceClient.create(vnfcURI, vnfc); - } else { - aaiResourceClient.get(vnfcURI); - } AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network() .genericVnf(context.getVariable("vnfId")).vfModule(context.getVariable("vfModuleId"))); logger.debug("creating VNFC edge to vf module"); diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplace.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplace.java new file mode 100644 index 0000000000..f4ac519f7a --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplace.java @@ -0,0 +1,25 @@ +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 com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Query-Replace-ID-Name-Resources") +@RequestMapping(value = "/sim/v1/tenantOne/stacks/replace_module/stackId/resources", method = RequestMethod.GET) +public class QueryResourcesByStackNameModuleReplace extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "replace_module"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json")); + + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplaceVolume.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplaceVolume.java new file mode 100644 index 0000000000..f6eebeb09e --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplaceVolume.java @@ -0,0 +1,26 @@ +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 com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Query-Replace-Volume-ID-Name-Resources") +@RequestMapping(value = "/sim/v1/tenantOne/stacks/replace_module_volume_id/stackId/resources", + method = RequestMethod.GET) +public class QueryResourcesByStackNameModuleReplaceVolume extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "replace_module_volume_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json")); + + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java index e13a23f397..eb306ccd6f 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java @@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario; import com.consol.citrus.simulator.scenario.ScenarioDesigner; @Scenario("Openstack-Query-Stack-Resources-Macro1") -@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_1/resources", method = RequestMethod.GET) +@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_1/stackId/resources", method = RequestMethod.GET) public class QueryResourcesByStackNameMacro1 extends AbstractSimulatorScenario { @@ -17,8 +17,8 @@ public class QueryResourcesByStackNameMacro1 extends AbstractSimulatorScenario { public void run(ScenarioDesigner scenario) { scenario.http().receive().get(); - scenario.http().send().response(HttpStatus.OK) - .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json")); + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json")); } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java index 580714ded2..d2551a2fb3 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java @@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario; import com.consol.citrus.simulator.scenario.ScenarioDesigner; @Scenario("Openstack-Query-Stack-Resources-Macro2") -@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_2/resources", method = RequestMethod.GET) +@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_2/stackId/resources", method = RequestMethod.GET) public class QueryResourcesByStackNameMacro2 extends AbstractSimulatorScenario { @@ -17,8 +17,8 @@ public class QueryResourcesByStackNameMacro2 extends AbstractSimulatorScenario { public void run(ScenarioDesigner scenario) { scenario.http().receive().get(); - scenario.http().send().response(HttpStatus.OK) - .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json")); + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json")); } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java index 096d2aa312..bb33f2c718 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java @@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario; import com.consol.citrus.simulator.scenario.ScenarioDesigner; @Scenario("Openstack-Query-Stack-Resources-Macro3") -@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_3/resources", method = RequestMethod.GET) +@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_3/stackId/resources", method = RequestMethod.GET) public class QueryResourcesByStackNameMacro3 extends AbstractSimulatorScenario { @@ -17,8 +17,8 @@ public class QueryResourcesByStackNameMacro3 extends AbstractSimulatorScenario { public void run(ScenarioDesigner scenario) { scenario.http().receive().get(); - scenario.http().send().response(HttpStatus.OK) - .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json")); + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json")); } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java index b590966e2f..77cc0054cc 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java @@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario; import com.consol.citrus.simulator.scenario.ScenarioDesigner; @Scenario("Openstack-Query-Base-Stack-Resources") -@RequestMapping(value = "/sim/v1/tenantOne/stacks/base_module_id/resources", method = RequestMethod.GET) +@RequestMapping(value = "/sim/v1/tenantOne/stacks/base_module_id/stackId/resources", method = RequestMethod.GET) public class QueryResourcesByBaseStackName extends AbstractSimulatorScenario { @@ -19,8 +19,8 @@ public class QueryResourcesByBaseStackName extends AbstractSimulatorScenario { scenario.variable("stackName", "dummy_id"); - scenario.http().send().response(HttpStatus.OK) - .payload(new ClassPathResource("openstack/gr_api/GetStackResources.json")); + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json")); } |