summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java43
-rw-r--r--examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java91
-rw-r--r--examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java32
-rw-r--r--examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java10
-rw-r--r--examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTaskTaskLogic.mvel11
-rw-r--r--examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTaskTaskLogic.mvel11
-rw-r--r--examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicyActTaskSelectionLogic.mvel11
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java5
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java12
-rw-r--r--examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java88
-rw-r--r--examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java41
-rw-r--r--examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java11
-rw-r--r--examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java5
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionConceptTest.java5
14 files changed, 71 insertions, 305 deletions
diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java
index 70af74ab9..650bd82e0 100644
--- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java
+++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
@@ -21,13 +22,19 @@
package org.onap.policy.apex.examples.aadm.concepts;
import java.io.Serializable;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
/**
* The Class ENodeBStatus holds the status of an eNodeB in the AADM domain.
*/
+@Getter
+@Setter
public class ENodeBStatus implements Serializable {
private static final long serialVersionUID = 2852523814242234172L;
+ @Getter(AccessLevel.NONE)
private final String enodeB;
private long dosCount = 0;
@@ -52,24 +59,6 @@ public class ENodeBStatus implements Serializable {
}
/**
- * Gets the number of Denial Of Service incidents on the eNodeB.
- *
- * @return the number of Denial Of Service incidents on the eNodeB
- */
- public long getDosCount() {
- return dosCount;
- }
-
- /**
- * Sets the number of Denial Of Service incidents on the eNodeB.
- *
- * @param incomingDosCount the number of Denial Of Service incidents on the eNodeB
- */
- public void setDosCount(final long incomingDosCount) {
- this.dosCount = incomingDosCount;
- }
-
- /**
* Increment DOS count.
*
* @return the long
@@ -86,22 +75,4 @@ public class ENodeBStatus implements Serializable {
public long decrementDosCount() {
return --dosCount;
}
-
- /**
- * Gets the being probed.
- *
- * @return the being probed
- */
- public boolean getBeingProbed() {
- return beingProbed;
- }
-
- /**
- * Sets the being probed.
- *
- * @param beingProbed the being probed
- */
- public void setBeingProbed(final boolean beingProbed) {
- this.beingProbed = beingProbed;
- }
}
diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java
index 4b7def097..74f069dce 100644
--- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java
+++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
@@ -21,10 +22,15 @@
package org.onap.policy.apex.examples.aadm.concepts;
import java.io.Serializable;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
/**
* The Class IMSIStatus holds the status of an IMSI in the AADM domain.
*/
+@Getter
+@Setter
public class ImsiStatus implements Serializable {
private static final long serialVersionUID = 2852523814242234172L;
@@ -34,8 +40,10 @@ public class ImsiStatus implements Serializable {
private boolean anomalous = false;
private long anomalousTime = TIME_NOT_SET;
+ @Getter(AccessLevel.NONE)
+ @Setter(AccessLevel.NONE)
private String enodeBId;
- private long blackListedTime = TIME_NOT_SET;
+ private long blacklistedTime = TIME_NOT_SET;
private long blockingCount = 0;
/**
@@ -48,51 +56,6 @@ public class ImsiStatus implements Serializable {
}
/**
- * Gets the IMSI value.
- *
- * @return the IMSI value
- */
- public String getImsi() {
- return imsi;
- }
-
- /**
- * Gets the anomalous flag.
- *
- * @return the anomalous flag
- */
- public boolean getAnomalous() {
- return anomalous;
- }
-
- /**
- * Sets the anomalous flag.
- *
- * @param anomalous the anomalous flag
- */
- public void setAnomalous(final boolean anomalous) {
- this.anomalous = anomalous;
- }
-
- /**
- * Gets the time of the most recent anomolous event.
- *
- * @return the time of the most recent anomolous event
- */
- public long getAnomolousTime() {
- return anomalousTime;
- }
-
- /**
- * Sets the time of the most recent anomolous event.
- *
- * @param incomingAnomalousTime the time of the most recent anomolous event
- */
- public void setAnomolousTime(final long incomingAnomalousTime) {
- this.anomalousTime = incomingAnomalousTime;
- }
-
- /**
* Gets the eNodeB ID to which the IMSI is attached.
*
* @return theeNodeB ID to which the IMSI is attached
@@ -120,42 +83,6 @@ public class ImsiStatus implements Serializable {
}
/**
- * Gets the time at which the IMSI was blacklisted.
- *
- * @return the time at which the IMSI was blacklisted
- */
- public long getBlacklistedTime() {
- return blackListedTime;
- }
-
- /**
- * Sets the time at which the IMSI was blacklisted.
- *
- * @param incomingBlackListedTime the time at which the IMSI was blacklisted
- */
- public void setBlacklistedTime(final long incomingBlackListedTime) {
- this.blackListedTime = incomingBlackListedTime;
- }
-
- /**
- * Gets the number of times this IMSI was blocked.
- *
- * @return the number of times this IMSI was blocked
- */
- public long getBlockingCount() {
- return blockingCount;
- }
-
- /**
- * Sets the number of times this IMSI was blocked.
- *
- * @param blockingCount the number of times this IMSI was blocked
- */
- public void setBlockingCount(final long blockingCount) {
- this.blockingCount = blockingCount;
- }
-
- /**
* Increment the number of times this IMSI was blocked.
*
* @return the incremented number of times this IMSI was blocked
diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java
index 689865b16..26f2b4110 100644
--- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java
+++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
@@ -21,10 +22,14 @@
package org.onap.policy.apex.examples.aadm.concepts;
import java.io.Serializable;
+import lombok.Getter;
+import lombok.Setter;
/**
* The Class IPAddressStatus holds the status of an IP address in the AADM domain.
*/
+@Getter
+@Setter
public class IpAddressStatus implements Serializable {
private static final long serialVersionUID = -7402022458317593252L;
@@ -42,33 +47,6 @@ public class IpAddressStatus implements Serializable {
}
/**
- * Gets the IP address.
- *
- * @return the IP address
- */
- public String getIpAddress() {
- return ipAddress;
- }
-
- /**
- * Gets the IMSI.
- *
- * @return the imsi
- */
- public String getImsi() {
- return imsi;
- }
-
- /**
- * Sets the IMSI.
- *
- * @param incomingImsi the imsi
- */
- public void setImsi(final String incomingImsi) {
- this.imsi = incomingImsi;
- }
-
- /**
* Check set IMSI.
*
* @return true, if check set IMSI
diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java
index 492769dad..52edb31a3 100644
--- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java
+++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -21,6 +22,8 @@
package org.onap.policy.apex.examples.aadm.model;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
@@ -32,17 +35,12 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class AadmDomainModelSaver {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(AadmDomainModelSaver.class);
/**
- * Private default constructor to prevent subclassing.
- */
- private AadmDomainModelSaver() {
- }
-
- /**
* Write the AADM model to args[0].
*
* @param args Not used
diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTaskTaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTaskTaskLogic.mvel
index 225a0da4d..743824394 100644
--- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTaskTaskLogic.mvel
+++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTaskTaskLogic.mvel
@@ -1,19 +1,20 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -52,7 +53,7 @@ eNodeBStatus.setBeingProbed(false);
leaveProbingOn = false;
for (ENodeBStatus enbStatus : getContextAlbum("ENodeBStatusAlbum").values) {
- if (enbStatus.getBeingProbed()) {
+ if (enbStatus.isBeingProbed()) {
leaveProbingOn = true;
}
}
@@ -67,7 +68,7 @@ logger.debug(eNodeBStatus.getENodeB() + ": dosCount is " + eNodeBStatus.getDosCo
imsiStatus.setAnomalous(false);
-logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.getAnomalous());
+logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.isAnomalous());
getContextAlbum("IMSIStatusAlbum") .put(imsiStatus.getImsi(), imsiStatus);
getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus);
diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTaskTaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTaskTaskLogic.mvel
index 63ac8d0ba..6af2d1163 100644
--- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTaskTaskLogic.mvel
+++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTaskTaskLogic.mvel
@@ -1,19 +1,20 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -60,7 +61,7 @@ if (imsiStatus.getENodeBId() != null && !imsiStatus.getENodeBId().equals(inField
outFields["ACTTASK"] = "remove_from_probe";
for (ENodeBStatus enbStatus : getContextAlbum("ENodeBStatusAlbum").values) {
- if (enbStatus.getBeingProbed()) {
+ if (enbStatus.isBeingProbed()) {
outFields["PROBE_ON"] = true;
outFields["TCP_ON"] = true;
return true;
@@ -78,7 +79,7 @@ if (imsiStatus.getENodeBId() != null && !imsiStatus.getENodeBId().equals(inField
}
imsiStatus.setAnomalous(true);
-imsiStatus.setAnomolousTime(System.currentTimeMillis());
+imsiStatus.setAnomalousTime(System.currentTimeMillis());
imsiStatus.setENodeBId(inFields["ENODEB_ID"]);
getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus);
logger.debug(imsiStatus.getENodeBId() + ": enodeb added to imsi ip added " + outFields["IMSI_IP"]);
diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicyActTaskSelectionLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicyActTaskSelectionLogic.mvel
index 9c71db50a..2aca804d1 100644
--- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicyActTaskSelectionLogic.mvel
+++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicyActTaskSelectionLogic.mvel
@@ -1,19 +1,20 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -33,10 +34,10 @@ if (imsiStatus.getBlockingCount() > 1) {
return false;
}
-logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.getAnomalous());
+logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.isAnomalous());
// check if this is second iteration
-if (inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] != null && inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] > 100 && imsiStatus.getAnomalous()) {
+if (inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] != null && inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] > 100 && imsiStatus.isAnomalous()) {
subject.getTaskKey("AADMDoSProvenActTask").copyTo(selectedTask);
logger.debug("inside TCP_UE_SIDE_AVG_THROUGHPUT");
return true;
diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
index fe9914061..99625f136 100644
--- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
+++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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,6 +32,8 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
public class AadmModelTest {
+ private static final String VALID_MODEL_STRING = "***validation of model successful***";
+
TestApexModel<AxPolicyModel> testApexModel;
/**
@@ -66,6 +69,4 @@ public class AadmModelTest {
testApexModel.testApexModelWriteReadJpa(DaoParameters);
}
-
- private static final String VALID_MODEL_STRING = "***validation of model successful***";
}
diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java
index 00cf98a93..37a916a1e 100644
--- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java
+++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -23,6 +24,7 @@ package org.onap.policy.apex.examples.aadm;
import java.util.ArrayList;
import java.util.List;
+import lombok.Getter;
import org.onap.policy.apex.core.engine.engine.EnEventListener;
import org.onap.policy.apex.core.engine.event.EnEvent;
@@ -37,6 +39,7 @@ import org.onap.policy.apex.core.engine.event.EnEvent;
public class TestApexActionListener implements EnEventListener {
List<EnEvent> resultEvents = new ArrayList<EnEvent>();
+ @Getter
private final String id;
/**
@@ -64,13 +67,4 @@ public class TestApexActionListener implements EnEventListener {
public void onEnEvent(final EnEvent actionEvent) {
resultEvents.add(actionEvent);
}
-
- /**
- * Gets the id.
- *
- * @return the id
- */
- public String getId() {
- return id;
- }
}
diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java
index b0cff91d0..10c3610ba 100644
--- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java
+++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (c) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -26,11 +27,17 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
/**
* The Class AnomalyDetection is used as a Java context for Adaptive anomaly detection in the adaptive domain.
*/
+@Getter
+@Setter
@EqualsAndHashCode
+@ToString
public class AnomalyDetection implements Serializable {
private static final long serialVersionUID = -823013127095523727L;
@@ -70,60 +77,6 @@ public class AnomalyDetection implements Serializable {
}
/**
- * Indicates if this is the first round of the algorithm.
- *
- * @return true if this is the first round of the algorithm
- */
- public boolean getFirstRound() {
- return firstRound;
- }
-
- /**
- * Sets the first round indicator of the algorithm.
- *
- * @param firstRound the first round indicator of the algorithm
- */
- public void setFirstRound(final boolean firstRound) {
- this.firstRound = firstRound;
- }
-
- /**
- * Gets the frequency value of the algorithm.
- *
- * @return the frequency value of the algorithm
- */
- public int getFrequency() {
- return frequency;
- }
-
- /**
- * Sets the frequency value of the algorithm.
- *
- * @param frequency the frequency value of the algorithm
- */
- public void setFrequency(final int frequency) {
- this.frequency = frequency;
- }
-
- /**
- * Gets the anomaly score values of the algorithm.
- *
- * @return the anomaly score values of the algorithm
- */
- public List<Double> getAnomalyScores() {
- return anomalyScores;
- }
-
- /**
- * Sets the anomaly score values of the algorithm.
- *
- * @param anomalyScores the anomaly score values of the algorithm
- */
- public void setAnomalyScores(final List<Double> anomalyScores) {
- this.anomalyScores = anomalyScores;
- }
-
- /**
* Check if the anomaly score values of the algorithm are set.
*
* @return true, if the anomaly score values of the algorithm are set
@@ -140,24 +93,6 @@ public class AnomalyDetection implements Serializable {
}
/**
- * Gets the frequency forecasted by the algorithm.
- *
- * @return the frequency forecasted by the algorithm
- */
- public List<Double> getFrequencyForecasted() {
- return frequencyForecasted;
- }
-
- /**
- * Sets the frequency forecasted by the algorithm.
- *
- * @param frequencyForecasted the frequency forecasted by the algorithm
- */
- public void setFrequencyForecasted(final List<Double> frequencyForecasted) {
- this.frequencyForecasted = frequencyForecasted;
- }
-
- /**
* Check if the frequency forecasted by the algorithm is set.
*
* @return true, if the frequency forecasted by the algorithm is set
@@ -172,13 +107,4 @@ public class AnomalyDetection implements Serializable {
public void unsetFrequencyForecasted() {
frequencyForecasted = null;
}
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "AnomalyDetection [firstRound=" + firstRound + ", frequency=" + frequency + ", anomalyScores="
- + anomalyScores + ", frequencyForecasted=" + frequencyForecasted + "]";
- }
}
diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java
index 60c4d96d9..1760f910d 100644
--- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java
+++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (c) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -25,12 +26,16 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
import lombok.ToString;
/**
* The Class AutoLearn is used as a Java context for Adaptive auto-learning of trends towards a fixed value in the
* adaptive domain.
*/
+@Getter
+@Setter
@EqualsAndHashCode
@ToString
public class AutoLearn implements Serializable {
@@ -71,24 +76,6 @@ public class AutoLearn implements Serializable {
}
/**
- * Gets the average difference values of the algorithm.
- *
- * @return the average difference values of the algorithm
- */
- public List<Double> getAvDiffs() {
- return avDiffs;
- }
-
- /**
- * Sets the average difference values of the algorithm.
- *
- * @param avDiffs the average difference values of the algorithm
- */
- public void setAvDiffs(final List<Double> avDiffs) {
- this.avDiffs = avDiffs;
- }
-
- /**
* Check if the average difference values of the algorithm are set.
*
* @return true, if check set av diffs
@@ -105,24 +92,6 @@ public class AutoLearn implements Serializable {
}
/**
- * Gets the count values of the algorithm.
- *
- * @return the count values of the algorithm
- */
- public List<Long> getCounts() {
- return counts;
- }
-
- /**
- * Sets the count values of the algorithm.
- *
- * @param counts the count values of the algorithm
- */
- public void setCounts(final List<Long> counts) {
- this.counts = counts;
- }
-
- /**
* Check if the count values of the algorithm are set.
*
* @return true, if the count values of the algorithm are set
diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java
index 83a42ac8d..0ebff497c 100644
--- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java
+++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -21,6 +22,8 @@
package org.onap.policy.apex.examples.adaptive.model;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
@@ -32,18 +35,12 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class AdaptiveDomainModelSaver {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(AdaptiveDomainModelSaver.class);
/**
- * Private default constructor to prevent subclassing.
- */
- private AdaptiveDomainModelSaver() {
- // Prevent subclassing
- }
-
- /**
* Write the AADM model to args[0].
*
* @param args Not used
diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java
index 6b61e822b..e059c9810 100644
--- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java
+++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -144,7 +145,7 @@ public class AnomalyDetectionPolicyDecideTaskSelectionLogic {
}
anomalyDetection.setFrequency(frequency);
- if (unsetfirstround && anomalyDetection.getFirstRound()) {
+ if (unsetfirstround && anomalyDetection.isFirstRound()) {
anomalyDetection.setFirstRound(false);
}
@@ -160,7 +161,7 @@ public class AnomalyDetectionPolicyDecideTaskSelectionLogic {
anomalyDetection.getFrequencyForecasted().set(frequency, forecastedValue);
// anomaly score is ignored in the first frequency period
- if (!anomalyDetection.getFirstRound()) {
+ if (!anomalyDetection.isFirstRound()) {
((LinkedList<Double>) anomalyDetection.getAnomalyScores()).addLast(anomalyScore);
}
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionConceptTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionConceptTest.java
index d24733224..1237537fd 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionConceptTest.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionConceptTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (c) 2020 Nordix Foundation.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -44,8 +45,8 @@ public class AnomalyDetectionConceptTest {
assertEquals(newAnomalyScores, anomalyDetection.getAnomalyScores());
assertTrue(anomalyDetection.checkSetAnomalyScores());
assertEquals(55, anomalyDetection.getFrequency());
- assertEquals(true, anomalyDetection.getFirstRound());
- assertEquals("AnomalyDetection [firstRound=true, frequency=55, anomalyScores=[55.0], frequencyForecasted=null]",
+ assertEquals(true, anomalyDetection.isFirstRound());
+ assertEquals("AnomalyDetection(firstRound=true, frequency=55, anomalyScores=[55.0], frequencyForecasted=null)",
anomalyDetection.toString());
}