From 4cfa2e2d98f6877d54da304ef17f096284430908 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 13 Sep 2018 15:25:32 +0100 Subject: Sonar/Checkstyle in service/plugins Sonar and Checkstyle changes in plugins and services, and knock on changes Issue-ID: POLICY-1034 Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b Signed-off-by: liamfallon --- .../apex/examples/aadm/concepts/ENodeBStatus.java | 8 +- .../apex/examples/aadm/concepts/IMSIStatus.java | 175 ----- .../examples/aadm/concepts/IPAddressStatus.java | 79 --- .../apex/examples/aadm/concepts/ImsiStatus.java | 175 +++++ .../examples/aadm/concepts/IpAddressStatus.java | 79 +++ .../aadm/model/AADMDomainModelFactory.java | 703 --------------------- .../examples/aadm/model/AADMDomainModelSaver.java | 57 -- .../aadm/model/AadmDomainModelFactory.java | 703 +++++++++++++++++++++ .../examples/aadm/model/AadmDomainModelSaver.java | 57 ++ .../config/AADM/Stdin2StdoutJsonEvent.json | 2 +- .../examples/config/AADM/Stdin2StdoutXmlEvent.json | 6 +- .../model/mvel/AADMDoSProvenActTask_TaskLogic.mvel | 14 +- .../mvel/AADMDoSSuggestionActTask_TaskLogic.mvel | 28 +- .../aadm/model/mvel/AADMMatchTask_TaskLogic.mvel | 20 +- .../mvel/AADMPolicy_Act_TaskSelectionLogic.mvel | 8 +- .../aadm/model/mvel/PeriodicActTask_TaskLogic.mvel | 6 +- .../aadm/model/mvel/SAPCActTask_TaskLogic.mvel | 8 +- 17 files changed, 1064 insertions(+), 1064 deletions(-) delete mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java delete mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java create mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java create mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java delete mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java delete mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java create mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java create mode 100644 examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java (limited to 'examples/examples-aadm/src/main') 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 1f3cf5185..70af74ab9 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 @@ -56,7 +56,7 @@ public class ENodeBStatus implements Serializable { * * @return the number of Denial Of Service incidents on the eNodeB */ - public long getDOSCount() { + public long getDosCount() { return dosCount; } @@ -65,7 +65,7 @@ public class ENodeBStatus implements Serializable { * * @param incomingDosCount the number of Denial Of Service incidents on the eNodeB */ - public void setDOSCount(final long incomingDosCount) { + public void setDosCount(final long incomingDosCount) { this.dosCount = incomingDosCount; } @@ -74,7 +74,7 @@ public class ENodeBStatus implements Serializable { * * @return the long */ - public long incrementDOSCount() { + public long incrementDosCount() { return ++dosCount; } @@ -83,7 +83,7 @@ public class ENodeBStatus implements Serializable { * * @return the long */ - public long decrementDOSCount() { + public long decrementDosCount() { return --dosCount; } 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 deleted file mode 100644 index 8f89d4c15..000000000 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. 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========================================================= - */ - -package org.onap.policy.apex.examples.aadm.concepts; - -import java.io.Serializable; - -/** - * The Class IMSIStatus holds the status of an IMSI in the AADM domain. - */ -public class IMSIStatus implements Serializable { - private static final long serialVersionUID = 2852523814242234172L; - - private static final long TIME_NOT_SET = 0; - - private final String imsi; - - private boolean anomalous = false; - private long anomalousTime = TIME_NOT_SET; - private String enodeBId; - private long blackListedTime = TIME_NOT_SET; - private long blockingCount = 0; - - /** - * Initiate an IMSI status instance with an IMSI value. - * - * @param imsi the IMSI value - */ - public IMSIStatus(final String imsi) { - this.imsi = imsi; - } - - /** - * 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 - */ - public String getENodeBID() { - return enodeBId; - } - - /** - * Sets the eNodeB ID to which the IMSI is attached. - * - * @param incomingENodeBID the eNodeB ID to which the IMSI is attached - */ - public void setENodeBID(final String incomingENodeBID) { - this.enodeBId = incomingENodeBID; - } - - /** - * Checks if the eNodeB ID to which the IMSI is attached is set. - * - * @return true, if eNodeB ID to which the IMSI is attached is set - */ - public boolean checkSetENodeBID() { - return (enodeBId != null); - } - - /** - * 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 - */ - public long incrementBlockingCount() { - return ++blockingCount; - } - - /** - * Decrement the number of times this IMSI was blocked. - * - * @return the decremented number of times this IMSI was blocked - */ - public long decrementBlockingCount() { - return --blockingCount; - } -} 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 deleted file mode 100644 index fc3780f17..000000000 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. 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========================================================= - */ - -package org.onap.policy.apex.examples.aadm.concepts; - -import java.io.Serializable; - -/** - * The Class IPAddressStatus holds the status of an IP address in the AADM domain. - */ -public class IPAddressStatus implements Serializable { - private static final long serialVersionUID = -7402022458317593252L; - - private final String ipAddress; - - private String imsi; - - /** - * The Constructor sets up the IP address status instance. - * - * @param ipAddress the ip address - */ - public IPAddressStatus(final String ipAddress) { - this.ipAddress = ipAddress; - } - - /** - * 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 - */ - public boolean checkSetIMSI() { - return (imsi != null); - } -} 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 new file mode 100644 index 000000000..4b7def097 --- /dev/null +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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========================================================= + */ + +package org.onap.policy.apex.examples.aadm.concepts; + +import java.io.Serializable; + +/** + * The Class IMSIStatus holds the status of an IMSI in the AADM domain. + */ +public class ImsiStatus implements Serializable { + private static final long serialVersionUID = 2852523814242234172L; + + private static final long TIME_NOT_SET = 0; + + private final String imsi; + + private boolean anomalous = false; + private long anomalousTime = TIME_NOT_SET; + private String enodeBId; + private long blackListedTime = TIME_NOT_SET; + private long blockingCount = 0; + + /** + * Initiate an IMSI status instance with an IMSI value. + * + * @param imsi the IMSI value + */ + public ImsiStatus(final String imsi) { + this.imsi = imsi; + } + + /** + * 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 + */ + public String getENodeBId() { + return enodeBId; + } + + /** + * Sets the eNodeB ID to which the IMSI is attached. + * + * @param incomingENodeBId the eNodeB ID to which the IMSI is attached + */ + public void setENodeBId(final String incomingENodeBId) { + this.enodeBId = incomingENodeBId; + } + + /** + * Checks if the eNodeB ID to which the IMSI is attached is set. + * + * @return true, if eNodeB ID to which the IMSI is attached is set + */ + public boolean checkSetENodeBId() { + return (enodeBId != null); + } + + /** + * 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 + */ + public long incrementBlockingCount() { + return ++blockingCount; + } + + /** + * Decrement the number of times this IMSI was blocked. + * + * @return the decremented number of times this IMSI was blocked + */ + public long decrementBlockingCount() { + return --blockingCount; + } +} 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 new file mode 100644 index 000000000..689865b16 --- /dev/null +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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========================================================= + */ + +package org.onap.policy.apex.examples.aadm.concepts; + +import java.io.Serializable; + +/** + * The Class IPAddressStatus holds the status of an IP address in the AADM domain. + */ +public class IpAddressStatus implements Serializable { + private static final long serialVersionUID = -7402022458317593252L; + + private final String ipAddress; + + private String imsi; + + /** + * The Constructor sets up the IP address status instance. + * + * @param ipAddress the ip address + */ + public IpAddressStatus(final String ipAddress) { + this.ipAddress = ipAddress; + } + + /** + * 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 + */ + public boolean checkSetImsi() { + return (imsi != null); + } +} diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java deleted file mode 100644 index 9a2d50626..000000000 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java +++ /dev/null @@ -1,703 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. 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========================================================= - */ - -package org.onap.policy.apex.examples.aadm.model; - -import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; -import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; -import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; -import org.onap.policy.apex.model.eventmodel.concepts.AxField; -import org.onap.policy.apex.model.policymodel.concepts.AxLogicReader; -import org.onap.policy.apex.model.policymodel.concepts.AxPolicies; -import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; -import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; -import org.onap.policy.apex.model.policymodel.concepts.AxState; -import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput; -import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType; -import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; -import org.onap.policy.apex.model.policymodel.concepts.AxTask; -import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic; -import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; -import org.onap.policy.apex.model.policymodel.concepts.AxTasks; -import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; - -/** - * The Class AADMDomainModelFactory. - */ -public class AADMDomainModelFactory { - /** - * Gets the AADM policy model. - * - * @return the AADM policy model - */ - // CHECKSTYLE:OFF: checkstyle - public AxPolicyModel getAADMPolicyModel() { - // CHECKSTYLE:ON: checkstyle - // Data types for event parameters - final AxContextSchema imsi = new AxContextSchema(new AxArtifactKey("IMSI", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema ueIPAddress = - new AxContextSchema(new AxArtifactKey("UEIPAddress", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema nwIPAddress = - new AxContextSchema(new AxArtifactKey("NWIPAddress", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema dosFlag = - new AxContextSchema(new AxArtifactKey("DOSFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema roundTripTime = - new AxContextSchema(new AxArtifactKey("RoundTripTime", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema applicationName = - new AxContextSchema(new AxArtifactKey("ApplicationName", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema protocolGroup = - new AxContextSchema(new AxArtifactKey("ProtocolGroup", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema eNodeBID = - new AxContextSchema(new AxArtifactKey("ENodeBID", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema httpHostClass = - new AxContextSchema(new AxArtifactKey("HttpHostClass", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema tcpOnFlag = - new AxContextSchema(new AxArtifactKey("TCPOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema probeOnFlag = - new AxContextSchema(new AxArtifactKey("ProbeOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema blacklistOnFlag = - new AxContextSchema(new AxArtifactKey("BlacklistOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema averageThroughput = - new AxContextSchema(new AxArtifactKey("AverageThroughput", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema serviceRequestCount = - new AxContextSchema(new AxArtifactKey("ServiceRequestCount", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema attchCount = - new AxContextSchema(new AxArtifactKey("AttachCount", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema subscriberCount = - new AxContextSchema(new AxArtifactKey("SubscriberCount", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema averageServiceRequest = - new AxContextSchema(new AxArtifactKey("AverageServiceRequest", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema averageAttach = - new AxContextSchema(new AxArtifactKey("AverageAttach", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema actionTask = - new AxContextSchema(new AxArtifactKey("ActionTask", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema version = - new AxContextSchema(new AxArtifactKey("Version", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema profile = - new AxContextSchema(new AxArtifactKey("Profile", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema threshold = - new AxContextSchema(new AxArtifactKey("Threshold", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema triggerSpec = - new AxContextSchema(new AxArtifactKey("TriggerSpec", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema periodicEventCount = - new AxContextSchema(new AxArtifactKey("PeriodicEventCount", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema periodicDelay = - new AxContextSchema(new AxArtifactKey("PeriodicDelay", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema periodicTime = - new AxContextSchema(new AxArtifactKey("PeriodicTime", "0.0.1"), "Java", "java.lang.Long"); - - final AxContextSchemas aadmContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); - aadmContextSchemas.getSchemasMap().put(imsi.getKey(), imsi); - aadmContextSchemas.getSchemasMap().put(ueIPAddress.getKey(), ueIPAddress); - aadmContextSchemas.getSchemasMap().put(nwIPAddress.getKey(), nwIPAddress); - aadmContextSchemas.getSchemasMap().put(dosFlag.getKey(), dosFlag); - aadmContextSchemas.getSchemasMap().put(roundTripTime.getKey(), roundTripTime); - aadmContextSchemas.getSchemasMap().put(applicationName.getKey(), applicationName); - aadmContextSchemas.getSchemasMap().put(protocolGroup.getKey(), protocolGroup); - aadmContextSchemas.getSchemasMap().put(eNodeBID.getKey(), eNodeBID); - aadmContextSchemas.getSchemasMap().put(httpHostClass.getKey(), httpHostClass); - aadmContextSchemas.getSchemasMap().put(tcpOnFlag.getKey(), tcpOnFlag); - aadmContextSchemas.getSchemasMap().put(probeOnFlag.getKey(), probeOnFlag); - aadmContextSchemas.getSchemasMap().put(blacklistOnFlag.getKey(), blacklistOnFlag); - aadmContextSchemas.getSchemasMap().put(averageThroughput.getKey(), averageThroughput); - aadmContextSchemas.getSchemasMap().put(serviceRequestCount.getKey(), serviceRequestCount); - aadmContextSchemas.getSchemasMap().put(attchCount.getKey(), attchCount); - aadmContextSchemas.getSchemasMap().put(subscriberCount.getKey(), subscriberCount); - aadmContextSchemas.getSchemasMap().put(averageServiceRequest.getKey(), averageServiceRequest); - aadmContextSchemas.getSchemasMap().put(averageAttach.getKey(), averageAttach); - aadmContextSchemas.getSchemasMap().put(actionTask.getKey(), actionTask); - aadmContextSchemas.getSchemasMap().put(version.getKey(), version); - aadmContextSchemas.getSchemasMap().put(profile.getKey(), profile); - aadmContextSchemas.getSchemasMap().put(threshold.getKey(), threshold); - aadmContextSchemas.getSchemasMap().put(triggerSpec.getKey(), triggerSpec); - aadmContextSchemas.getSchemasMap().put(periodicEventCount.getKey(), periodicEventCount); - aadmContextSchemas.getSchemasMap().put(periodicDelay.getKey(), periodicDelay); - aadmContextSchemas.getSchemasMap().put(periodicTime.getKey(), periodicTime); - - final AxEvent aadmEvent = - new AxEvent(new AxArtifactKey("AADMEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - aadmEvent.setSource("External"); - aadmEvent.setTarget("Apex"); - aadmEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI"), imsi.getKey())); - aadmEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); - aadmEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); - aadmEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); - aadmEvent.getParameterMap().put("DoS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "DoS"), dosFlag.getKey())); - aadmEvent.getParameterMap().put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", new AxField( - new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX"), roundTripTime.getKey())); - aadmEvent.getParameterMap().put("TCP_UE_SIDE_AVG_THROUGHPUT", new AxField( - new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_AVG_THROUGHPUT"), averageThroughput.getKey())); - aadmEvent.getParameterMap().put("APPLICATION", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "APPLICATION"), applicationName.getKey())); - aadmEvent.getParameterMap().put("protocol_group", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "protocol_group"), protocolGroup.getKey())); - aadmEvent.getParameterMap().put("http_host_class", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "http_host_class"), httpHostClass.getKey())); - aadmEvent.getParameterMap().put("PROBE_ON", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - aadmEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); - aadmEvent.getParameterMap().put("SGW_IP_ADDRESS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "SGW_IP_ADDRESS"), nwIPAddress.getKey())); - aadmEvent.getParameterMap().put("UE_IP_ADDRESS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "UE_IP_ADDRESS"), ueIPAddress.getKey())); - aadmEvent.getParameterMap().put("SERVICE_REQUEST_COUNT", new AxField( - new AxReferenceKey(aadmEvent.getKey(), "SERVICE_REQUEST_COUNT"), serviceRequestCount.getKey())); - aadmEvent.getParameterMap().put("ATTACH_COUNT", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "ATTACH_COUNT"), attchCount.getKey())); - aadmEvent.getParameterMap().put("NUM_SUBSCRIBERS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "NUM_SUBSCRIBERS"), subscriberCount.getKey())); - aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_SERVICE_REQUEST", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_SERVICE_REQUEST"), - averageServiceRequest.getKey())); - aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_ATTACH", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_ATTACH"), averageAttach.getKey())); - aadmEvent.getParameterMap().put("ACTTASK", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "ACTTASK"), actionTask.getKey())); - - final AxEvent aadmXStreamActEvent = new AxEvent(new AxArtifactKey("XSTREAM_AADM_ACT_EVENT", "0.0.1"), - "org.onap.policy.apex.examples.aadm.events"); - aadmXStreamActEvent.setSource("Apex"); - aadmXStreamActEvent.setTarget("External"); - aadmXStreamActEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI"), imsi.getKey())); - aadmXStreamActEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); - aadmXStreamActEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); - aadmXStreamActEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); - aadmXStreamActEvent.getParameterMap().put("ACTTASK", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ACTTASK"), actionTask.getKey())); - aadmXStreamActEvent.getParameterMap().put("PROBE_ON", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - aadmXStreamActEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); - aadmXStreamActEvent.getParameterMap().put("VERSION", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "VERSION"), version.getKey())); - aadmXStreamActEvent.getParameterMap().put("TRIGGER_SPEC", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TRIGGER_SPEC"), triggerSpec.getKey())); - aadmXStreamActEvent.getParameterMap().put("MAJ_MIN_MAINT_VERSION", new AxField( - new AxReferenceKey(aadmXStreamActEvent.getKey(), "MAJ_MIN_MAINT_VERSION"), version.getKey())); - aadmXStreamActEvent.getParameterMap().put("BLACKLIST_ON", new AxField( - new AxReferenceKey(aadmXStreamActEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); - aadmXStreamActEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROFILE"), profile.getKey())); - aadmXStreamActEvent.getParameterMap().put("THRESHOLD", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "THRESHOLD"), threshold.getKey())); - - final AxEvent vMMEEvent = - new AxEvent(new AxArtifactKey("VMMEEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - vMMEEvent.setSource("External"); - vMMEEvent.setTarget("Apex"); - vMMEEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "IMSI"), imsi.getKey())); - vMMEEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); - vMMEEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); - vMMEEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); - vMMEEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "PROFILE"), profile.getKey())); - vMMEEvent.getParameterMap().put("THRESHOLD", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "THRESHOLD"), threshold.getKey())); - - final AxEvent sapcEvent = - new AxEvent(new AxArtifactKey("SAPCEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - sapcEvent.setSource("External"); - sapcEvent.setTarget("Apex"); - sapcEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI"), imsi.getKey())); - sapcEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); - sapcEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); - sapcEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); - sapcEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROFILE"), profile.getKey())); - sapcEvent.getParameterMap().put("THRESHOLD", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "THRESHOLD"), threshold.getKey())); - sapcEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); - sapcEvent.getParameterMap().put("PROBE_ON", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - sapcEvent.getParameterMap().put("VERSION", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "VERSION"), version.getKey())); - sapcEvent.getParameterMap().put("BLACKLIST_ON", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); - - final AxEvent sapcBlacklistSubscriberEvent = - new AxEvent(new AxArtifactKey("SAPCBlacklistSubscriberEvent", "0.0.1"), - "org.onap.policy.apex.examples.aadm.events"); - sapcBlacklistSubscriberEvent.setSource("Apex"); - sapcBlacklistSubscriberEvent.setTarget("External"); - sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI"), imsi.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROFILE"), profile.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("BLACKLIST_ON", new AxField( - new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI_IP", new AxField( - new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("PROBE_ON", new AxField( - new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); - - final AxEvent periodicEvent = - new AxEvent(new AxArtifactKey("PeriodicEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - periodicEvent.setSource("System"); - periodicEvent.setTarget("Apex"); - periodicEvent.getParameterMap().put("PERIODIC_EVENT_COUNT", new AxField( - new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_EVENT_COUNT"), periodicEventCount.getKey())); - periodicEvent.getParameterMap().put("PERIODIC_DELAY", - new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_DELAY"), periodicDelay.getKey())); - periodicEvent.getParameterMap().put("PERIODIC_FIRST_TIME", - new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_FIRST_TIME"), periodicTime.getKey())); - periodicEvent.getParameterMap().put("PERIODIC_CURRENT_TIME", new AxField( - new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_CURRENT_TIME"), periodicTime.getKey())); - periodicEvent.getParameterMap().put("PERIODIC_LAST_TIME", - new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_LAST_TIME"), periodicTime.getKey())); - - final AxEvents aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", "0.0.1")); - aadmEvents.getEventMap().put(aadmEvent.getKey(), aadmEvent); - aadmEvents.getEventMap().put(aadmXStreamActEvent.getKey(), aadmXStreamActEvent); - aadmEvents.getEventMap().put(vMMEEvent.getKey(), vMMEEvent); - aadmEvents.getEventMap().put(sapcEvent.getKey(), sapcEvent); - aadmEvents.getEventMap().put(sapcBlacklistSubscriberEvent.getKey(), sapcBlacklistSubscriberEvent); - aadmEvents.getEventMap().put(periodicEvent.getKey(), periodicEvent); - - // Data types for context - final AxContextSchema eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", "0.0.1"), "Java", - "org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus"); - final AxContextSchema imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", "0.0.1"), "Java", - "org.onap.policy.apex.examples.aadm.concepts.IMSIStatus"); - final AxContextSchema ipAddressStatus = new AxContextSchema(new AxArtifactKey("IPAddressStatus", "0.0.1"), - "Java", "org.onap.policy.apex.examples.aadm.concepts.IPAddressStatus"); - aadmContextSchemas.getSchemasMap().put(eNodeBStatus.getKey(), eNodeBStatus); - aadmContextSchemas.getSchemasMap().put(imsiStatus.getKey(), imsiStatus); - aadmContextSchemas.getSchemasMap().put(ipAddressStatus.getKey(), ipAddressStatus); - - // Three context albums for AADM - final AxContextAlbum eNodeBStatusAlbum = new AxContextAlbum(new AxArtifactKey("ENodeBStatusAlbum", "0.0.1"), - "APPLICATION", true, eNodeBStatus.getKey()); - final AxContextAlbum imsiStatusAlbum = new AxContextAlbum(new AxArtifactKey("IMSIStatusAlbum", "0.0.1"), - "APPLICATION", true, imsiStatus.getKey()); - final AxContextAlbum ipAddressStatusAlbum = new AxContextAlbum( - new AxArtifactKey("IPAddressStatusAlbum", "0.0.1"), "APPLICATION", true, ipAddressStatus.getKey()); - - final AxContextAlbums aadmAlbums = new AxContextAlbums(new AxArtifactKey("AADMContext", "0.0.1")); - aadmAlbums.getAlbumsMap().put(eNodeBStatusAlbum.getKey(), eNodeBStatusAlbum); - aadmAlbums.getAlbumsMap().put(imsiStatusAlbum.getKey(), imsiStatusAlbum); - aadmAlbums.getAlbumsMap().put(ipAddressStatusAlbum.getKey(), ipAddressStatusAlbum); - - // Tasks - final AxLogicReader logicReader = - new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic(null); - - final AxTask aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", "0.0.1")); - aadmMatchTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmMatchTask.duplicateOutputFields(aadmEvent.getParameterMap()); - aadmMatchTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); - aadmMatchTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); - aadmMatchTask.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); - aadmMatchTask.setTaskLogic(new AxTaskLogic(aadmMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask aadmEstablishTask = new AxTask(new AxArtifactKey("AADMEstablishTask", "0.0.1")); - aadmEstablishTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmEstablishTask.duplicateOutputFields(aadmEvent.getParameterMap()); - logicReader.setDefaultLogic("Default_TaskLogic"); - aadmEstablishTask.setTaskLogic(new AxTaskLogic(aadmEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask aadmDecideTask = new AxTask(new AxArtifactKey("AADMDecideTask", "0.0.1")); - aadmDecideTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmDecideTask.duplicateOutputFields(aadmEvent.getParameterMap()); - aadmDecideTask.setTaskLogic(new AxTaskLogic(aadmDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - logicReader.setDefaultLogic(null); - - final AxTask aadmDoSSuggestionActTask = new AxTask(new AxArtifactKey("AADMDoSSuggestionActTask", "0.0.1")); - aadmDoSSuggestionActTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmDoSSuggestionActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); - aadmDoSSuggestionActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); - aadmDoSSuggestionActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); - aadmDoSSuggestionActTask - .setTaskLogic(new AxTaskLogic(aadmDoSSuggestionActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask aadmNoActTask = new AxTask(new AxArtifactKey("AADMNoActTask", "0.0.1")); - aadmNoActTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmNoActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); - aadmNoActTask.setTaskLogic(new AxTaskLogic(aadmNoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", "0.0.1")); - aadmDoSProvenActTask.duplicateInputFields(aadmEvent.getParameterMap()); - aadmDoSProvenActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); - aadmDoSProvenActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); - aadmDoSProvenActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); - aadmDoSProvenActTask - .setTaskLogic(new AxTaskLogic(aadmDoSProvenActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask vMMEMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", "0.0.1")); - vMMEMatchTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEMatchTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - vMMEMatchTask.setTaskLogic(new AxTaskLogic(vMMEMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask vMMEEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", "0.0.1")); - vMMEEstablishTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEEstablishTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - logicReader.setDefaultLogic("Default_TaskLogic"); - vMMEEstablishTask.setTaskLogic(new AxTaskLogic(vMMEEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask vMMEDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", "0.0.1")); - vMMEDecideTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEDecideTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - vMMEDecideTask.setTaskLogic(new AxTaskLogic(vMMEDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask vMMENoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", "0.0.1")); - vMMENoActTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMENoActTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - vMMENoActTask.setTaskLogic(new AxTaskLogic(vMMENoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask vMMEActTask = new AxTask(new AxArtifactKey("VMMEActTask", "0.0.1")); - vMMEActTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEActTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - logicReader.setDefaultLogic(null); - vMMEActTask.setTaskLogic(new AxTaskLogic(vMMEActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", "0.0.1")); - sapcMatchTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcMatchTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - sapcMatchTask.setTaskLogic(new AxTaskLogic(sapcMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", "0.0.1")); - sapcEstablishTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcEstablishTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - logicReader.setDefaultLogic("Default_TaskLogic"); - sapcEstablishTask.setTaskLogic(new AxTaskLogic(sapcEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask sapcDecideTask = new AxTask(new AxArtifactKey("SAPCDecideTask", "0.0.1")); - sapcDecideTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcDecideTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - sapcDecideTask.setTaskLogic(new AxTaskLogic(sapcDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", "0.0.1")); - sapcActTask.duplicateInputFields(sapcEvent.getParameterMap()); - sapcActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - sapcActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); - logicReader.setDefaultLogic(null); - sapcActTask.setTaskLogic(new AxTaskLogic(sapcActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - logicReader.setDefaultLogic("Default_TaskLogic"); - - final AxTask periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", "0.0.1")); - periodicMatchTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicMatchTask.duplicateOutputFields(periodicEvent.getParameterMap()); - periodicMatchTask.setTaskLogic(new AxTaskLogic(periodicMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", "0.0.1")); - periodicEstablishTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicEstablishTask.duplicateOutputFields(periodicEvent.getParameterMap()); - periodicEstablishTask - .setTaskLogic(new AxTaskLogic(periodicEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", "0.0.1")); - periodicDecideTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicDecideTask.duplicateOutputFields(periodicEvent.getParameterMap()); - periodicDecideTask.setTaskLogic(new AxTaskLogic(periodicDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTask periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", "0.0.1")); - periodicActTask.duplicateInputFields(periodicEvent.getParameterMap()); - periodicActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - periodicActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); - logicReader.setDefaultLogic(null); - periodicActTask.setTaskLogic(new AxTaskLogic(periodicActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - - final AxTasks aadmTasks = new AxTasks(new AxArtifactKey("AADMTasks", "0.0.1")); - aadmTasks.getTaskMap().put(aadmMatchTask.getKey(), aadmMatchTask); - aadmTasks.getTaskMap().put(aadmEstablishTask.getKey(), aadmEstablishTask); - aadmTasks.getTaskMap().put(aadmDecideTask.getKey(), aadmDecideTask); - aadmTasks.getTaskMap().put(aadmDoSSuggestionActTask.getKey(), aadmDoSSuggestionActTask); - aadmTasks.getTaskMap().put(aadmNoActTask.getKey(), aadmNoActTask); - aadmTasks.getTaskMap().put(aadmDoSProvenActTask.getKey(), aadmDoSProvenActTask); - aadmTasks.getTaskMap().put(vMMEMatchTask.getKey(), vMMEMatchTask); - aadmTasks.getTaskMap().put(vMMEEstablishTask.getKey(), vMMEEstablishTask); - aadmTasks.getTaskMap().put(vMMEDecideTask.getKey(), vMMEDecideTask); - aadmTasks.getTaskMap().put(vMMENoActTask.getKey(), vMMENoActTask); - aadmTasks.getTaskMap().put(vMMEActTask.getKey(), vMMEActTask); - aadmTasks.getTaskMap().put(sapcMatchTask.getKey(), sapcMatchTask); - aadmTasks.getTaskMap().put(sapcEstablishTask.getKey(), sapcEstablishTask); - aadmTasks.getTaskMap().put(sapcDecideTask.getKey(), sapcDecideTask); - aadmTasks.getTaskMap().put(sapcActTask.getKey(), sapcActTask); - aadmTasks.getTaskMap().put(periodicMatchTask.getKey(), periodicMatchTask); - aadmTasks.getTaskMap().put(periodicEstablishTask.getKey(), periodicEstablishTask); - aadmTasks.getTaskMap().put(periodicDecideTask.getKey(), periodicDecideTask); - aadmTasks.getTaskMap().put(periodicActTask.getKey(), periodicActTask); - - // Policies - logicReader.setDefaultLogic(null); - - final AxPolicy aadmPolicy = new AxPolicy(new AxArtifactKey("AADMPolicy", "0.0.1")); - aadmPolicy.setTemplate("MEDA"); - - final AxState aadmActState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Act")); - aadmActState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmAct2Out = - new AxStateOutput(aadmActState.getKey(), AxReferenceKey.getNullKey(), aadmXStreamActEvent.getKey()); - aadmActState.getStateOutputs().put(aadmAct2Out.getKey().getLocalName(), aadmAct2Out); - aadmActState.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); - aadmActState.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); - aadmActState.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); - aadmActState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); - aadmActState.setDefaultTask(aadmNoActTask.getKey()); - aadmActState.getTaskReferences().put(aadmNoActTask.getKey(), new AxStateTaskReference(aadmActState.getKey(), - aadmNoActTask.getKey(), AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); - aadmActState.getTaskReferences().put(aadmDoSSuggestionActTask.getKey(), - new AxStateTaskReference(aadmActState.getKey(), aadmDoSSuggestionActTask.getKey(), - AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); - aadmActState.getTaskReferences().put(aadmDoSProvenActTask.getKey(), - new AxStateTaskReference(aadmActState.getKey(), aadmDoSProvenActTask.getKey(), - AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); - - logicReader.setDefaultLogic("Default_TaskSelectionLogic"); - - final AxState aadmDecideState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Decide")); - aadmDecideState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmDec2Act = - new AxStateOutput(aadmDecideState.getKey(), aadmActState.getKey(), aadmEvent.getKey()); - aadmDecideState.getStateOutputs().put(aadmDec2Act.getKey().getLocalName(), aadmDec2Act); - aadmDecideState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmDecideState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); - aadmDecideState.setDefaultTask(aadmDecideTask.getKey()); - aadmDecideState.getTaskReferences().put(aadmDecideTask.getKey(), new AxStateTaskReference( - aadmDecideState.getKey(), aadmDecideTask.getKey(), AxStateTaskOutputType.DIRECT, aadmDec2Act.getKey())); - - final AxState aadmEstablishState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Establish")); - aadmEstablishState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmEst2Dec = - new AxStateOutput(aadmEstablishState.getKey(), aadmDecideState.getKey(), aadmEvent.getKey()); - aadmEstablishState.getStateOutputs().put(aadmEst2Dec.getKey().getLocalName(), aadmEst2Dec); - aadmEstablishState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); - aadmEstablishState.setDefaultTask(aadmEstablishTask.getKey()); - aadmEstablishState.getTaskReferences().put(aadmEstablishTask.getKey(), - new AxStateTaskReference(aadmEstablishState.getKey(), aadmEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, aadmEst2Dec.getKey())); - - final AxState aadmMatchState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Match")); - aadmMatchState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmMat2Est = - new AxStateOutput(aadmMatchState.getKey(), aadmEstablishState.getKey(), aadmEvent.getKey()); - aadmMatchState.getStateOutputs().put(aadmMat2Est.getKey().getLocalName(), aadmMat2Est); - aadmMatchState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmMatchState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); - aadmMatchState.setDefaultTask(aadmMatchTask.getKey()); - aadmMatchState.getTaskReferences().put(aadmMatchTask.getKey(), new AxStateTaskReference(aadmMatchState.getKey(), - aadmMatchTask.getKey(), AxStateTaskOutputType.DIRECT, aadmMat2Est.getKey())); - - aadmPolicy.setFirstState(aadmMatchState.getKey().getLocalName()); - aadmPolicy.getStateMap().put(aadmMatchState.getKey().getLocalName(), aadmMatchState); - aadmPolicy.getStateMap().put(aadmEstablishState.getKey().getLocalName(), aadmEstablishState); - aadmPolicy.getStateMap().put(aadmDecideState.getKey().getLocalName(), aadmDecideState); - aadmPolicy.getStateMap().put(aadmActState.getKey().getLocalName(), aadmActState); - - final AxPolicy vMMEPolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", "0.0.1")); - vMMEPolicy.setTemplate("MEDA"); - - final AxState vMMEActState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Act")); - vMMEActState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEAct2Out = - new AxStateOutput(vMMEActState.getKey(), AxReferenceKey.getNullKey(), vMMEEvent.getKey()); - vMMEActState.getStateOutputs().put(vMMEAct2Out.getKey().getLocalName(), vMMEAct2Out); - vMMEActState.setDefaultTask(vMMEActTask.getKey()); - vMMEActState.getTaskReferences().put(vMMEActTask.getKey(), new AxStateTaskReference(vMMEActState.getKey(), - vMMEActTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEAct2Out.getKey())); - vMMEActState.getTaskReferences().put(vMMENoActTask.getKey(), new AxStateTaskReference(vMMEActState.getKey(), - vMMENoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEAct2Out.getKey())); - - final AxState vMMEDecideState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Decide")); - vMMEDecideState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEDec2Act = - new AxStateOutput(vMMEDecideState.getKey(), vMMEActState.getKey(), vMMEEvent.getKey()); - vMMEDecideState.getStateOutputs().put(vMMEDec2Act.getKey().getLocalName(), vMMEDec2Act); - vMMEDecideState.setDefaultTask(vMMEDecideTask.getKey()); - vMMEDecideState.getTaskReferences().put(vMMEDecideTask.getKey(), new AxStateTaskReference( - vMMEDecideState.getKey(), vMMEDecideTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEDec2Act.getKey())); - - final AxState vMMEEstablishState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Establish")); - vMMEEstablishState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEEst2Dec = - new AxStateOutput(vMMEEstablishState.getKey(), vMMEDecideState.getKey(), vMMEEvent.getKey()); - vMMEEstablishState.getStateOutputs().put(vMMEEst2Dec.getKey().getLocalName(), vMMEEst2Dec); - vMMEEstablishState.setDefaultTask(vMMEEstablishTask.getKey()); - vMMEEstablishState.getTaskReferences().put(vMMEEstablishTask.getKey(), - new AxStateTaskReference(vMMEEstablishState.getKey(), vMMEEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, vMMEEst2Dec.getKey())); - - final AxState vMMEMatchState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Match")); - vMMEMatchState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEMat2Est = - new AxStateOutput(vMMEMatchState.getKey(), vMMEEstablishState.getKey(), vMMEEvent.getKey()); - vMMEMatchState.getStateOutputs().put(vMMEMat2Est.getKey().getLocalName(), vMMEMat2Est); - vMMEMatchState.setDefaultTask(vMMEMatchTask.getKey()); - vMMEMatchState.getTaskReferences().put(vMMEMatchTask.getKey(), new AxStateTaskReference(vMMEMatchState.getKey(), - vMMEMatchTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEMat2Est.getKey())); - - vMMEPolicy.setFirstState(vMMEMatchState.getKey().getLocalName()); - vMMEPolicy.getStateMap().put(vMMEMatchState.getKey().getLocalName(), vMMEMatchState); - vMMEPolicy.getStateMap().put(vMMEEstablishState.getKey().getLocalName(), vMMEEstablishState); - vMMEPolicy.getStateMap().put(vMMEDecideState.getKey().getLocalName(), vMMEDecideState); - vMMEPolicy.getStateMap().put(vMMEActState.getKey().getLocalName(), vMMEActState); - - final AxPolicy sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", "0.0.1")); - sapcPolicy.setTemplate("MEDA"); - - final AxState sapcActState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Act")); - sapcActState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcAct2Out = new AxStateOutput(sapcActState.getKey(), AxReferenceKey.getNullKey(), - sapcBlacklistSubscriberEvent.getKey()); - sapcActState.getStateOutputs().put(sapcAct2Out.getKey().getLocalName(), sapcAct2Out); - sapcActState.setDefaultTask(sapcActTask.getKey()); - sapcActState.getTaskReferences().put(sapcActTask.getKey(), new AxStateTaskReference(sapcActState.getKey(), - sapcActTask.getKey(), AxStateTaskOutputType.DIRECT, sapcAct2Out.getKey())); - - final AxState sapcDecideState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Decide")); - sapcDecideState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcDec2Act = - new AxStateOutput(sapcDecideState.getKey(), sapcActState.getKey(), sapcEvent.getKey()); - sapcDecideState.getStateOutputs().put(sapcDec2Act.getKey().getLocalName(), sapcDec2Act); - sapcDecideState.setDefaultTask(sapcDecideTask.getKey()); - sapcDecideState.getTaskReferences().put(sapcDecideTask.getKey(), new AxStateTaskReference( - sapcDecideState.getKey(), sapcDecideTask.getKey(), AxStateTaskOutputType.DIRECT, sapcDec2Act.getKey())); - - final AxState sapcEstablishState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Establish")); - sapcEstablishState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcEst2Dec = - new AxStateOutput(sapcEstablishState.getKey(), sapcDecideState.getKey(), sapcEvent.getKey()); - sapcEstablishState.getStateOutputs().put(sapcEst2Dec.getKey().getLocalName(), sapcEst2Dec); - sapcEstablishState.setDefaultTask(sapcEstablishTask.getKey()); - sapcEstablishState.getTaskReferences().put(sapcEstablishTask.getKey(), - new AxStateTaskReference(sapcEstablishState.getKey(), sapcEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, sapcEst2Dec.getKey())); - - final AxState sapcMatchState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Match")); - sapcMatchState.setTrigger(aadmXStreamActEvent.getKey()); - final AxStateOutput sapcMat2Est = - new AxStateOutput(sapcMatchState.getKey(), sapcEstablishState.getKey(), sapcEvent.getKey()); - sapcMatchState.getStateOutputs().put(sapcMat2Est.getKey().getLocalName(), sapcMat2Est); - sapcMatchState.setDefaultTask(sapcMatchTask.getKey()); - sapcMatchState.getTaskReferences().put(sapcMatchTask.getKey(), new AxStateTaskReference(sapcMatchState.getKey(), - sapcMatchTask.getKey(), AxStateTaskOutputType.DIRECT, sapcMat2Est.getKey())); - - sapcPolicy.setFirstState(sapcMatchState.getKey().getLocalName()); - sapcPolicy.getStateMap().put(sapcMatchState.getKey().getLocalName(), sapcMatchState); - sapcPolicy.getStateMap().put(sapcEstablishState.getKey().getLocalName(), sapcEstablishState); - sapcPolicy.getStateMap().put(sapcDecideState.getKey().getLocalName(), sapcDecideState); - sapcPolicy.getStateMap().put(sapcActState.getKey().getLocalName(), sapcActState); - - final AxPolicy periodicPolicy = new AxPolicy(new AxArtifactKey("PeriodicPolicy", "0.0.1")); - periodicPolicy.setTemplate("MEDA"); - - final AxState periodicActState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Act")); - periodicActState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perAct2Out = new AxStateOutput(periodicActState.getKey(), AxReferenceKey.getNullKey(), - sapcBlacklistSubscriberEvent.getKey()); - periodicActState.getStateOutputs().put(perAct2Out.getKey().getLocalName(), perAct2Out); - periodicActState.setDefaultTask(periodicActTask.getKey()); - periodicActState.getTaskReferences().put(periodicActTask.getKey(), - new AxStateTaskReference(periodicActState.getKey(), periodicActTask.getKey(), - AxStateTaskOutputType.DIRECT, perAct2Out.getKey())); - - final AxState periodicDecideState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Decide")); - periodicDecideState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perDec2Act = - new AxStateOutput(periodicDecideState.getKey(), periodicActState.getKey(), periodicEvent.getKey()); - periodicDecideState.getStateOutputs().put(perDec2Act.getKey().getLocalName(), perDec2Act); - periodicDecideState.setDefaultTask(periodicDecideTask.getKey()); - periodicDecideState.getTaskReferences().put(periodicDecideTask.getKey(), - new AxStateTaskReference(periodicDecideState.getKey(), periodicDecideTask.getKey(), - AxStateTaskOutputType.DIRECT, perDec2Act.getKey())); - - final AxState periodicEstablishState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Establish")); - periodicEstablishState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perEst2Dec = new AxStateOutput(periodicEstablishState.getKey(), - periodicDecideState.getKey(), periodicEvent.getKey()); - periodicEstablishState.getStateOutputs().put(perEst2Dec.getKey().getLocalName(), perEst2Dec); - periodicEstablishState.setDefaultTask(periodicEstablishTask.getKey()); - periodicEstablishState.getTaskReferences().put(periodicEstablishTask.getKey(), - new AxStateTaskReference(periodicEstablishState.getKey(), periodicEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, perEst2Dec.getKey())); - - final AxState periodicMatchState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Match")); - periodicMatchState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perMat2Est = - new AxStateOutput(periodicMatchState.getKey(), periodicEstablishState.getKey(), periodicEvent.getKey()); - periodicMatchState.getStateOutputs().put(perMat2Est.getKey().getLocalName(), perMat2Est); - periodicMatchState.setDefaultTask(periodicMatchTask.getKey()); - periodicMatchState.getTaskReferences().put(periodicMatchTask.getKey(), - new AxStateTaskReference(periodicMatchState.getKey(), periodicMatchTask.getKey(), - AxStateTaskOutputType.DIRECT, perMat2Est.getKey())); - - periodicPolicy.setFirstState(periodicMatchState.getKey().getLocalName()); - periodicPolicy.getStateMap().put(periodicMatchState.getKey().getLocalName(), periodicMatchState); - periodicPolicy.getStateMap().put(periodicEstablishState.getKey().getLocalName(), periodicEstablishState); - periodicPolicy.getStateMap().put(periodicDecideState.getKey().getLocalName(), periodicDecideState); - periodicPolicy.getStateMap().put(periodicActState.getKey().getLocalName(), periodicActState); - - final AxPolicies aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", "0.0.1")); - aadmPolicies.getPolicyMap().put(aadmPolicy.getKey(), aadmPolicy); - aadmPolicies.getPolicyMap().put(vMMEPolicy.getKey(), vMMEPolicy); - aadmPolicies.getPolicyMap().put(sapcPolicy.getKey(), sapcPolicy); - aadmPolicies.getPolicyMap().put(periodicPolicy.getKey(), periodicPolicy); - - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("AADMKeyInformation", "0.0.1")); - final AxPolicyModel aadmPolicyModel = new AxPolicyModel(new AxArtifactKey("AADMPolicyModel", "0.0.1")); - aadmPolicyModel.setPolicies(aadmPolicies); - aadmPolicyModel.setEvents(aadmEvents); - aadmPolicyModel.setTasks(aadmTasks); - aadmPolicyModel.setAlbums(aadmAlbums); - aadmPolicyModel.setSchemas(aadmContextSchemas); - aadmPolicyModel.setKeyInformation(keyInformation); - aadmPolicyModel.getKeyInformation().generateKeyInfo(aadmPolicyModel); - - final AxValidationResult result = aadmPolicyModel.validate(new AxValidationResult()); - if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { - throw new ApexRuntimeException("model " + aadmPolicyModel.getId() + " is not valid" + result); - } - return aadmPolicyModel; - } -} 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 deleted file mode 100644 index a25a0e983..000000000 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. 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========================================================= - */ - -package org.onap.policy.apex.examples.aadm.model; - -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; - -/** - * This class saves sample domain models to disk in XML and JSON format. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public final class AADMDomainModelSaver { - /** - * Private default constructor to prevent subclassing. - */ - private AADMDomainModelSaver() {} - - /** - * Write the AADM model to args[0]. - * - * @param args Not used - * @throws ApexException the apex exception - */ - public static void main(final String[] args) throws ApexException { - if (args.length != 1) { - System.err.println("usage: " + AADMDomainModelSaver.class.getCanonicalName() + " modelDirectory"); - return; - } - - // Save Java model - final AxPolicyModel aadmPolicyModel = new AADMDomainModelFactory().getAADMPolicyModel(); - final ApexModelSaver aadmModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, aadmPolicyModel, args[0]); - aadmModelSaver.apexModelWriteJson(); - aadmModelSaver.apexModelWriteXml(); - } -} diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java new file mode 100644 index 000000000..376643211 --- /dev/null +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java @@ -0,0 +1,703 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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========================================================= + */ + +package org.onap.policy.apex.examples.aadm.model; + +import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; +import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation; +import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; +import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; +import org.onap.policy.apex.model.eventmodel.concepts.AxEvents; +import org.onap.policy.apex.model.eventmodel.concepts.AxField; +import org.onap.policy.apex.model.policymodel.concepts.AxLogicReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicies; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.policymodel.concepts.AxState; +import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput; +import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType; +import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference; +import org.onap.policy.apex.model.policymodel.concepts.AxTask; +import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic; +import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic; +import org.onap.policy.apex.model.policymodel.concepts.AxTasks; +import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; + +/** + * The Class AADMDomainModelFactory. + */ +public class AadmDomainModelFactory { + /** + * Gets the AADM policy model. + * + * @return the AADM policy model + */ + // CHECKSTYLE:OFF: checkstyle + public AxPolicyModel getAadmPolicyModel() { + // CHECKSTYLE:ON: checkstyle + // Data types for event parameters + final AxContextSchema imsi = new AxContextSchema(new AxArtifactKey("IMSI", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema ueIpAddress = + new AxContextSchema(new AxArtifactKey("UEIPAddress", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema nwIpAddress = + new AxContextSchema(new AxArtifactKey("NWIPAddress", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema dosFlag = + new AxContextSchema(new AxArtifactKey("DOSFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema roundTripTime = + new AxContextSchema(new AxArtifactKey("RoundTripTime", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema applicationName = + new AxContextSchema(new AxArtifactKey("ApplicationName", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema protocolGroup = + new AxContextSchema(new AxArtifactKey("ProtocolGroup", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema eNodeBId = + new AxContextSchema(new AxArtifactKey("ENodeBID", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema httpHostClass = + new AxContextSchema(new AxArtifactKey("HttpHostClass", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema tcpOnFlag = + new AxContextSchema(new AxArtifactKey("TCPOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema probeOnFlag = + new AxContextSchema(new AxArtifactKey("ProbeOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema blacklistOnFlag = + new AxContextSchema(new AxArtifactKey("BlacklistOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); + final AxContextSchema averageThroughput = + new AxContextSchema(new AxArtifactKey("AverageThroughput", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema serviceRequestCount = + new AxContextSchema(new AxArtifactKey("ServiceRequestCount", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema attchCount = + new AxContextSchema(new AxArtifactKey("AttachCount", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema subscriberCount = + new AxContextSchema(new AxArtifactKey("SubscriberCount", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema averageServiceRequest = + new AxContextSchema(new AxArtifactKey("AverageServiceRequest", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema averageAttach = + new AxContextSchema(new AxArtifactKey("AverageAttach", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema actionTask = + new AxContextSchema(new AxArtifactKey("ActionTask", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema version = + new AxContextSchema(new AxArtifactKey("Version", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema profile = + new AxContextSchema(new AxArtifactKey("Profile", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema threshold = + new AxContextSchema(new AxArtifactKey("Threshold", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema triggerSpec = + new AxContextSchema(new AxArtifactKey("TriggerSpec", "0.0.1"), "Java", "java.lang.String"); + final AxContextSchema periodicEventCount = + new AxContextSchema(new AxArtifactKey("PeriodicEventCount", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema periodicDelay = + new AxContextSchema(new AxArtifactKey("PeriodicDelay", "0.0.1"), "Java", "java.lang.Long"); + final AxContextSchema periodicTime = + new AxContextSchema(new AxArtifactKey("PeriodicTime", "0.0.1"), "Java", "java.lang.Long"); + + final AxContextSchemas aadmContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); + aadmContextSchemas.getSchemasMap().put(imsi.getKey(), imsi); + aadmContextSchemas.getSchemasMap().put(ueIpAddress.getKey(), ueIpAddress); + aadmContextSchemas.getSchemasMap().put(nwIpAddress.getKey(), nwIpAddress); + aadmContextSchemas.getSchemasMap().put(dosFlag.getKey(), dosFlag); + aadmContextSchemas.getSchemasMap().put(roundTripTime.getKey(), roundTripTime); + aadmContextSchemas.getSchemasMap().put(applicationName.getKey(), applicationName); + aadmContextSchemas.getSchemasMap().put(protocolGroup.getKey(), protocolGroup); + aadmContextSchemas.getSchemasMap().put(eNodeBId.getKey(), eNodeBId); + aadmContextSchemas.getSchemasMap().put(httpHostClass.getKey(), httpHostClass); + aadmContextSchemas.getSchemasMap().put(tcpOnFlag.getKey(), tcpOnFlag); + aadmContextSchemas.getSchemasMap().put(probeOnFlag.getKey(), probeOnFlag); + aadmContextSchemas.getSchemasMap().put(blacklistOnFlag.getKey(), blacklistOnFlag); + aadmContextSchemas.getSchemasMap().put(averageThroughput.getKey(), averageThroughput); + aadmContextSchemas.getSchemasMap().put(serviceRequestCount.getKey(), serviceRequestCount); + aadmContextSchemas.getSchemasMap().put(attchCount.getKey(), attchCount); + aadmContextSchemas.getSchemasMap().put(subscriberCount.getKey(), subscriberCount); + aadmContextSchemas.getSchemasMap().put(averageServiceRequest.getKey(), averageServiceRequest); + aadmContextSchemas.getSchemasMap().put(averageAttach.getKey(), averageAttach); + aadmContextSchemas.getSchemasMap().put(actionTask.getKey(), actionTask); + aadmContextSchemas.getSchemasMap().put(version.getKey(), version); + aadmContextSchemas.getSchemasMap().put(profile.getKey(), profile); + aadmContextSchemas.getSchemasMap().put(threshold.getKey(), threshold); + aadmContextSchemas.getSchemasMap().put(triggerSpec.getKey(), triggerSpec); + aadmContextSchemas.getSchemasMap().put(periodicEventCount.getKey(), periodicEventCount); + aadmContextSchemas.getSchemasMap().put(periodicDelay.getKey(), periodicDelay); + aadmContextSchemas.getSchemasMap().put(periodicTime.getKey(), periodicTime); + + final AxEvent aadmEvent = + new AxEvent(new AxArtifactKey("AADMEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + aadmEvent.setSource("External"); + aadmEvent.setTarget("Apex"); + aadmEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI"), imsi.getKey())); + aadmEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); + aadmEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); + aadmEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); + aadmEvent.getParameterMap().put("DoS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "DoS"), dosFlag.getKey())); + aadmEvent.getParameterMap().put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX"), roundTripTime.getKey())); + aadmEvent.getParameterMap().put("TCP_UE_SIDE_AVG_THROUGHPUT", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_AVG_THROUGHPUT"), averageThroughput.getKey())); + aadmEvent.getParameterMap().put("APPLICATION", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "APPLICATION"), applicationName.getKey())); + aadmEvent.getParameterMap().put("protocol_group", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "protocol_group"), protocolGroup.getKey())); + aadmEvent.getParameterMap().put("http_host_class", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "http_host_class"), httpHostClass.getKey())); + aadmEvent.getParameterMap().put("PROBE_ON", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + aadmEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + aadmEvent.getParameterMap().put("SGW_IP_ADDRESS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "SGW_IP_ADDRESS"), nwIpAddress.getKey())); + aadmEvent.getParameterMap().put("UE_IP_ADDRESS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "UE_IP_ADDRESS"), ueIpAddress.getKey())); + aadmEvent.getParameterMap().put("SERVICE_REQUEST_COUNT", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "SERVICE_REQUEST_COUNT"), serviceRequestCount.getKey())); + aadmEvent.getParameterMap().put("ATTACH_COUNT", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ATTACH_COUNT"), attchCount.getKey())); + aadmEvent.getParameterMap().put("NUM_SUBSCRIBERS", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "NUM_SUBSCRIBERS"), subscriberCount.getKey())); + aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_SERVICE_REQUEST", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_SERVICE_REQUEST"), + averageServiceRequest.getKey())); + aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_ATTACH", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_ATTACH"), averageAttach.getKey())); + aadmEvent.getParameterMap().put("ACTTASK", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ACTTASK"), actionTask.getKey())); + + final AxEvent aadmXStreamActEvent = new AxEvent(new AxArtifactKey("XSTREAM_AADM_ACT_EVENT", "0.0.1"), + "org.onap.policy.apex.examples.aadm.events"); + aadmXStreamActEvent.setSource("Apex"); + aadmXStreamActEvent.setTarget("External"); + aadmXStreamActEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI"), imsi.getKey())); + aadmXStreamActEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); + aadmXStreamActEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); + aadmXStreamActEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); + aadmXStreamActEvent.getParameterMap().put("ACTTASK", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ACTTASK"), actionTask.getKey())); + aadmXStreamActEvent.getParameterMap().put("PROBE_ON", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put("VERSION", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "VERSION"), version.getKey())); + aadmXStreamActEvent.getParameterMap().put("TRIGGER_SPEC", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TRIGGER_SPEC"), triggerSpec.getKey())); + aadmXStreamActEvent.getParameterMap().put("MAJ_MIN_MAINT_VERSION", new AxField( + new AxReferenceKey(aadmXStreamActEvent.getKey(), "MAJ_MIN_MAINT_VERSION"), version.getKey())); + aadmXStreamActEvent.getParameterMap().put("BLACKLIST_ON", new AxField( + new AxReferenceKey(aadmXStreamActEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROFILE"), profile.getKey())); + aadmXStreamActEvent.getParameterMap().put("THRESHOLD", + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "THRESHOLD"), threshold.getKey())); + + final AxEvent vMmeEvent = + new AxEvent(new AxArtifactKey("VMMEEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + vMmeEvent.setSource("External"); + vMmeEvent.setTarget("Apex"); + vMmeEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "IMSI"), imsi.getKey())); + vMmeEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); + vMmeEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); + vMmeEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); + vMmeEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "PROFILE"), profile.getKey())); + vMmeEvent.getParameterMap().put("THRESHOLD", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "THRESHOLD"), threshold.getKey())); + + final AxEvent sapcEvent = + new AxEvent(new AxArtifactKey("SAPCEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + sapcEvent.setSource("External"); + sapcEvent.setTarget("Apex"); + sapcEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI"), imsi.getKey())); + sapcEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); + sapcEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); + sapcEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); + sapcEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROFILE"), profile.getKey())); + sapcEvent.getParameterMap().put("THRESHOLD", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "THRESHOLD"), threshold.getKey())); + sapcEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + sapcEvent.getParameterMap().put("PROBE_ON", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + sapcEvent.getParameterMap().put("VERSION", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "VERSION"), version.getKey())); + sapcEvent.getParameterMap().put("BLACKLIST_ON", + new AxField(new AxReferenceKey(sapcEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); + + final AxEvent sapcBlacklistSubscriberEvent = + new AxEvent(new AxArtifactKey("SAPCBlacklistSubscriberEvent", "0.0.1"), + "org.onap.policy.apex.examples.aadm.events"); + sapcBlacklistSubscriberEvent.setSource("Apex"); + sapcBlacklistSubscriberEvent.setTarget("External"); + sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI"), imsi.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROFILE"), profile.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("BLACKLIST_ON", new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI_IP", new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("PROBE_ON", new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put("TCP_ON", + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + + final AxEvent periodicEvent = + new AxEvent(new AxArtifactKey("PeriodicEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + periodicEvent.setSource("System"); + periodicEvent.setTarget("Apex"); + periodicEvent.getParameterMap().put("PERIODIC_EVENT_COUNT", new AxField( + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_EVENT_COUNT"), periodicEventCount.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_DELAY", + new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_DELAY"), periodicDelay.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_FIRST_TIME", + new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_FIRST_TIME"), periodicTime.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_CURRENT_TIME", new AxField( + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_CURRENT_TIME"), periodicTime.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_LAST_TIME", + new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_LAST_TIME"), periodicTime.getKey())); + + final AxEvents aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", "0.0.1")); + aadmEvents.getEventMap().put(aadmEvent.getKey(), aadmEvent); + aadmEvents.getEventMap().put(aadmXStreamActEvent.getKey(), aadmXStreamActEvent); + aadmEvents.getEventMap().put(vMmeEvent.getKey(), vMmeEvent); + aadmEvents.getEventMap().put(sapcEvent.getKey(), sapcEvent); + aadmEvents.getEventMap().put(sapcBlacklistSubscriberEvent.getKey(), sapcBlacklistSubscriberEvent); + aadmEvents.getEventMap().put(periodicEvent.getKey(), periodicEvent); + + // Data types for context + final AxContextSchema eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", "0.0.1"), "Java", + "org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus"); + final AxContextSchema imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", "0.0.1"), "Java", + "org.onap.policy.apex.examples.aadm.concepts.ImsiStatus"); + final AxContextSchema ipAddressStatus = new AxContextSchema(new AxArtifactKey("IPAddressStatus", "0.0.1"), + "Java", "org.onap.policy.apex.examples.aadm.concepts.IpAddressStatus"); + aadmContextSchemas.getSchemasMap().put(eNodeBStatus.getKey(), eNodeBStatus); + aadmContextSchemas.getSchemasMap().put(imsiStatus.getKey(), imsiStatus); + aadmContextSchemas.getSchemasMap().put(ipAddressStatus.getKey(), ipAddressStatus); + + // Three context albums for AADM + final AxContextAlbum eNodeBStatusAlbum = new AxContextAlbum(new AxArtifactKey("ENodeBStatusAlbum", "0.0.1"), + "APPLICATION", true, eNodeBStatus.getKey()); + final AxContextAlbum imsiStatusAlbum = new AxContextAlbum(new AxArtifactKey("IMSIStatusAlbum", "0.0.1"), + "APPLICATION", true, imsiStatus.getKey()); + final AxContextAlbum ipAddressStatusAlbum = new AxContextAlbum( + new AxArtifactKey("IPAddressStatusAlbum", "0.0.1"), "APPLICATION", true, ipAddressStatus.getKey()); + + final AxContextAlbums aadmAlbums = new AxContextAlbums(new AxArtifactKey("AADMContext", "0.0.1")); + aadmAlbums.getAlbumsMap().put(eNodeBStatusAlbum.getKey(), eNodeBStatusAlbum); + aadmAlbums.getAlbumsMap().put(imsiStatusAlbum.getKey(), imsiStatusAlbum); + aadmAlbums.getAlbumsMap().put(ipAddressStatusAlbum.getKey(), ipAddressStatusAlbum); + + // Tasks + final AxLogicReader logicReader = + new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic(null); + + final AxTask aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", "0.0.1")); + aadmMatchTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmMatchTask.duplicateOutputFields(aadmEvent.getParameterMap()); + aadmMatchTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmMatchTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmMatchTask.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); + aadmMatchTask.setTaskLogic(new AxTaskLogic(aadmMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmEstablishTask = new AxTask(new AxArtifactKey("AADMEstablishTask", "0.0.1")); + aadmEstablishTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmEstablishTask.duplicateOutputFields(aadmEvent.getParameterMap()); + logicReader.setDefaultLogic("Default_TaskLogic"); + aadmEstablishTask.setTaskLogic(new AxTaskLogic(aadmEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmDecideTask = new AxTask(new AxArtifactKey("AADMDecideTask", "0.0.1")); + aadmDecideTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmDecideTask.duplicateOutputFields(aadmEvent.getParameterMap()); + aadmDecideTask.setTaskLogic(new AxTaskLogic(aadmDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + logicReader.setDefaultLogic(null); + + final AxTask aadmDoSSuggestionActTask = new AxTask(new AxArtifactKey("AADMDoSSuggestionActTask", "0.0.1")); + aadmDoSSuggestionActTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmDoSSuggestionActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); + aadmDoSSuggestionActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmDoSSuggestionActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmDoSSuggestionActTask + .setTaskLogic(new AxTaskLogic(aadmDoSSuggestionActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmNoActTask = new AxTask(new AxArtifactKey("AADMNoActTask", "0.0.1")); + aadmNoActTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmNoActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); + aadmNoActTask.setTaskLogic(new AxTaskLogic(aadmNoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", "0.0.1")); + aadmDoSProvenActTask.duplicateInputFields(aadmEvent.getParameterMap()); + aadmDoSProvenActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); + aadmDoSProvenActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmDoSProvenActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmDoSProvenActTask + .setTaskLogic(new AxTaskLogic(aadmDoSProvenActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMmeMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", "0.0.1")); + vMmeMatchTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeMatchTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + vMmeMatchTask.setTaskLogic(new AxTaskLogic(vMmeMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMmeEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", "0.0.1")); + vMmeEstablishTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeEstablishTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + logicReader.setDefaultLogic("Default_TaskLogic"); + vMmeEstablishTask.setTaskLogic(new AxTaskLogic(vMmeEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMmeDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", "0.0.1")); + vMmeDecideTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeDecideTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + vMmeDecideTask.setTaskLogic(new AxTaskLogic(vMmeDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMmeNoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", "0.0.1")); + vMmeNoActTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeNoActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + vMmeNoActTask.setTaskLogic(new AxTaskLogic(vMmeNoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask vMmeActTask = new AxTask(new AxArtifactKey("VMMEActTask", "0.0.1")); + vMmeActTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + logicReader.setDefaultLogic(null); + vMmeActTask.setTaskLogic(new AxTaskLogic(vMmeActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", "0.0.1")); + sapcMatchTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcMatchTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + sapcMatchTask.setTaskLogic(new AxTaskLogic(sapcMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", "0.0.1")); + sapcEstablishTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcEstablishTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + logicReader.setDefaultLogic("Default_TaskLogic"); + sapcEstablishTask.setTaskLogic(new AxTaskLogic(sapcEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcDecideTask = new AxTask(new AxArtifactKey("SAPCDecideTask", "0.0.1")); + sapcDecideTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcDecideTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + sapcDecideTask.setTaskLogic(new AxTaskLogic(sapcDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", "0.0.1")); + sapcActTask.duplicateInputFields(sapcEvent.getParameterMap()); + sapcActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + sapcActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + logicReader.setDefaultLogic(null); + sapcActTask.setTaskLogic(new AxTaskLogic(sapcActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + logicReader.setDefaultLogic("Default_TaskLogic"); + + final AxTask periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", "0.0.1")); + periodicMatchTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicMatchTask.duplicateOutputFields(periodicEvent.getParameterMap()); + periodicMatchTask.setTaskLogic(new AxTaskLogic(periodicMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", "0.0.1")); + periodicEstablishTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicEstablishTask.duplicateOutputFields(periodicEvent.getParameterMap()); + periodicEstablishTask + .setTaskLogic(new AxTaskLogic(periodicEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", "0.0.1")); + periodicDecideTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicDecideTask.duplicateOutputFields(periodicEvent.getParameterMap()); + periodicDecideTask.setTaskLogic(new AxTaskLogic(periodicDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTask periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", "0.0.1")); + periodicActTask.duplicateInputFields(periodicEvent.getParameterMap()); + periodicActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); + periodicActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + logicReader.setDefaultLogic(null); + periodicActTask.setTaskLogic(new AxTaskLogic(periodicActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + + final AxTasks aadmTasks = new AxTasks(new AxArtifactKey("AADMTasks", "0.0.1")); + aadmTasks.getTaskMap().put(aadmMatchTask.getKey(), aadmMatchTask); + aadmTasks.getTaskMap().put(aadmEstablishTask.getKey(), aadmEstablishTask); + aadmTasks.getTaskMap().put(aadmDecideTask.getKey(), aadmDecideTask); + aadmTasks.getTaskMap().put(aadmDoSSuggestionActTask.getKey(), aadmDoSSuggestionActTask); + aadmTasks.getTaskMap().put(aadmNoActTask.getKey(), aadmNoActTask); + aadmTasks.getTaskMap().put(aadmDoSProvenActTask.getKey(), aadmDoSProvenActTask); + aadmTasks.getTaskMap().put(vMmeMatchTask.getKey(), vMmeMatchTask); + aadmTasks.getTaskMap().put(vMmeEstablishTask.getKey(), vMmeEstablishTask); + aadmTasks.getTaskMap().put(vMmeDecideTask.getKey(), vMmeDecideTask); + aadmTasks.getTaskMap().put(vMmeNoActTask.getKey(), vMmeNoActTask); + aadmTasks.getTaskMap().put(vMmeActTask.getKey(), vMmeActTask); + aadmTasks.getTaskMap().put(sapcMatchTask.getKey(), sapcMatchTask); + aadmTasks.getTaskMap().put(sapcEstablishTask.getKey(), sapcEstablishTask); + aadmTasks.getTaskMap().put(sapcDecideTask.getKey(), sapcDecideTask); + aadmTasks.getTaskMap().put(sapcActTask.getKey(), sapcActTask); + aadmTasks.getTaskMap().put(periodicMatchTask.getKey(), periodicMatchTask); + aadmTasks.getTaskMap().put(periodicEstablishTask.getKey(), periodicEstablishTask); + aadmTasks.getTaskMap().put(periodicDecideTask.getKey(), periodicDecideTask); + aadmTasks.getTaskMap().put(periodicActTask.getKey(), periodicActTask); + + // Policies + logicReader.setDefaultLogic(null); + + final AxPolicy aadmPolicy = new AxPolicy(new AxArtifactKey("AADMPolicy", "0.0.1")); + aadmPolicy.setTemplate("MEDA"); + + final AxState aadmActState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Act")); + aadmActState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmAct2Out = + new AxStateOutput(aadmActState.getKey(), AxReferenceKey.getNullKey(), aadmXStreamActEvent.getKey()); + aadmActState.getStateOutputs().put(aadmAct2Out.getKey().getLocalName(), aadmAct2Out); + aadmActState.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); + aadmActState.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); + aadmActState.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); + aadmActState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmActState.setDefaultTask(aadmNoActTask.getKey()); + aadmActState.getTaskReferences().put(aadmNoActTask.getKey(), new AxStateTaskReference(aadmActState.getKey(), + aadmNoActTask.getKey(), AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + aadmActState.getTaskReferences().put(aadmDoSSuggestionActTask.getKey(), + new AxStateTaskReference(aadmActState.getKey(), aadmDoSSuggestionActTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + aadmActState.getTaskReferences().put(aadmDoSProvenActTask.getKey(), + new AxStateTaskReference(aadmActState.getKey(), aadmDoSProvenActTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + + logicReader.setDefaultLogic("Default_TaskSelectionLogic"); + + final AxState aadmDecideState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Decide")); + aadmDecideState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmDec2Act = + new AxStateOutput(aadmDecideState.getKey(), aadmActState.getKey(), aadmEvent.getKey()); + aadmDecideState.getStateOutputs().put(aadmDec2Act.getKey().getLocalName(), aadmDec2Act); + aadmDecideState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmDecideState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmDecideState.setDefaultTask(aadmDecideTask.getKey()); + aadmDecideState.getTaskReferences().put(aadmDecideTask.getKey(), new AxStateTaskReference( + aadmDecideState.getKey(), aadmDecideTask.getKey(), AxStateTaskOutputType.DIRECT, aadmDec2Act.getKey())); + + final AxState aadmEstablishState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Establish")); + aadmEstablishState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmEst2Dec = + new AxStateOutput(aadmEstablishState.getKey(), aadmDecideState.getKey(), aadmEvent.getKey()); + aadmEstablishState.getStateOutputs().put(aadmEst2Dec.getKey().getLocalName(), aadmEst2Dec); + aadmEstablishState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmEstablishState.setDefaultTask(aadmEstablishTask.getKey()); + aadmEstablishState.getTaskReferences().put(aadmEstablishTask.getKey(), + new AxStateTaskReference(aadmEstablishState.getKey(), aadmEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmEst2Dec.getKey())); + + final AxState aadmMatchState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Match")); + aadmMatchState.setTrigger(aadmEvent.getKey()); + final AxStateOutput aadmMat2Est = + new AxStateOutput(aadmMatchState.getKey(), aadmEstablishState.getKey(), aadmEvent.getKey()); + aadmMatchState.getStateOutputs().put(aadmMat2Est.getKey().getLocalName(), aadmMat2Est); + aadmMatchState.setTaskSelectionLogic( + new AxTaskSelectionLogic(aadmMatchState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmMatchState.setDefaultTask(aadmMatchTask.getKey()); + aadmMatchState.getTaskReferences().put(aadmMatchTask.getKey(), new AxStateTaskReference(aadmMatchState.getKey(), + aadmMatchTask.getKey(), AxStateTaskOutputType.DIRECT, aadmMat2Est.getKey())); + + aadmPolicy.setFirstState(aadmMatchState.getKey().getLocalName()); + aadmPolicy.getStateMap().put(aadmMatchState.getKey().getLocalName(), aadmMatchState); + aadmPolicy.getStateMap().put(aadmEstablishState.getKey().getLocalName(), aadmEstablishState); + aadmPolicy.getStateMap().put(aadmDecideState.getKey().getLocalName(), aadmDecideState); + aadmPolicy.getStateMap().put(aadmActState.getKey().getLocalName(), aadmActState); + + final AxPolicy vMmePolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", "0.0.1")); + vMmePolicy.setTemplate("MEDA"); + + final AxState vMmeActState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Act")); + vMmeActState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeAct2Out = + new AxStateOutput(vMmeActState.getKey(), AxReferenceKey.getNullKey(), vMmeEvent.getKey()); + vMmeActState.getStateOutputs().put(vMmeAct2Out.getKey().getLocalName(), vMmeAct2Out); + vMmeActState.setDefaultTask(vMmeActTask.getKey()); + vMmeActState.getTaskReferences().put(vMmeActTask.getKey(), new AxStateTaskReference(vMmeActState.getKey(), + vMmeActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); + vMmeActState.getTaskReferences().put(vMmeNoActTask.getKey(), new AxStateTaskReference(vMmeActState.getKey(), + vMmeNoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); + + final AxState vMmeDecideState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Decide")); + vMmeDecideState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeDec2Act = + new AxStateOutput(vMmeDecideState.getKey(), vMmeActState.getKey(), vMmeEvent.getKey()); + vMmeDecideState.getStateOutputs().put(vMmeDec2Act.getKey().getLocalName(), vMmeDec2Act); + vMmeDecideState.setDefaultTask(vMmeDecideTask.getKey()); + vMmeDecideState.getTaskReferences().put(vMmeDecideTask.getKey(), new AxStateTaskReference( + vMmeDecideState.getKey(), vMmeDecideTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeDec2Act.getKey())); + + final AxState vMmeEstablishState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Establish")); + vMmeEstablishState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeEst2Dec = + new AxStateOutput(vMmeEstablishState.getKey(), vMmeDecideState.getKey(), vMmeEvent.getKey()); + vMmeEstablishState.getStateOutputs().put(vMmeEst2Dec.getKey().getLocalName(), vMmeEst2Dec); + vMmeEstablishState.setDefaultTask(vMmeEstablishTask.getKey()); + vMmeEstablishState.getTaskReferences().put(vMmeEstablishTask.getKey(), + new AxStateTaskReference(vMmeEstablishState.getKey(), vMmeEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, vMmeEst2Dec.getKey())); + + final AxState vMmeMatchState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Match")); + vMmeMatchState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeMat2Est = + new AxStateOutput(vMmeMatchState.getKey(), vMmeEstablishState.getKey(), vMmeEvent.getKey()); + vMmeMatchState.getStateOutputs().put(vMmeMat2Est.getKey().getLocalName(), vMmeMat2Est); + vMmeMatchState.setDefaultTask(vMmeMatchTask.getKey()); + vMmeMatchState.getTaskReferences().put(vMmeMatchTask.getKey(), new AxStateTaskReference(vMmeMatchState.getKey(), + vMmeMatchTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeMat2Est.getKey())); + + vMmePolicy.setFirstState(vMmeMatchState.getKey().getLocalName()); + vMmePolicy.getStateMap().put(vMmeMatchState.getKey().getLocalName(), vMmeMatchState); + vMmePolicy.getStateMap().put(vMmeEstablishState.getKey().getLocalName(), vMmeEstablishState); + vMmePolicy.getStateMap().put(vMmeDecideState.getKey().getLocalName(), vMmeDecideState); + vMmePolicy.getStateMap().put(vMmeActState.getKey().getLocalName(), vMmeActState); + + final AxPolicy sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", "0.0.1")); + sapcPolicy.setTemplate("MEDA"); + + final AxState sapcActState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Act")); + sapcActState.setTrigger(sapcEvent.getKey()); + final AxStateOutput sapcAct2Out = new AxStateOutput(sapcActState.getKey(), AxReferenceKey.getNullKey(), + sapcBlacklistSubscriberEvent.getKey()); + sapcActState.getStateOutputs().put(sapcAct2Out.getKey().getLocalName(), sapcAct2Out); + sapcActState.setDefaultTask(sapcActTask.getKey()); + sapcActState.getTaskReferences().put(sapcActTask.getKey(), new AxStateTaskReference(sapcActState.getKey(), + sapcActTask.getKey(), AxStateTaskOutputType.DIRECT, sapcAct2Out.getKey())); + + final AxState sapcDecideState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Decide")); + sapcDecideState.setTrigger(sapcEvent.getKey()); + final AxStateOutput sapcDec2Act = + new AxStateOutput(sapcDecideState.getKey(), sapcActState.getKey(), sapcEvent.getKey()); + sapcDecideState.getStateOutputs().put(sapcDec2Act.getKey().getLocalName(), sapcDec2Act); + sapcDecideState.setDefaultTask(sapcDecideTask.getKey()); + sapcDecideState.getTaskReferences().put(sapcDecideTask.getKey(), new AxStateTaskReference( + sapcDecideState.getKey(), sapcDecideTask.getKey(), AxStateTaskOutputType.DIRECT, sapcDec2Act.getKey())); + + final AxState sapcEstablishState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Establish")); + sapcEstablishState.setTrigger(sapcEvent.getKey()); + final AxStateOutput sapcEst2Dec = + new AxStateOutput(sapcEstablishState.getKey(), sapcDecideState.getKey(), sapcEvent.getKey()); + sapcEstablishState.getStateOutputs().put(sapcEst2Dec.getKey().getLocalName(), sapcEst2Dec); + sapcEstablishState.setDefaultTask(sapcEstablishTask.getKey()); + sapcEstablishState.getTaskReferences().put(sapcEstablishTask.getKey(), + new AxStateTaskReference(sapcEstablishState.getKey(), sapcEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, sapcEst2Dec.getKey())); + + final AxState sapcMatchState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Match")); + sapcMatchState.setTrigger(aadmXStreamActEvent.getKey()); + final AxStateOutput sapcMat2Est = + new AxStateOutput(sapcMatchState.getKey(), sapcEstablishState.getKey(), sapcEvent.getKey()); + sapcMatchState.getStateOutputs().put(sapcMat2Est.getKey().getLocalName(), sapcMat2Est); + sapcMatchState.setDefaultTask(sapcMatchTask.getKey()); + sapcMatchState.getTaskReferences().put(sapcMatchTask.getKey(), new AxStateTaskReference(sapcMatchState.getKey(), + sapcMatchTask.getKey(), AxStateTaskOutputType.DIRECT, sapcMat2Est.getKey())); + + sapcPolicy.setFirstState(sapcMatchState.getKey().getLocalName()); + sapcPolicy.getStateMap().put(sapcMatchState.getKey().getLocalName(), sapcMatchState); + sapcPolicy.getStateMap().put(sapcEstablishState.getKey().getLocalName(), sapcEstablishState); + sapcPolicy.getStateMap().put(sapcDecideState.getKey().getLocalName(), sapcDecideState); + sapcPolicy.getStateMap().put(sapcActState.getKey().getLocalName(), sapcActState); + + final AxPolicy periodicPolicy = new AxPolicy(new AxArtifactKey("PeriodicPolicy", "0.0.1")); + periodicPolicy.setTemplate("MEDA"); + + final AxState periodicActState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Act")); + periodicActState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perAct2Out = new AxStateOutput(periodicActState.getKey(), AxReferenceKey.getNullKey(), + sapcBlacklistSubscriberEvent.getKey()); + periodicActState.getStateOutputs().put(perAct2Out.getKey().getLocalName(), perAct2Out); + periodicActState.setDefaultTask(periodicActTask.getKey()); + periodicActState.getTaskReferences().put(periodicActTask.getKey(), + new AxStateTaskReference(periodicActState.getKey(), periodicActTask.getKey(), + AxStateTaskOutputType.DIRECT, perAct2Out.getKey())); + + final AxState periodicDecideState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Decide")); + periodicDecideState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perDec2Act = + new AxStateOutput(periodicDecideState.getKey(), periodicActState.getKey(), periodicEvent.getKey()); + periodicDecideState.getStateOutputs().put(perDec2Act.getKey().getLocalName(), perDec2Act); + periodicDecideState.setDefaultTask(periodicDecideTask.getKey()); + periodicDecideState.getTaskReferences().put(periodicDecideTask.getKey(), + new AxStateTaskReference(periodicDecideState.getKey(), periodicDecideTask.getKey(), + AxStateTaskOutputType.DIRECT, perDec2Act.getKey())); + + final AxState periodicEstablishState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Establish")); + periodicEstablishState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perEst2Dec = new AxStateOutput(periodicEstablishState.getKey(), + periodicDecideState.getKey(), periodicEvent.getKey()); + periodicEstablishState.getStateOutputs().put(perEst2Dec.getKey().getLocalName(), perEst2Dec); + periodicEstablishState.setDefaultTask(periodicEstablishTask.getKey()); + periodicEstablishState.getTaskReferences().put(periodicEstablishTask.getKey(), + new AxStateTaskReference(periodicEstablishState.getKey(), periodicEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, perEst2Dec.getKey())); + + final AxState periodicMatchState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Match")); + periodicMatchState.setTrigger(periodicEvent.getKey()); + final AxStateOutput perMat2Est = + new AxStateOutput(periodicMatchState.getKey(), periodicEstablishState.getKey(), periodicEvent.getKey()); + periodicMatchState.getStateOutputs().put(perMat2Est.getKey().getLocalName(), perMat2Est); + periodicMatchState.setDefaultTask(periodicMatchTask.getKey()); + periodicMatchState.getTaskReferences().put(periodicMatchTask.getKey(), + new AxStateTaskReference(periodicMatchState.getKey(), periodicMatchTask.getKey(), + AxStateTaskOutputType.DIRECT, perMat2Est.getKey())); + + periodicPolicy.setFirstState(periodicMatchState.getKey().getLocalName()); + periodicPolicy.getStateMap().put(periodicMatchState.getKey().getLocalName(), periodicMatchState); + periodicPolicy.getStateMap().put(periodicEstablishState.getKey().getLocalName(), periodicEstablishState); + periodicPolicy.getStateMap().put(periodicDecideState.getKey().getLocalName(), periodicDecideState); + periodicPolicy.getStateMap().put(periodicActState.getKey().getLocalName(), periodicActState); + + final AxPolicies aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", "0.0.1")); + aadmPolicies.getPolicyMap().put(aadmPolicy.getKey(), aadmPolicy); + aadmPolicies.getPolicyMap().put(vMmePolicy.getKey(), vMmePolicy); + aadmPolicies.getPolicyMap().put(sapcPolicy.getKey(), sapcPolicy); + aadmPolicies.getPolicyMap().put(periodicPolicy.getKey(), periodicPolicy); + + final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("AADMKeyInformation", "0.0.1")); + final AxPolicyModel aadmPolicyModel = new AxPolicyModel(new AxArtifactKey("AADMPolicyModel", "0.0.1")); + aadmPolicyModel.setPolicies(aadmPolicies); + aadmPolicyModel.setEvents(aadmEvents); + aadmPolicyModel.setTasks(aadmTasks); + aadmPolicyModel.setAlbums(aadmAlbums); + aadmPolicyModel.setSchemas(aadmContextSchemas); + aadmPolicyModel.setKeyInformation(keyInformation); + aadmPolicyModel.getKeyInformation().generateKeyInfo(aadmPolicyModel); + + final AxValidationResult result = aadmPolicyModel.validate(new AxValidationResult()); + if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) { + throw new ApexRuntimeException("model " + aadmPolicyModel.getId() + " is not valid" + result); + } + return aadmPolicyModel; + } +} 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 new file mode 100644 index 000000000..5a3afd901 --- /dev/null +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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========================================================= + */ + +package org.onap.policy.apex.examples.aadm.model; + +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; + +/** + * This class saves sample domain models to disk in XML and JSON format. + * + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public final class AadmDomainModelSaver { + /** + * Private default constructor to prevent subclassing. + */ + private AadmDomainModelSaver() {} + + /** + * Write the AADM model to args[0]. + * + * @param args Not used + * @throws ApexException the apex exception + */ + public static void main(final String[] args) throws ApexException { + if (args.length != 1) { + System.err.println("usage: " + AadmDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + return; + } + + // Save Java model + final AxPolicyModel aadmPolicyModel = new AadmDomainModelFactory().getAadmPolicyModel(); + final ApexModelSaver aadmModelSaver = + new ApexModelSaver<>(AxPolicyModel.class, aadmPolicyModel, args[0]); + aadmModelSaver.apexModelWriteJson(); + aadmModelSaver.apexModelWriteXml(); + } +} diff --git a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json index c43f41353..427dea352 100644 --- a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json +++ b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" } } } diff --git a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json index 294da2483..3658b09a2 100644 --- a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json +++ b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" } } } @@ -24,7 +24,7 @@ }, "eventProtocolParameters": { "eventProtocol": "XML", - "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters" + "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XmlEventProtocolParameters" } } }, @@ -38,7 +38,7 @@ }, "eventProtocolParameters": { "eventProtocol": "XML", - "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters" + "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XmlEventProtocolParameters" } } } diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel index 078841792..225a0da4d 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -44,10 +44,10 @@ else{ outFields["NW_IP"] = inFields["SGW_IP_ADDRESS"]; } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); logger.debug(imsiStatus); -ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId()); eNodeBStatus.setBeingProbed(false); leaveProbingOn = false; @@ -62,14 +62,14 @@ if (!leaveProbingOn) { outFields["TCP_ON"] = false; } -eNodeBStatus.decrementDOSCount(); -logger.debug(eNodeBStatus.getENodeB() + ": dosCount is " + eNodeBStatus.getDOSCount()); +eNodeBStatus.decrementDosCount(); +logger.debug(eNodeBStatus.getENodeB() + ": dosCount is " + eNodeBStatus.getDosCount()); imsiStatus.setAnomalous(false); -logger.debug("imsi: " + imsiStatus.getIMSI() + " anamalous " + imsiStatus.getAnomalous()); +logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.getAnomalous()); -getContextAlbum("IMSIStatusAlbum") .put(imsiStatus.getIMSI(), imsiStatus); +getContextAlbum("IMSIStatusAlbum") .put(imsiStatus.getImsi(), imsiStatus); getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); outFields["THRESHOLD"] = 0; diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel index d04f9425e..63ac8d0ba 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -42,16 +42,16 @@ else { outFields["NW_IP"] = inFields["SGW_IP_ADDRESS"]; } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); logger.debug(imsiStatus); -ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId()); logger.debug(eNodeBStatus); -if (imsiStatus.getENodeBID() != null && !imsiStatus.getENodeBID().equals(inFields["ENODEB_ID"]) || inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] == null) { +if (imsiStatus.getENodeBId() != null && !imsiStatus.getENodeBId().equals(inFields["ENODEB_ID"]) || inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] == null) { // if user moved enodeB remove him from previous one - if (imsiStatus.getENodeBID() != null) { - eNodeBStatus.decrementDOSCount(); + if (imsiStatus.getENodeBId() != null) { + eNodeBStatus.decrementDosCount(); } // if user became non anomalous return action @@ -79,20 +79,20 @@ if (imsiStatus.getENodeBID() != null && !imsiStatus.getENodeBID().equals(inField imsiStatus.setAnomalous(true); imsiStatus.setAnomolousTime(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"]); +imsiStatus.setENodeBId(inFields["ENODEB_ID"]); +getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); +logger.debug(imsiStatus.getENodeBId() + ": enodeb added to imsi ip added " + outFields["IMSI_IP"]); -ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId()); if (eNodeBStatus == null) { - eNodeBStatus = new ENodeBStatus(imsiStatus.getENodeBID()); + eNodeBStatus = new ENodeBStatus(imsiStatus.getENodeBId()); getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); - logger.debug("new eNodeB added " + getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID())); + logger.debug("new eNodeB added " + getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId())); } -eNodeBStatus.incrementDOSCount(); +eNodeBStatus.incrementDosCount(); getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); -logger.debug(eNodeBStatus.getENodeB() + ": dosCount incremented to " + eNodeBStatus.getDOSCount()); +logger.debug(eNodeBStatus.getENodeB() + ": dosCount incremented to " + eNodeBStatus.getDosCount()); outFields["PROBE_ON"] = true; outFields["TCP_ON"] = true; diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel index bb38034af..24ad9bb0a 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel @@ -18,8 +18,8 @@ * ============LICENSE_END========================================================= */ import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; -import org.onap.policy.apex.examples.aadm.concepts.IPAddressStatus; -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.IpAddressStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -46,22 +46,22 @@ if (eNodeBID == null ) { return false; } -IPAddressStatus ipAddressStatus = getContextAlbum("IPAddressStatusAlbum").get(ipAddress); +IpAddressStatus ipAddressStatus = getContextAlbum("IPAddressStatusAlbum").get(ipAddress); if (ipAddressStatus == null) { - ipAddressStatus = new IPAddressStatus(ipAddress); - ipAddressStatus.setIMSI(imsi); - getContextAlbum("IPAddressStatusAlbum").put(ipAddressStatus.getIPAddress(), ipAddressStatus); + ipAddressStatus = new IpAddressStatus(ipAddress); + ipAddressStatus.setImsi(imsi); + getContextAlbum("IPAddressStatusAlbum").put(ipAddressStatus.getIpAddress(), ipAddressStatus); logger.debug("added new IP address " + getContextAlbum("IPAddressStatusAlbum").get(ipAddress)); } else { logger.debug("found IP address " + ipAddressStatus); } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)imsi); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)imsi); if (imsiStatus == null) { - imsiStatus = new IMSIStatus(imsi); - imsiStatus.setENodeBID(eNodeBID); - getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + imsiStatus = new ImsiStatus(imsi); + imsiStatus.setENodeBId(eNodeBID); + getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); logger.debug("added new IMSI " + imsi + " to IMSI status map") } diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel index 2d0d45bdf..9c71db50a 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; logger.debug(subject.id + ":" + subject.stateName + " execution logic"); @@ -25,7 +25,7 @@ logger.debug(inFields); logger.debug("inFields[SERVICE_REQUEST_COUNT]=" + inFields["SERVICE_REQUEST_COUNT"]); -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); if (imsiStatus.getBlockingCount() > 1) { subject.getTaskKey("AADMNoActTask").copyTo(selectedTask); @@ -33,7 +33,7 @@ if (imsiStatus.getBlockingCount() > 1) { return false; } -logger.debug("imsi: " + imsiStatus.getIMSI() + " anamalous " + imsiStatus.getAnomalous()); +logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.getAnomalous()); // check if this is second iteration if (inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] != null && inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] > 100 && imsiStatus.getAnomalous()) { @@ -49,7 +49,7 @@ ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get((String)inF if (inFields["SERVICE_REQUEST_COUNT"] != null && inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] != null && inFields["SERVICE_REQUEST_COUNT"] > inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] && - eNodeBStatus != null && eNodeBStatus.getDOSCount() > 100 && + eNodeBStatus != null && eNodeBStatus.getDosCount() > 100 && inFields["NUM_SUBSCRIBERS"] != null && inFields["NUM_SUBSCRIBERS"] > 100) { logger.debug("inside NUM_SUBSCRIBERS"); subject.getTaskKey("AADMDoSProvenActTask").copyTo(selectedTask); diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel index 115ac5477..6a2c598b0 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel @@ -17,15 +17,15 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); -for (IMSIStatus imsiStatus : getContextAlbum("IMSIStatusAlbum").values()) { +for (ImsiStatus imsiStatus : getContextAlbum("IMSIStatusAlbum").values()) { if ((System.currentTimeMillis() - imsiStatus.getBlacklistedTime()) > 180000) { imsiStatus.setBlacklistedTime(0); - getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); } } diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel index 7ceaa2abe..b0c6c3158 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -38,7 +38,7 @@ if (outFields["IMSI"] == 0 && inFields["IMSI_IP"] != null && inFields["IMSI_IP"] return true; } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); logger.debug(imsiStatus); if (imsiStatus.getBlockingCount() > 1) { @@ -62,8 +62,8 @@ if (imsiStatus.getBlockingCount() > 0 && imsiStatus.getBlacklistedTime() != 0) { imsiStatus.incrementBlockingCount(); imsiStatus.setBlacklistedTime(System.currentTimeMillis()); -logger.debug("Bocking count for IMSI: " + imsiStatus.getIMSI() + " is: " + imsiStatus.getBlockingCount()); -getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); +logger.debug("Bocking count for IMSI: " + imsiStatus.getImsi() + " is: " + imsiStatus.getBlockingCount()); +getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); outFields["PROFILE"] = "ServiceA"; outFields["BLACKLIST_ON"] = true; -- cgit 1.2.3-korg