From af58baecadb732685e29e5c1b8172d90fec1458d Mon Sep 17 00:00:00 2001 From: qingshuting Date: Mon, 26 Sep 2022 16:57:12 +0800 Subject: [SLICEMS]Fix bug that config thread hang up when cbs policy is empty Fix bug for config thread Issue-ID: DCAEGEN2-3273 Signed-off-by: qingshuting Change-Id: I3de62d62b5dc91ada70060c0820b0b4b701df728 --- components/slice-analysis-ms/ChangeLog.md | 2 ++ .../analysis/ms/dmaap/VesNotificationCallback.java | 3 +-- .../onap/slice/analysis/ms/service/ConfigThread.java | 5 ++--- .../analysis/ms/service/ccvpn/BandwidthEvaluator.java | 7 ++++--- .../analysis/ms/service/ccvpn/CCVPNPmDatastore.java | 19 +++++++++---------- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'components/slice-analysis-ms') diff --git a/components/slice-analysis-ms/ChangeLog.md b/components/slice-analysis-ms/ChangeLog.md index 0796670f..417ad64d 100644 --- a/components/slice-analysis-ms/ChangeLog.md +++ b/components/slice-analysis-ms/ChangeLog.md @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - [DCAEGEN2-3240](https://jira.onap.org/browse/DCAEGEN2-3240) - Implement runtime service configuration + - [DCAEGEN2-3273](https://jira.onap.org/browse/DCAEGEN2-3273) - Fix bug that config thread hang up when cbs policy is empty + ## [1.1.4] - 2022/07/28 - [DCAEGEN2-3120](https://jira.onap.org/browse/DCAEGEN2-3120) - Enhance sliceanalysis MS to use DCAE SDK dmaap-client lib 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 4b880e3d..fff156cc 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 @@ -95,7 +95,6 @@ public class VesNotificationCallback implements NotificationCallback { JsonNode node = obj.readTree(msg); JsonNode notificationNode = node.get(EVENT).get(NOTIFICATIONFIELDS); output = obj.treeToValue(notificationNode, NotificationFields.class); - //Filter out target notification changeIdentifier and changeType notifChangeIdentifier = output.getChangeIdentifier(); notifChangeType = output.getChangeType(); @@ -120,7 +119,7 @@ public class VesNotificationCallback implements NotificationCallback { */ public void updateCllInstance(){ Set instances = aaiService.fetchAllCllInstances(); - log.error("instances {}", instances); + log.debug("All valid instances are {}", instances); ccvpnPmDatastore.updateCllInstances(instances); } diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConfigThread.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConfigThread.java index 61e445d0..0bd41e2d 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConfigThread.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConfigThread.java @@ -47,8 +47,7 @@ public class ConfigThread extends Thread{ try { Thread.sleep(1000); ConfigPolicy configPolicy = ConfigPolicy.getInstance(); - if(configPolicy != null) { - // config content + if(configPolicy.getConfig() != null) { String cllId = null; Boolean clBwAssuranceStatus = null; int originalBw = 0; @@ -65,7 +64,7 @@ public class ConfigThread extends Thread{ ccvpnPmDatastore.updateConfigFromPolicy(cllId, clBwAssuranceStatus, originalBw); } } else { - log.debug("Config policy is empty, nothing to update."); + log.error("Config policy is empty, nothing to update."); } } catch (Exception e) { diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/BandwidthEvaluator.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/BandwidthEvaluator.java index 7ca100d1..67cda89a 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/BandwidthEvaluator.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/BandwidthEvaluator.java @@ -109,16 +109,17 @@ public class BandwidthEvaluator { String serviceId = (String) event.subject(); Map maxBandwidthData = aaiService.fetchMaxBandwidthOfService(serviceId); if (maxBandwidthData.get("maxBandwidth") != null){ - log.info("Successfully retrieved bandwidth info from AAI; service: {}, bandwidth: {}", + log.debug("Successfully retrieved bandwidth info from AAI; service: {}, bandwidth: {}", serviceId, maxBandwidthData.get("maxBandwidth")); int bwValue = maxBandwidthData.get("maxBandwidth").intValue(); if (ccvpnPmDatastore.getProvBwOfSvc(serviceId) == 0){ ccvpnPmDatastore.updateProvBw(serviceId, bwValue, true); + log.debug("Provision bw of cll {} updated from 0 to {}, max bw is {}", serviceId, ccvpnPmDatastore.getProvBwOfSvc(serviceId), bwValue); } else if (ccvpnPmDatastore.getProvBwOfSvc(serviceId) != bwValue) { - log.info("Service modification complete; serviceId: {} with new bandwidth: {}", serviceId, bwValue); + log.debug("Service modification complete; serviceId: {} update prov bw from {} to {}", serviceId, ccvpnPmDatastore.getProvBwOfSvc(serviceId), bwValue); ccvpnPmDatastore.updateProvBw(serviceId, bwValue, true); ccvpnPmDatastore.updateSvcState(serviceId, ServiceState.RUNNING); - log.debug("Service state of {} is changed to running", serviceId); + log.debug("Service state of {} is changed to running, {}", serviceId, ccvpnPmDatastore.getStatusOfSvc(serviceId)); } } log.debug("=== Processing AAI network policy query complete ==="); diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/CCVPNPmDatastore.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/CCVPNPmDatastore.java index 5f3ce311..3e6c4746 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/CCVPNPmDatastore.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ccvpn/CCVPNPmDatastore.java @@ -25,7 +25,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; import lombok.Getter; -import lombok.Setter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -200,15 +199,6 @@ public class CCVPNPmDatastore { public void updateCllInstances(Set allValidCllInstances){ Set invalidCllIds; invalidCllIds= filterInvalidCllIds(allValidCllInstances, svcStatus.keySet()); - svcStatus.keySet().removeAll(invalidCllIds); - invalidCllIds = filterInvalidCllIds(allValidCllInstances, endpointToProvBw.keySet()); - endpointToProvBw.keySet().removeAll(invalidCllIds); - invalidCllIds = filterInvalidCllIds(allValidCllInstances, upperBoundBw.keySet()); - upperBoundBw.keySet().removeAll(invalidCllIds); - invalidCllIds = filterInvalidCllIds(allValidCllInstances, endpointToOriginalBw.keySet()); - endpointToOriginalBw.keySet().removeAll(invalidCllIds); - invalidCllIds = filterInvalidCllIds(allValidCllInstances, closedLoopBwAssuranceStatus.keySet()); - closedLoopBwAssuranceStatus.keySet().removeAll(invalidCllIds); for(String invalidCllId : invalidCllIds) { log.debug("drop {} from endpointToUsedBw", invalidCllId); endpointToUsedBw.entrySet().stream().dropWhile(map -> map.getKey().getCllId().equalsIgnoreCase(invalidCllId)); @@ -220,6 +210,15 @@ public class CCVPNPmDatastore { } } } + svcStatus.keySet().removeAll(invalidCllIds); + invalidCllIds = filterInvalidCllIds(allValidCllInstances, endpointToProvBw.keySet()); + endpointToProvBw.keySet().removeAll(invalidCllIds); + invalidCllIds = filterInvalidCllIds(allValidCllInstances, upperBoundBw.keySet()); + upperBoundBw.keySet().removeAll(invalidCllIds); + invalidCllIds = filterInvalidCllIds(allValidCllInstances, endpointToOriginalBw.keySet()); + endpointToOriginalBw.keySet().removeAll(invalidCllIds); + invalidCllIds = filterInvalidCllIds(allValidCllInstances, closedLoopBwAssuranceStatus.keySet()); + closedLoopBwAssuranceStatus.keySet().removeAll(invalidCllIds); } /** -- cgit 1.2.3-korg