summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-rest/src/main/java/org')
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java3
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java2
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java12
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/CmHandleStateMapper.java12
4 files changed, 18 insertions, 11 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java
index b3f36f9c8b..af785d5658 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java
@@ -48,6 +48,9 @@ public interface NcmpRestInputMapper {
@Mapping(source = "removedCmHandles", target = "removedCmHandles",
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT)
+ @Mapping(source = "upgradedCmHandles", target = "upgradedCmHandles",
+ nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
+ nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT)
DmiPluginRegistration toDmiPluginRegistration(final RestDmiPluginRegistration restDmiPluginRegistration);
@Mapping(source = "cmHandle", target = "cmHandleId")
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index b81378dd20..6c730cb1f8 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -37,8 +37,8 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.api.NetworkCmProxyDataService;
import org.onap.cps.ncmp.api.impl.exception.InvalidDatastoreException;
+import org.onap.cps.ncmp.api.impl.inventory.CompositeState;
import org.onap.cps.ncmp.api.impl.operations.DatastoreType;
-import org.onap.cps.ncmp.api.inventory.CompositeState;
import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
import org.onap.cps.ncmp.rest.api.NetworkCmProxyApi;
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
index 87f9d835a1..453abcabb1 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
@@ -110,23 +110,23 @@ public class NetworkCmProxyInventoryController implements NetworkCmProxyInventor
getFailedResponses(dmiPluginRegistrationResponse.getUpdatedCmHandles()));
dmiPluginRegistrationErrorResponse.setFailedRemovedCmHandles(
getFailedResponses(dmiPluginRegistrationResponse.getRemovedCmHandles()));
-
+ dmiPluginRegistrationErrorResponse.setFailedUpgradeCmHandles(
+ getFailedResponses(dmiPluginRegistrationResponse.getUpgradedCmHandles()));
return dmiPluginRegistrationErrorResponse;
}
private List<CmHandlerRegistrationErrorResponse> getFailedResponses(
- final List<CmHandleRegistrationResponse> cmHandleRegistrationResponseList) {
+ final List<CmHandleRegistrationResponse> cmHandleRegistrationResponseList) {
return cmHandleRegistrationResponseList.stream()
- .filter(cmHandleRegistrationResponse -> cmHandleRegistrationResponse.getStatus() == Status.FAILURE)
- .map(this::toCmHandleRegistrationErrorResponse)
- .collect(Collectors.toList());
+ .filter(cmHandleRegistrationResponse -> cmHandleRegistrationResponse.getStatus() == Status.FAILURE)
+ .map(this::toCmHandleRegistrationErrorResponse).collect(Collectors.toList());
}
private CmHandlerRegistrationErrorResponse toCmHandleRegistrationErrorResponse(
final CmHandleRegistrationResponse registrationResponse) {
return new CmHandlerRegistrationErrorResponse()
.cmHandle(registrationResponse.getCmHandle())
- .errorCode(registrationResponse.getRegistrationError().errorCode)
+ .errorCode(registrationResponse.getNcmpResponseStatus().getCode())
.errorText(registrationResponse.getErrorText());
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/CmHandleStateMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/CmHandleStateMapper.java
index 64a9934b99..b436540fc2 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/CmHandleStateMapper.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/CmHandleStateMapper.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,14 @@
package org.onap.cps.ncmp.rest.mapper;
+import static org.onap.cps.ncmp.api.impl.inventory.LockReasonCategory.LOCKED_MISBEHAVING;
+
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
-import org.onap.cps.ncmp.api.inventory.CompositeState;
+import org.onap.cps.ncmp.api.impl.inventory.CompositeState;
import org.onap.cps.ncmp.rest.model.CmHandleCompositeState;
import org.onap.cps.ncmp.rest.model.DataStores;
import org.onap.cps.ncmp.rest.model.LockReason;
@@ -75,8 +77,10 @@ public interface CmHandleStateMapper {
@Named("toExternalLockReason")
static LockReason toExternalLockReason(CompositeState.LockReason internalLockReason) {
final LockReason externalLockReason = new LockReason();
- if (internalLockReason.getLockReasonCategory() != null) {
- externalLockReason.setReason("LOCKED_MISBEHAVING");
+ if (internalLockReason.getLockReasonCategory() == null) {
+ externalLockReason.setReason(LOCKED_MISBEHAVING.name());
+ } else {
+ externalLockReason.setReason(internalLockReason.getLockReasonCategory().name());
}
externalLockReason.setDetails(internalLockReason.getDetails());
return externalLockReason;