From 0c92a69b4e45ce14d0643032bed23a1799cae8d0 Mon Sep 17 00:00:00 2001 From: jhh Date: Mon, 12 Sep 2022 17:46:32 -0500 Subject: 5G SON usecase A1 O1 policies support Issue-ID: POLICY-4108 Signed-off-by: jhh Change-Id: I3e740f108dad18f78dc69ebed1949674c58ff95b --- .../controlloop/common/rules/test/BaseTest.java | 50 +++++++++++++++++----- .../common/rules/test/DroolsRuleTest.java | 4 +- .../src/main/resources/vpci/v5G.son.O1.onset.json | 20 +++++++++ .../resources/vpci/v5G.son.O1.sdnr.success.json | 23 ++++++++++ .../src/main/resources/vsonh/v5G.son.A1.onset.json | 20 +++++++++ .../resources/vsonh/v5G.son.A1.sdnr.success.json | 23 ++++++++++ 6 files changed, 128 insertions(+), 12 deletions(-) create mode 100644 controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.onset.json create mode 100644 controlloop/common/rules-test/src/main/resources/vpci/v5G.son.O1.sdnr.success.json create mode 100644 controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.onset.json create mode 100644 controlloop/common/rules-test/src/main/resources/vsonh/v5G.son.A1.sdnr.success.json (limited to 'controlloop/common') 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 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 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 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()); @@ -366,6 +380,22 @@ public abstract class BaseTest { sdnrSunnyDay(VSONH_TOSCA_COMPLIANT_POLICY, VSONH_ONSET, VSONH_SDNR_SUCCESS, SNDR_MODIFY_CONFIG_ANR_OP); } + /** + * 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. * @@ -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 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 ruleMaker = Rules::new; + private static final Function 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" +} -- cgit 1.2.3-korg