diff options
author | krishnaa96 <krishna.moorthy6@wipro.com> | 2020-08-26 14:59:04 +0530 |
---|---|---|
committer | krishnaa96 <krishna.moorthy6@wipro.com> | 2020-09-01 19:00:35 +0530 |
commit | 0690ef13433cb30d3d6c475990a818a714f0538d (patch) | |
tree | bb0ec20c49777f224057b2bb929b64aa79c6b456 /models-interactions/model-simulators/src | |
parent | b13f57c283bf7e90db88e159d0e3e8bd6ba6f698 (diff) |
Add Modify NSSI operation in SO actor
Issue-ID: POLICY-2586
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: I6ac184a6e731767f06401a0ac984c6b448c5d82f
Diffstat (limited to 'models-interactions/model-simulators/src')
3 files changed, 45 insertions, 0 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 2e6f46b26..12a523a65 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 @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 Wipro Limited. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +32,7 @@ import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -38,6 +40,7 @@ import javax.ws.rs.core.MediaType; import lombok.Setter; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequest3gpp; @Path("/") public class SoSimulatorJaxRs { @@ -123,6 +126,14 @@ public class SoSimulatorJaxRs { } } + @PUT + @Path("/3gppservices/v7/modify") + @Consumes(MediaType.APPLICATION_JSON) + @Produces("application/json") + public String soPost3gpp(@ApiParam(required = true) SoRequest3gpp request) { + return ResourceUtils.getResourceAsString("org/onap/policy/simulators/so/so.3gpp.success.json"); + } + private String makeStarted() { String requestId = UUID.randomUUID().toString(); diff --git a/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.3gpp.success.json b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.3gpp.success.json new file mode 100644 index 000000000..98f045503 --- /dev/null +++ b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.3gpp.success.json @@ -0,0 +1,5 @@ +{ + "jobId": "db245365e79c47ed88fcd60caa8f6549", + "status": "In progress", + "statusDescription": {} +} diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index 6dac1b042..7654e0053 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2020 Wipro Limited. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ package org.onap.policy.simulators; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -39,6 +41,7 @@ import org.onap.policy.so.SoModelInfo; import org.onap.policy.so.SoRelatedInstance; import org.onap.policy.so.SoRelatedInstanceListElement; import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequest3gpp; import org.onap.policy.so.SoRequestDetails; import org.onap.policy.so.SoRequestInfo; import org.onap.policy.so.SoRequestParameters; @@ -219,6 +222,32 @@ public class SoSimulatorTest { assertThat(httpDetails.getRight()).contains("\"COMPLETE\"").doesNotContain("requestSelfLink"); } + @Test + public void testModifyNssi() { + SoSimulatorJaxRs.setRequirePolling(false); + String request = Serialization.gsonPretty.toJson(this.createNssiRequest()); + Pair<Integer, String> httpDetails = new RestManager().put( + "http://localhost:6667/3gppservices/v7/modify", + "username", + "password", new HashMap<>(), "application/json", request); + assertNotNull(httpDetails); + assertEquals(200, httpDetails.getLeft().intValue()); + assertThat(httpDetails.getRight()).contains("jobId").contains("status"); + } + + private SoRequest3gpp createNssiRequest() { + SoRequest3gpp request = new SoRequest3gpp(); + + request.setName("URLLC_core1"); + request.setServiceInstanceId("ff67a209-dc69-4a1a-b89a-c1f55c2a8842"); + request.setGlobalSubscriberId("5G Customer"); + request.setSubscriptionServiceType("5G"); + request.setNetworkType("an"); + request.setAdditionalProperties(new HashMap<String, Object>()); + + return request; + } + private String extractUri(String response) { final String prefix = "\"requestId\": \""; |