aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-09-01 16:15:55 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-01 16:15:55 +0000
commit64591b51d4da3900f37f53701b2ffef4a38778e9 (patch)
treef731dbd62c859361ce237b9b3cc8927b8f9af11c
parent1b141f012e0c35c6a52de99c67d9f0fdd9f9662a (diff)
parent0690ef13433cb30d3d6c475990a818a714f0538d (diff)
Merge "Add Modify NSSI operation in SO actor"
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java81
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java2
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java44
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java4
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java5
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java117
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorTest.java5
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java4
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java4
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java2
-rw-r--r--models-interactions/model-actors/actor.so/src/test/resources/ModifyNSSI.json19
-rw-r--r--models-interactions/model-actors/actor.so/src/test/resources/service.yaml2
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest3gpp.java49
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequest3gppTest.java48
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java11
-rw-r--r--models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/so/so.3gpp.success.json5
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java29
17 files changed, 415 insertions, 16 deletions
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java
new file mode 100644
index 000000000..69d11fd14
--- /dev/null
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop.actor.so;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import org.onap.policy.common.endpoints.event.comm.Topic;
+import org.onap.policy.common.endpoints.utils.NetLoggerUtil;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
+import org.onap.policy.so.SoRequest3gpp;
+
+public class ModifyNssi extends SoOperation {
+ public static final String NAME = "Modify NSSI";
+
+ private static final List<String> PROPERTY_NAMES = List.of(
+ OperationProperties.AAI_SERVICE,
+ OperationProperties.EVENT_PAYLOAD);
+
+ /**
+ * Constructs the object.
+ *
+ * @param params operation parameters
+ * @param config configuration for this operation
+ */
+ public ModifyNssi(ControlLoopOperationParams params, HttpPollingConfig config) {
+ super(params, config, PROPERTY_NAMES);
+ }
+
+ @Override
+ protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
+
+ SoRequest3gpp soRequest = makeRequest();
+
+ String path = getPath();
+ String url = getClient().getBaseUrl() + path;
+
+ String strRequest = prettyPrint(soRequest);
+ logMessage(NetLoggerUtil.EventType.OUT, Topic.CommInfrastructure.REST, url, strRequest);
+
+ Entity<String> entity = Entity.entity(strRequest, MediaType.APPLICATION_JSON);
+ Map<String, Object> headers = createSimpleHeaders();
+
+ return handleResponse(outcome, url, callback -> getClient().put(callback, path, entity, headers));
+ }
+
+ private SoRequest3gpp makeRequest() {
+
+ Map<String, Object> payload = params.getPayload();
+
+ try {
+ return getCoder().convert(payload, SoRequest3gpp.class);
+ } catch (CoderException e) {
+ throw new IllegalArgumentException("invalid payload value: " + payload, e);
+ }
+ }
+}
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java
index a6619710e..195fbcb96 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.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.
@@ -36,5 +37,6 @@ public class SoActor extends HttpActor<HttpPollingActorParams> {
addOperator(new HttpPollingOperator(NAME, VfModuleCreate.NAME, VfModuleCreate::new));
addOperator(new HttpPollingOperator(NAME, VfModuleDelete.NAME, VfModuleDelete::new));
+ addOperator(new HttpPollingOperator(NAME, ModifyNssi.NAME, ModifyNssi::new));
}
}
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
index 8a0cb703b..ac25c841e 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -75,13 +76,16 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
public static final String REQ_PARAM_NM = "requestParameters";
public static final String CONFIG_PARAM_NM = "configurationParameters";
- // values extracted from the parameter Target
+ /* Values extracted from the parameter Target. These fields are required by any
+ subclasses that make use of prepareSoModelInfo().
+ */
private final String modelCustomizationId;
private final String modelInvariantId;
private final String modelVersionId;
private final String modelName;
private final String modelVersion;
+
private final String vfCountKey;
@@ -95,25 +99,45 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
public SoOperation(ControlLoopOperationParams params, HttpPollingConfig config, List<String> propertyNames) {
super(params, config, SoResponse.class, propertyNames);
- setUsePolling();
+ this.modelCustomizationId = null;
+ this.modelInvariantId = null;
+ this.modelVersionId = null;
+ this.modelVersion = null;
+ this.modelName = null;
+ this.vfCountKey = null;
verifyNotNull("Target information", params.getTargetType());
+ }
- verifyNotNull("Target entity Ids information", params.getTargetEntityIds());
+ /**
+ * Constructs the object.
+ *
+ * @param params operation parameters
+ * @param config configuration for this operation
+ * @param propertyNames names of properties required by this operation
+ * @param targetEntityIds Target Entity information
+ */
+ public SoOperation(ControlLoopOperationParams params, HttpPollingConfig config, List<String> propertyNames,
+ Map<String, String> targetEntityIds) {
+ super(params, config, SoResponse.class, propertyNames);
- this.modelCustomizationId = params.getTargetEntityIds()
+ verifyNotNull("Target entity Ids information", targetEntityIds);
+
+ this.modelCustomizationId = targetEntityIds
.get(ControlLoopOperationParams.PARAMS_ENTITY_MODEL_CUSTOMIZATION_ID);
- this.modelInvariantId = params.getTargetEntityIds()
+ this.modelInvariantId = targetEntityIds
.get(ControlLoopOperationParams.PARAMS_ENTITY_MODEL_INVARIANT_ID);
- this.modelVersionId = params.getTargetEntityIds()
+ this.modelVersionId = targetEntityIds
.get(ControlLoopOperationParams.PARAMS_ENTITY_MODEL_VERSION_ID);
- this.modelVersion = params.getTargetEntityIds()
+ this.modelVersion = targetEntityIds
.get(ControlLoopOperationParams.PARAMS_ENTITY_MODEL_VERSION);
- this.modelName = params.getTargetEntityIds()
+ this.modelName = targetEntityIds
.get(ControlLoopOperationParams.PARAMS_ENTITY_MODEL_NAME);
- vfCountKey = SoConstants.VF_COUNT_PREFIX + "[" + modelCustomizationId + "][" + modelInvariantId + "]["
- + modelVersionId + "]";
+ this.vfCountKey = SoConstants.VF_COUNT_PREFIX + "[" + modelCustomizationId + "][" + modelInvariantId + "]["
+ + modelVersionId + "]";
+
+ verifyNotNull("Target information", params.getTargetType());
}
@Override
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
index 7e95bda03..af06c9184 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -78,8 +79,9 @@ public class VfModuleCreate extends SoOperation {
* @param config configuration for this operation
*/
public VfModuleCreate(ControlLoopOperationParams params, HttpPollingConfig config) {
- super(params, config, PROPERTY_NAMES);
+ super(params, config, PROPERTY_NAMES, params.getTargetEntityIds());
+ setUsePolling();
// ensure we have the necessary parameters
validateTarget();
}
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
index 0ff833c59..f35cdb4e1 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -84,7 +85,9 @@ public class VfModuleDelete extends SoOperation {
* @param config configuration for this operation
*/
public VfModuleDelete(ControlLoopOperationParams params, HttpPollingConfig config) {
- super(params, config, PROPERTY_NAMES);
+ super(params, config, PROPERTY_NAMES, params.getTargetEntityIds());
+
+ setUsePolling();
// ensure we have the necessary parameters
validateTarget();
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java
new file mode 100644
index 000000000..21d7229a3
--- /dev/null
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/ModifyNssiTest.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop.actor.so;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
+import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams;
+import org.onap.policy.so.SoResponse;
+
+public class ModifyNssiTest extends BasicSoOperation {
+
+ private ModifyNssi oper;
+
+ private static StandardCoder coder = new StandardCoder();
+
+ public ModifyNssiTest() {
+ super(DEFAULT_ACTOR, ModifyNssi.NAME);
+ }
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ initBeforeClass();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() {
+ destroyAfterClass();
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ oper = new ModifyNssi(params, config);
+ }
+
+ @Test
+ public void testSuccess() throws Exception {
+ HttpPollingParams opParams = HttpPollingParams.builder().clientName(MY_CLIENT)
+ .path("3gppservices/v7/modify").pollPath("orchestrationRequests/v5/")
+ .maxPolls(2).build();
+ config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
+
+ oper = new ModifyNssi(params, config);
+
+ outcome = oper.start().get();
+
+ assertEquals(OperationResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof SoResponse);
+ }
+
+ @Test
+ public void testConstructor() {
+ assertEquals(DEFAULT_ACTOR, oper.getActorName());
+ assertEquals(ModifyNssi.NAME, oper.getName());
+ assertFalse(oper.isUsePolling());
+
+ params = params.toBuilder().targetType(null).build();
+ assertThatIllegalArgumentException().isThrownBy(() -> new ModifyNssi(params, config))
+ .withMessageContaining("Target information");
+ }
+
+ @Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.AAI_SERVICE,
+ OperationProperties.EVENT_PAYLOAD));
+ }
+
+ @Override
+ protected Map<String, Object> makePayload() {
+ String payloadString = ResourceUtils
+ .getResourceAsString("src/test/resources/ModifyNSSI.json");
+
+ try {
+ return coder.decode(payloadString, Map.class);
+ } catch (CoderException e) {
+ throw new IllegalArgumentException("invalid payload value: " + payloadString, e);
+ }
+ }
+}
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorTest.java
index b42b3f8dd..79b9944d3 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorTest.java
@@ -5,6 +5,7 @@
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2018-2020 AT&T. 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.
@@ -36,8 +37,8 @@ public class SoActorTest extends BasicActor {
SoActor prov = new SoActor();
// verify that it has the operators we expect
- var expected = Arrays.asList(VfModuleCreate.NAME, VfModuleDelete.NAME).stream().sorted()
- .collect(Collectors.toList());
+ var expected = Arrays.asList(VfModuleCreate.NAME, VfModuleDelete.NAME, ModifyNssi.NAME).stream()
+ .sorted().collect(Collectors.toList());
var actual = prov.getOperationNames().stream().sorted().collect(Collectors.toList());
assertEquals(expected.toString(), actual.toString());
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
index 464e5d162..e9a49545e 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -81,7 +82,7 @@ public class SoOperationTest extends BasicSoOperation {
initConfig();
- oper = new SoOperation(params, config, PROP_NAMES) {};
+ oper = new SoOperation(params, config, PROP_NAMES, params.getTargetEntityIds()) {};
}
@Test
@@ -89,7 +90,6 @@ public class SoOperationTest extends BasicSoOperation {
assertEquals(DEFAULT_ACTOR, oper.getActorName());
assertEquals(DEFAULT_OPERATION, oper.getName());
assertSame(config, oper.getConfig());
- assertTrue(oper.isUsePolling());
// check when Target is null
params = params.toBuilder().targetType(null).build();
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
index f1741d677..9d4d00908 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -62,6 +63,8 @@ import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponse;
public class VfModuleCreateTest extends BasicSoOperation {
+
+
private static final String MODEL_NAME2 = "my-model-name-B";
private static final String MODEL_VERS2 = "my-model-version-B";
private static final String SVC_INSTANCE_ID = "my-service-instance-id";
@@ -158,6 +161,7 @@ public class VfModuleCreateTest extends BasicSoOperation {
public void testConstructor() {
assertEquals(DEFAULT_ACTOR, oper.getActorName());
assertEquals(VfModuleCreate.NAME, oper.getName());
+ assertTrue(oper.isUsePolling());
// verify that target validation is done
params = params.toBuilder().targetType(null).build();
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
index 2ab1dbe83..300d73b53 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -179,6 +180,7 @@ public class VfModuleDeleteTest extends BasicSoOperation {
public void testConstructor() {
assertEquals(DEFAULT_ACTOR, oper.getActorName());
assertEquals(VfModuleDelete.NAME, oper.getName());
+ assertTrue(oper.isUsePolling());
// verify that target validation is done
params = params.toBuilder().targetType(null).build();
diff --git a/models-interactions/model-actors/actor.so/src/test/resources/ModifyNSSI.json b/models-interactions/model-actors/actor.so/src/test/resources/ModifyNSSI.json
new file mode 100644
index 000000000..50dbbcbec
--- /dev/null
+++ b/models-interactions/model-actors/actor.so/src/test/resources/ModifyNSSI.json
@@ -0,0 +1,19 @@
+{
+ "name": "eMBB-001",
+ "globalSubscriberId": "5GCustomer",
+ "subscriptionServiceType": "5G",
+ "networkType": "an",
+ "serviceInstanceID": "02328c27-bb1a-4b0d-a437-111dc7087665",
+ "additionalProperties": {
+ "modifyAction": "allocate",
+ "snssaiList": [
+ "001-100001"
+ ],
+ "sliceProfileId": "",
+ "nsiInfo": {
+ "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+ "nsiName": "eMBB-001"
+ },
+ "scriptName": "AN1"
+ }
+}
diff --git a/models-interactions/model-actors/actor.so/src/test/resources/service.yaml b/models-interactions/model-actors/actor.so/src/test/resources/service.yaml
index e16e7d74a..81b0f2e26 100644
--- a/models-interactions/model-actors/actor.so/src/test/resources/service.yaml
+++ b/models-interactions/model-actors/actor.so/src/test/resources/service.yaml
@@ -34,3 +34,5 @@ actors:
path: serviceInstantiation/v7/serviceInstances
VF Module Delete:
path: serviceInstances/v7
+ Modify NSSI:
+ path: 3gppservices/v7/modify
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest3gpp.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest3gpp.java
new file mode 100644
index 000000000..212eabe58
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest3gpp.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class SoRequest3gpp implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ private String name;
+
+ @SerializedName("serviceInstanceID")
+ private String serviceInstanceId;
+
+ private String globalSubscriberId;
+ private String subscriptionServiceType;
+ private String networkType;
+ private Map<String, Object> additionalProperties;
+
+
+ public SoRequest3gpp() {
+ // required by author
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequest3gppTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequest3gppTest.java
new file mode 100644
index 000000000..a7369120c
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequest3gppTest.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.impl.PojoClassFactory;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.SetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+import org.junit.Test;
+
+public class SoRequest3gppTest {
+
+ @Test
+ public void testSetGet() {
+ PojoClass pojoClass = PojoClassFactory.getPojoClass(SoRequest3gpp.class);
+ Validator validator = ValidatorBuilder
+ .create()
+ .with(new SetterMustExistRule())
+ .with(new GetterMustExistRule())
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .build();
+
+ validator.validate(pojoClass);
+ }
+}
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\": \"";