aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-simulators/src/main/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-03-03 21:02:13 -0500
committerJim Hahn <jrh3@att.com>2020-03-05 15:42:01 -0500
commit03248c4de4197dac33c156e6a7a6538c9943305c (patch)
tree3224aa774d09649ed83d91a9a36f9bd969e701cf /models-interactions/model-simulators/src/main/java
parent7f1903bae3069d5e14b4c322c09c1317d90114b6 (diff)
Add SO VF Module Delete Operation
Redesigned the SO Operation classes; moved some code from the subclass to the superclass so it could be reused by the VF Module Delete Operation. JerseyClient does not support DELETE with a request body, so had to implement a delete() method using java11 HttpClient. Fix some issues found while testing with drools-apps. Added "delete" operation to SO simulator. Issue-ID: POLICY-2371 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I269fe13cf90c295ec2bbac92bc5a59b3820ea265
Diffstat (limited to 'models-interactions/model-simulators/src/main/java')
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
index 1af0b767c..b06a66f41 100644
--- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
+++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java
@@ -25,6 +25,7 @@ import com.google.gson.Gson;
import java.util.UUID;
import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -36,7 +37,7 @@ import org.onap.policy.so.SoRequestStatus;
import org.onap.policy.so.SoResponse;
-@Path("/serviceInstantiation")
+@Path("/")
public class SoSimulatorJaxRs {
/**
@@ -47,7 +48,7 @@ public class SoSimulatorJaxRs {
* @return the response
*/
@POST
- @Path("/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
+ @Path("/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/json")
public String soPostQuery(@PathParam("serviceInstanceId") final String serviceInstanceId,
@@ -69,4 +70,36 @@ public class SoSimulatorJaxRs {
return new Gson().toJson(response);
}
+
+ /**
+ * SO Delete.
+ *
+ * @param serviceInstanceId the service instance Id
+ * @param vnfInstanceId the VNF Id
+ * @return the response
+ */
+ @DELETE
+ @Path("/serviceInstances/v7/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String soDelete(@PathParam("serviceInstanceId") final String serviceInstanceId,
+ @PathParam("vnfInstanceId") final String vnfInstanceId,
+ @PathParam("vfModuleInstanceId") final String vfModuleInstanceId) {
+ final SoRequest request = new SoRequest();
+ final SoRequestStatus requestStatus = new SoRequestStatus();
+ requestStatus.setRequestState("COMPLETE");
+ request.setRequestStatus(requestStatus);
+ request.setRequestId(UUID.randomUUID());
+
+ final SoResponse response = new SoResponse();
+
+ final SoRequestReferences requestReferences = new SoRequestReferences();
+ final String requestId = UUID.randomUUID().toString();
+ requestReferences.setRequestId(requestId);
+ response.setRequestReferences(requestReferences);
+
+ response.setRequest(request);
+
+ return new Gson().toJson(response);
+ }
}