diff options
author | decheng zhang <decheng.zhang@huawei.com> | 2022-08-23 18:02:28 -0400 |
---|---|---|
committer | decheng zhang <decheng.zhang@huawei.com> | 2022-09-08 09:30:17 -0400 |
commit | 9d6cf9dc122d8c980e1bc96b86b5c0233c372fd0 (patch) | |
tree | 9a0c4985113da0f1bd2e61c87adf1e1dec25c0d8 /components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/AaiEventNotificationCallback.java | |
parent | c21ca66f190f76feb5800ee500ff87ff7e67f5c5 (diff) |
[SLICEANALYSIS] Enhance BandwidthEvaluator to listen on user's bandwidth threshold
Put bandwidth evaluation into seperated evaluationStrategy; minor enhance to bandwidth evalution and adjustment; adding ratelimiter for each network function calling.
Issue-ID: DCAEGEN2-3239
Issue-ID: DCAEGEN2-3195
Signed-off-by: decheng zhang <decheng.zhang@huawei.com>
Change-Id: Id5e64fea0a03b0b41054840911ea6a7336956415
Signed-off-by: decheng zhang <decheng.zhang@huawei.com>
Diffstat (limited to 'components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/AaiEventNotificationCallback.java')
-rw-r--r-- | components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/AaiEventNotificationCallback.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/AaiEventNotificationCallback.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/AaiEventNotificationCallback.java index 9bff14a0..292cf6ae 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/AaiEventNotificationCallback.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/AaiEventNotificationCallback.java @@ -95,7 +95,7 @@ public class AaiEventNotificationCallback implements NotificationCallback { private void handleMsgJsonObject(JsonObject jsonObject){ JsonObject header = jsonObject.get(EVENT_HEADER).getAsJsonObject(); - if (!header.has(ACTION) || !header.get(ACTION).getAsString().equals(aaiNotifTargetAction)){ + if (!header.has(ACTION) || !isValid(header, ACTION, aaiNotifTargetAction)){ return; } if (!header.has(ENTITY_TYPE) || !header.get(ENTITY_TYPE).getAsString().equals(aaiNotifTargetEntity)){ @@ -131,4 +131,15 @@ public class AaiEventNotificationCallback implements NotificationCallback { } return null; } + + // make sure dmaap mesg header is expected type and valid; + private boolean isValid(JsonObject header, String targetKey, String allowed){ + boolean valid = false; + String[] allowedArr = allowed.split("\\|"); + String targetVal= header.get(targetKey).getAsString(); + for (String al: allowedArr){ + valid |= targetVal.equals(al); + } + return valid; + } } |