* ============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.
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;
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.
*/
}
/**
- * 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();
}
}
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());
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.
*
}
/**
- * Returns Listener from createListner based on Coder.
+ * Returns Listener from createListener based on Coder.
*
* @return the Listener
*/
*/
private void verifyUnlocked() {
Map<String, SimpleLock> locks = getLockMap();
- if (locks != null) {
+ if (!MapUtils.isEmpty(locks)) {
Awaitility.await().atMost(5, TimeUnit.SECONDS).until(locks::isEmpty);
}
}
return Whitebox.getInternalState(lockMgr, "resource2lock");
}
- return null;
+ return Collections.emptyMap();
}
}
--- /dev/null
+{
+ "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
--- /dev/null
+{
+ "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