diff options
author | 2022-09-14 12:05:19 +0800 | |
---|---|---|
committer | 2022-09-20 23:14:48 +0800 | |
commit | f5db5bd223d369a1186c94f43ab642e9c4d69709 (patch) | |
tree | 1acf6e5cdeff298622d6f6fad8c1431d0e90b43a /components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai | |
parent | 3a0de968e2c5a32a2fa43f791c78455db1c3e641 (diff) |
[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 <qingshuting1@huawei.com>
Change-Id: Id611d10973fca1e1715e9e220819dfcf51bbd1ba
Diffstat (limited to 'components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai')
-rw-r--r-- | components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java index 9459b64f..b68373d1 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2021-2022 Wipro Limited. * 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. @@ -26,10 +27,12 @@ import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; import org.json.JSONArray; import org.json.JSONObject; import org.onap.slice.analysis.ms.models.Configuration; @@ -111,6 +114,39 @@ public class AaiService implements AaiInterface { } /** + * fetch all valid cll instances + * @return + */ + public Set<String> fetchAllCllInstances() { + globalSubscriberId = "IBNCustomer"; + subscriptionServiceType = "IBN"; + String serviceReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId + + "/service-subscriptions/service-subscription/" + subscriptionServiceType + "/service-instances"; + log.info("serviceReqUrl {}", serviceReqUrl); + Set<String> cllInstances = new HashSet<>(); + try { + String serviceInstance = + restclient.sendGetRequest(serviceReqUrl, new ParameterizedTypeReference<String>() {}).getBody(); + log.debug("The service instance response msg are :{}", serviceInstance); + JSONObject serviceInstanceJson = new JSONObject(serviceInstance); + JSONArray serviceInstanceArray = serviceInstanceJson.getJSONArray("service-instance"); + for (int i = 0; i < serviceInstanceArray.length(); i++) { + JSONObject serviceObj = serviceInstanceArray.getJSONObject(i); + String serviceId = serviceObj.getString("service-instance-id"); + log.debug("Jsonobject {}", serviceObj); + if(serviceId.startsWith("cll")){ + cllInstances.add(serviceId); + log.debug("Add {} to latest service id list", serviceId); + } + } + return cllInstances; + } catch (Exception e) { + log.error("Exception while fetching serviceDetails: " + e); + } + return new HashSet<>(); + } + + /** * Fetches the current configuration of a Slice from AAI * * @param snssai SNSSAI ID @@ -210,7 +246,7 @@ public class AaiService implements AaiInterface { /** * Fetches the SNSSIs of a serviceInstanceId * - * @param serviceInstanceId service instance ID + * @param sliceInstanceId service instance ID * @return snssaiList contains list of SNSSAIs */ public List<String> getSnssaiList(String sliceInstanceId) { |