From 8225287985743c015f79dc5ba5b7083424ba5903 Mon Sep 17 00:00:00 2001 From: "Leigh, Phillip (pl876u)" Date: Fri, 15 Mar 2019 14:52:19 -0400 Subject: AaiCtxBldr:Line up attributes w Pomba Common Model Issue-ID: LOG-1013 Change-Id: Ic59ac988afcd201903151455c8625225f85cd972 Signed-off-by: Leigh, Phillip (pl876u) --- .../pomba/contextbuilder/aai/util/RestUtil.java | 52 +--------------------- 1 file changed, 2 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java index cf28487..1eadfe5 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java +++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java @@ -26,9 +26,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; @@ -751,7 +748,7 @@ public class RestUtil { vnfcModel.setModelInvariantUUID(vnfc.getModelInvariantId()); vnfcModel.setName(vnfc.getVnfcName()); vnfcModel.setModelVersionID(vnfc.getModelVersionId()); - vnfcModel.setUuid(vnfc.getModelVersionId()); + // Do not fill up UUID, based on the Pomba audit common model. vnfcModel.setAttributes(populateVnfcAttributeList(vnfc)); vnfcLst.add(vnfcModel); } @@ -774,11 +771,8 @@ public class RestUtil { // --------------- Handle the vfModule List vfModuleLst = new ArrayList<>(); - //Map to calculate the Vf Module MaxInstance. if (vnf.getVfModules() != null) { List vfModuleList_from_aai = vnf.getVfModules().getVfModule(); - ConcurrentMap maxInstanceMap = - buildMaxInstanceMap(vfModuleList_from_aai); for (VfModule t_vfModule : vfModuleList_from_aai ) { VFModule vfModule = new VFModule(); @@ -787,7 +781,6 @@ public class RestUtil { vfModule.setName(t_vfModule.getVfModuleName()); vfModule.setModelVersionID(t_vfModule.getModelVersionId()); vfModule.setModelCustomizationUUID(t_vfModule.getModelCustomizationId()); - vfModule.setMaxInstances(maxInstanceMap.size()); vfModule.setDataQuality(DataQuality.ok()); List l3networkInVfModule = transformL3Network(t_vfModule.getL3NetworkList()); if ((l3networkInVfModule != null) && (!l3networkInVfModule.isEmpty()) ){ @@ -810,7 +803,6 @@ public class RestUtil { && (modelInvariantId.equals(t_vfModule.getModelInvariantId()))){ List vserverList = vfmoduleEntry.getValue(); - vfModule.setMaxInstances(getMaxInstance(vfmoduleEntry.getKey(), maxInstanceMap)); // Handle VM List vmList = new ArrayList<>(); @@ -975,7 +967,7 @@ public class RestUtil { { Attribute att = new Attribute(); att.setDataQuality(DataQuality.ok()); - att.setName(Attribute.Name.nfcNamingCode); + att.setName(Attribute.Name.lockedBoolean); att.setValue(String.valueOf(vnfc.getInMaintenance())); attributeList.add(att); } @@ -1709,46 +1701,6 @@ public class RestUtil { return relatedLink.substring(relatedLink.lastIndexOf("/")+1); } - /* - * Build the map with key (model_version_id and model_invariant_id), and with the max occurrences of - * the value in the map - * - */ - private static ConcurrentMap buildMaxInstanceMap(List vfModuleList) { - - ConcurrentMap map = new ConcurrentHashMap<>(); - - for (VfModule vfModule : vfModuleList) { - // group the key by vf-module-id, model-invariant-id,vf-module-name, model-version-id and model-customization-id - String key = new StringBuilder().append(vfModule.getVfModuleId()).append(DELIMITER) - .append(vfModule.getModelInvariantId()).toString(); - - if (key.length() > 0) { - map.putIfAbsent(key, new AtomicInteger(0)); //alway 0 - } - - } - - return map; - - } - - /* - * Return the occurrence of the VfModule complex key: (model-version-id)+(model-invariant-id) - */ - private static int getMaxInstance(String key, ConcurrentMap maxInstanceMap) { - - for (Map.Entry entry : maxInstanceMap.entrySet()) { - - if (entry.getKey().equals(key)) { - return entry.getValue().intValue(); - } - - } - return 0; - } - - public static boolean isEmptyJson(String serviceInstancePayload) { return (serviceInstancePayload.equals(EMPTY_JSON_STRING)); -- cgit 1.2.3-korg