diff options
author | tragait <rahul.tyagi@est.tech> | 2021-10-11 16:31:59 +0100 |
---|---|---|
committer | tragait <rahul.tyagi@est.tech> | 2021-10-12 11:19:20 +0100 |
commit | 7ad748f44a8f9624b53462850759804ffc185576 (patch) | |
tree | ccde8f22676b02edf7b1de58dec99792a3a83604 /cps-ncmp-service/src/main/java | |
parent | 66b598a4243bb702059902af2903d1c3da01d5fa (diff) |
fix for sync and passthough usecase
fixed unknown modules issue, if unknown modules are size 0
dmi should not be called.
fixed 2xx issue for create resource.
fixed options = null issue.
Issue-ID: CPS-730
Signed-off-by: tragait <rahul.tyagi@est.tech>
Change-Id: If6226f65e72753189c27648ad903c45a5d8fa14e
Diffstat (limited to 'cps-ncmp-service/src/main/java')
2 files changed, 11 insertions, 5 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index 5594a2a7a5..d6aaf36d3a 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -284,7 +284,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } private static void handleResponseForPost(final @NotNull ResponseEntity<String> responseEntity) { - if (responseEntity.getStatusCode() != HttpStatus.OK) { + if (!HttpStatus.valueOf(responseEntity.getStatusCodeValue()).is2xxSuccessful()) { throw new NcmpException("Not able to create resource data.", "DMI status code: " + responseEntity.getStatusCodeValue() + ", DMI response body: " + responseEntity.getBody()); @@ -387,9 +387,13 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService final List<ModuleReference> unknownModuleReferences = new ArrayList<>(); prepareModuleSubsets(moduleReferencesFromCmHandle, existingModuleReferences, unknownModuleReferences); - final Map<String, String> newYangResourcesModuleNameToContentMap = - getNewYangResourcesFromDmi(persistenceCmHandle, unknownModuleReferences, cmHandlePropertiesAsMap); - + final Map<String, String> newYangResourcesModuleNameToContentMap; + if (unknownModuleReferences.size() > 0) { + newYangResourcesModuleNameToContentMap = getNewYangResourcesFromDmi(persistenceCmHandle, + unknownModuleReferences, cmHandlePropertiesAsMap); + } else { + newYangResourcesModuleNameToContentMap = new HashMap<>(); + } cpsModuleService.createSchemaSetFromModules(NF_PROXY_DATASPACE_NAME, persistenceCmHandle.getId(), newYangResourcesModuleNameToContentMap, existingModuleReferences); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java index 363b0ef9b2..f7421cdb71 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java @@ -203,7 +203,9 @@ public class DmiOperations { private void appendOptionsQuery(final StringBuilder stringBuilder, final String optionsParamInQuery) { - stringBuilder.append("&").append(OPTIONS_QUERY_KEY).append("=").append(optionsParamInQuery); + if (optionsParamInQuery != null) { + stringBuilder.append("&").append(OPTIONS_QUERY_KEY).append("=").append(optionsParamInQuery); + } } private HttpHeaders prepareHeader(final String acceptParam) { |