aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel')
-rw-r--r--examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel75
1 files changed, 75 insertions, 0 deletions
diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel
new file mode 100644
index 000000000..24ad9bb0a
--- /dev/null
+++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel
@@ -0,0 +1,75 @@
+/*
+ * ============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=========================================================
+ */
+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;
+
+logger.debug(subject.id + ":" + subject.taskName + " execution logic");
+logger.debug(inFields);
+
+ipAddress = inFields["UE_IP_ADDRESS"];
+if (ipAddress == null ) {
+ ipAddress = inFields["IMSI_IP"];
+
+ if (ipAddress == null ) {
+ logger.debug("Incoming event must specify parameter UE_IP_ADDRESS or parameter IMSI_IP");
+ return false;
+ }
+}
+
+imsi = inFields["IMSI"];
+if (imsi == null ) {
+ logger.debug("Incoming event must specify parameter IMSI");
+ return false;
+}
+
+eNodeBID = inFields["ENODEB_ID"];
+if (eNodeBID == null ) {
+ logger.debug("Incoming event must specify parameter ENODEB_ID");
+ return false;
+}
+
+IpAddressStatus ipAddressStatus = getContextAlbum("IPAddressStatusAlbum").get(ipAddress);
+if (ipAddressStatus == null) {
+ 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);
+if (imsiStatus == null) {
+ imsiStatus = new ImsiStatus(imsi);
+ imsiStatus.setENodeBId(eNodeBID);
+ getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus);
+ logger.debug("added new IMSI " + imsi + " to IMSI status map")
+}
+
+ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get((String)eNodeBID);
+if (eNodeBStatus == null) {
+ eNodeBStatus = new ENodeBStatus(eNodeBID);
+ getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus);
+ logger.debug("added new ENodeB " + eNodeBID + " to ENodeB status map")
+}
+
+return true;