* @return module references
*/
public List<ModuleReference> getModuleReferences(final YangModelCmHandle yangModelCmHandle) {
- final DmiRequestBody dmiRequestBody = DmiRequestBody.builder().build();
+ final DmiRequestBody dmiRequestBody = DmiRequestBody.builder()
+ .moduleSetTag(yangModelCmHandle.getModuleSetTag()).build();
dmiRequestBody.asDmiProperties(yangModelCmHandle.getDmiProperties());
final ResponseEntity<Object> dmiFetchModulesResponseEntity = getResourceFromDmiWithJsonData(
yangModelCmHandle.resolveDmiServiceName(MODEL),
@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
@Builder
-@JsonPropertyOrder({"operation", "dataType", "data", "cmHandleProperties", "requestId"})
+@JsonPropertyOrder({"operation", "dataType", "data", "cmHandleProperties", "requestId", "moduleSetTag"})
public class DmiRequestBody {
@JsonProperty("operation")
@JsonProperty("cmHandleProperties")
private Map<String, String> dmiProperties;
private String requestId;
+ private String moduleSetTag;
/**
* Set DMI Properties by converting a list of YangModelCmHandle.Property objects.
def moduleReferencesAsLisOfMaps = [[moduleName: 'mod1', revision: 'A'], [moduleName: 'mod2', revision: 'X']]
def expectedUrl = "${dmiServiceName}/dmi/v1/ch/${cmHandleId}/modules"
def responseFromDmi = new ResponseEntity([schemas: moduleReferencesAsLisOfMaps], HttpStatus.OK)
- mockDmiRestClient.postOperationWithJsonData(expectedUrl, '{"cmHandleProperties":{}}', READ, NO_AUTH_HEADER)
+ mockDmiRestClient.postOperationWithJsonData(expectedUrl, '{"cmHandleProperties":{},"moduleSetTag":"tag1"}', READ, NO_AUTH_HEADER)
>> responseFromDmi
when: 'get module references is called'
def result = objectUnderTest.getModuleReferences(yangModelCmHandle)
and: 'a positive response from DMI service when it is called with tha expected parameters'
def responseFromDmi = new ResponseEntity<String>(HttpStatus.OK)
mockDmiRestClient.postOperationWithJsonData("${dmiServiceName}/dmi/v1/ch/${cmHandleId}/modules",
- '{"cmHandleProperties":' + expectedAdditionalPropertiesInRequest + '}', READ, NO_AUTH_HEADER) >> responseFromDmi
+ '{"cmHandleProperties":' + expectedAdditionalPropertiesInRequest + ',"moduleSetTag":"tag1"}', READ, NO_AUTH_HEADER) >> responseFromDmi
when: 'a get module references is called'
def result = objectUnderTest.getModuleReferences(yangModelCmHandle)
then: 'the result is the response from DMI service'
yangModelCmHandle.id = cmHandleId
yangModelCmHandle.compositeState = new CompositeState()
yangModelCmHandle.compositeState.cmHandleState = CmHandleState.READY
+ yangModelCmHandle.moduleSetTag = 'tag1'
}
}
public ResponseEntity<String> getModuleReferences(@PathVariable("cmHandleId") final String cmHandleId,
@RequestBody final Object moduleReferencesRequest) {
delay(moduleReferencesDelayMs);
+ try {
+ log.info("Incoming DMI request body: {}",
+ objectMapper.writeValueAsString(moduleReferencesRequest));
+ } catch (final JsonProcessingException jsonProcessingException) {
+ log.info("Unable to parse dmi data operation request to json string");
+ }
final String moduleResponseContent = getModuleResourceResponse(cmHandleId,
"ModuleResponse.json");
log.info("cm handle: {} requested for modules", cmHandleId);