2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus;
21 import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus;
23 logger.debug(subject.id + ":" + subject.stateName + " execution logic");
24 logger.debug(inFields);
26 logger.debug("inFields[SERVICE_REQUEST_COUNT]=" + inFields["SERVICE_REQUEST_COUNT"]);
28 ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]);
30 if (imsiStatus.getBlockingCount() > 1) {
31 subject.getTaskKey("AADMNoActTask").copyTo(selectedTask);
32 logger.debug("user blacklisted permanently");
36 logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.getAnomalous());
38 // check if this is second iteration
39 if (inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] != null && inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] > 100 && imsiStatus.getAnomalous()) {
40 subject.getTaskKey("AADMDoSProvenActTask").copyTo(selectedTask);
41 logger.debug("inside TCP_UE_SIDE_AVG_THROUGHPUT");
45 // Get the status of the ENodeB
46 ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get((String)inFields["ENODEB_ID"]);
48 // check if this is first iteration and DoS
49 if (inFields["SERVICE_REQUEST_COUNT"] != null &&
50 inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] != null &&
51 inFields["SERVICE_REQUEST_COUNT"] > inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] &&
52 eNodeBStatus != null && eNodeBStatus.getDosCount() > 100 &&
53 inFields["NUM_SUBSCRIBERS"] != null && inFields["NUM_SUBSCRIBERS"] > 100) {
54 logger.debug("inside NUM_SUBSCRIBERS");
55 subject.getTaskKey("AADMDoSProvenActTask").copyTo(selectedTask);
59 // check if this is first iteration and request probe
60 if (inFields["UE_IP_ADDRESS"] != null) {
61 logger.debug("inside UE_IP_ADDRESS");
62 subject.getTaskKey("AADMDoSSuggestionActTask").copyTo(selectedTask);
66 subject.defaultTaskKey.copyTo(selectedTask);