aboutsummaryrefslogtreecommitdiffstats
path: root/so-simulator
diff options
context:
space:
mode:
Diffstat (limited to 'so-simulator')
-rw-r--r--so-simulator/pom.xml2
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java7
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java24
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java33
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java24
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java24
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR.java9
-rw-r--r--so-simulator/src/test/resources/log4j.properties2
8 files changed, 61 insertions, 64 deletions
diff --git a/so-simulator/pom.xml b/so-simulator/pom.xml
index c4dc79761f..8c2c529701 100644
--- a/so-simulator/pom.xml
+++ b/so-simulator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-simulator</artifactId>
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java
index b42441bcae..f7e829335e 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java
@@ -1,5 +1,8 @@
package org.onap.so.simulator.actions.aai;
+import com.consol.citrus.actions.AbstractTestAction;
+import com.consol.citrus.context.TestContext;
+import java.security.SecureRandom;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
@@ -7,8 +10,6 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.consol.citrus.actions.AbstractTestAction;
-import com.consol.citrus.context.TestContext;
public class ProcessNetwork extends AbstractTestAction {
@@ -17,7 +18,7 @@ public class ProcessNetwork extends AbstractTestAction {
public void doExecute(TestContext context) {
final Logger logger = LoggerFactory.getLogger(ProcessNetwork.class);
try {
- int random = (int) (Math.random() * 50 + 1);
+ int random = (new SecureRandom()).nextInt(50) + 1;
AAIResourcesClient aaiResourceClient = new AAIResourcesClient();
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 383e1bfd5f..4989e99e20 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
@@ -14,19 +14,21 @@ import com.consol.citrus.context.TestContext;
public class ProcessVnfc extends AbstractTestAction {
+ private static final String VNF_SERVER_1_NAME = "ssc_server_1";
+
@Override
public void doExecute(TestContext context) {
final Logger logger = LoggerFactory.getLogger(ProcessVnfc.class);
try {
logger.debug("running ProcessVnfc scenario");
- logger.debug("requestAction: " + context.getVariable("requestAction"));
- logger.debug("serviceAction: " + context.getVariable("serviceAction"));
- logger.debug("cloudOwner: " + context.getVariable("cloudOwner"));
- logger.debug("cloundRegion: " + context.getVariable("cloudRegion"));
- logger.debug("tenant: " + context.getVariable("tenant"));
- logger.debug("vfModuleId: " + context.getVariable("vfModuleId"));
- logger.debug("vnfId: " + context.getVariable("vnfId"));
+ logger.debug("requestAction: {}", context.getVariable("requestAction"));
+ logger.debug("serviceAction: {}", context.getVariable("serviceAction"));
+ logger.debug("cloudOwner: {}", context.getVariable("cloudOwner"));
+ logger.debug("cloundRegion: {}", context.getVariable("cloudRegion"));
+ logger.debug("tenant: {}", context.getVariable("tenant"));
+ logger.debug("vfModuleId: {}", context.getVariable("vfModuleId"));
+ logger.debug("vnfId: {}", context.getVariable("vnfId"));
AAIResourcesClient aaiResourceClient = new AAIResourcesClient();
@@ -34,9 +36,9 @@ public class ProcessVnfc extends AbstractTestAction {
&& context.getVariable("serviceAction").equals("assign")) {
AAIResourceUri vnfcURI =
- AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc("ssc_server_1"));
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(VNF_SERVER_1_NAME));
Vnfc vnfc = new Vnfc();
- vnfc.setVnfcName("ssc_server_1");
+ vnfc.setVnfcName(VNF_SERVER_1_NAME);
vnfc.setNfcNamingCode("oamfw");
vnfc.setNfcFunction("EPC-OAM-FIREWALL");
vnfc.setProvStatus("PREPROV");
@@ -53,8 +55,8 @@ public class ProcessVnfc extends AbstractTestAction {
if (aaiResourceClient.exists(vnfcURI)) {
Optional<VfModule> vfModule = aaiResourceClient.get(vfModuleURI).asBean(VfModule.class);
- if (vfModule.get().getVfModuleName().contains("macro")) {
- String vnfcName = "ssc_server_1" + vfModule.get().getVfModuleName()
+ if (vfModule.isPresent() && vfModule.get().getVfModuleName().contains("macro")) {
+ String vnfcName = VNF_SERVER_1_NAME + vfModule.get().getVfModuleName()
.substring(vfModule.get().getVfModuleName().length() - 1);
vnfc.setVnfcName(vnfcName);
vnfcURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName));
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 29a9aff93c..140ac3c532 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
@@ -1,22 +1,24 @@
package org.onap.so.simulator.scenarios.openstack.macro;
-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.endpoint.resolver.DynamicEndpointUriResolver;
import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+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;
/**
- * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ * 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/v1/tenantOne/stacks/macro_module_1/*", method = RequestMethod.GET)
public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
+ private static final String FILE_STACK_CREATED_PATH = "openstack/gr_api/Stack_Created.json";
+ private static final String FILE_STACK_DELETED_PATH = "openstack/gr_api/Stack_Deleted.json";
@Override
public void run(ScenarioDesigner scenario) {
@@ -31,38 +33,31 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
scenario.variable("stackName", "macro_module_1");
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
// Create (module_2)
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
// Create (module_3)
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
// Create (module_2 recreate)
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
// Delete
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
// Delete
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
// Poll
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
}
}
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 15f0b611a0..05d87cd314 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
@@ -1,22 +1,24 @@
package org.onap.so.simulator.scenarios.openstack.macro;
-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.endpoint.resolver.DynamicEndpointUriResolver;
import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+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;
/**
- * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ * 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/v1/tenantOne/stacks/macro_module_2/*", method = RequestMethod.GET)
public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
+ private static final String FILE_STACK_CREATED_PATH = "openstack/gr_api/Stack_Created.json";
+ private static final String FILE_STACK_DELETED_PATH = "openstack/gr_api/Stack_Deleted.json";
@Override
public void run(ScenarioDesigner scenario) {
@@ -31,22 +33,18 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
scenario.variable("stackName", "macro_module_2");
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
// Delete
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
// Poll
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
}
}
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 b7808dc2ff..15a6fa3029 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
@@ -1,22 +1,24 @@
package org.onap.so.simulator.scenarios.openstack.macro;
-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.endpoint.resolver.DynamicEndpointUriResolver;
import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+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;
/**
- * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ * 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/v1/tenantOne/stacks/macro_module_3/*", method = RequestMethod.GET)
public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
+ private static final String FILE_STACK_CREATED_PATH = "openstack/gr_api/Stack_Created.json";
+ private static final String FILE_STACK_DELETED_PATH = "openstack/gr_api/Stack_Deleted.json";
@Override
public void run(ScenarioDesigner scenario) {
@@ -31,22 +33,18 @@ 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"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
// Delete
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_CREATED_PATH));
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
// Poll
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ scenario.http().send().response(HttpStatus.OK).payload(new ClassPathResource(FILE_STACK_DELETED_PATH));
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR.java
index 4e6b15158c..6e5122f6d1 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR.java
@@ -1,12 +1,13 @@
package org.onap.so.simulator.scenarios.sdnc.grapi;
+import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
+import com.consol.citrus.simulator.scenario.Scenario;
+import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+import java.security.SecureRandom;
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("SDNC-GRAPI-QueryVFModule")
@RequestMapping(
@@ -17,7 +18,7 @@ public class QueryVFModuleGR extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
scenario.http().receive().get();
- int random = (int) (Math.random() * 50 + 1);
+ int random = (new SecureRandom()).nextInt(50) + 1;
scenario.variable("vfModuleName", "vfModuleName" + random);
diff --git a/so-simulator/src/test/resources/log4j.properties b/so-simulator/src/test/resources/log4j.properties
index bbf07d9f49..b6e146aa24 100644
--- a/so-simulator/src/test/resources/log4j.properties
+++ b/so-simulator/src/test/resources/log4j.properties
@@ -5,8 +5,10 @@ log4j.rootLogger=INFO, out
log4j.logger.com.consol.citrus=DEBUG
log4j.logger.org.springframework=INFO
+log4j.logger.org.reflections=ERROR
# CONSOLE appender not used by default
log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5.5p %20.20c{2}| %m%n
+