2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.simulators;
24 import com.google.gson.Gson;
26 import java.util.UUID;
27 import javax.ws.rs.Consumes;
28 import javax.ws.rs.POST;
29 import javax.ws.rs.Path;
30 import javax.ws.rs.PathParam;
31 import javax.ws.rs.Produces;
32 import javax.ws.rs.core.MediaType;
33 import org.onap.policy.so.SoRequest;
34 import org.onap.policy.so.SoRequestReferences;
35 import org.onap.policy.so.SoRequestStatus;
36 import org.onap.policy.so.SoResponse;
39 @Path("/serviceInstantiation")
40 public class SoSimulatorJaxRs {
45 * @param serviceInstanceId the service instance Id
46 * @param vnfInstanceId the VNF Id
47 * @return the response
50 @Path("/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
51 @Consumes(MediaType.APPLICATION_JSON)
52 @Produces("application/json")
53 public String soPostQuery(@PathParam("serviceInstanceId") final String serviceInstanceId,
54 @PathParam("vnfInstanceId") final String vnfInstanceId) {
55 final SoRequest request = new SoRequest();
56 final SoRequestStatus requestStatus = new SoRequestStatus();
57 requestStatus.setRequestState("COMPLETE");
58 request.setRequestStatus(requestStatus);
59 request.setRequestId(UUID.randomUUID());
61 final SoResponse response = new SoResponse();
63 final SoRequestReferences requestReferences = new SoRequestReferences();
64 final String requestId = UUID.randomUUID().toString();
65 requestReferences.setRequestId(requestId);
66 response.setRequestReferences(requestReferences);
68 response.setRequest(request);
70 return new Gson().toJson(response);