aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/rules-test
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2022-09-12 17:46:32 -0500
committerjhh <jorge.hernandez-herrero@att.com>2022-09-12 17:46:32 -0500
commit0c92a69b4e45ce14d0643032bed23a1799cae8d0 (patch)
tree0ec9646bb3af9ce55135e96a4ee5c9d4b820f1de /controlloop/common/rules-test
parent10554fd32c7b4ffd32e3096e44cf309a4a06e3a5 (diff)
5G SON usecase A1 O1 policies support
Issue-ID: POLICY-4108 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I3e740f108dad18f78dc69ebed1949674c58ff95b
Diffstat (limited to 'controlloop/common/rules-test')
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java50
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java4
-rw-r--r--controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.onset.json20
-rw-r--r--controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.sdnr.success.json23
-rw-r--r--controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.onset.json20
-rw-r--r--controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.sdnr.success.json23
6 files changed, 128 insertions, 12 deletions
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
index 3bfa971d0..2b81fda7d 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +22,18 @@ package org.onap.policy.controlloop.common.rules.test;
import static org.junit.Assert.assertEquals;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
+import org.apache.commons.collections.MapUtils;
import org.awaitility.Awaitility;
import org.junit.Test;
import org.onap.policy.appc.Request;
@@ -106,16 +109,27 @@ public abstract class BaseTest {
private static final String VFW_APPC_SUCCESS = "vfw/vfw.appc.success.json";
private static final String VFW_APPC_FAILURE = "vfw/vfw.appc.failure.json";
- // VPCI
+ // 5G SON Legacy - PCI
private static final String VPCI_TOSCA_COMPLIANT_POLICY = "vpci/tosca-compliant-vpci.json";
private static final String VPCI_ONSET = "vpci/vpci.onset.json";
private static final String VPCI_SDNR_SUCCESS = "vpci/vpci.sdnr.success.json";
- // VSONH
+ // 5G SON Legacy - ANR
private static final String VSONH_TOSCA_COMPLIANT_POLICY = "vsonh/tosca-compliant-vsonh.json";
private static final String VSONH_ONSET = "vsonh/vsonh.onset.json";
private static final String VSONH_SDNR_SUCCESS = "vsonh/vsonh.sdnr.success.json";
+ // 5G SON Use case Policies (Kohn+)
+
+ private static final String V5G_SON_O1_TOSCA_POLICY = "policies/v5gSonO1.policy.operational.input.tosca.json";
+ private static final String V5G_SON_O1_ONSET = "vpci/v5G.son.O1.onset.json";
+ private static final String V5G_SON_O1_SDNR_SUCCESS = "vpci/v5G.son.O1.sdnr.success.json";
+ private static final String MODIFY_O1_CONFIG_OPERATION = "ModifyO1Config";
+
+ private static final String V5G_SON_A1_TOSCA_POLICY = "policies/v5gSonA1.policy.operational.input.tosca.json";
+ private static final String V5G_SON_A1_ONSET = "vsonh/v5G.son.A1.onset.json";
+ private static final String V5G_SON_A1_SDNR_SUCCESS = "vsonh/v5G.son.A1.sdnr.success.json";
+ private static final String MODIFY_A1_POLICY_OPERATION = "ModifyA1Policy";
/*
* Coders used to decode requests and responses.
*/
@@ -170,13 +184,13 @@ public abstract class BaseTest {
}
/**
- * Initializes {@link #topics} and {@link #controller}.
+ * Initializes {@link #topics}.
*/
public void init() {
setTopics(topicMaker.get());
Map<String, SimpleLock> locks = getLockMap();
- if (locks != null) {
+ if (!MapUtils.isEmpty(locks)) {
locks.clear();
}
}
@@ -270,8 +284,8 @@ public abstract class BaseTest {
VirtualControlLoopNotification notif1 = waitForFinalSuccess(policy, policyClMgt);
VirtualControlLoopNotification notif2 = waitForFinalSuccess(policy, policyClMgt);
- // get the list of target names so we can ensure there's one of each
- List<String> actual = List.of(notif1, notif2).stream().map(notif -> notif.getAai().get("generic-vnf.vnf-id"))
+ // get the list of target names, so we can ensure there's one of each
+ List<String> actual = Stream.of(notif1, notif2).map(notif -> notif.getAai().get("generic-vnf.vnf-id"))
.sorted().collect(Collectors.toList());
assertEquals(List.of("duplicate-VNF", "vCPE_Infrastructure_vGMUX_demo_app").toString(), actual.toString());
@@ -367,6 +381,22 @@ public abstract class BaseTest {
}
/**
+ * Sunny day 5G SON 01 Modify01Config Operational Policy.
+ */
+ @Test
+ public void test5gSonO1SunnyDayCompliant() {
+ sdnrSunnyDay(V5G_SON_O1_TOSCA_POLICY, V5G_SON_O1_ONSET, V5G_SON_O1_SDNR_SUCCESS, MODIFY_O1_CONFIG_OPERATION);
+ }
+
+ /**
+ * Sunny day 5G SON A1 ModifyA1Policy Operational Policy.
+ */
+ @Test
+ public void test5gSonA1SunnyDayCompliant() {
+ sdnrSunnyDay(V5G_SON_A1_TOSCA_POLICY, V5G_SON_A1_ONSET, V5G_SON_A1_SDNR_SUCCESS, MODIFY_A1_POLICY_OPERATION);
+ }
+
+ /**
* Sunny day scenario for use cases that use APPC-LCM.
*
* @param policyFile file containing the ToscaPolicy to be loaded
@@ -710,7 +740,7 @@ public abstract class BaseTest {
}
/**
- * Returns Listener from createListner based on Coder.
+ * Returns Listener from createListener based on Coder.
*
* @return the Listener
*/
@@ -723,7 +753,7 @@ public abstract class BaseTest {
*/
private void verifyUnlocked() {
Map<String, SimpleLock> locks = getLockMap();
- if (locks != null) {
+ if (!MapUtils.isEmpty(locks)) {
Awaitility.await().atMost(5, TimeUnit.SECONDS).until(locks::isEmpty);
}
}
@@ -734,6 +764,6 @@ public abstract class BaseTest {
return Whitebox.getInternalState(lockMgr, "resource2lock");
}
- return null;
+ return Collections.emptyMap();
}
}
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java
index 580b398e9..449096223 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020, 2022 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
public abstract class DroolsRuleTest extends BaseTest {
// these may be overridden by junit tests
- private static Function<String, Rules> ruleMaker = Rules::new;
+ private static final Function<String, Rules> ruleMaker = Rules::new;
protected static Rules rules;
diff --git a/controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.onset.json b/controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.onset.json
new file mode 100644
index 000000000..8021c21c7
--- /dev/null
+++ b/controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.onset.json
@@ -0,0 +1,20 @@
+{
+ "closedLoopControlName": "ControlLoop-SONO1-fb41f388-a5f2-11e8-98d0-529269fb1459",
+ "closedLoopAlarmStart": 1606806580487,
+ "closedLoopEventClient": "microservice.PCI",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "427e68b6-3946-4cc6-bbf9-602aff28ac3a",
+ "target_type": "PNF",
+ "target": "pnf.pnf-name",
+ "AAI": {
+ "generic-vnf.prov-status": "ACTIVE",
+ "generic-vnf.is-closed-loop-disabled": "false",
+ "pnf.pnf-name": "ncserver1"
+ },
+ "from": "PCIMS",
+ "version": "1.0.2",
+ "policyName": "SONO1",
+ "policyVersion": "1.0.2",
+ "Action": "ModifyO1Config",
+ "payload": "{\"Configurations\":[{\"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}}},{\"data\":{\"FAPService\":{\"alias\":\"Chn0331\",\"X0005b9Lte\":{\"phyCellIdInUse\":7,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0331\"}}}}}}}]}"
+} \ No newline at end of file
diff --git a/controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.sdnr.success.json b/controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.sdnr.success.json
new file mode 100644
index 000000000..2fa46c0f4
--- /dev/null
+++ b/controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.sdnr.success.json
@@ -0,0 +1,23 @@
+{
+ "body": {
+ "output": {
+ "CommonHeader": {
+ "TimeStamp": "2022-08-10T07:10:05.614Z",
+ "APIver": "1.0",
+ "RequestID": "427e68b6-3946-4cc6-bbf9-602aff28ac3a",
+ "SubRequestID": "${replaceMe}",
+ "RequestTrack": [],
+ "Flags": []
+ },
+ "Status": {
+ "Code": 200,
+ "Value": "SUCCESS"
+ },
+ "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}} } ] }"
+ }
+ },
+ "version": "1.0",
+ "rpc-name": "ModifyO1Config",
+ "correlation-id": "427e68b6-3946-4cc6-bbf9-602aff28ac3a",
+ "type": "response"
+}
diff --git a/controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.onset.json b/controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.onset.json
new file mode 100644
index 000000000..6f562fec3
--- /dev/null
+++ b/controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.onset.json
@@ -0,0 +1,20 @@
+{
+ "closedLoopControlName": "ControlLoop-SONA1-7d4baf04-8875-4d1f-946d-06b874048b61",
+ "closedLoopAlarmStart": 1606805921693,
+ "closedLoopEventClient": "microservice.SONH",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "82feb01e-4f3e-40e2-b8df-683adabae893",
+ "target_type": "PNF",
+ "target": "pnf.pnf-name",
+ "AAI": {
+ "generic-vnf.prov-status": "ACTIVE",
+ "generic-vnf.is-closed-loop-disabled": "false",
+ "pnf.pnf-name": "ncserver1"
+ },
+ "from": "SONHMS",
+ "version": "1.0.2",
+ "policyName": "SONA1",
+ "policyVersion": "1.0.2",
+ "Action": "ModifyA1Policy",
+ "payload": "{ \"Configurations\":[ { \"data\":{ \"FAPService\":{ \"alias\":\"Cell1\", \"CellConfig\":{ \"LTE\":{ \"RAN\":{ \"Common\":{ \"CellIdentity\":\"1\" }, \"NeighborListInUse\" : { \"LTECellNumberOfEntries\" : \"1\" , \"LTECell\" : [{ \"PLMNID\" :\"plmnid1\", \"CID\":\"Chn0001\", \"PhyCellID\":\"3\", \"PNFName\":\"ncserver01\", \"Blacklisted\":\"false\"}] } } } } } } } ] }"
+} \ No newline at end of file
diff --git a/controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.sdnr.success.json b/controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.sdnr.success.json
new file mode 100644
index 000000000..12cfbc626
--- /dev/null
+++ b/controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.sdnr.success.json
@@ -0,0 +1,23 @@
+{
+ "body": {
+ "output": {
+ "CommonHeader": {
+ "TimeStamp": "2022-09-10T07:10:05.614Z",
+ "APIver": "1.0",
+ "RequestID": "82feb01e-4f3e-40e2-b8df-683adabae893",
+ "SubRequestID": "${replaceMe}",
+ "RequestTrack": [],
+ "Flags": []
+ },
+ "Status": {
+ "Code": 200,
+ "Value": "SUCCESS"
+ },
+ "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{ \"FAPService\":{ \"alias\":\"Cell1\", \"CellConfig\":{ \"LTE\":{ \"RAN\":{ \"Common\":{ \"CellIdentity\":\"1\" }, \"NeighborListInUse\" : { \"LTECellNumberOfEntries\" : \"1\" , \"LTECell\" : [{ \"PLMNID\" :\"plmnid1\", \"CID\":\"Chn0001\", \"PhyCellID\":\"3\", \"PNFName\":\"ncserver01\", \"Blacklisted\":\"false\"}] } } } } } } } ] }"
+ }
+ },
+ "version": "1.0",
+ "rpc-name": "ModifyA1Policy",
+ "correlation-id": "82feb01e-4f3e-40e2-b8df-683adabae893",
+ "type": "response"
+}