diff options
Diffstat (limited to 'so-simulator/src/main/java/org/onap')
59 files changed, 1943 insertions, 0 deletions
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/AAIPropertiesImpl.java b/so-simulator/src/main/java/org/onap/so/simulator/AAIPropertiesImpl.java new file mode 100644 index 0000000000..a0c0007927 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/AAIPropertiesImpl.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.simulator; + +import java.net.MalformedURLException; +import java.net.URL; +import org.onap.so.client.aai.AAIVersion; + + +public class AAIPropertiesImpl implements org.onap.so.client.aai.AAIProperties { + + public static final String AAI_ENDPOINT = "aai.endpoint"; + + + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL("http://so-aai-resources-svc:9900"); + } + + @Override + public String getSystemName() { + return "SIMULATOR"; + } + + @Override + public AAIVersion getDefaultVersion() { + return AAIVersion.LATEST; + } + + @Override + public String getAuth() { + return null; + } + + @Override + public String getKey() { + // TODO Auto-generated method stub + return null; + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/Simulator.java b/so-simulator/src/main/java/org/onap/so/simulator/Simulator.java new file mode 100644 index 0000000000..02032e485f --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/Simulator.java @@ -0,0 +1,46 @@ + +package org.onap.so.simulator; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpStatus; +import org.springframework.ws.soap.SoapVersion; +import org.springframework.ws.soap.saaj.SaajSoapMessageFactory; +import com.consol.citrus.endpoint.EndpointAdapter; +import com.consol.citrus.endpoint.adapter.StaticEndpointAdapter; +import com.consol.citrus.http.message.HttpMessage; +import com.consol.citrus.message.Message; +import com.consol.citrus.simulator.http.SimulatorRestAdapter; +import com.consol.citrus.simulator.http.SimulatorRestConfigurationProperties; + + +@SpringBootApplication +public class Simulator extends SimulatorRestAdapter { + + public static void main(String[] args) { + SpringApplication.run(Simulator.class, args); + } + + @Override + public String urlMapping(SimulatorRestConfigurationProperties simulatorRestConfiguration) { + return "/sim/**"; + } + + @Override + public EndpointAdapter fallbackEndpointAdapter() { + return new StaticEndpointAdapter() { + @Override + protected Message handleMessageInternal(Message message) { + return new HttpMessage().status(HttpStatus.INTERNAL_SERVER_ERROR); + } + }; + } + + @Bean + public SaajSoapMessageFactory messageFactory() { + SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory(); + messageFactory.setSoapVersion(SoapVersion.SOAP_12); + return messageFactory; + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java new file mode 100644 index 0000000000..064556da00 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java @@ -0,0 +1,34 @@ +package org.onap.so.simulator.actions.aai; + +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.consol.citrus.actions.AbstractTestAction; +import com.consol.citrus.context.TestContext; + +public class DeleteVServers extends AbstractTestAction { + + private static final Logger logger = LoggerFactory.getLogger(DeleteVServers.class); + + @Override + public void doExecute(TestContext context) { + + try { + logger.info("Deleting Vservers in A&AI"); + AAIResourcesClient aaiResourceClient = new AAIResourcesClient(); + String vserverId = context.getVariable("vServerId"); + String cloudRegion = context.getVariable("cloudRegion"); + String cloudOwner = context.getVariable("cloudOwner"); + String tenantId = context.getVariable("tenantId"); + AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, + tenantId, vserverId); + aaiResourceClient.delete(vserverURI); + } catch (Exception e) { + logger.error("Error Deleting VServer in A&AI", e); + } + + } +} 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 new file mode 100644 index 0000000000..075a5b7a6b --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java @@ -0,0 +1,42 @@ +package org.onap.so.simulator.actions.aai; + +import org.onap.aai.domain.yang.L3Network; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import com.consol.citrus.actions.AbstractTestAction; +import com.consol.citrus.context.TestContext; + + +public class ProcessNetwork extends AbstractTestAction { + + @Override + public void doExecute(TestContext context) { + + try { + int random = (int) (Math.random() * 50 + 1); + + AAIResourcesClient aaiResourceClient = new AAIResourcesClient(); + + if (context.getVariable("action").equals("assign")) { + String networkId = context.getVariable("generatedNetworkId"); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId); + L3Network network = new L3Network(); + network.setNetworkId(networkId); + network.setNetworkName(context.getVariable("networkName")); + network.setNetworkType(context.getVariable("networkType")); + network.setNetworkTechnology("SR_IOV"); + network.setPhysicalNetworkName("PhysicalNetwork" + random); + aaiResourceClient.create(networkURI, network); + } else if (context.getVariable("action").equals("delete")) { + String networkId = context.getVariable("networkId"); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId); + aaiResourceClient.delete(networkURI); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } +} 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 new file mode 100644 index 0000000000..1d90f7cffb --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java @@ -0,0 +1,64 @@ +package org.onap.so.simulator.actions.aai; + +import org.onap.aai.domain.yang.Vnfc; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.consol.citrus.actions.AbstractTestAction; +import com.consol.citrus.context.TestContext; + +public class ProcessVnfc extends AbstractTestAction { + + @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")); + + AAIResourcesClient aaiResourceClient = new AAIResourcesClient(); + + if (context.getVariable("requestAction").equals("CreateVfModuleInstance") + && context.getVariable("serviceAction").equals("activate")) { + + AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, "zauk51bfrwl09oam001"); + Vnfc vnfc = new Vnfc(); + vnfc.setVnfcName("zauk51bfrwl09oam001"); + vnfc.setNfcNamingCode("oamfw"); + vnfc.setNfcFunction("EPC-OAM-FIREWALL"); + vnfc.setProvStatus("PREPROV"); + vnfc.setOrchestrationStatus("Active"); + vnfc.setInMaint(false); + vnfc.setIsClosedLoopDisabled(false); + + vnfc.setModelInvariantId("b214d2e9-73d9-49d7-b7c4-a9ae7f06e244"); + vnfc.setModelVersionId("9e314c37-2258-4572-a399-c0dd7d5f1aec"); + vnfc.setModelCustomizationId("2bd95cd4-d7ff-4af0-985d-2adea0339921"); + + if (!aaiResourceClient.exists(vnfcURI)) + aaiResourceClient.create(vnfcURI, vnfc); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, + context.getVariable("vnfId"), context.getVariable("vfModuleId")); + AAIResourceUri pserverURI = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "rdm52r19c001"); + AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, + context.getVariable("cloudOwner"), context.getVariable("cloudRegion"), + context.getVariable("tenant"), "d29f3151-592d-4011-9356-ad047794e236"); + aaiResourceClient.connect(vnfcURI, vserverURI); + aaiResourceClient.connect(vserverURI, pserverURI); + aaiResourceClient.connect(vfModuleURI, vnfcURI); + } + } catch (Exception e) { + logger.debug(e.getMessage()); + } + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/DefaultScenario.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/DefaultScenario.java new file mode 100644 index 0000000000..cb9c7873a9 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/DefaultScenario.java @@ -0,0 +1,34 @@ +/* + * Copyright 2006-2017 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.simulator.scenarios; + +import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioRunner; +import org.springframework.http.HttpStatus; + +/** + * @author Christoph Deppisch + */ +@Scenario("Default") +public class DefaultScenario extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioRunner scenario) { + scenario.http().receive((builder -> builder.get())); + + scenario.http().send((builder -> builder.response(HttpStatus.BAD_REQUEST))); + + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java new file mode 100644 index 0000000000..eae5ef2135 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java @@ -0,0 +1,38 @@ +package org.onap.so.simulator.scenarios.openstack; + +import java.io.InputStream; +import org.onap.aai.domain.yang.Vserver; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.springframework.core.io.ClassPathResource; +import com.consol.citrus.actions.AbstractTestAction; +import com.consol.citrus.context.TestContext; + +public class CreateAAInventory extends AbstractTestAction { + + @Override + public void doExecute(TestContext context) { + try { + String stackName = context.getVariable("stackName"); + + if (stackName != null && stackName.equals("replace_module")) { + String vServerId = "92272b67-d23f-42ca-87fa-7b06a9ec81f3"; + AAIResourcesClient aaiResourceClient = new AAIResourcesClient(); + AAICommonObjectMapperProvider aaiMapper = new AAICommonObjectMapperProvider(); + InputStream vserverFile = + new ClassPathResource("openstack/gr_api/CreateAAIInventory.json").getInputStream(); + Vserver vserver = aaiMapper.getMapper().readValue(vserverFile, Vserver.class); + AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloudOwner", + "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", vServerId); + aaiResourceClient.create(vserverURI, vserver); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateStack.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateStack.java new file mode 100644 index 0000000000..2c0c4aff09 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateStack.java @@ -0,0 +1,28 @@ +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("Openstack-CreateStack") +@RequestMapping(value = "/sim/mockPublicUrl/stacks", method = RequestMethod.POST) +public class CreateStack extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().post().extractFromPayload("$.stack_name", "stackName"); + + scenario.action(new CreateAAInventory()); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Create.json")); + + + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateStackAudit.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateStackAudit.java new file mode 100644 index 0000000000..35e0571b14 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateStackAudit.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("Openstack-CreateStackAudit") +@RequestMapping(value = "/sim/mockPublicUrlThree/stacks", method = RequestMethod.POST) +public class CreateStackAudit extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().post().extractFromPayload("$.stack_name", "stackName"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/ModuleCreateDelete.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/ModuleCreateDelete.java new file mode 100644 index 0000000000..25bb87c8bc --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/ModuleCreateDelete.java @@ -0,0 +1,53 @@ +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 org.onap.so.simulator.actions.aai.DeleteVServers; +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; + +@Scenario("Openstack-ModuleCreateDelete") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/dummy_id/stackId") +public class ModuleCreateDelete extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "dummy_id"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionOne"); + scenario.variable("tenantId", "0422ffb57ba042c0800a29dc85ca70f8"); + scenario.variable("vServerId", "92272b67-d23f-42ca-87fa-7b06a9ec81f3"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Initial Get from Openstack Adapter prior to deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Delete of the stack + scenario.http().receive().delete(); + scenario.action(new DeleteVServers()); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Final Get from Openstack Adapter after the deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/ModuleCreateDeleteAudit.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/ModuleCreateDeleteAudit.java new file mode 100644 index 0000000000..1365fa04c8 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/ModuleCreateDeleteAudit.java @@ -0,0 +1,52 @@ +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 org.onap.so.simulator.actions.aai.DeleteVServers; +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; + +@Scenario("Openstack-ModuleCreateDeleteAudit") +@RequestMapping(value = "/sim/mockPublicUrlThree/stacks/nc_dummy_id/stackId") +public class ModuleCreateDeleteAudit extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "nc_dummy_id"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionThree"); + scenario.variable("tenantId", "0422ffb57ba042c0800a29dc85ca70a3"); + scenario.variable("vServerId", "92272b67-d23f-42ca-87fa-7b06a9ec81f3"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Initial Get from Openstack Adapter prior to deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Delete of the stack + scenario.http().receive().delete(); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Final Get from Openstack Adapter after the deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/NetworkCreateDeleteCloud.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/NetworkCreateDeleteCloud.java new file mode 100644 index 0000000000..712f377f4e --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/NetworkCreateDeleteCloud.java @@ -0,0 +1,48 @@ +package org.onap.so.simulator.scenarios.openstack; + +import org.onap.so.simulator.actions.aai.DeleteVServers; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.RequestMapping; +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; + +@Scenario("Openstack-NetworkCreateDeleteCloud") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/network_dummy_id/stackId") +public class NetworkCreateDeleteCloud extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "network_dummy_id"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionOne"); + scenario.variable("tenantId", "0422ffb57ba042c0800a29dc85ca70f8"); + scenario.variable("vServerId", "92272b67-d23f-42ca-87fa-7b06a9ec81f3"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + + // Delete of the stack + scenario.http().receive().delete(); + scenario.action(new DeleteVServers()); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Final Get from Openstack Adapter after the deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryBaseStack.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryBaseStack.java new file mode 100644 index 0000000000..25bd563e1a --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryBaseStack.java @@ -0,0 +1,35 @@ +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.endpoint.resolver.DynamicEndpointUriResolver; +import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Openstack-QueryBaseStackByName") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/base_module_id/*", method = RequestMethod.GET) +public class QueryBaseStack extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "base_module_id"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionTwo"); + scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c"); + scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236"); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryBaseVfModuleStackById.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryBaseVfModuleStackById.java new file mode 100644 index 0000000000..149794fb3c --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryBaseVfModuleStackById.java @@ -0,0 +1,48 @@ +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.onap.so.simulator.actions.aai.DeleteVServers; +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; + +@Scenario("Openstack-QueryBaseVfModuleStackById") +@RequestMapping(value = "/sim/v1/872f331350c54e59991a8de2cbffb40c/stacks/base_module_id/stackId") +public class QueryBaseVfModuleStackById extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "base_module_id"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionTwo"); + scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c"); + scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236"); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Initial Get from Openstack Adapter prior to deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Delete of the stack + scenario.http().receive().delete(); + scenario.action(new DeleteVServers()); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Poll Deletion of stack for status + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameFailureId.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameFailureId.java new file mode 100644 index 0000000000..5659f309d1 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameFailureId.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-Failure-ID-Name-Resources") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/failure_id/resources", method = RequestMethod.GET) +public class QueryResourcesByStackNameFailureId extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "failure_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json")); + + } +} 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..4c3b4b628e --- /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/mockPublicUrl/stacks/replace_module/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/GetStackResourcesMacro.json")); + + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStack.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStack.java new file mode 100644 index 0000000000..8d36e567e4 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStack.java @@ -0,0 +1,23 @@ +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("Openstack-QueryStackByName") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/*", method = RequestMethod.GET) +public class QueryStack extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.NOT_FOUND); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java new file mode 100644 index 0000000000..2311c4c44e --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java @@ -0,0 +1,49 @@ +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 org.onap.so.simulator.actions.aai.DeleteVServers; +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; + +@Scenario("Double-Failure-Stack-Endpoint") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/double_failure_id/stackId") +public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "double_failure_id"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionTwo"); + scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c"); + scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236"); + scenario.variable("stack_failure_message", "The Flavor ID (nd.c6r16d20) could not be found."); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + + // Delete of the stack + scenario.http().receive().delete(); + scenario.action(new DeleteVServers()); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Poll Deletion of stack for status + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java new file mode 100644 index 0000000000..4d0d578831 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java @@ -0,0 +1,49 @@ +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 org.onap.so.simulator.actions.aai.DeleteVServers; +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; + +@Scenario("Failure-Stack-Endpoint") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/failure_id/stackId") +public class QueryStackByIdFailure extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "failure_id"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionTwo"); + scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c"); + scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236"); + scenario.variable("stack_failure_message", "The Flavor ID (nd.c6r16d20) could not be found."); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + + // Delete of the stack + scenario.http().receive().delete(); + scenario.action(new DeleteVServers()); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Poll Deletion of stack for status + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdNetworkMacro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdNetworkMacro1.java new file mode 100644 index 0000000000..4001d1c972 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdNetworkMacro1.java @@ -0,0 +1,38 @@ +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.endpoint.resolver.DynamicEndpointUriResolver; +import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Openstack-QueryStackByID-NetworkMacro1") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_network1/*", method = RequestMethod.GET) +public class QueryStackByIdNetworkMacro1 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "dummy_id"); + + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdNetworkMacro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdNetworkMacro2.java new file mode 100644 index 0000000000..55d697aa69 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdNetworkMacro2.java @@ -0,0 +1,38 @@ +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.endpoint.resolver.DynamicEndpointUriResolver; +import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Openstack-QueryStackByID-NetworkMacro2") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_network1/*", method = RequestMethod.GET) +public class QueryStackByIdNetworkMacro2 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "dummy_id"); + + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdReplaceModule.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdReplaceModule.java new file mode 100644 index 0000000000..c0302ad1eb --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdReplaceModule.java @@ -0,0 +1,51 @@ +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.onap.so.simulator.actions.aai.DeleteVServers; +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; + +@Scenario("Openstack-Replace-VF-Module-Get") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/replace_module/*") +public class QueryStackByIdReplaceModule extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + // Get to see if stack exists + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "replace_module"); + scenario.variable("cloudOwner", "cloudOwner"); + scenario.variable("cloudRegion", "regionOne"); + scenario.variable("tenantId", "0422ffb57ba042c0800a29dc85ca70f8"); + scenario.variable("vServerId", "92272b67-d23f-42ca-87fa-7b06a9ec81f3"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Initial Get from Openstack Adapter prior to deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Delete of the stack + scenario.http().receive().delete(); + scenario.action(new DeleteVServers()); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Final Get from Openstack Adapter after the deletion of the stack + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdVolumeGroup.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdVolumeGroup.java new file mode 100644 index 0000000000..75b1ecac81 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdVolumeGroup.java @@ -0,0 +1,40 @@ +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.endpoint.resolver.DynamicEndpointUriResolver; +import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Openstack-VolumeGroup-Interactions") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/VolumeGroup/*") +public class QueryStackByIdVolumeGroup extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "VolumeGroup"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + scenario.http().receive().delete(); + + scenario.http().send().response(HttpStatus.NO_CONTENT); + + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByName.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByName.java new file mode 100644 index 0000000000..b51a608e6d --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByName.java @@ -0,0 +1,24 @@ +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("Openstack-QueryStackByName3") +@RequestMapping(value = "/sim/mockPublicUrlThree/stacks/*", method = RequestMethod.GET) +public class QueryStackByName extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.NOT_FOUND); + + } + + +} 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 new file mode 100644 index 0000000000..9413fab7df --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java @@ -0,0 +1,25 @@ +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.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Openstack-Query-Stack-Resources-Macro1") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_1/resources", method = RequestMethod.GET) +public class QueryResourcesByStackNameMacro1 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.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 new file mode 100644 index 0000000000..8708dac438 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java @@ -0,0 +1,25 @@ +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.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Openstack-Query-Stack-Resources-Macro2") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_2/resources", method = RequestMethod.GET) +public class QueryResourcesByStackNameMacro2 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.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 new file mode 100644 index 0000000000..a30115a63a --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java @@ -0,0 +1,25 @@ +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.simulator.scenario.AbstractSimulatorScenario; +import com.consol.citrus.simulator.scenario.Scenario; +import com.consol.citrus.simulator.scenario.ScenarioDesigner; + +@Scenario("Openstack-Query-Stack-Resources-Macro3") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_3/resources", method = RequestMethod.GET) +public class QueryResourcesByStackNameMacro3 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json")); + + } + +} 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 new file mode 100644 index 0000000000..ba6a1a1185 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java @@ -0,0 +1,36 @@ +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; + +@Scenario("Openstack-QueryStackByID-Macro1") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_1/*", method = RequestMethod.GET) +public class QueryStackByIdMacro1 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "macro_module_1"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + } + +} 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 new file mode 100644 index 0000000000..efd420486d --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java @@ -0,0 +1,37 @@ +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; + +@Scenario("Openstack-QueryStackByID-Macro2") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_2/*", method = RequestMethod.GET) +public class QueryStackByIdMacro2 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "macro_module_2"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} 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 new file mode 100644 index 0000000000..4d3ba8697a --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java @@ -0,0 +1,37 @@ +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; + +@Scenario("Openstack-QueryStackByID-Macro3") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_3/*", method = RequestMethod.GET) +public class QueryStackByIdMacro3 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "correlationId"); + scenario.echo("${correlationId}"); + scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, + "${correlationId}"); + + scenario.variable("stackName", "macro_module_3"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/nova/NovaKeyPairDelete.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/nova/NovaKeyPairDelete.java new file mode 100644 index 0000000000..32b29f2ab8 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/nova/NovaKeyPairDelete.java @@ -0,0 +1,19 @@ +package org.onap.so.simulator.scenarios.openstack.nova; + +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("Nova-Keypair-Delete") +@RequestMapping(value = "/sim/mockPublicUrl/os-keypairs/*", method = RequestMethod.DELETE) +public class NovaKeyPairDelete extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().delete(); + scenario.http().send().response(HttpStatus.NO_CONTENT); + } +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCHAPort0.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCHAPort0.java new file mode 100644 index 0000000000..682ed9f03d --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCHAPort0.java @@ -0,0 +1,28 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryNeutronNetworkSSCHAPort0") +@RequestMapping(value = "/sim/mockPublicUrl/v2.0/ports/00bb8407-650e-48b5-b919-33b88d6f8fe3", + method = RequestMethod.GET) +public class QueryNeutronNetworkSSCHAPort0 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/GetNeutronNetworkSSCHAPort0.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCManagementPort0.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCManagementPort0.java new file mode 100644 index 0000000000..26b2e1305e --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCManagementPort0.java @@ -0,0 +1,28 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryNeutronNetworkSSCManagementPort0") +@RequestMapping(value = "/sim/mockPublicUrl/v2.0/ports/8d93f63e-e972-48c7-ad98-b2122da47315", + method = RequestMethod.GET) +public class QueryNeutronNetworkSSCManagementPort0 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/GetNeutronNetworkSSCManagementPort0.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCManagementPort1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCManagementPort1.java new file mode 100644 index 0000000000..7269e54554 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCManagementPort1.java @@ -0,0 +1,28 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryNeutronNetworkSSCManagementPort1") +@RequestMapping(value = "/sim/mockPublicUrl/v2.0/ports/07f5b14c-147a-4d14-8c94-a9e94dbc097b", + method = RequestMethod.GET) +public class QueryNeutronNetworkSSCManagementPort1 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/GetNeutronNetworkSSCManagementPort1.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCRole1Port0.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCRole1Port0.java new file mode 100644 index 0000000000..f7e677b158 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCRole1Port0.java @@ -0,0 +1,28 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryNeutronNetworkSSCRole1Port0") +@RequestMapping(value = "/sim/mockPublicUrl/v2.0/ports/0594a2f2-7ea4-42eb-abc2-48ea49677fca", + method = RequestMethod.GET) +public class QueryNeutronNetworkSSCRole1Port0 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/GetNeutronNetworkSSCRole1Port0.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCService1Port0.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCService1Port0.java new file mode 100644 index 0000000000..0e5c7fd2b6 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCService1Port0.java @@ -0,0 +1,28 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryNeutronNetworkSSCservice1Port0") +@RequestMapping(value = "/sim/mockPublicUrl/v2.0/ports/27391d94-33af-474a-927d-d409249e8fd3", + method = RequestMethod.GET) +public class QueryNeutronNetworkSSCService1Port0 extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/GetNeutronNetworkSSCTservice1Port0.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCTrusted.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCTrusted.java new file mode 100644 index 0000000000..29f1df3e01 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryNeutronNetworkSSCTrusted.java @@ -0,0 +1,28 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryNeutronNetworkSSCTrusted") +@RequestMapping(value = "/sim/mockPublicUrl/v2.0/ports/d2f51f82-0ec2-4581-bd1a-d2a82073e52b", + method = RequestMethod.GET) +public class QueryNeutronNetworkSSCTrusted extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("openstack/gr_api/GetNeutronNetworkSSCTrustedPort.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsRole1Sub1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsRole1Sub1.java new file mode 100644 index 0000000000..d9331e7e1a --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsRole1Sub1.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Resource-Details-Role1-Sub0") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_role1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources", + method = RequestMethod.GET) +public class QueryResourceDetailsRole1Sub1 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Role1SubInterface1Resources.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub0.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub0.java new file mode 100644 index 0000000000..9c42e489ee --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub0.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Resource-Details-service1-Sub0") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb/resources", + method = RequestMethod.GET) +public class QueryResourceDetailsService1Sub0 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/service1SubInterface0Resources.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub1.java new file mode 100644 index 0000000000..691879cfc8 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub1.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Resource-Details-service1-Sub1") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a/resources", + method = RequestMethod.GET) +public class QueryResourceDetailsService1Sub1 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/service1SubInterface1Resources.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub2.java new file mode 100644 index 0000000000..33b450a08c --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourceDetailsService1Sub2.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Resource-Details-service1-Sub2") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", + method = RequestMethod.GET) +public class QueryResourceDetailsService1Sub2 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/service1SubInterface2Resources.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 new file mode 100644 index 0000000000..6dbd898154 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java @@ -0,0 +1,27 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("Openstack-Query-Base-Stack-Resources") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/base_module_id/resources", method = RequestMethod.GET) +public class QueryResourcesByBaseStackName extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/GetStackResources.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByStackName.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByStackName.java new file mode 100644 index 0000000000..aff4d924e2 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByStackName.java @@ -0,0 +1,27 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("Openstack-Query-Stack-Resources") +@RequestMapping(value = "/sim/mockPublicUrl/stacks/dummy_id/resources", method = RequestMethod.GET) +public class QueryResourcesByStackName extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("stackName", "dummy_id"); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/GetStackResources.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryRole1StackResources.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryRole1StackResources.java new file mode 100644 index 0000000000..5372d2ad78 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryRole1StackResources.java @@ -0,0 +1,27 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryRole1StackResources-tsbc0005vm002ssc001") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_role1_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources", + method = RequestMethod.GET) +public class QueryRole1StackResources extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/StackResourcesRole1ResourceGroup.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryService1StackResources.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryService1StackResources.java new file mode 100644 index 0000000000..60a5ad8964 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryService1StackResources.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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("QueryService1StackResources-tsbc0005vm002ssc001") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources", + method = RequestMethod.GET) +public class QueryService1StackResources extends AbstractSimulatorScenario { + + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/StackResourcesservice1ResourceGroup.json")); + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsRole1Sub0.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsRole1Sub0.java new file mode 100644 index 0000000000..068bc26072 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsRole1Sub0.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Stack-Details-Role1-Sub0") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_role1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + method = RequestMethod.GET) +public class QueryStackDetailsRole1Sub0 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Role1SubInterface0.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub0.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub0.java new file mode 100644 index 0000000000..22fb263d5b --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub0.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Stack-Details-service1-Sub0") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a", + method = RequestMethod.GET) +public class QueryStackDetailsService1Sub0 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/service1SubInterface0.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub1.java new file mode 100644 index 0000000000..16688ffae8 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub1.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Stack-Details-service1-Sub1") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + method = RequestMethod.GET) +public class QueryStackDetailsService1Sub1 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/service1SubInterface1.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub2.java new file mode 100644 index 0000000000..53bf966421 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryStackDetailsService1Sub2.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.openstack.resources; + +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-Stack-Details-service1-Sub2") +@RequestMapping( + value = "/sim/mockPublicUrl/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c", + method = RequestMethod.GET) +public class QueryStackDetailsService1Sub2 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/service1SubInterface2.json")); + + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/AssignVFModule.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/AssignVFModule.java new file mode 100644 index 0000000000..e089f33aa3 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/AssignVFModule.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.sdnc; + +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-VNFAPI-AssignVFModule") +@RequestMapping(value = "/sim/restconf/operations/VNF-API:vnf-topology-operation", method = RequestMethod.POST) +public class AssignVFModule extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().post(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("sdnc/vnf-api/AssignResponseSuccess.xml")); + + + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/QueryVFModule.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/QueryVFModule.java new file mode 100644 index 0000000000..24bb671a06 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/QueryVFModule.java @@ -0,0 +1,24 @@ + +package org.onap.so.simulator.scenarios.sdnc; + +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-VNFAPI-QueryVFModule") +@RequestMapping(value = "/sim/restconf/config/VNF-API:vnfs/vnf-list/*", method = RequestMethod.GET) +public class QueryVFModule extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("sdnc/vnf-api/QueryResponseSuccess.xml")); + } + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/HealthCheck.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/HealthCheck.java new file mode 100644 index 0000000000..e7af44d261 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/HealthCheck.java @@ -0,0 +1,24 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +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("Health-Check-SDNC") +@RequestMapping(value = "/sim/restconf/operations/SLI-API:healthcheck", method = RequestMethod.POST) +public class HealthCheck extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().post(); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("sdnc/HealthCheck.json")); + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java new file mode 100644 index 0000000000..c1ba812513 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ProcessSDNCAssignService.java @@ -0,0 +1,29 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +import com.consol.citrus.actions.AbstractTestAction; +import com.consol.citrus.context.TestContext; + +public class ProcessSDNCAssignService extends AbstractTestAction { + + + @Override + public void doExecute(TestContext context) { + try { + String serviceName = context.getVariable("serviceName"); + String action = context.getVariable("action"); + if (("Robot_SI_For_Service_Failure".equals(serviceName) && "assign".equals(action)) + || ("Robot_SI_For_Service_Rollback_Failure".equals(serviceName))) { + context.setVariable("responseMessage", "SDNC is throwing errors"); + context.setVariable("responseCode", "500"); + } else { + context.setVariable("responseMessage", "Success"); + context.setVariable("responseCode", "200"); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + } + +} 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 new file mode 100644 index 0000000000..4e6b15158c --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR.java @@ -0,0 +1,31 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +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( + value = "/sim/restconf/config/GENERIC-RESOURCE-API:services/service/*/service-data/vnfs/vnf/*/vnf-data/vf-modules/vf-module/dummy_id/vf-module-data/vf-module-topology/", + method = RequestMethod.GET) +public class QueryVFModuleGR extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + int random = (int) (Math.random() * 50 + 1); + + scenario.variable("vfModuleName", "vfModuleName" + random); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("sdnc/gr-api/SDNC_Query_VfModule.json")); + + + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro1.java new file mode 100644 index 0000000000..6a6fbf191c --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro1.java @@ -0,0 +1,31 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +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-Macro1") +@RequestMapping( + value = "/sim/restconf/config/GENERIC-RESOURCE-API:services/service/*/service-data/vnfs/vnf/*/vnf-data/vf-modules/vf-module/macro_module_1/vf-module-data/vf-module-topology/", + method = RequestMethod.GET) +public class QueryVFModuleGR_Macro1 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + + scenario.variable("vfModuleName", "macro_module_1"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("sdnc/gr-api/SDNC_Query_VfModule.json")); + + + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro2.java new file mode 100644 index 0000000000..a63aa0f94f --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro2.java @@ -0,0 +1,30 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +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-Macro2") +@RequestMapping( + value = "/sim/restconf/config/GENERIC-RESOURCE-API:services/service/*/service-data/vnfs/vnf/*/vnf-data/vf-modules/vf-module/macro_module_2/vf-module-data/vf-module-topology/", + method = RequestMethod.GET) +public class QueryVFModuleGR_Macro2 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("vfModuleName", "macro_module_2"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("sdnc/gr-api/SDNC_Query_VfModule.json")); + + + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro3.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro3.java new file mode 100644 index 0000000000..0d4fb2adf3 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVFModuleGR_Macro3.java @@ -0,0 +1,30 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +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-Macro3") +@RequestMapping( + value = "/sim/restconf/config/GENERIC-RESOURCE-API:services/service/*/service-data/vnfs/vnf/*/vnf-data/vf-modules/vf-module/macro_module_3/vf-module-data/vf-module-topology/", + method = RequestMethod.GET) +public class QueryVFModuleGR_Macro3 extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.variable("vfModuleName", "macro_module_3"); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("sdnc/gr-api/SDNC_Query_VfModule.json")); + + + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVNF.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVNF.java new file mode 100644 index 0000000000..a891ea73e2 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/QueryVNF.java @@ -0,0 +1,26 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +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-QueryVnf") +@RequestMapping( + value = "/sim/restconf/config/GENERIC-RESOURCE-API:services/service/*/service-data/vnfs/vnf/*/vnf-data/vnf-topology/", + method = RequestMethod.GET) +public class QueryVNF extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().get(); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("sdnc/gr-api/SDNC_Query_Vnf.json")); + } + + +} diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ServiceInstance.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ServiceInstance.java new file mode 100644 index 0000000000..4dd57d2b39 --- /dev/null +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ServiceInstance.java @@ -0,0 +1,35 @@ +package org.onap.so.simulator.scenarios.sdnc.grapi; + +import org.onap.logging.ref.slf4j.ONAPLogConstants; +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-ServiceInstance") +@RequestMapping(value = "/sim/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation/", + method = RequestMethod.POST) +public class ServiceInstance extends AbstractSimulatorScenario { + + @Override + public void run(ScenarioDesigner scenario) { + scenario.http().receive().post().extractFromPayload("$.input.service-information.service-id", "serviceId") + .extractFromPayload("$.input.service-request-input.service-instance-name", "serviceName") + .extractFromPayload("$.input.sdnc-request-header.svc-action", "action"); + + scenario.createVariable("finalIndicator", "Y"); + scenario.createVariable("responseCode", "200"); + scenario.createVariable("responseMessage", "success"); + scenario.action(new ProcessSDNCAssignService()); + + scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json") + .payload(new ClassPathResource("sdnc/gr-api/SDNCSuccess.json")); + + + } + + +} |