* Execute cm handle query search and return a list of cm handle details. Any number of conditions can be applied.
*
* @param cmHandleQueryParameters the cm handle query parameters
- * @param includePrivateProperties boolean value to determine the inclusion of private properties
+ * @param includeAdditionalProperties boolean value to determine the inclusion of additional properties
* @return collection of cm handles
*/
@Override
public ResponseEntity<List<RestOutputCmHandle>> searchCmHandles(
final CmHandleQueryParameters cmHandleQueryParameters,
- final Boolean includePrivateProperties) {
+ final Boolean includeAdditionalProperties) {
final CmHandleQueryApiParameters cmHandleQueryApiParameters =
deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
- final boolean includePrivatePropertiesParameter = Boolean.TRUE.equals(includePrivateProperties);
+ final boolean includeAdditionalPropertiesParameter = Boolean.TRUE.equals(includeAdditionalProperties);
final List<RestOutputCmHandle> restOutputCmHandles =
networkCmProxyInventoryFacade.executeCmHandleInventorySearch(cmHandleQueryApiParameters)
.map(handle -> restOutputCmHandleMapper
- .toRestOutputCmHandle(handle, includePrivatePropertiesParameter))
+ .toRestOutputCmHandle(handle, includeAdditionalPropertiesParameter))
.collectList().block();
return ResponseEntity.ok(restOutputCmHandles);
}
DmiPluginRegistration toDmiPluginRegistration(final RestDmiPluginRegistration restDmiPluginRegistration);
@Mapping(source = "cmHandle", target = "cmHandleId")
- @Mapping(source = "cmHandleProperties", target = "dmiProperties")
+ @Mapping(source = "cmHandleProperties", target = "additionalProperties")
@Mapping(source = "publicCmHandleProperties", target = "publicProperties")
@Mapping(source = "trustLevel", target = "registrationTrustLevel")
NcmpServiceCmHandle toNcmpServiceCmHandle(final RestInputCmHandle restInputCmHandle);
* Map NcmpServiceCmHandle to a RestOutputCmHandle object.
*
* @param ncmpServiceCmHandle DMI plugin identifier
- * @param includePrivateProperties Boolean for cm handle reference type either
+ * @param includeAdditionalProperties Boolean for cm handle reference type either
* cm handle id (False) or alternate id (True)
* @return list of cm handles
*/
public RestOutputCmHandle toRestOutputCmHandle(final NcmpServiceCmHandle ncmpServiceCmHandle,
- final boolean includePrivateProperties) {
+ final boolean includeAdditionalProperties) {
final RestOutputCmHandle restOutputCmHandle = new RestOutputCmHandle();
restOutputCmHandle.setCmHandle(ncmpServiceCmHandle.getCmHandleId());
restOutputCmHandle.setPublicCmHandleProperties(
Collections.singletonList(ncmpServiceCmHandle.getPublicProperties()));
- if (includePrivateProperties) {
- restOutputCmHandle.setPrivateCmHandleProperties(ncmpServiceCmHandle.getDmiProperties());
+ if (includeAdditionalProperties) {
+ restOutputCmHandle.setPrivateCmHandleProperties(ncmpServiceCmHandle.getAdditionalProperties());
}
restOutputCmHandle.setState(
cmHandleStateMapper.toCmHandleCompositeStateExternalLockReason(
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021-2022 Bell Canada
- * Modifications Copyright (C) 2021-2024 Nordix Foundation
+ * Modifications Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
def postUrl = "$ncmpBasePathV1/ch/searchCmHandles?includePrivatePropertiesInQuery=true"
String jsonString = TestUtils.getResourceFileContent('cm-handle-search-by-dmi-service.json')
and: 'a cm handle is returned'
- def ncmpServiceCmHandle = new NcmpServiceCmHandle(dmiProperties: ['someName': 'my dmi'])
+ def ncmpServiceCmHandle = new NcmpServiceCmHandle(additionalProperties: ['someName': 'my dmi'])
mockNetworkCmProxyInventoryFacade.executeCmHandleInventorySearch(_) >> Flux.fromIterable([ncmpServiceCmHandle])
- and: 'the mapper is requested to convert the object with private properties'
+ and: 'the mapper is requested to convert the object with additional properties'
mockRestOutputCmHandleMapper.toRestOutputCmHandle(ncmpServiceCmHandle, true) >> new RestOutputCmHandle()
when: 'the endpoint is invoked'
def response = mvc.perform(post(postUrl).contentType(MediaType.APPLICATION_JSON).content(jsonString)).andReturn().response
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2024 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
def 'Convert a created REST CM Handle Input to an NCMP Service CM Handle with #scenario'() {
given: 'a rest cm handle input'
- def inputRestCmHandle = new RestInputCmHandle(cmHandle : 'example-id', cmHandleProperties: registrationDmiProperties,
+ def inputRestCmHandle = new RestInputCmHandle(cmHandle : 'example-id', cmHandleProperties: registrationAdditionalProperties,
publicCmHandleProperties: registrationPublicProperties, trustLevel: registrationTrustLevel, alternateId: 'my-alternate-id', moduleSetTag: 'my-module-set-tag', dataProducerIdentifier: 'my-data-producer-identifier')
def restDmiPluginRegistration = new RestDmiPluginRegistration(
createdCmHandles: [inputRestCmHandle])
and: 'the converted cm handle has the same id'
result.createdCmHandles[0].cmHandleId == 'example-id'
and: '(empty) properties are converted correctly'
- result.createdCmHandles[0].dmiProperties == mappedDmiProperties
+ result.createdCmHandles[0].additionalProperties == mappedAdditionalProperties
result.createdCmHandles[0].publicProperties == mappedPublicProperties
and: 'other fields are mapped correctly'
result.createdCmHandles[0].alternateId == 'my-alternate-id'
result.createdCmHandles[0].registrationTrustLevel == mappedTrustLevel
result.createdCmHandles[0].dataProducerIdentifier == 'my-data-producer-identifier'
where: 'the following parameters are used'
- scenario | registrationDmiProperties | registrationPublicProperties | registrationTrustLevel || mappedDmiProperties | mappedPublicProperties | mappedTrustLevel
- 'dmi and public properties' | ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | 'COMPLETE' || ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | TrustLevel.COMPLETE
- 'no properties' | null | null | null || [:] | [:] | null
+ scenario | registrationAdditionalProperties | registrationPublicProperties | registrationTrustLevel || mappedAdditionalProperties | mappedPublicProperties | mappedTrustLevel
+ 'additional and public properties' | ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | 'COMPLETE' || ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | TrustLevel.COMPLETE
+ 'no properties' | null | null | null || [:] | [:] | null
}
def 'Handling empty dmi registration'() {
and: 'the state mapper returns a composite state'
mockCmHandleStateMapper.toCmHandleCompositeStateExternalLockReason(ncmpServiceCmHandle.getCompositeState()) >> new CmHandleCompositeState(cmHandleState: 'ADVISED')
when: 'the mapper function is called'
- def result = objectUnderTest.toRestOutputCmHandle(ncmpServiceCmHandle, includePrivateProperties)
+ def result = objectUnderTest.toRestOutputCmHandle(ncmpServiceCmHandle, includeAdditionalProperties)
then: 'result has the expected properties'
- assert result.privateCmHandleProperties.containsKey('private property key') == includePrivateProperties
+ assert result.privateCmHandleProperties.containsKey('additional property key') == includeAdditionalProperties
if (trustLevel != null) {
assert result.trustLevel == trustLevel.toString()
}
assert result.alternateId == 'alt-1'
assert result.cmHandle == 'ch-1'
where:
- scenario | includePrivateProperties || trustLevel
- 'without private properties' | false || null
- 'with private properties' | true || TrustLevel.NONE
- 'with trust level' | false || TrustLevel.COMPLETE
+ scenario | includeAdditionalProperties || trustLevel
+ 'without additional properties' | false || null
+ 'with additional properties' | true || TrustLevel.NONE
+ 'with trust level' | false || TrustLevel.COMPLETE
}
def createNcmpServiceCmHandle(trustLevel) {
- return new NcmpServiceCmHandle(cmHandleId: 'ch-1', dmiProperties: ['private property key': 'some value'],
+ return new NcmpServiceCmHandle(cmHandleId: 'ch-1', additionalProperties: ['additional property key': 'some value'],
currentTrustLevel: trustLevel,
publicProperties: ['public property key': 'public property value'],
alternateId: 'alt-1', compositeState: new CompositeState(cmHandleState: 'ADVISED'))
private String dmiModelServiceName;
@JsonSetter(nulls = Nulls.AS_EMPTY)
- private Map<String, String> dmiProperties = Collections.emptyMap();
+ private Map<String, String> additionalProperties = Collections.emptyMap();
@JsonSetter(nulls = Nulls.AS_EMPTY)
private Map<String, String> publicProperties = Collections.emptyMap();
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2024 Nordix Foundation
+ * Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
final DmiInEvent dmiInEvent = new DmiInEvent();
final Data cmSubscriptionData = new Data();
cmSubscriptionData.setPredicates(mapToDmiInEventPredicates(dmiCmSubscriptionPredicates));
- cmSubscriptionData.setCmHandles(mapToCmSubscriptionCmHandleWithPrivateProperties(
+ cmSubscriptionData.setCmHandles(mapToCmSubscriptionCmHandleWithAdditionalProperties(
extractUniqueCmHandleIds(dmiCmSubscriptionPredicates)));
dmiInEvent.setData(cmSubscriptionData);
return dmiInEvent;
}
- private List<CmHandle> mapToCmSubscriptionCmHandleWithPrivateProperties(final Set<String> cmHandleIds) {
+ private List<CmHandle> mapToCmSubscriptionCmHandleWithAdditionalProperties(final Set<String> cmHandleIds) {
final List<CmHandle> cmSubscriptionCmHandles = new ArrayList<>();
inventoryPersistence.getYangModelCmHandles(cmHandleIds).forEach(yangModelCmHandle -> {
- final CmHandle cmhandle = new CmHandle();
- final Map<String, String> cmhandleDmiProperties = new LinkedHashMap<>();
- yangModelCmHandle.getDmiProperties()
- .forEach(dmiProperty -> cmhandleDmiProperties.put(dmiProperty.getName(), dmiProperty.getValue()));
- cmhandle.setCmhandleId(yangModelCmHandle.getId());
- cmhandle.setPrivateProperties(cmhandleDmiProperties);
- cmSubscriptionCmHandles.add(cmhandle);
+ final CmHandle cmHandle = new CmHandle();
+ final Map<String, String> cmHandleAdditionalProperties = new LinkedHashMap<>();
+ yangModelCmHandle.getAdditionalProperties()
+ .forEach(additionalProperty -> cmHandleAdditionalProperties.put(additionalProperty.getName(),
+ additionalProperty.getValue()));
+ cmHandle.setCmhandleId(yangModelCmHandle.getId());
+ cmHandle.setPrivateProperties(cmHandleAdditionalProperties);
+ cmSubscriptionCmHandles.add(cmHandle);
});
return cmSubscriptionCmHandles;
.dataType(dataType)
.moduleSetTag(yangModelCmHandle.getModuleSetTag())
.build();
- dmiRequestBody.asDmiProperties(yangModelCmHandle.getDmiProperties());
+ dmiRequestBody.asAdditionalProperties(yangModelCmHandle.getAdditionalProperties());
return jsonObjectMapper.asJsonString(dmiRequestBody);
}
private String id;
@JsonProperty("cmHandleProperties")
- private Map<String, String> dmiProperties;
+ private Map<String, String> additionalProperties;
private String moduleSetTag;
/**
* Builds Dmi Operation Cm Handle object with all its associated properties.
*/
public static DmiOperationCmHandle buildDmiOperationCmHandle(final String cmHandleId,
- final Map<String, String> dmiProperties,
+ final Map<String, String> additionalProperties,
final String moduleSetTag) {
return DmiOperationCmHandle.builder().id(cmHandleId)
- .dmiProperties(dmiProperties).moduleSetTag(moduleSetTag)
+ .additionalProperties(additionalProperties).moduleSetTag(moduleSetTag)
.build();
}
}
final Map<String, String> nonReadyAlternateIdPerCmHandleId =
filterAndGetNonReadyAlternateIdPerCmHandleId(yangModelCmHandles);
- final Map<String, Map<String, Map<String, String>>> dmiPropertiesPerCmHandleIdPerServiceName =
- DmiServiceNameOrganizer.getDmiPropertiesPerCmHandleIdPerServiceName(yangModelCmHandles);
+ final Map<String, Map<String, Map<String, String>>> additionalPropertiesPerCmHandleIdPerDmiServiceName =
+ DmiServiceNameOrganizer.getAdditionalPropertiesPerCmHandleIdPerDmiServiceName(yangModelCmHandles);
final Map<String, String> dmiServiceNamesPerCmHandleId =
- getDmiServiceNamesPerCmHandleId(dmiPropertiesPerCmHandleIdPerServiceName);
+ getDmiServiceNamesPerCmHandleId(additionalPropertiesPerCmHandleIdPerDmiServiceName);
final Map<String, String> moduleSetTagPerCmHandle = getModuleSetTagPerCmHandleId(yangModelCmHandles);
} else {
final String cmHandleId = getCmHandleId(cmHandleReference, yangModelCmHandles);
final String dmiServiceName = dmiServiceNamesPerCmHandleId.get(cmHandleId);
- final Map<String, String> cmHandleIdProperties
- = dmiPropertiesPerCmHandleIdPerServiceName.get(dmiServiceName).get(cmHandleId);
- if (cmHandleIdProperties == null) {
+ final Map<String, String> additionalProperties
+ = additionalPropertiesPerCmHandleIdPerDmiServiceName.get(dmiServiceName).get(cmHandleId);
+ if (additionalProperties == null) {
nonExistingCmHandleReferences.add(cmHandleReference);
} else {
final DmiDataOperation dmiBatchOperationOut = getOrAddDmiBatchOperation(dmiServiceName,
dataOperationDefinitionIn, dmiDataOperationsOutPerDmiServiceName);
final DmiOperationCmHandle dmiOperationCmHandle = DmiOperationCmHandle
- .buildDmiOperationCmHandle(cmHandleId, cmHandleIdProperties,
+ .buildDmiOperationCmHandle(cmHandleId, additionalProperties,
moduleSetTagPerCmHandle.get(cmHandleId));
dmiBatchOperationOut.getCmHandles().add(dmiOperationCmHandle);
}
}
private static Map<String, String> getDmiServiceNamesPerCmHandleId(
- final Map<String, Map<String, Map<String, String>>> dmiDmiPropertiesPerCmHandleIdPerServiceName) {
+ final Map<String, Map<String, Map<String, String>>> additionalPropertiesPerCmHandleIdPerDmiServiceName) {
final Map<String, String> dmiServiceNamesPerCmHandleId = new HashMap<>();
- for (final Map.Entry<String, Map<String, Map<String, String>>> dmiDmiPropertiesEntry
- : dmiDmiPropertiesPerCmHandleIdPerServiceName.entrySet()) {
- final String dmiServiceName = dmiDmiPropertiesEntry.getKey();
- final Set<String> cmHandleIds = dmiDmiPropertiesPerCmHandleIdPerServiceName.get(dmiServiceName).keySet();
+ for (final Map.Entry<String, Map<String, Map<String, String>>>
+ additionalPropertiesPerCmHandleIdPerDmiServiceNameEntry
+ : additionalPropertiesPerCmHandleIdPerDmiServiceName.entrySet()) {
+ final String dmiServiceName = additionalPropertiesPerCmHandleIdPerDmiServiceNameEntry.getKey();
+ final Set<String> cmHandleIds
+ = additionalPropertiesPerCmHandleIdPerDmiServiceName.get(dmiServiceName).keySet();
for (final String cmHandleId : cmHandleIds) {
dmiServiceNamesPerCmHandleId.put(cmHandleId, dmiServiceName);
}
}
- dmiDmiPropertiesPerCmHandleIdPerServiceName.put(UNKNOWN_SERVICE_NAME, Collections.emptyMap());
+ additionalPropertiesPerCmHandleIdPerDmiServiceName.put(UNKNOWN_SERVICE_NAME, Collections.emptyMap());
return dmiServiceNamesPerCmHandleId;
}
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2024 Nordix Foundation.
+ * Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* @param yangModelCmHandles list of cm handle model
*/
- public static Map<String, Map<String, Map<String, String>>> getDmiPropertiesPerCmHandleIdPerServiceName(
+ public static Map<String, Map<String, Map<String, String>>> getAdditionalPropertiesPerCmHandleIdPerDmiServiceName(
final Collection<YangModelCmHandle> yangModelCmHandles) {
- final Map<String, Map<String, Map<String, String>>> dmiPropertiesPerCmHandleIdPerServiceName
+ final Map<String, Map<String, Map<String, String>>> additionalPropertiesPerCmHandleIdPerServiceName
= new HashMap<>();
yangModelCmHandles.forEach(yangModelCmHandle -> {
final String dmiServiceName = yangModelCmHandle.resolveDmiServiceName(RequiredDmiService.DATA);
- if (!dmiPropertiesPerCmHandleIdPerServiceName.containsKey(dmiServiceName)) {
- final Map<String, Map<String, String>> cmHandleDmiPropertiesMap = new HashMap<>();
- cmHandleDmiPropertiesMap.put(yangModelCmHandle.getId(),
- dmiPropertiesAsMap(yangModelCmHandle.getDmiProperties()));
- dmiPropertiesPerCmHandleIdPerServiceName.put(dmiServiceName, cmHandleDmiPropertiesMap);
+ if (!additionalPropertiesPerCmHandleIdPerServiceName.containsKey(dmiServiceName)) {
+ final Map<String, Map<String, String>> cmHandleAdditionalPropertiesMap = new HashMap<>();
+ cmHandleAdditionalPropertiesMap.put(yangModelCmHandle.getId(),
+ additionalPropertiesAsMap(yangModelCmHandle.getAdditionalProperties()));
+ additionalPropertiesPerCmHandleIdPerServiceName.put(dmiServiceName, cmHandleAdditionalPropertiesMap);
} else {
- dmiPropertiesPerCmHandleIdPerServiceName.get(dmiServiceName)
- .put(yangModelCmHandle.getId(), dmiPropertiesAsMap(yangModelCmHandle.getDmiProperties()));
+ additionalPropertiesPerCmHandleIdPerServiceName.get(dmiServiceName)
+ .put(yangModelCmHandle.getId(),
+ additionalPropertiesAsMap(yangModelCmHandle.getAdditionalProperties()));
}
});
- return dmiPropertiesPerCmHandleIdPerServiceName;
+ return additionalPropertiesPerCmHandleIdPerServiceName;
}
- private static Map<String, String> dmiPropertiesAsMap(final List<YangModelCmHandle.Property> dmiProperties) {
- return dmiProperties.stream().collect(
+ private static Map<String, String> additionalPropertiesAsMap(
+ final List<YangModelCmHandle.Property> additionalProperties) {
+ return additionalProperties.stream().collect(
Collectors.toMap(YangModelCmHandle.Property::getName, YangModelCmHandle.Property::getValue));
}
}
private final CpsValidator cpsValidator;
@Override
- public Collection<String> queryCmHandleAdditionalProperties(final Map<String, String> privatePropertyQueryPairs,
+ public Collection<String> queryCmHandleAdditionalProperties(final Map<String, String> additionalPropertyQueryPairs,
final boolean outputAlternateId) {
- return queryCmHandleAnyProperties(privatePropertyQueryPairs, PropertyType.ADDITIONAL, outputAlternateId);
+ return queryCmHandleAnyProperties(additionalPropertyQueryPairs, PropertyType.ADDITIONAL, outputAlternateId);
}
@Override
import static org.onap.cps.ncmp.api.NcmpResponseStatus.CM_HANDLES_NOT_FOUND;
import static org.onap.cps.ncmp.api.NcmpResponseStatus.CM_HANDLE_ALREADY_EXIST;
import static org.onap.cps.ncmp.api.NcmpResponseStatus.CM_HANDLE_INVALID_ID;
-import static org.onap.cps.ncmp.impl.inventory.CmHandleRegistrationServicePropertyHandler.PropertyType.DMI_PROPERTY;
+import static org.onap.cps.ncmp.impl.inventory.CmHandleRegistrationServicePropertyHandler.PropertyType.ADDITIONAL_PROPERTY;
import static org.onap.cps.ncmp.impl.inventory.CmHandleRegistrationServicePropertyHandler.PropertyType.PUBLIC_PROPERTY;
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DATASPACE_NAME;
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR;
updateProperties(existingCmHandleDataNode, PUBLIC_PROPERTY,
updatedNcmpServiceCmHandle.getPublicProperties());
}
- if (!updatedNcmpServiceCmHandle.getDmiProperties().isEmpty()) {
- updateProperties(existingCmHandleDataNode, DMI_PROPERTY, updatedNcmpServiceCmHandle.getDmiProperties());
+ if (!updatedNcmpServiceCmHandle.getAdditionalProperties().isEmpty()) {
+ updateProperties(existingCmHandleDataNode, ADDITIONAL_PROPERTY,
+ updatedNcmpServiceCmHandle.getAdditionalProperties());
}
}
}
enum PropertyType {
- DMI_PROPERTY("additional-properties"), PUBLIC_PROPERTY("public-properties");
+ ADDITIONAL_PROPERTY("additional-properties"), PUBLIC_PROPERTY("public-properties");
private static final String LIST_INDEX_PATTERN = "\\[@(\\w+)[^\\/]'([^']+)']";
return executeQueries(cmHandleQueryServiceParameters, outputAlternateId,
this::executeCpsPathQuery,
this::queryCmHandlesByPublicProperties,
- this::queryCmHandlesByPrivateProperties,
+ this::queryCmHandlesByAdditionalProperties,
this::queryCmHandlesByDmiPlugin);
}
}
- private Collection<String> queryCmHandlesByPrivateProperties(
+ private Collection<String> queryCmHandlesByAdditionalProperties(
final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) {
- final Map<String, String> privatePropertyQueryPairs =
+ final Map<String, String> additionalPropertyQueryPairs =
getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
InventoryQueryConditions.HAS_ALL_ADDITIONAL_PROPERTIES.getName());
- if (privatePropertyQueryPairs.isEmpty()) {
+ if (additionalPropertyQueryPairs.isEmpty()) {
return NO_QUERY_TO_EXECUTE;
}
- return cmHandleQueryService.queryCmHandleAdditionalProperties(privatePropertyQueryPairs, outputAlternateId);
+ return cmHandleQueryService.queryCmHandleAdditionalProperties(additionalPropertyQueryPairs, outputAlternateId);
}
private Collection<String> queryCmHandlesByPublicProperties(
private String dataProducerIdentifier;
@JsonProperty("additional-properties")
- private List<Property> dmiProperties;
+ private List<Property> additionalProperties;
@JsonProperty("public-properties")
private List<Property> publicProperties;
copy.dmiModelServiceName = original.getDmiModelServiceName();
copy.compositeState =
original.getCompositeState() == null ? null : new CompositeState(original.getCompositeState());
- copy.dmiProperties = original.getDmiProperties() == null ? null : new ArrayList<>(original.getDmiProperties());
+ copy.additionalProperties = original.getAdditionalProperties()
+ == null ? null : new ArrayList<>(original.getAdditionalProperties());
copy.publicProperties =
original.getPublicProperties() == null ? null : new ArrayList<>(original.getPublicProperties());
copy.moduleSetTag = original.getModuleSetTag();
yangModelCmHandle.setModuleSetTag(StringUtils.trimToEmpty(moduleSetTag));
yangModelCmHandle.setAlternateId(StringUtils.trimToEmpty(alternateId));
yangModelCmHandle.setDataProducerIdentifier(StringUtils.trimToEmpty(dataProducerIdentifier));
- yangModelCmHandle.setDmiProperties(asYangModelCmHandleProperties(ncmpServiceCmHandle.getDmiProperties()));
+ yangModelCmHandle.setAdditionalProperties(
+ asYangModelCmHandleProperties(ncmpServiceCmHandle.getAdditionalProperties()));
yangModelCmHandle.setPublicProperties(asYangModelCmHandleProperties(ncmpServiceCmHandle.getPublicProperties()));
yangModelCmHandle.setCompositeState(ncmpServiceCmHandle.getCompositeState());
return yangModelCmHandle;
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2022 Bell Canada
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
public List<ModuleReference> getModuleReferences(final YangModelCmHandle yangModelCmHandle,
final String targetModuleSetTag) {
final DmiRequestBody dmiRequestBody = DmiRequestBody.builder().moduleSetTag(targetModuleSetTag).build();
- dmiRequestBody.asDmiProperties(yangModelCmHandle.getDmiProperties());
+ dmiRequestBody.asAdditionalProperties(yangModelCmHandle.getAdditionalProperties());
final ResponseEntity<Object> dmiFetchModulesResponseEntity = getResourceFromDmiWithJsonData(
yangModelCmHandle.resolveDmiServiceName(MODEL),
jsonObjectMapper.asJsonString(dmiRequestBody), yangModelCmHandle.getId(), "modules");
if (newModuleReferences.isEmpty()) {
return Collections.emptyMap();
}
- final String jsonWithDataAndDmiProperties = getRequestBodyToFetchYangResources(newModuleReferences,
- yangModelCmHandle.getDmiProperties(), targetModuleSetTag);
+ final String jsonWithDataAndAdditionalProperties = getRequestBodyToFetchYangResources(newModuleReferences,
+ yangModelCmHandle.getAdditionalProperties(), targetModuleSetTag);
final ResponseEntity<Object> responseEntity = getResourceFromDmiWithJsonData(
yangModelCmHandle.resolveDmiServiceName(MODEL),
- jsonWithDataAndDmiProperties,
+ jsonWithDataAndAdditionalProperties,
yangModelCmHandle.getId(),
"moduleResources");
return asModuleNameToYangResourceMap(responseEntity);
}
private static String getRequestBodyToFetchYangResources(final Collection<ModuleReference> newModuleReferences,
- final List<YangModelCmHandle.Property> dmiProperties,
+ final List<YangModelCmHandle.Property>
+ additionalProperties,
final String targetModuleSetTag) {
final JsonArray moduleReferencesAsJson = getModuleReferencesAsJson(newModuleReferences);
final JsonObject data = new JsonObject();
jsonRequestObject.addProperty("moduleSetTag", targetModuleSetTag);
}
jsonRequestObject.add("data", data);
- jsonRequestObject.add("cmHandleProperties", toJsonObject(dmiProperties));
+ jsonRequestObject.add("cmHandleProperties", toJsonObject(additionalProperties));
return jsonRequestObject.toString();
}
}
private static JsonObject toJsonObject(final List<YangModelCmHandle.Property>
- dmiProperties) {
+ additionalProperties) {
final JsonObject asJsonObject = new JsonObject();
- for (final YangModelCmHandle.Property additionalProperty : dmiProperties) {
+ for (final YangModelCmHandle.Property additionalProperty : additionalProperties) {
asJsonObject.addProperty(additionalProperty.getName(), additionalProperty.getValue());
}
return asJsonObject;
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
private String dataType;
private String data;
@JsonProperty("cmHandleProperties")
- private Map<String, String> dmiProperties;
+ private Map<String, String> additionalProperties;
private String requestId;
private String moduleSetTag;
/**
- * Set DMI Properties by converting a list of YangModelCmHandle.Property objects.
+ * Set additional Properties by converting a list of YangModelCmHandle.Property objects.
*
- * @param yangModelCmHandleProperties list of cm handle dmi properties
+ * @param yangModelCmHandleProperties list of cm handle additional properties
*/
- public void asDmiProperties(
+ public void asAdditionalProperties(
final List<YangModelCmHandle.Property> yangModelCmHandleProperties) {
- dmiProperties = new LinkedHashMap<>();
- for (final YangModelCmHandle.Property dmiProperty : yangModelCmHandleProperties) {
- dmiProperties.put(dmiProperty.getName(), dmiProperty.getValue());
+ additionalProperties = new LinkedHashMap<>();
+ for (final YangModelCmHandle.Property additionalProperty : yangModelCmHandleProperties) {
+ additionalProperties.put(additionalProperty.getName(), additionalProperty.getValue());
}
}
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2024 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
public static NcmpServiceCmHandle toNcmpServiceCmHandle(final YangModelCmHandle yangModelCmHandle) {
final NcmpServiceCmHandle ncmpServiceCmHandle = new NcmpServiceCmHandle();
- final List<YangModelCmHandle.Property> dmiProperties = yangModelCmHandle.getDmiProperties();
+ final List<YangModelCmHandle.Property> additionalProperties = yangModelCmHandle.getAdditionalProperties();
final List<YangModelCmHandle.Property> publicProperties = yangModelCmHandle.getPublicProperties();
ncmpServiceCmHandle.setCmHandleId(yangModelCmHandle.getId());
ncmpServiceCmHandle.setDmiServiceName(yangModelCmHandle.getDmiServiceName());
ncmpServiceCmHandle.setModuleSetTag(yangModelCmHandle.getModuleSetTag());
ncmpServiceCmHandle.setAlternateId(yangModelCmHandle.getAlternateId());
ncmpServiceCmHandle.setDataProducerIdentifier(yangModelCmHandle.getDataProducerIdentifier());
- setDmiProperties(dmiProperties, ncmpServiceCmHandle);
+ setAdditionalProperties(additionalProperties, ncmpServiceCmHandle);
setPublicProperties(publicProperties, ncmpServiceCmHandle);
return ncmpServiceCmHandle;
}
private static void populateCmHandleDetails(final DataNode cmHandleDataNode,
final NcmpServiceCmHandle ncmpServiceCmHandle) {
- final Map<String, String> dmiProperties = new LinkedHashMap<>();
+ final Map<String, String> additionalProperties = new LinkedHashMap<>();
final Map<String, String> publicProperties = new LinkedHashMap<>();
final CompositeStateBuilder compositeStateBuilder = new CompositeStateBuilder();
CompositeState compositeState = compositeStateBuilder.build();
for (final DataNode childDataNode: cmHandleDataNode.getChildDataNodes()) {
if (childDataNode.getXpath().contains("/additional-properties[@name=")) {
- addProperty(childDataNode, dmiProperties);
+ addProperty(childDataNode, additionalProperties);
} else if (childDataNode.getXpath().contains("/public-properties[@name=")) {
addProperty(childDataNode, publicProperties);
} else if (childDataNode.getXpath().endsWith("/state")) {
compositeState = compositeStateBuilder.fromDataNode(childDataNode).build();
}
}
- ncmpServiceCmHandle.setDmiProperties(dmiProperties);
+ ncmpServiceCmHandle.setAdditionalProperties(additionalProperties);
ncmpServiceCmHandle.setPublicProperties(publicProperties);
ncmpServiceCmHandle.setCompositeState(compositeState);
}
String.valueOf(propertyDataNode.getLeaves().get("value")));
}
- private static void setDmiProperties(final List<YangModelCmHandle.Property> dmiProperties,
+ private static void setAdditionalProperties(final List<YangModelCmHandle.Property> additionalProperties,
final NcmpServiceCmHandle ncmpServiceCmHandle) {
- ncmpServiceCmHandle.setDmiProperties(toPropertiesMap(dmiProperties));
+ ncmpServiceCmHandle.setAdditionalProperties(toPropertiesMap(additionalProperties));
}
private static void setPublicProperties(final List<YangModelCmHandle.Property> publicProperties,
def objectUnderTest = new DmiInEventMapper(mockInventoryPersistence)
def setup() {
- def yangModelCmHandles = [new YangModelCmHandle(id: 'ch-1', dmiProperties: [new YangModelCmHandle.Property('k1', 'v1')], publicProperties: []),
- new YangModelCmHandle(id: 'ch-2', dmiProperties: [new YangModelCmHandle.Property('k2', 'v2')], publicProperties: [])]
+ def yangModelCmHandles = [new YangModelCmHandle(id: 'ch-1', additionalProperties: [new YangModelCmHandle.Property('k1', 'v1')], publicProperties: []),
+ new YangModelCmHandle(id: 'ch-2', additionalProperties: [new YangModelCmHandle.Property('k2', 'v2')], publicProperties: [])]
mockInventoryPersistence.getYangModelCmHandles(['ch-1', 'ch-2'] as Set) >> yangModelCmHandles
}
def 'call get resource data for #expectedDataStore from DMI without topic #scenario.'() {
given: 'a cm handle for #cmHandleId'
alternateIdMatcher.getCmHandleId(cmHandleId) >> cmHandleId
- mockYangModelCmHandleRetrieval(dmiProperties)
+ mockYangModelCmHandleRetrieval(additionalProperties)
and: 'a positive response from DMI service when it is called with the expected parameters'
def responseFromDmi = Mono.just(new ResponseEntity<Object>('{some-key:some-value}', HttpStatus.OK))
def expectedUrlTemplateWithVariables = getExpectedUrlTemplateWithVariables(expectedOptions, expectedDataStore)
assert result.body == '{some-key:some-value}'
assert result.statusCode.'2xxSuccessful'
where: 'the following parameters are used'
- scenario | dmiProperties || expectedDataStore | expectedOptions | expectedProperties
+ scenario | additionalProperties || expectedDataStore | expectedOptions | expectedProperties
'without properties' | [] || PASSTHROUGH_OPERATIONAL | OPTIONS_PARAM | '{}'
'with properties' | [yangModelCmHandleProperty] || PASSTHROUGH_OPERATIONAL | OPTIONS_PARAM | '{"prop1":"val1"}'
'null options' | [yangModelCmHandleProperty] || PASSTHROUGH_OPERATIONAL | null | '{"prop1":"val1"}'
}
static def getYangModelCmHandles() {
- def dmiProperties = [new YangModelCmHandle.Property('prop', 'some DMI property')]
+ def additionalProperties = [new YangModelCmHandle.Property('prop', 'some additional property')]
def readyState = new CompositeStateBuilder().withCmHandleState(READY).withLastUpdatedTimeNow().build()
def advisedState = new CompositeStateBuilder().withCmHandleState(ADVISED).withLastUpdatedTimeNow().build()
- return [new YangModelCmHandle(id: 'ch1-dmi1', 'alternateId': 'alt1-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch2-dmi1', 'alternateId': 'alt2-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch6-dmi1', 'alternateId': 'alt6-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch8-dmi1', 'alternateId': 'alt8-dmi1', dmiServiceName: 'dmi1', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch3-dmi2', 'alternateId': 'alt3-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch4-dmi2', 'alternateId': 'alt4-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'ch7-dmi2', 'alternateId': 'alt7-dmi2', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: readyState),
- new YangModelCmHandle(id: 'non-ready-cm-handle', 'alternateId': 'non-ready-alternate', dmiServiceName: 'dmi2', dmiProperties: dmiProperties, compositeState: advisedState)
+ return [new YangModelCmHandle(id: 'ch1-dmi1', 'alternateId': 'alt1-dmi1', dmiServiceName: 'dmi1', additionalProperties: additionalProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch2-dmi1', 'alternateId': 'alt2-dmi1', dmiServiceName: 'dmi1', additionalProperties: additionalProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch6-dmi1', 'alternateId': 'alt6-dmi1', dmiServiceName: 'dmi1', additionalProperties: additionalProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch8-dmi1', 'alternateId': 'alt8-dmi1', dmiServiceName: 'dmi1', additionalProperties: additionalProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch3-dmi2', 'alternateId': 'alt3-dmi2', dmiServiceName: 'dmi2', additionalProperties: additionalProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch4-dmi2', 'alternateId': 'alt4-dmi2', dmiServiceName: 'dmi2', additionalProperties: additionalProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'ch7-dmi2', 'alternateId': 'alt7-dmi2', dmiServiceName: 'dmi2', additionalProperties: additionalProperties, compositeState: readyState),
+ new YangModelCmHandle(id: 'non-ready-cm-handle', 'alternateId': 'non-ready-alternate', dmiServiceName: 'dmi2', additionalProperties: additionalProperties, compositeState: advisedState)
]
}
static def getYangModelCmHandlesForOneCmHandle() {
- def dmiProperties = [new YangModelCmHandle.Property('prop', 'some DMI property')]
+ def additionalProperties = [new YangModelCmHandle.Property('prop', 'some additional property')]
def readyState = new CompositeStateBuilder().withCmHandleState(READY).withLastUpdatedTimeNow().build()
- return [new YangModelCmHandle(id: 'ch1-dmi1', dmiServiceName: 'dmi1', moduleSetTag: 'module-set-tag1', dmiProperties: dmiProperties, compositeState: readyState)]
+ return [new YangModelCmHandle(id: 'ch1-dmi1', dmiServiceName: 'dmi1', moduleSetTag: 'module-set-tag1', additionalProperties: additionalProperties, compositeState: readyState)]
}
def mockAndPopulateErrorMap(errorReportedToClientTopic) {
def objectUnderTest = new WriteRequestExaminer(mockAlternateIdMatcher, mockInventoryPersistence)
def setup() {
- def yangModelCmHandle1 = new YangModelCmHandle(id: 'ch1', dmiServiceName: 'dmiA', dmiProperties: [],
+ def yangModelCmHandle1 = new YangModelCmHandle(id: 'ch1', dmiServiceName: 'dmiA', additionalProperties: [],
publicProperties: [], compositeState: null, moduleSetTag: '', alternateId: 'fdn1', dataProducerIdentifier: 'p1')
- def yangModelCmHandle2 = new YangModelCmHandle(id: 'ch2', dmiServiceName: 'dmiA', dmiProperties: [],
+ def yangModelCmHandle2 = new YangModelCmHandle(id: 'ch2', dmiServiceName: 'dmiA', additionalProperties: [],
publicProperties: [], compositeState: null, moduleSetTag: '', alternateId: 'fdn2', dataProducerIdentifier: 'p1')
- def yangModelCmHandle3 = new YangModelCmHandle(id: 'ch3', dmiServiceName: 'dmiA', dmiProperties: [],
+ def yangModelCmHandle3 = new YangModelCmHandle(id: 'ch3', dmiServiceName: 'dmiA', additionalProperties: [],
publicProperties: [], compositeState: null, moduleSetTag: '', alternateId: 'fdn3', dataProducerIdentifier: 'p2')
- def yangModelCmHandle4 = new YangModelCmHandle(id: 'ch4', dmiServiceName: 'dmiB', dmiProperties: [],
+ def yangModelCmHandle4 = new YangModelCmHandle(id: 'ch4', dmiServiceName: 'dmiB', additionalProperties: [],
publicProperties: [], compositeState: null, moduleSetTag: '', alternateId: 'fdn4', dataProducerIdentifier: 'p1')
mockAlternateIdMatcher.getCmHandleIdsByLongestMatchingAlternateIds(_, '/') > ['ch1','ch2','ch3','ch4']
def static alternateId = 'alt-id-' + cmHandleId
def static resourceIdentifier = 'parent/child'
- def mockYangModelCmHandleRetrieval(dmiProperties) {
- populateYangModelCmHandle(dmiProperties, '')
+ def mockYangModelCmHandleRetrieval(additionalProperties) {
+ populateYangModelCmHandle(additionalProperties, '')
mockInventoryPersistence.getYangModelCmHandle(cmHandleId) >> yangModelCmHandle
}
- def mockYangModelCmHandleRetrieval(dmiProperties, moduleSetTag) {
- populateYangModelCmHandle(dmiProperties, moduleSetTag)
+ def mockYangModelCmHandleRetrieval(additionalProperties, moduleSetTag) {
+ populateYangModelCmHandle(additionalProperties, moduleSetTag)
mockInventoryPersistence.getYangModelCmHandle(cmHandleId) >> yangModelCmHandle
}
- def mockYangModelCmHandleRetrievalByCmHandleId(dmiProperties) {
- populateYangModelCmHandle(dmiProperties, '')
+ def mockYangModelCmHandleRetrievalByCmHandleId(additionalProperties) {
+ populateYangModelCmHandle(additionalProperties, '')
mockInventoryPersistence.getYangModelCmHandles(_) >> [yangModelCmHandle]
}
- def populateYangModelCmHandle(dmiProperties, moduleSetTag) {
+ def populateYangModelCmHandle(additionalProperties, moduleSetTag) {
yangModelCmHandle.dmiDataServiceName = dmiServiceName
yangModelCmHandle.dmiServiceName = dmiServiceName
- yangModelCmHandle.dmiProperties = dmiProperties
+ yangModelCmHandle.additionalProperties = additionalProperties
yangModelCmHandle.id = cmHandleId
yangModelCmHandle.alternateId = alternateId
yangModelCmHandle.compositeState = new CompositeState()
'property ignored(value is null)' | ['pub-prop': null] || [['publicProp3': 'publicValue3'], ['publicProp4': 'publicValue4']]
}
- def 'Update DMI Properties: #scenario'() {
+ def 'Update Additional Properties: #scenario'() {
given: 'the CPS service return a CM handle'
mockInventoryPersistence.getCmHandleDataNodeByCmHandleId(cmHandleId, INCLUDE_ALL_DESCENDANTS) >> cmHandleDataNodeAsCollection
- and: 'an update cm handle request with DMI properties updates'
- def cmHandleUpdateRequest = [new NcmpServiceCmHandle(cmHandleId: cmHandleId, dmiProperties: updatedDmiProperties)]
+ and: 'an update cm handle request with additional properties updates'
+ def cmHandleUpdateRequest = [new NcmpServiceCmHandle(cmHandleId: cmHandleId, additionalProperties: updatedAdditionalProperties)]
when: 'update data node leaves is called with the update request'
objectUnderTest.updateCmHandleProperties(cmHandleUpdateRequest)
then: 'replace list method should is called with correct params'
assert args[1].leaves.containsAll(convertToProperties(expectedPropertiesAfterUpdate))
}
}
- where: 'following DMI properties updates are made'
- scenario | updatedDmiProperties || expectedPropertiesAfterUpdate | expectedCallsToReplaceMethod
+ where: 'following additional properties updates are made'
+ scenario | updatedAdditionalProperties || expectedPropertiesAfterUpdate | expectedCallsToReplaceMethod
'property added' | ['newAdditionalProp1': 'add-value'] || [['additionalProp1': 'additionalValue1'], ['additionalProp2': 'additionalValue2'], ['newAdditionalProp1': 'add-value']] | 1
'property updated' | ['additionalProp1': 'newValue'] || [['additionalProp2': 'additionalValue2'], ['additionalProp1': 'newValue']] | 1
'property removed' | ['additionalProp1': null] || [['additionalProp2': 'additionalValue2']] | 1
'no property changes' | [:] || [['additionalProp1': 'additionalValue1'], ['additionalProp2': 'additionalValue2']] | 0
}
- def 'Update CM Handle Properties, remove all properties: #scenario'() {
+ def 'Update CM Handle Properties, remove all public properties: #scenario'() {
given: 'the CPS service return a CM handle'
def cmHandleDataNode = new DataNode(xpath: cmHandleXpath, leaves: ['id': cmHandleId], childDataNodes: originalPropertyDataNodes)
mockInventoryPersistence.getCmHandleDataNodeByCmHandleId(cmHandleId, INCLUDE_ALL_DESCENDANTS) >> [cmHandleDataNode]
def '#scenario error leads to #exception when we try to update cmHandle'() {
given: 'cm handles request'
- def cmHandleUpdateRequest = [new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: [:], dmiProperties: [:])]
+ def cmHandleUpdateRequest = [new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: [:], additionalProperties: [:])]
and: 'data node cannot be found'
mockInventoryPersistence.getCmHandleDataNodeByCmHandleId(*_) >> { throw exception }
when: 'update data node leaves is called using correct parameters'
def 'Multiple update operations in a single request'() {
given: 'cm handles request'
- def cmHandleUpdateRequest = [new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: ['publicProp1': "value"], dmiProperties: [:]),
- new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: ['publicProp1': "value"], dmiProperties: [:]),
- new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: ['publicProp1': "value"], dmiProperties: [:])]
+ def cmHandleUpdateRequest = [new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: ['publicProp1': "value"], additionalProperties: [:]),
+ new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: ['publicProp1': "value"], additionalProperties: [:]),
+ new NcmpServiceCmHandle(cmHandleId: cmHandleId, publicProperties: ['publicProp1': "value"], additionalProperties: [:])]
and: 'data node can be found for 1st and 3rd cm-handle but not for 2nd cm-handle'
mockInventoryPersistence.getCmHandleDataNodeByCmHandleId(*_) >> cmHandleDataNodeAsCollection >> {
throw new DataNodeNotFoundException(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR) } >> cmHandleDataNodeAsCollection
def 'DMI Registration: Create, Update, Delete & Upgrade operations are processed in the right order'() {
given: 'a registration with operations of all types'
def dmiRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server')
- dmiRegistration.setCreatedCmHandles([new NcmpServiceCmHandle(cmHandleId: 'cmhandle-1', publicProperties: ['publicProp1': 'value'], dmiProperties: [:])])
- dmiRegistration.setUpdatedCmHandles([new NcmpServiceCmHandle(cmHandleId: 'cmhandle-2', publicProperties: ['publicProp1': 'value'], dmiProperties: [:])])
+ dmiRegistration.setCreatedCmHandles([new NcmpServiceCmHandle(cmHandleId: 'cmhandle-1', publicProperties: ['publicProp1': 'value'], additionalProperties: [:])])
+ dmiRegistration.setUpdatedCmHandles([new NcmpServiceCmHandle(cmHandleId: 'cmhandle-2', publicProperties: ['publicProp1': 'value'], additionalProperties: [:])])
dmiRegistration.setRemovedCmHandles(['cmhandle-3'])
dmiRegistration.setUpgradedCmHandles(new UpgradedCmHandles(cmHandles: ['cmhandle-4', 'cmhandle-5'], moduleSetTag: moduleSetTagForUpgrade))
and: 'cm handles 2,3 and 4 already exist in the inventory'
def 'Create CM-Handle Successfully: #scenario.'() {
given: 'a registration without cm-handle properties'
def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server')
- dmiPluginRegistration.createdCmHandles = [new NcmpServiceCmHandle(cmHandleId: 'cmhandle', dmiProperties: dmiProperties, publicProperties: publicProperties)]
+ dmiPluginRegistration.createdCmHandles = [new NcmpServiceCmHandle(cmHandleId: 'cmhandle', additionalProperties: additionalProperties, publicProperties: publicProperties)]
when: 'registration is updated'
def response = objectUnderTest.updateDmiRegistration(dmiPluginRegistration)
then: 'a successful response is received'
}
}
where:
- scenario | dmiProperties | publicProperties || expectedDmiProperties | expectedPublicProperties
- 'with dmi & public properties' | ['dmi-key': 'dmi-value'] | ['public-key': 'public-value'] || '[{"name":"dmi-key","value":"dmi-value"}]' | '[{"name":"public-key","value":"public-value"}]'
- 'with only public properties' | [:] | ['public-key': 'public-value'] || [:] | '[{"name":"public-key","value":"public-value"}]'
- 'with only dmi properties' | ['dmi-key': 'dmi-value'] | [:] || '[{"name":"dmi-key","value":"dmi-value"}]' | [:]
- 'without dmi & public properties' | [:] | [:] || [:] | [:]
+ scenario | additionalProperties | publicProperties || expectedAdditionalProperties | expectedPublicProperties
+ 'with additional & public properties' | ['dmi-key': 'dmi-value'] | ['public-key': 'public-value'] || '[{"name":"dmi-key","value":"dmi-value"}]' | '[{"name":"public-key","value":"public-value"}]'
+ 'with only public properties' | [:] | ['public-key': 'public-value'] || [:] | '[{"name":"public-key","value":"public-value"}]'
+ 'with only dmi properties' | ['dmi-key': 'dmi-value'] | [:] || '[{"name":"dmi-key","value":"dmi-value"}]' | [:]
+ 'without additional & public properties' | [:] | [:] || [:] | [:]
}
def 'Add CM-Handle #scenario.'() {
new DataNode(xpath: "/dmi-registry/cm-handles[@id='some cm handle']/public-properties[@name='myPublicProperty']", leaves: ["name":"myPublicProperty","value":"myPublicValue"])]
@Shared
- def childDataNodesForCmHandleWithDMIProperties = [new DataNode(xpath: "/dmi-registry/cm-handles[@id='some-cm-handle']/additional-properties[@name='myAdditionalProperty']", leaves: ["name":"myAdditionalProperty", "value":"myAdditionalValue"])]
+ def childDataNodesForCmHandleWithAdditionalProperties = [new DataNode(xpath: "/dmi-registry/cm-handles[@id='some-cm-handle']/additional-properties[@name='myAdditionalProperty']", leaves: ["name":"myAdditionalProperty", "value":"myAdditionalValue"])]
@Shared
def childDataNodesForCmHandleWithPublicProperties = [new DataNode(xpath: "/dmi-registry/cm-handles[@id='some-cm-handle']/public-properties[@name='myPublicProperty']", leaves: ["name":"myPublicProperty","value":"myPublicValue"])]
result.dmiDataServiceName == 'data service name'
result.dmiModelServiceName == 'model service name'
and: 'the expected additional properties'
- result.dmiProperties.name == expectedAdditionalProperties
+ result.additionalProperties.name == expectedAdditionalProperties
and: 'the expected public properties'
result.publicProperties.name == expectedPublicProperties
and: 'the state details are returned'
and: 'the CM Handle ID is validated'
1 * mockCpsValidator.validateNameCharacters(cmHandleId)
where: 'the following parameters are used'
- scenario | childDataNodes || expectedAdditionalProperties || expectedPublicProperties || expectedCompositeState
- 'no properties' | [] || [] || [] || null
- 'DMI and public properties' | childDataNodesForCmHandleWithAllProperties || ["myAdditionalProperty"] || ["myPublicProperty"] || null
- 'just DMI properties' | childDataNodesForCmHandleWithDMIProperties || ["myAdditionalProperty"] || [] || null
- 'just public properties' | childDataNodesForCmHandleWithPublicProperties || [] || ["myPublicProperty"] || null
- 'with state details' | childDataNodesForCmHandleWithState || [] || [] || CmHandleState.ADVISED
+ scenario | childDataNodes || expectedAdditionalProperties || expectedPublicProperties || expectedCompositeState
+ 'no properties' | [] || [] || [] || null
+ 'additional and public properties' | childDataNodesForCmHandleWithAllProperties || ["myAdditionalProperty"] || ["myPublicProperty"] || null
+ 'just additional properties' | childDataNodesForCmHandleWithAdditionalProperties || ["myAdditionalProperty"] || [] || null
+ 'just public properties' | childDataNodesForCmHandleWithPublicProperties || [] || ["myPublicProperty"] || null
+ 'with state details' | childDataNodesForCmHandleWithState || [] || [] || CmHandleState.ADVISED
}
def 'Handling missing service names as null.'() {
def 'Save Cmhandle'() {
given: 'cmHandle represented as Yang Model'
- def yangModelCmHandle = new YangModelCmHandle(id: 'cmhandle', dmiProperties: [], publicProperties: [])
+ def yangModelCmHandle = new YangModelCmHandle(id: 'cmhandle', additionalProperties: [], publicProperties: [])
when: 'the method to save cmhandle is called'
objectUnderTest.saveCmHandle(yangModelCmHandle)
then: 'the data service method to save list elements is called once'
lastUpdateTime: 'some-timestamp',
dataSyncEnabled: false,
dataStores: dataStores())
- def dmiProperties = [new YangModelCmHandle.Property('Book', 'Romance Novel')]
+ def additionalProperties = [new YangModelCmHandle.Property('Book', 'Romance Novel')]
def publicProperties = [new YangModelCmHandle.Property('Public Book', 'Public Romance Novel')]
def moduleSetTag = 'some-module-set-tag'
def alternateId = 'some-alternate-id'
- def yangModelCmHandle = new YangModelCmHandle(id: 'some-cm-handle', dmiServiceName: dmiServiceName, dmiProperties: dmiProperties,
+ def yangModelCmHandle = new YangModelCmHandle(id: 'some-cm-handle', dmiServiceName: dmiServiceName, additionalProperties: additionalProperties,
publicProperties: publicProperties, compositeState: compositeState, moduleSetTag: moduleSetTag, alternateId: alternateId)
1 * mockAlternateIdMatcher.getCmHandleId(cmHandleRef) >> 'some-cm-handle'
1 * mockInventoryPersistence.getYangModelCmHandle('some-cm-handle') >> yangModelCmHandle
assert result.alternateId == 'some-alternate-id'
and: 'the cm handle contains the module-set-tag'
assert result.moduleSetTag == 'some-module-set-tag'
- and: 'the cm handle contains the DMI Properties'
- assert result.dmiProperties ==[ Book:'Romance Novel' ]
+ and: 'the cm handle contains the additional Properties'
+ assert result.additionalProperties ==[Book:'Romance Novel' ]
and: 'the cm handle contains the public Properties'
assert result.publicProperties == [ "Public Book":'Public Romance Novel' ]
and: 'the cm handle contains the cm handle composite state'
def 'Get cm handle public properties using #scenario'() {
given: 'a yang modelled cm handle'
- def dmiProperties = [new YangModelCmHandle.Property('prop', 'some DMI property')]
+ def additionalProperties = [new YangModelCmHandle.Property('prop', 'some additional property')]
def publicProperties = [new YangModelCmHandle.Property('public prop', 'some public prop')]
def cmHandleId = 'some-cm-handle'
def alternateId = 'some-alternate-id'
- def yangModelCmHandle = new YangModelCmHandle(id:cmHandleId, alternateId: alternateId, dmiServiceName: 'some service name', dmiProperties: dmiProperties, publicProperties: publicProperties)
+ def yangModelCmHandle = new YangModelCmHandle(id:cmHandleId, alternateId: alternateId, dmiServiceName: 'some service name', additionalProperties: additionalProperties, publicProperties: publicProperties)
and: 'we have corresponding cm handle for the cm handle reference'
1 * mockAlternateIdMatcher.getCmHandleId(cmHandleRef) >> cmHandleId
and: 'the system returns this yang modelled cm handle'
lastUpdateTime: 'some-timestamp',
dataSyncEnabled: false,
dataStores: dataStores())
- def dmiProperties = [new YangModelCmHandle.Property('prop', 'some DMI property')]
+ def additionalProperties = [new YangModelCmHandle.Property('prop', 'some DMI property')]
def publicProperties = [new YangModelCmHandle.Property('public prop', 'some public prop')]
def cmHandleId = 'some-cm-handle'
def alternateId = 'some-alternate-id'
- def yangModelCmHandle = new YangModelCmHandle(id:cmHandleId, alternateId: alternateId, dmiServiceName: 'some service name', dmiProperties: dmiProperties, publicProperties: publicProperties, compositeState: compositeState)
+ def yangModelCmHandle = new YangModelCmHandle(id:cmHandleId, alternateId: alternateId, dmiServiceName: 'some service name', additionalProperties: additionalProperties, publicProperties: publicProperties, compositeState: compositeState)
and: 'we have corresponding cm handle for the cm handle reference'
1 * mockAlternateIdMatcher.getCmHandleId(cmHandleRef) >> cmHandleId
and: 'the system returns this yang modelled cm handle'
1 * mockInventoryPersistence.getCmHandleReferencesWithGivenModules(['some-module-name'], false) >> ['ch1']
and: 'the inventory service is called with teh correct if and returns a yang model cm handle'
1 * mockInventoryPersistence.getYangModelCmHandles(['ch1']) >>
- [new YangModelCmHandle(id: 'abc', dmiProperties: [new YangModelCmHandle.Property('name','value')], publicProperties: [])]
+ [new YangModelCmHandle(id: 'abc', additionalProperties: [new YangModelCmHandle.Property('name','value')], publicProperties: [])]
and: 'the expected cm handle(s) are returned as NCMP Service cm handles'
assert result[0] instanceof NcmpServiceCmHandle
assert result.size() == 1
- assert result[0].dmiProperties == [name:'value']
+ assert result[0].additionalProperties == [name:'value']
}
def 'Query cm handle references when the query is empty.'() {
and: 'the inventory persistence returns the cm handle ids of all cm handles'
cmHandleQueries.getAllCmHandleReferences(false) >> getCmHandleReferencesForDmiRegistry(false)
and: 'the inventory persistence returns the cm handle details when requested'
- mockInventoryPersistence.getYangModelCmHandles(_) >> dmiRegistry.childDataNodes.collect { new YangModelCmHandle(id: it.leaves.get("id").toString(), dmiProperties: [], publicProperties: []) }
+ mockInventoryPersistence.getYangModelCmHandles(_) >> dmiRegistry.childDataNodes.collect { new YangModelCmHandle(id: it.leaves.get("id").toString(), additionalProperties: [], publicProperties: []) }
when: 'the query is executed for both cm handle details'
def result = objectUnderTest.queryCmHandles(cmHandleQueryParameters).collectList().block()
then: 'the correct cm handles are returned'
cmHandleQueryParameters.setCmHandleQueryParameters([conditionProperties])
and: 'the inventoryPersistence returns different CmHandleIds'
partiallyMockedCmHandleQueries.queryPublicCmHandleProperties(*_) >> cmHandlesWithMatchingPublicProperties
- partiallyMockedCmHandleQueries.queryCmHandleAdditionalProperties(*_) >> cmHandlesWithMatchingPrivateProperties
+ partiallyMockedCmHandleQueries.queryCmHandleAdditionalProperties(*_) >> cmHandlesWithMatchingAdditionalProperties
when: 'the query executed'
def result = objectUnderTestWithPartiallyMockedQueries.queryCmHandleIdsForInventory(cmHandleQueryParameters, false)
then: 'the expected number of results are returned.'
assert result.size() == expectedCmHandleIdsSize
where: 'the following data is used'
- scenario | conditionName | cmHandlesWithMatchingPublicProperties | cmHandlesWithMatchingPrivateProperties || expectedCmHandleIdsSize
- 'all properties, only public matching' | 'hasAllProperties' | ['h1', 'h2'] | null || 2
- 'all properties, no matching cm handles' | 'hasAllProperties' | [] | [] || 0
- 'additional properties, some matching cm handles' | 'hasAllAdditionalProperties' | [] | ['h1', 'h2'] || 2
- 'additional properties, no matching cm handles' | 'hasAllAdditionalProperties' | null | [] || 0
+ scenario | conditionName | cmHandlesWithMatchingPublicProperties | cmHandlesWithMatchingAdditionalProperties || expectedCmHandleIdsSize
+ 'all properties, only public matching' | 'hasAllProperties' | ['h1', 'h2'] | null || 2
+ 'all properties, no matching cm handles' | 'hasAllProperties' | [] | [] || 0
+ 'additional properties, some matching cm handles' | 'hasAllAdditionalProperties' | [] | ['h1', 'h2'] || 2
+ 'additional properties, no matching cm handles' | 'hasAllAdditionalProperties' | null | [] || 0
}
def 'Retrieve alternate ids by different DMI properties.' () {
mockInventoryPersistence.getYangModelCmHandles([expectedCmHandleId]) >> [
new YangModelCmHandle(
id: expectedCmHandleId,
- dmiProperties: [new YangModelCmHandle.Property('name', 'value')],
+ additionalProperties: [new YangModelCmHandle.Property('name', 'value')],
publicProperties: []
)
]
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2024 Nordix Foundation
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
given: 'a cm handle with properties'
def ncmpServiceCmHandle = new NcmpServiceCmHandle()
ncmpServiceCmHandle.cmHandleId = 'cm-handle-id01'
- ncmpServiceCmHandle.dmiProperties = [myDmiProperty:'value1']
+ ncmpServiceCmHandle.additionalProperties = [myAdditionalProperty:'value1']
ncmpServiceCmHandle.publicProperties = [myPublicProperty:'value2']
and: 'with a composite state'
def compositeState = new CompositeStateBuilder()
when: 'it is converted to a yang model cm handle'
def objectUnderTest = YangModelCmHandle.toYangModelCmHandle('', '', '', ncmpServiceCmHandle,'my-module-set-tag', 'my-alternate-id', 'my-data-producer-identifier')
then: 'the result has the right size'
- assert objectUnderTest.dmiProperties.size() == 1
+ assert objectUnderTest.additionalProperties.size() == 1
and: 'the result has the correct values for module set tag, alternate ID, and data producer identifier'
assert objectUnderTest.moduleSetTag == 'my-module-set-tag'
assert objectUnderTest.alternateId == 'my-alternate-id'
assert objectUnderTest.dataProducerIdentifier == 'my-data-producer-identifier'
- and: 'the DMI property in the result has the correct name and value'
- assert objectUnderTest.dmiProperties[0].name == 'myDmiProperty'
- assert objectUnderTest.dmiProperties[0].value == 'value1'
+ and: 'the additional property in the result has the correct name and value'
+ assert objectUnderTest.additionalProperties[0].name == 'myAdditionalProperty'
+ assert objectUnderTest.additionalProperties[0].value == 'value1'
and: 'the public property in the result has the correct name and value'
assert objectUnderTest.publicProperties[0].name == 'myPublicProperty'
assert objectUnderTest.publicProperties[0].value == 'value2'
given: 'a yang model cm handle'
def currentYangModelCmHandle = new YangModelCmHandle(id: 'cmhandle',
publicProperties: [new YangModelCmHandle.Property('publicProperty1', 'value1')],
- dmiProperties: [new YangModelCmHandle.Property('dmiProperty1', 'value1')],
+ additionalProperties: [new YangModelCmHandle.Property('additionalProperty1', 'value1')],
compositeState: new CompositeState(cmHandleState: CmHandleState.ADVISED, dataSyncEnabled: false))
when: 'a deep copy is created'
def yangModelCmhandleDeepCopy = YangModelCmHandle.deepCopyOf(currentYangModelCmHandle)
and: 'we try to mutate current yang model cm handle'
currentYangModelCmHandle.id = 'cmhandle-changed'
- currentYangModelCmHandle.dmiProperties = [new YangModelCmHandle.Property('updatedPublicProperty1', 'value1')]
- currentYangModelCmHandle.publicProperties = [new YangModelCmHandle.Property('updatedDmiProperty1', 'value1')]
+ currentYangModelCmHandle.additionalProperties = [new YangModelCmHandle.Property('updatedAdditionalProperty1', 'value1')]
+ currentYangModelCmHandle.publicProperties = [new YangModelCmHandle.Property('updatedPublicProperty1', 'value1')]
currentYangModelCmHandle.compositeState.cmHandleState = CmHandleState.READY
currentYangModelCmHandle.compositeState.dataSyncEnabled = true
then: 'there is no change in the deep copied object'
assert yangModelCmhandleDeepCopy.id == 'cmhandle'
- assert yangModelCmhandleDeepCopy.dmiProperties == [new YangModelCmHandle.Property('dmiProperty1', 'value1')]
+ assert yangModelCmhandleDeepCopy.additionalProperties == [new YangModelCmHandle.Property('additionalProperty1', 'value1')]
assert yangModelCmhandleDeepCopy.publicProperties == [new YangModelCmHandle.Property('publicProperty1', 'value1')]
assert yangModelCmhandleDeepCopy.compositeState.cmHandleState == CmHandleState.ADVISED
assert yangModelCmhandleDeepCopy.compositeState.dataSyncEnabled == false
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2025 Nordix Foundation
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
* Modifications Copyright (C) 2022 Bell Canada
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
'no body' | null
}
- def 'Retrieving module references, DMI property handling: #scenario.'() {
+ def 'Retrieving module references, additional property handling: #scenario.'() {
given: 'a cm handle'
- mockYangModelCmHandleRetrieval(dmiProperties)
+ mockYangModelCmHandleRetrieval(additionalProperties)
and: 'a positive response from DMI service when it is called with tha expected parameters'
def responseFromDmi = new ResponseEntity<String>(HttpStatus.OK)
mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedModulesUrlTemplateWithVariables,
def result = objectUnderTest.getModuleReferences(yangModelCmHandle, NO_MODULE_SET_TAG)
then: 'the result is the response from DMI service'
assert result == []
- where: 'the following DMI properties are used'
- scenario | dmiProperties || expectedAdditionalPropertiesInRequest
+ where: 'the following additional properties are used'
+ scenario | additionalProperties || expectedAdditionalPropertiesInRequest
'with properties' | [yangModelCmHandleProperty] || '{"prop1":"val1"}'
'without properties' | [] || '{}'
}
'null array' | null
}
- def 'Retrieving yang resources, DMI property handling #scenario.'() {
+ def 'Retrieving yang resources, additional property handling #scenario.'() {
given: 'a cm handle'
- mockYangModelCmHandleRetrieval(dmiProperties)
+ mockYangModelCmHandleRetrieval(additionalProperties)
and: 'a positive response from DMI service when it is called with the expected moduleSetTag, modules and properties'
def responseFromDmi = new ResponseEntity<>([[moduleName: 'mod1', revision: 'A', yangSource: 'some yang source']], HttpStatus.OK)
mockDmiRestClient.synchronousPostOperationWithJsonData(MODEL, expectedModuleResourcesUrlTemplateWithVariables,
def result = objectUnderTest.getNewYangResourcesFromDmi(yangModelCmHandle, NO_MODULE_SET_TAG, newModuleReferences)
then: 'the result is the response from DMI service'
assert result == [mod1:'some yang source']
- where: 'the following DMI properties are used'
- scenario | dmiProperties || expectedAdditionalPropertiesInRequest
+ where: 'the following additional properties are used'
+ scenario | additionalProperties || expectedAdditionalPropertiesInRequest
'with module references and properties' | [yangModelCmHandleProperty] || '{"prop1":"val1"}'
'without properties' | [] || '{}'
}
def 'Update and Send Events on State Change #stateChange'() {
given: 'Cm Handle represented as YangModelCmHandle'
compositeState = new CompositeState(cmHandleState: fromCmHandleState)
- yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, dmiProperties: [], publicProperties: [], compositeState: compositeState)
+ yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, additionalProperties: [], publicProperties: [], compositeState: compositeState)
when: 'update state is invoked'
objectUnderTest.updateCmHandleStateBatch(Map.of(yangModelCmHandle, toCmHandleState))
then: 'state is saved using inventory persistence'
def 'Update and Send Events on State Change from non-existing to ADVISED'() {
given: 'Cm Handle represented as YangModelCmHandle'
- yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, dmiProperties: [], publicProperties: [])
+ yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, additionalProperties: [], publicProperties: [])
when: 'update state is invoked'
objectUnderTest.updateCmHandleStateBatch(Map.of(yangModelCmHandle, ADVISED))
then: 'CM-handle is saved using inventory persistence'
given: 'Cm Handle represented as YangModelCmHandle in LOCKED state'
compositeState = new CompositeState(cmHandleState: LOCKED,
lockReason: CompositeState.LockReason.builder().lockReasonCategory(MODULE_SYNC_FAILED).details('some lock details').build())
- yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, dmiProperties: [], publicProperties: [], compositeState: compositeState)
+ yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, additionalProperties: [], publicProperties: [], compositeState: compositeState)
when: 'update state is invoked'
objectUnderTest.updateCmHandleStateBatch(Map.of(yangModelCmHandle, ADVISED))
then: 'state is saved using inventory persistence and old lock reason details are retained'
def 'Update and Send Events on State Change to from ADVISED to READY'() {
given: 'Cm Handle represented as YangModelCmHandle'
compositeState = new CompositeState(cmHandleState: ADVISED)
- yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, dmiProperties: [], publicProperties: [], compositeState: compositeState)
+ yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, additionalProperties: [], publicProperties: [], compositeState: compositeState)
and: 'global sync flag is set'
compositeState.setDataSyncEnabled(false)
when: 'update cmhandle state is invoked'
def 'Update cmHandle state from READY to DELETING' (){
given: 'cm Handle as Yang model'
compositeState = new CompositeState(cmHandleState: READY)
- yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, dmiProperties: [], publicProperties: [], compositeState: compositeState)
+ yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, additionalProperties: [], publicProperties: [], compositeState: compositeState)
when: 'updating cm handle state to "DELETING"'
objectUnderTest.updateCmHandleStateBatch(Map.of(yangModelCmHandle, DELETING))
then: 'the cm handle state is as expected'
def 'Update cmHandle state to DELETING to DELETED' (){
given: 'cm Handle with state "DELETING" as Yang model '
compositeState = new CompositeState(cmHandleState: DELETING)
- yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, dmiProperties: [], publicProperties: [], compositeState: compositeState)
+ yangModelCmHandle = new YangModelCmHandle(id: cmHandleId, additionalProperties: [], publicProperties: [], compositeState: compositeState)
when: 'updating cm handle state to "DELETED"'
objectUnderTest.updateCmHandleStateBatch(Map.of(yangModelCmHandle, DELETED))
then: 'the cm handle state is as expected'
def setupBatch(type) {
- def yangModelCmHandle1 = new YangModelCmHandle(id: 'cmhandle1', dmiProperties: [], publicProperties: [])
- def yangModelCmHandle2 = new YangModelCmHandle(id: 'cmhandle2', dmiProperties: [], publicProperties: [])
+ def yangModelCmHandle1 = new YangModelCmHandle(id: 'cmhandle1', additionalProperties: [], publicProperties: [])
+ def yangModelCmHandle2 = new YangModelCmHandle(id: 'cmhandle2', additionalProperties: [], publicProperties: [])
switch (type) {
case 'NEW':
/*
* ============LICENSE_START========================================================
- * Copyright (C) 2022-2024 Nordix Foundation
+ * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
class YangDataConverterSpec extends Specification{
- def 'Convert a cm handle data node with private and public properties.'() {
- given: 'a datanode with some additional (dmi, private) and public properties'
+ def 'Convert a cm handle data node with additional and public properties.'() {
+ given: 'a datanode with some additional and public properties'
def dataNodeAdditionalProperties = new DataNode(xpath:'/additional-properties[@name="dmiProp1"]',
leaves: ['name': 'dmiProp1', 'value': 'dmiValue1'])
def dataNodePublicProperties = new DataNode(xpath:'/public-properties[@name="pubProp1"]',
assert yangModelCmHandle.dmiServiceName == 'my-dmi'
assert yangModelCmHandle.moduleSetTag == 'my-tag'
assert yangModelCmHandle.dataProducerIdentifier == 'my-dpi'
- and: 'the additional (dmi, private) properties are included'
- assert yangModelCmHandle.dmiProperties[0].name == 'dmiProp1'
- assert yangModelCmHandle.dmiProperties[0].value == 'dmiValue1'
+ and: 'the additional properties are included'
+ assert yangModelCmHandle.additionalProperties[0].name == 'dmiProp1'
+ assert yangModelCmHandle.additionalProperties[0].value == 'dmiValue1'
and: 'the public properties are included'
assert yangModelCmHandle.publicProperties[0].name == 'pubProp1'
assert yangModelCmHandle.publicProperties[0].value == 'pubValue1'