+ });
+ failedCmHandlesPerResponseStatus.put(CM_HANDLES_NOT_READY, nonReadyCmHandleIds);
+ failedCmHandlesPerResponseStatus.put(CM_HANDLES_NOT_FOUND, nonExistingCmHandleIds);
+ failedCmHandlesPerResponseStatus.put(CM_HANDLE_INVALID_ID, invalidCmHandleIds);
+ return mergeAllCmHandleResponses(acceptedCmHandleStatePerCmHandle, failedCmHandlesPerResponseStatus);
+ }
+
+ private static YangModelCmHandle createYangModelCmHandle(final DmiPluginRegistration dmiPluginRegistration,
+ final String cmHandleId) {
+ final NcmpServiceCmHandle ncmpServiceCmHandle = new NcmpServiceCmHandle();
+ ncmpServiceCmHandle.setCmHandleId(cmHandleId);
+ final String moduleSetTag = dmiPluginRegistration.getUpgradedCmHandles().getModuleSetTag();
+ final String lockReasonWithModuleSetTag = MessageFormat.format(
+ ModuleOperationsUtils.MODULE_SET_TAG_MESSAGE_FORMAT, moduleSetTag);
+ ncmpServiceCmHandle.setCompositeState(new CompositeStateBuilder().withCmHandleState(CmHandleState.READY)
+ .withLockReason(MODULE_UPGRADE, lockReasonWithModuleSetTag).build());
+ return YangModelCmHandle.toYangModelCmHandle(dmiPluginRegistration.getDmiPlugin(),
+ dmiPluginRegistration.getDmiDataPlugin(), dmiPluginRegistration.getDmiModelPlugin(),
+ ncmpServiceCmHandle, moduleSetTag, ncmpServiceCmHandle.getAlternateId());
+ }
+
+ private CmHandleRegistrationResponse deleteCmHandleAndGetCmHandleRegistrationResponse(final String cmHandleId) {
+ try {
+ deleteCmHandleFromDbAndModuleSyncMap(cmHandleId);
+ return CmHandleRegistrationResponse.createSuccessResponse(cmHandleId);
+ } catch (final DataNodeNotFoundException dataNodeNotFoundException) {
+ log.error("Unable to find dataNode for cmHandleId : {} , caused by : {}",
+ cmHandleId, dataNodeNotFoundException.getMessage());
+ return CmHandleRegistrationResponse.createFailureResponse(cmHandleId, CM_HANDLES_NOT_FOUND);
+ } catch (final DataValidationException dataValidationException) {
+ log.error("Unable to de-register cm-handle id: {}, caused by: {}",
+ cmHandleId, dataValidationException.getMessage());
+ return CmHandleRegistrationResponse.createFailureResponse(cmHandleId, CM_HANDLE_INVALID_ID);
+ } catch (final Exception exception) {
+ log.error("Unable to de-register cm-handle id : {} , caused by : {}", cmHandleId, exception.getMessage());
+ return CmHandleRegistrationResponse.createFailureResponse(cmHandleId, exception);