From f5db5bd223d369a1186c94f43ab642e9c4d69709 Mon Sep 17 00:00:00 2001 From: qingshuting Date: Wed, 14 Sep 2022 12:05:19 +0800 Subject: [SLICEMS] Add bw decrease logics and enhance runtime config feature Add closed loop assurance decrease bw logics. Add a thread transfers latest data from cbs client configs to corresponding value. Add runtime configuration function. Fix the bug that cll service info didn't get updated when a cll service is deleted. Issue-ID: DCAEGEN2-3240 Issue-ID: DCAEGEN2-3264 Issue-ID: DCAEGEN2-3255 Issue-ID: DCAEGEN2-3238 Signed-off-by: qingshuting Change-Id: Id611d10973fca1e1715e9e220819dfcf51bbd1ba --- .../analysis/ms/dmaap/VesNotificationCallback.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java') diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java index 584da7b7..4b880e3d 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java @@ -3,6 +3,7 @@ * slice-analysis-ms * ================================================================================ * Copyright (C) 2022 Huawei Canada Limited. + * Copyright (C) 2022 Huawei Technologies Co., Ltd. * ============================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +22,10 @@ package org.onap.slice.analysis.ms.dmaap; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.Set; +import org.onap.slice.analysis.ms.aai.AaiService; import org.onap.slice.analysis.ms.models.Configuration; import org.onap.slice.analysis.ms.models.vesnotification.NotificationFields; @@ -51,6 +53,9 @@ public class VesNotificationCallback implements NotificationCallback { @Autowired CCVPNPmDatastore ccvpnPmDatastore; + @Autowired + AaiService aaiService; + private static Logger log = LoggerFactory.getLogger(VesNotificationCallback.class); /** @@ -86,6 +91,7 @@ public class VesNotificationCallback implements NotificationCallback { String uniId = null; String bw = null; try { + updateCllInstance(); JsonNode node = obj.readTree(msg); JsonNode notificationNode = node.get(EVENT).get(NOTIFICATIONFIELDS); output = obj.treeToValue(notificationNode, NotificationFields.class); @@ -104,11 +110,18 @@ public class VesNotificationCallback implements NotificationCallback { log.error("Error converting VES msg to object, {}", e.getMessage()); } if (cllId != null && uniId != null && bw != null){ - log.info("Saving new CCVPN service usage data into ccvpnPmDatastore"); log.debug("new bandwidth data -- serviceId: {}, uniId: {}, bw: {}", cllId, uniId, bw); ccvpnPmDatastore.addUsedBwToEndpoint(cllId, uniId, bw); } + } + /** + * Get latest services list, and update local related variables. + */ + public void updateCllInstance(){ + Set instances = aaiService.fetchAllCllInstances(); + log.error("instances {}", instances); + ccvpnPmDatastore.updateCllInstances(instances); } } -- cgit 1.2.3-korg