dataProducerIdentifier:
type: string
example: "my-data-producer-identifier"
+ cmHandleStatus:
+ type: string
+ example: "READY"
#Module upgrade schema
UpgradedCmHandles:
required:
dataProducerIdentifier:
type: string
example: my-data-producer-identifier
+ cmHandleStatus:
+ type: string
+ example: "READY"
CmHandleCompositeState:
type: object
properties:
restOutputCmHandle.setModuleSetTag(ncmpServiceCmHandle.getModuleSetTag());
restOutputCmHandle.setAlternateId(ncmpServiceCmHandle.getAlternateId());
restOutputCmHandle.setDataProducerIdentifier(ncmpServiceCmHandle.getDataProducerIdentifier());
+ restOutputCmHandle.setCmHandleStatus(ncmpServiceCmHandle.getCmHandleStatus());
return restOutputCmHandle;
}
}
assert result.publicCmHandleProperties[0].containsKey('public property key')
assert result.alternateId == 'alt-1'
assert result.cmHandle == 'ch-1'
+ assert result.cmHandleStatus == 'REPORTED STATE'
where:
scenario | includeAdditionalProperties || trustLevel
'without additional properties' | false || null
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'))
+ alternateId: 'alt-1', compositeState: new CompositeState(cmHandleState: 'ADVISED'), cmHandleStatus: 'REPORTED STATE')
}
}
@JsonSetter(nulls = Nulls.AS_EMPTY)
private String dataProducerIdentifier;
+
+ @JsonSetter(nulls = Nulls.AS_EMPTY)
+ private String cmHandleStatus;
+
}
ncmpServiceCmHandle,
ncmpServiceCmHandle.getModuleSetTag(),
ncmpServiceCmHandle.getAlternateId(),
- ncmpServiceCmHandle.getDataProducerIdentifier());
+ ncmpServiceCmHandle.getDataProducerIdentifier(),
+ ncmpServiceCmHandle.getCmHandleStatus());
}
void removeAlternateIdsFromCache(final Collection<YangModelCmHandle> yangModelCmHandles) {
@JsonProperty("public-properties")
private List<Property> publicProperties;
+ @JsonProperty("cm-handle-state")
+ private String cmHandleStatus;
+
/**
* Creates a deep copy of Yang Model Cm Handle.
*
copy.moduleSetTag = original.getModuleSetTag();
copy.alternateId = original.getAlternateId();
copy.dataProducerIdentifier = original.getDataProducerIdentifier();
+ copy.cmHandleStatus = original.getCmHandleStatus();
return copy;
}
* @param moduleSetTag moduleSetTag
* @param alternateId alternateId
* @param dataProducerIdentifier dataProducerIdentifier
+ * @param cmHandleStatus cm handle status
* @return instance of yangModelCmHandle
*/
public static YangModelCmHandle toYangModelCmHandle(final String dmiServiceName,
final NcmpServiceCmHandle ncmpServiceCmHandle,
final String moduleSetTag,
final String alternateId,
- final String dataProducerIdentifier) {
+ final String dataProducerIdentifier,
+ final String cmHandleStatus) {
final YangModelCmHandle yangModelCmHandle = new YangModelCmHandle();
yangModelCmHandle.setId(ncmpServiceCmHandle.getCmHandleId());
yangModelCmHandle.setDmiServiceName(dmiServiceName);
asYangModelCmHandleProperties(ncmpServiceCmHandle.getAdditionalProperties()));
yangModelCmHandle.setPublicProperties(asYangModelCmHandleProperties(ncmpServiceCmHandle.getPublicProperties()));
yangModelCmHandle.setCompositeState(ncmpServiceCmHandle.getCompositeState());
+ yangModelCmHandle.setCmHandleStatus(cmHandleStatus);
return yangModelCmHandle;
}
ncmpServiceCmHandle.setModuleSetTag(yangModelCmHandle.getModuleSetTag());
ncmpServiceCmHandle.setAlternateId(yangModelCmHandle.getAlternateId());
ncmpServiceCmHandle.setDataProducerIdentifier(yangModelCmHandle.getDataProducerIdentifier());
+ ncmpServiceCmHandle.setCmHandleStatus(yangModelCmHandle.getCmHandleStatus());
setAdditionalProperties(additionalProperties, ncmpServiceCmHandle);
setPublicProperties(publicProperties, ncmpServiceCmHandle);
+
return ncmpServiceCmHandle;
}
ncmpServiceCmHandle.setCmHandleId(cmHandleId);
populateCmHandleDetails(cmHandleDataNode, ncmpServiceCmHandle);
return YangModelCmHandle.toYangModelCmHandle(
- (String) cmHandleDataNode.getLeaves().get("dmi-service-name"),
- (String) cmHandleDataNode.getLeaves().get("dmi-data-service-name"),
- (String) cmHandleDataNode.getLeaves().get("dmi-model-service-name"),
+ safeGetLeafValue(cmHandleDataNode, "dmi-service-name"),
+ safeGetLeafValue(cmHandleDataNode, "dmi-data-service-name"),
+ safeGetLeafValue(cmHandleDataNode, "dmi-model-service-name"),
ncmpServiceCmHandle,
- (String) cmHandleDataNode.getLeaves().get("module-set-tag"),
- (String) cmHandleDataNode.getLeaves().get("alternate-id"),
- (String) cmHandleDataNode.getLeaves().get("data-producer-identifier")
+ safeGetLeafValue(cmHandleDataNode, "module-set-tag"),
+ safeGetLeafValue(cmHandleDataNode, "alternate-id"),
+ safeGetLeafValue(cmHandleDataNode, "data-producer-identifier"),
+ safeGetLeafValue(cmHandleDataNode, "cm-handle-state")
);
}
final NcmpServiceCmHandle ncmpServiceCmHandle) {
ncmpServiceCmHandle.setPublicProperties(toPropertiesMap(publicProperties));
}
+
+
+ private static String safeGetLeafValue(final DataNode node, final String leafName) {
+ final Object value = node.getLeaves().get(leafName);
+ return value == null ? null : value.toString();
+
+ }
+
}
.withOperationalDataStores(DataStoreSyncState.SYNCHRONIZED, 'some-sync-time').build()
ncmpServiceCmHandle.setCompositeState(compositeState)
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')
+ def objectUnderTest = YangModelCmHandle.toYangModelCmHandle('', '', '', ncmpServiceCmHandle,'my-module-set-tag', 'my-alternate-id', 'my-data-producer-identifier', 'ADVISED')
then: 'the result has the right size'
assert objectUnderTest.additionalProperties.size() == 1
and: 'the result has the correct values for module set tag, alternate ID, and data producer identifier'
and: 'the composite state matches the composite state of the ncmpServiceCmHandle'
objectUnderTest.getCompositeState().cmHandleState == CmHandleState.LOCKED
objectUnderTest.getCompositeState() == ncmpServiceCmHandle.getCompositeState()
+ and: 'the cm-handle-state is correct'
+ assert objectUnderTest.cmHandleStatus == 'ADVISED'
}
def 'Resolve DMI service name: #scenario and #requiredService service require.'() {
given: 'a yang model cm handle'
def objectUnderTest = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, dmiDataServiceName,
- dmiModelServiceName, new NcmpServiceCmHandle(cmHandleId: 'cm-handle-id-1'),'', '', '')
+ dmiModelServiceName, new NcmpServiceCmHandle(cmHandleId: 'cm-handle-id-1'),'', '', '', '')
expect:
assert objectUnderTest.resolveDmiServiceName(requiredService) == expectedService
where:
ncmpServiceCmHandle.setCompositeState(new CompositeStateBuilder().withLockReason(MODULE_UPGRADE, '').build())
def dmiServiceName = 'some service name'
ncmpServiceCmHandle.cmHandleId = 'upgraded-ch'
- def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, '', '', ncmpServiceCmHandle,'', '', '')
+ def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, '', '', ncmpServiceCmHandle,'', '', '', '')
and: 'DMI operations returns some module references for upgraded cm handle'
def moduleReferences = [ new ModuleReference('module1','1') ]
mockDmiModelOperations.getModuleReferences(yangModelCmHandle, NO_MODULE_SET_TAG) >> moduleReferences
def ncmpServiceCmHandle = new NcmpServiceCmHandle()
ncmpServiceCmHandle.setCompositeState(new CompositeStateBuilder().withLockReason(MODULE_UPGRADE, 'Upgrade to ModuleSetTag: ' + tagTo).build())
ncmpServiceCmHandle.setCmHandleId('cmHandleId-1')
- def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle('some service name', '', '', ncmpServiceCmHandle, tagFrom, '', '')
+ def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle('some service name', '', '', ncmpServiceCmHandle, tagFrom, '', '', '')
mockCmHandleQueries.cmHandleHasState('cmHandleId-1', CmHandleState.READY) >> true
and: 'the module tag (schemaset) exists is #schemaExists'
mockCpsModuleService.schemaSetExists(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, tagTo) >> schemaExists
def ncmpServiceCmHandle = new NcmpServiceCmHandle()
ncmpServiceCmHandle.setCompositeState(new CompositeStateBuilder().withCmHandleState(CmHandleState.ADVISED).build())
ncmpServiceCmHandle.cmHandleId = 'ch-1'
- return YangModelCmHandle.toYangModelCmHandle('some service name', '', '', ncmpServiceCmHandle, moduleSetTag, '', '')
+ return YangModelCmHandle.toYangModelCmHandle('some service name', '', '', ncmpServiceCmHandle, moduleSetTag, '', '', '')
}
}
dataProducerIdentifier: my-data-producer-identifier
publicCmHandleProperties:
key: my-property
+ cmHandleStatus: READY
cmHandleProperties:
key: my-property
moduleSetTag: my-module-set-tag
dataProducerIdentifier: my-data-producer-identifier
publicCmHandleProperties:
key: my-property
+ cmHandleStatus: READY
cmHandleProperties:
key: my-property
moduleSetTag: my-module-set-tag
dataProducerIdentifier: my-data-producer-identifier
publicCmHandleProperties:
key: my-property
+ cmHandleStatus: READY
cmHandleProperties:
key: my-property
moduleSetTag: my-module-set-tag
dataProducerIdentifier: my-data-producer-identifier
publicCmHandleProperties:
key: my-property
+ cmHandleStatus: READY
cmHandleProperties:
key: my-property
moduleSetTag: my-module-set-tag
dataProducerIdentifier: my-data-producer-identifier
publicCmHandleProperties:
key: my-property
+ cmHandleStatus: READY
cmHandleProperties:
key: my-property
moduleSetTag: my-module-set-tag
dataProducerIdentifier:
example: my-data-producer-identifier
type: string
+ cmHandleStatus:
+ example: READY
+ type: string
required:
- cmHandle
type: object
publicCmHandleProperties:
- key: 3gpp Type
- key: 3gpp Type
+ cmHandleStatus: READY
cmHandleProperties:
key: 3gpp Type
state:
dataProducerIdentifier:
example: my-data-producer-identifier
type: string
+ cmHandleStatus:
+ example: READY
+ type: string
title: CM handle Details
type: object
CmHandleCompositeState:
publicCmHandleProperties:
- key: 3gpp Type
- key: 3gpp Type
+ cmHandleStatus: READY
cmHandleProperties:
key: 3gpp Type
state:
dataProducerIdentifier:
example: my-data-producer-identifier
type: string
+ cmHandleStatus:
+ example: READY
+ type: string
title: CM handle Details
type: object
CmHandleCompositeState: