diff options
author | 2023-02-15 10:52:19 +0000 | |
---|---|---|
committer | 2023-02-15 10:52:19 +0000 | |
commit | 9575b84ab4e2db885d8761a98eaae9ff3a06aa81 (patch) | |
tree | 86c2d2952a9847ddf6db444d72c74d05f5c534b2 /cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl | |
parent | b2c8bc6b9bfd502be01e524c24628fcd10b1e177 (diff) | |
parent | c006702473c605450801b353d0c97e99968eced1 (diff) |
Merge "Use getDataNodes (plural version) into NCMP to get CM handles Performance improvement"
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl')
2 files changed, 3 insertions, 75 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java index f8e06593c..746630898 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java @@ -91,40 +91,6 @@ public class YangDataConverter { } /** - * This method convert cm handle data node to yang model cm handle without using NcmpServiceCmHandle. - * - * @param cmHandleDataNode the datanode of the cm handle - * @param cmHandleId the id of the cm handle - * @return yang model cm handle - */ - public static YangModelCmHandle convertCmHandleToYangModelWithoutNcmpServiceCmHandle( - final DataNode cmHandleDataNode, - final String cmHandleId) { - final Map<String, String> dmiProperties = new LinkedHashMap<>(); - final Map<String, String> publicProperties = new LinkedHashMap<>(); - final CompositeStateBuilder compositeStateBuilder = new CompositeStateBuilder(); - CompositeState compositeState = compositeStateBuilder.build(); - for (final DataNode childDataNode : cmHandleDataNode.getChildDataNodes()) { - if (childDataNode.getXpath().contains("/additional-properties[@name=")) { - addProperty(childDataNode, dmiProperties); - } else if (childDataNode.getXpath().contains("/public-properties[@name=")) { - addProperty(childDataNode, publicProperties); - } else if (childDataNode.getXpath().endsWith("/state")) { - compositeState = compositeStateBuilder.fromDataNode(childDataNode).build(); - } - } - return YangModelCmHandle.toYangModelCmHandleWithoutNcmpServiceHandle( - (String) cmHandleDataNode.getLeaves().get("dmi-service-name"), - (String) cmHandleDataNode.getLeaves().get("dmi-data-service-name"), - (String) cmHandleDataNode.getLeaves().get("dmi-model-service-name"), - cmHandleId, - dmiProperties, - publicProperties, - compositeState - ); - } - - /** * This method convert cm handle data nodes to yang model cm handles. * @param cmHandleDataNodes the datanode of the cm handle * @return yang model cm handles @@ -134,21 +100,15 @@ public class YangDataConverter { final Collection<YangModelCmHandle> yangModelCmHandles = new ArrayList<>(cmHandleDataNodes.size()); cmHandleDataNodes.forEach(dataNode -> { final String cmHandleId = extractCmHandleIdFromXpath(dataNode.getXpath()); - if (cmHandleId != null) { - yangModelCmHandles.add(convertCmHandleToYangModelWithoutNcmpServiceCmHandle(dataNode, cmHandleId)); - } + yangModelCmHandles.add(convertCmHandleToYangModel(dataNode, cmHandleId)); }); return yangModelCmHandles; } private static String extractCmHandleIdFromXpath(final String xpath) { final Matcher matcher = cmHandleIdInXpathPattern.matcher(xpath); - if (matcher.find()) { - return matcher.group(1); - } else { - log.error("Unexpected xpath {}", xpath); - } - return null; + matcher.find(); + return matcher.group(1); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java index 5f98f1499..a6f953aa8 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java @@ -115,38 +115,6 @@ public class YangModelCmHandle { return yangModelCmHandle; } - - /** - * Create a yangModelCmHandle without the use of NcmpServiceHandle. - * - * @param dmiServiceName dmi service name - * @param dmiDataServiceName dmi data service name - * @param dmiModelServiceName dmi model service name - * @param cmHandleId the cm handle id - * @param dmiProperties dmiProperties - * @param publicProperties publicProperties - * @param compositeState compositeState - * @return instance of yangModelCmHandle - */ - public static YangModelCmHandle toYangModelCmHandleWithoutNcmpServiceHandle(final String dmiServiceName, - final String dmiDataServiceName, - final String dmiModelServiceName, - final String cmHandleId, - final Map<String, String> dmiProperties, - final Map<String, String> publicProperties, - final CompositeState compositeState) { - final YangModelCmHandle yangModelCmHandle = new YangModelCmHandle(); - yangModelCmHandle.setId(cmHandleId); - yangModelCmHandle.setDmiServiceName(dmiServiceName); - yangModelCmHandle.setDmiDataServiceName(dmiDataServiceName); - yangModelCmHandle.setDmiModelServiceName(dmiModelServiceName); - yangModelCmHandle.setDmiProperties(asYangModelCmHandleProperties(dmiProperties)); - yangModelCmHandle.setPublicProperties(asYangModelCmHandleProperties(publicProperties)); - yangModelCmHandle.setCompositeState(compositeState); - return yangModelCmHandle; - } - - /** * Resolve a dmi service name. * |