2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.simulators;
25 import java.util.UUID;
26 import javax.ws.rs.Consumes;
27 import javax.ws.rs.POST;
28 import javax.ws.rs.Path;
29 import javax.ws.rs.Produces;
30 import javax.ws.rs.core.MediaType;
31 import org.onap.policy.sdnc.SdncResponse;
32 import org.onap.policy.sdnc.SdncResponseOutput;
33 import org.onap.policy.sdnc.util.Serialization;
36 @Path("/restconf/operations/")
37 public class SdncSimulatorJaxRs {
42 * @return the response
45 @Path("/GENERIC-RESOURCE-API:network-topology-operation")
46 @Consumes(MediaType.APPLICATION_JSON)
47 @Produces("application/json")
48 public String sdncPostQuery() {
49 return makeSuccessResponse();
54 * SDNC vf module topology operation.
56 * @return the response
59 @Path("/GENERIC-RESOURCE-API:vf-module-topology-operation")
60 @Consumes(MediaType.APPLICATION_JSON)
61 @Produces("application/json")
62 public String sdncVnfTopologyOperation() {
63 return makeSuccessResponse();
67 private String makeSuccessResponse() {
68 final SdncResponse response = new SdncResponse();
69 response.setRequestId(UUID.randomUUID().toString());
70 SdncResponseOutput responseOutput = new SdncResponseOutput();
71 responseOutput.setResponseCode("200");
72 responseOutput.setAckFinalIndicator("Y");
73 responseOutput.setSvcRequestId(UUID.randomUUID().toString());
74 response.setResponseOutput(responseOutput);
75 return Serialization.gsonPretty.toJson(response);