diff options
author | david.mcweeney <david.mcweeney@est.tech> | 2024-05-01 12:08:00 +0100 |
---|---|---|
committer | david.mcweeney <david.mcweeney@est.tech> | 2024-05-15 14:09:30 +0100 |
commit | 69a68f1c14dec4bfc3e76b55bc21a71107775619 (patch) | |
tree | e1f6f139255fe4f68022d0dbb2d86c3ce4d75f78 /cps-ncmp-service/src/main | |
parent | ce2acdfabae0c2e373c2e3b7a895831d9191e1fb (diff) |
CPS-2181 - #1 Included Module Set Tag in NCMP calls to DMI for Yang Module Resources
Change-Id: I4f8cf79667e3155f49b9109d26b5807f5d54f90c
Signed-off-by: david.mcweeney <david.mcweeney@est.tech>
Issue-ID: CPS-2181
Diffstat (limited to 'cps-ncmp-service/src/main')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java index 3a281d740b..798f6de810 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java @@ -24,7 +24,9 @@ package org.onap.cps.ncmp.api.impl.operations; import static org.onap.cps.ncmp.api.impl.operations.RequiredDmiService.MODEL; import com.google.gson.JsonArray; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -88,8 +90,8 @@ public class DmiModelOperations extends DmiOperations { if (newModuleReferences.isEmpty()) { return Collections.emptyMap(); } - final String jsonWithDataAndDmiProperties = getRequestBodyToFetchYangResources( - newModuleReferences, yangModelCmHandle.getDmiProperties()); + final String jsonWithDataAndDmiProperties = getRequestBodyToFetchYangResources(newModuleReferences, + yangModelCmHandle.getDmiProperties(), yangModelCmHandle.getModuleSetTag()); final ResponseEntity<Object> responseEntity = getResourceFromDmiWithJsonData( yangModelCmHandle.resolveDmiServiceName(MODEL), jsonWithDataAndDmiProperties, @@ -117,11 +119,16 @@ public class DmiModelOperations extends DmiOperations { } private static String getRequestBodyToFetchYangResources(final Collection<ModuleReference> newModuleReferences, - final List<YangModelCmHandle.Property> dmiProperties) { + final List<YangModelCmHandle.Property> dmiProperties, + final String moduleSetTag) { final JsonArray moduleReferencesAsJson = getModuleReferencesAsJson(newModuleReferences); final JsonObject data = new JsonObject(); data.add("modules", moduleReferencesAsJson); final JsonObject jsonRequestObject = new JsonObject(); + if (!moduleSetTag.isEmpty()) { + final JsonElement moduleSetTagAsJson = JsonParser.parseString(moduleSetTag); + jsonRequestObject.add("moduleSetTag", moduleSetTagAsJson); + } jsonRequestObject.add("data", data); jsonRequestObject.add("cmHandleProperties", toJsonObject(dmiProperties)); return jsonRequestObject.toString(); |