diff options
author | sourabh_sourabh <sourabh.sourabh@est.tech> | 2023-09-26 12:11:42 +0100 |
---|---|---|
committer | Sourabh Sourabh <sourabh.sourabh@est.tech> | 2023-10-11 08:55:27 +0000 |
commit | 55164b23839f187ae089fd08c34487dcfd165188 (patch) | |
tree | 6e710268e09b051544e70155e583be7b27ea8658 /cps-ncmp-rest/src/main/java | |
parent | 4bc19fe118ca7d81891c12d40719a569bc528a21 (diff) |
Expose REST endpoint to update YANG schema set using moduleSetTag
- Added new schema to upgrade model into component.
- Modified Ncmp rest input mapper to add upgradedCmHandles attributes.
- Modified cm handle state mapper to add new lock reason.
- Added new method to parse and upgrade Cm handles in DmiRegistration.
- YANG data converter is modified to add "module-set-tag" atribute.
- Cm handle new query method is added for cps path without appending
ancestor.
- Modified setCompositeStateForRetry to add lock reason.
- New lock reason category is added.
- Existing module sync service is modified to upgrade the model
"syncAndCreateOrUpgradeSchemaSetAndAnchor".
- Sync util method "getModuleSyncFailedCmHandles" to modified to add
another lock reason "LOCKED_MISBEHAVING".
- Added new attribute "UpgradedCmHandles" into DmiPluginRegistration and DmiPluginRegistrationResponse.
- New attribute "moduleSetTag" is added into NcmpServiceCmHandle.
- New model "UpgradedCmHandles" is added.
- New method "updateSchemaSetWithExistingModules" is added into cps
module service to update cm handle with exsting model.
- Code coverage is reducced to 96 percentage that would be addressed and
pushed into new patch.
Issue-ID: CPS-1798
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Change-Id: I540acb404e38fc434de87a0d959bfde710a18b03
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ncmp-rest/src/main/java')
3 files changed, 14 insertions, 7 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/NetworkCmProxyInventoryController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java index cd61c5a4a5..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,16 +110,16 @@ 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( 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 82dc4837f8..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 @@ -20,6 +20,8 @@ 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; @@ -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; |