aboutsummaryrefslogtreecommitdiffstats
path: root/so-simulator/src/main/java/org/onap/so/simulator/scenarios/sdnc/grapi/ServiceInstance.java
blob: 4dd57d2b390022c840b66e7458457f8416027f83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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"));


    }


}