diff options
author | leventecsanyi <levente.csanyi@est.tech> | 2023-12-07 16:17:12 +0100 |
---|---|---|
committer | Levente Csanyi <levente.csanyi@est.tech> | 2023-12-13 10:37:34 +0000 |
commit | d8be9ef1d451f3e19c0c73752ad3d947e8baa9bd (patch) | |
tree | fac70a881b7f65147b4ed9a460c1e02e78c9a1e2 /cps-ncmp-service/src/main | |
parent | 7e94b26a666907cc97d692b8dda8364bb0a0ef45 (diff) |
Modify cmHandle registration for alternateId
- added alternate id to the interface for persisting the new value
- updated unit tests to validate the new field
Issue-ID: CPS-1985
Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
Change-Id: I81e61f2ea2ecc5d8c0938af00fa81a99e27e2e23
Diffstat (limited to 'cps-ncmp-service/src/main')
4 files changed, 14 insertions, 19 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 1afe5c7114..469d75ab94 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 @@ -328,7 +328,8 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService dmiPluginRegistration.getDmiDataPlugin(), dmiPluginRegistration.getDmiModelPlugin(), cmHandle, - cmHandle.getModuleSetTag()); + cmHandle.getModuleSetTag(), + cmHandle.getAlternateId()); yangModelCmHandles.add(yangModelCmHandle); initialTrustLevelPerCmHandleId.put(cmHandle.getCmHandleId(), cmHandle.getRegistrationTrustLevel()); }); @@ -420,7 +421,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService .withLockReason(MODULE_UPGRADE, lockReasonWithModuleSetTag).build()); return YangModelCmHandle.toYangModelCmHandle(dmiPluginRegistration.getDmiPlugin(), dmiPluginRegistration.getDmiDataPlugin(), dmiPluginRegistration.getDmiModelPlugin(), - ncmpServiceCmHandle, moduleSetTag); + ncmpServiceCmHandle, moduleSetTag, ncmpServiceCmHandle.getAlternateId()); } private CmHandleRegistrationResponse deleteCmHandleAndGetCmHandleRegistrationResponse(final String cmHandleId) { diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java index b6a04d3677..b54c154b2a 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/YangDataConverter.java @@ -87,7 +87,8 @@ public class YangDataConverter { (String) cmHandleDataNode.getLeaves().get("dmi-data-service-name"), (String) cmHandleDataNode.getLeaves().get("dmi-model-service-name"), ncmpServiceCmHandle, - (String) cmHandleDataNode.getLeaves().get("module-set-tag") + (String) cmHandleDataNode.getLeaves().get("module-set-tag"), + (String) cmHandleDataNode.getLeaves().get("alternate-id") ); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java index f930d5b71d..ba36b1a54c 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/yangmodels/YangModelCmHandle.java @@ -68,6 +68,9 @@ public class YangModelCmHandle { @JsonProperty("module-set-tag") private String moduleSetTag; + @JsonProperty("alternate-id") + private String alternateId; + @JsonProperty("additional-properties") private List<Property> dmiProperties; @@ -91,6 +94,7 @@ public class YangModelCmHandle { copy.dmiProperties = original.getDmiProperties() == null ? null : new ArrayList<>(original.getDmiProperties()); copy.publicProperties = original.getPublicProperties() == null ? null : new ArrayList<>(original.getPublicProperties()); + copy.alternateId = original.getAlternateId(); return copy; } @@ -107,13 +111,15 @@ public class YangModelCmHandle { final String dmiDataServiceName, final String dmiModelServiceName, final NcmpServiceCmHandle ncmpServiceCmHandle, - final String moduleSetTag) { + final String moduleSetTag, + final String alternateId) { final YangModelCmHandle yangModelCmHandle = new YangModelCmHandle(); yangModelCmHandle.setId(ncmpServiceCmHandle.getCmHandleId()); yangModelCmHandle.setDmiServiceName(dmiServiceName); yangModelCmHandle.setDmiDataServiceName(dmiDataServiceName); yangModelCmHandle.setDmiModelServiceName(dmiModelServiceName); yangModelCmHandle.setModuleSetTag(moduleSetTag == null ? StringUtils.EMPTY : moduleSetTag); + yangModelCmHandle.setAlternateId(alternateId); yangModelCmHandle.setDmiProperties(asYangModelCmHandleProperties(ncmpServiceCmHandle.getDmiProperties())); yangModelCmHandle.setPublicProperties(asYangModelCmHandleProperties( ncmpServiceCmHandle.getPublicProperties())); diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/NcmpServiceCmHandle.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/NcmpServiceCmHandle.java index f323079e0b..4989878975 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/NcmpServiceCmHandle.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/NcmpServiceCmHandle.java @@ -23,7 +23,6 @@ package org.onap.cps.ncmp.api.models; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.Map; import lombok.Getter; import lombok.NoArgsConstructor; @@ -59,18 +58,6 @@ public class NcmpServiceCmHandle { @JsonSetter(nulls = Nulls.AS_EMPTY) private TrustLevel registrationTrustLevel; - /** - * NcmpServiceCmHandle copy constructor. - * - * @param ncmpServiceCmHandle Ncmp Service CmHandle - */ - public NcmpServiceCmHandle(final NcmpServiceCmHandle ncmpServiceCmHandle) { - this.cmHandleId = ncmpServiceCmHandle.getCmHandleId(); - this.dmiProperties = new LinkedHashMap<>(ncmpServiceCmHandle.getDmiProperties()); - this.publicProperties = new LinkedHashMap<>(ncmpServiceCmHandle.getPublicProperties()); - this.compositeState = ncmpServiceCmHandle.getCompositeState() != null ? new CompositeState( - ncmpServiceCmHandle.getCompositeState()) : null; - this.moduleSetTag = ncmpServiceCmHandle.getModuleSetTag(); - this.registrationTrustLevel = ncmpServiceCmHandle.getRegistrationTrustLevel(); - } + @JsonSetter(nulls = Nulls.AS_EMPTY) + private String alternateId; } |