+ private void createAnchor(final YangModelCmHandle yangModelCmHandle) {
+ cpsAdminService.createAnchor(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, yangModelCmHandle.getId(),
+ yangModelCmHandle.getId());
+ }
+
+ private static boolean hasTopicParameter(final String topicName) {
+ if (topicName == null) {
+ return false;
+ }
+ if (TOPIC_NAME_PATTERN.matcher(topicName).matches()) {
+ return true;
+ }
+ throw new InvalidTopicException("Topic name " + topicName + " is invalid", "invalid topic");
+ }
+
+ private Map<String, Object> buildDmiResponse(final String requestId) {
+ final Map<String, Object> dmiResponseMap = new HashMap<>();
+ dmiResponseMap.put("requestId", requestId);
+ return dmiResponseMap;
+ }
+
+ private Object validateTopicNameAndGetResourceData(final String cmHandleId,
+ final String resourceIdentifier,
+ final DmiOperations.DataStoreEnum dataStore,
+ final String optionsParamInQuery,
+ final String topicParamInQuery) {
+ final boolean processAsynchronously = hasTopicParameter(topicParamInQuery);
+ if (processAsynchronously) {
+ final String resourceDataRequestId = UUID.randomUUID().toString();
+ return ResponseEntity.status(HttpStatus.OK)
+ .body(buildDmiResponse(resourceDataRequestId));
+ }
+ final ResponseEntity<?> responseEntity = dmiDataOperations.getResourceDataFromDmi(
+ cmHandleId, resourceIdentifier, optionsParamInQuery, dataStore, NO_REQUEST_ID, NO_TOPIC);
+ return handleResponse(responseEntity, OperationEnum.READ);