/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 highstreet technologies GmbH
- * Modifications Copyright (C) 2021 Nordix Foundation
+ * Modifications Copyright (C) 2021-2024 Nordix Foundation
* Modifications Copyright (C) 2021 Pantheon.tech
+ * Modifications Copyright (C) 2022 Bell Canada
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.cps.ncmp.api;
-import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum;
-
import java.util.Collection;
-import org.checkerframework.checker.nullness.qual.NonNull;
+import java.util.Map;
+import org.onap.cps.ncmp.api.impl.inventory.CompositeState;
+import org.onap.cps.ncmp.api.impl.operations.OperationType;
+import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
+import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
+import org.onap.cps.ncmp.api.models.DmiPluginRegistrationResponse;
+import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.spi.model.ModuleDefinition;
import org.onap.cps.spi.model.ModuleReference;
/*
public interface NetworkCmProxyDataService {
/**
- * Retrieves datanode by XPath for a given cm handle.
+ * Registration of New CM Handles.
*
- * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
- * object by managed Network CM Proxy
- * @param xpath xpath
- * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
- * (recursively) as well
- * @return data node object
+ * @param dmiPluginRegistration Dmi Plugin Registration
+ * @return dmiPluginRegistrationResponse
*/
- DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
- @NonNull FetchDescendantsOption fetchDescendantsOption);
+ DmiPluginRegistrationResponse updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
/**
- * Get datanodes for the given cm handle by cps path.
+ * Get resource data for given data store using dmi.
*
- * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
- * object by managed Network CM Proxy
- * @param cpsPath cps path
- * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
- * included in the output
- * @return a collection of datanodes
+ * @param datastoreName datastore name
+ * @param cmHandleId cm handle identifier
+ * @param resourceIdentifier resource identifier
+ * @param optionsParamInQuery options query
+ * @param topicParamInQuery topic name for (triggering) async responses
+ * @param requestId unique requestId for async request
+ * @param authorization contents of Authorization header, or null if not present
+ * @return {@code Object} resource data
*/
- Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
- @NonNull FetchDescendantsOption fetchDescendantsOption);
+ Object getResourceDataForCmHandle(String datastoreName,
+ String cmHandleId,
+ String resourceIdentifier,
+ String optionsParamInQuery,
+ String topicParamInQuery,
+ String requestId,
+ String authorization);
/**
- * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
+ * Get resource data for operational.
*
- * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
- * object managed by Network CM Proxy
- * @param parentNodeXpath xpath to parent node or '/' for root level
- * @param jsonData data as JSON string
+ * @param datastoreName datastore name
+ * @param cmHandleId cm handle identifier
+ * @param resourceIdentifier resource identifier
+ * @Link FetchDescendantsOption fetch descendants option
+ * @return {@code Object} resource data
*/
- void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
+ Object getResourceDataForCmHandle(String datastoreName,
+ String cmHandleId,
+ String resourceIdentifier,
+ FetchDescendantsOption fetchDescendantsOption);
/**
- * Creates one or more child node elements with descendants under existing node from list-node data fragment.
+ * Execute (async) data operation for group of cm handles using dmi.
*
- * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
- * object managed by Network CM Proxy
- * @param parentNodeXpath xpath to parent node
- * @param jsonData data as JSON string
+ * @param topicParamInQuery topic name for (triggering) async responses
+ * @param dataOperationRequest contains a list of operation definitions(multiple operations)
+ * @param requestId request ID
+ * @param authorization contents of Authorization header, or null if not present
*/
- void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
+ void executeDataOperationForCmHandles(String topicParamInQuery,
+ DataOperationRequest dataOperationRequest,
+ String requestId,
+ String authorization);
+
/**
- * Updates data node for given cm handle using xpath to parent node.
+ * Write resource data for data store pass-through running using dmi for given cm-handle.
*
- * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
- * by managed Network CM Proxy
- * @param parentNodeXpath xpath to parent node
- * @param jsonData json data
+ * @param cmHandleId cm handle identifier
+ * @param resourceIdentifier resource identifier
+ * @param operationType required operation type
+ * @param requestBody request body to create resource
+ * @param contentType content type in body
+ * @param authorization contents of Authorization header, or null if not present
+ * @return {@code Object} return data
*/
- void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
+ Object writeResourceDataPassThroughRunningForCmHandle(String cmHandleId,
+ String resourceIdentifier,
+ OperationType operationType,
+ String requestBody,
+ String contentType,
+ String authorization);
/**
- * Replaces existing data node content including descendants.
+ * Retrieve module references for the given cm handle.
*
- * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
- * by managed Network CM Proxy
- * @param parentNodeXpath xpath to parent node
- * @param jsonData json data
+ * @param cmHandleId cm handle identifier
+ * @return a collection of modules names and revisions
*/
- void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
+ Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandleId);
/**
- * Registration of New CM Handles.
+ * Retrieve module definitions for the given cm handle.
*
- * @param dmiPluginRegistration Dmi Plugin Registration
+ * @param cmHandleId cm handle identifier
+ * @return a collection of module definition (moduleName, revision and yang resource content)
*/
- void updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
+ Collection<ModuleDefinition> getModuleDefinitionsByCmHandleId(String cmHandleId);
/**
- * Get resource data for data store pass-through operational
- * using dmi.
+ * Get module definitions for the given parameters.
*
- * @param cmHandle cm handle
- * @param resourceIdentifier resource identifier
- * @param acceptParamInHeader accept param
- * @param optionsParamInQuery options query
- * @return {@code Object} resource data
+ * @param cmHandleId cm-handle identifier
+ * @param moduleName module name
+ * @param moduleRevision the revision of the module
+ * @return list of module definitions (module name, revision, yang resource content)
*/
- Object getResourceDataOperationalForCmHandle(String cmHandle,
- String resourceIdentifier,
- String acceptParamInHeader,
- String optionsParamInQuery);
+ Collection<ModuleDefinition> getModuleDefinitionsByCmHandleAndModule(String cmHandleId,
+ String moduleName,
+ String moduleRevision);
/**
- * Get resource data for data store pass-through running
- * using dmi.
+ * Query cm handle details by cm handle's name.
*
- * @param cmHandle cm handle
- * @param resourceIdentifier resource identifier
- * @param acceptParamInHeader accept param
- * @param optionsParamInQuery options query
- * @return {@code Object} resource data
+ * @param cmHandleId cm handle identifier
+ * @return a collection of cm handle details.
*/
- Object getResourceDataPassThroughRunningForCmHandle(String cmHandle,
- String resourceIdentifier,
- String acceptParamInHeader,
- String optionsParamInQuery);
+ NcmpServiceCmHandle getNcmpServiceCmHandle(String cmHandleId);
/**
- * Write resource data for data store pass-through running
- * using dmi for given cm-handle.
- * @param cmHandle cm handle
- * @param resourceIdentifier resource identifier
- * @param operation required operation
- * @param requestBody request body to create resource
- * @param contentType content type in body
+ * Get cm handle public properties by cm handle id.
+ *
+ * @param cmHandleId cm handle identifier
+ * @return a collection of cm handle public properties.
*/
- void writeResourceDataPassThroughRunningForCmHandle(String cmHandle,
- String resourceIdentifier,
- OperationEnum operation,
- String requestBody,
- String contentType);
+ Map<String, String> getCmHandlePublicProperties(String cmHandleId);
/**
- * Retrieve module references for the given cm handle.
+ * Get cm handle composite state by cm handle id.
*
- * @param cmHandle cm handle
- * @return a collection of modules names and revisions
+ * @param cmHandleId cm handle identifier
+ * @return a cm handle composite state
*/
- Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandle);
+ CompositeState getCmHandleCompositeState(String cmHandleId);
/**
- * Query cm handle identifiers for the given collection of module names.
+ * Query and return cm handles that match the given query parameters.
*
- * @param moduleNames module names.
- * @return a collection of cm handle identifiers. The schema set for each cm handle must include all the
- * given module names
+ * @param cmHandleQueryApiParameters the cm handle query parameters
+ * @return collection of cm handles
*/
- Collection<String> executeCmHandleHasAllModulesSearch(Collection<String> moduleNames);
+ Collection<NcmpServiceCmHandle> executeCmHandleSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
+ /**
+ * Query and return cm handle ids that match the given query parameters.
+ *
+ * @param cmHandleQueryApiParameters the cm handle query parameters
+ * @return collection of cm handle ids
+ */
+ Collection<String> executeCmHandleIdSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
+
+ /**
+ * Set the data sync enabled flag, along with the data sync state to true or false based on the cm handle id.
+ *
+ * @param cmHandleId cm handle id
+ * @param dataSyncEnabled data sync enabled flag
+ */
+ void setDataSyncEnabled(String cmHandleId, Boolean dataSyncEnabled);
+
+ /**
+ * Get all cm handle IDs by DMI plugin identifier.
+ *
+ * @param dmiPluginIdentifier DMI plugin identifier
+ * @return collection of cm handle IDs
+ */
+ Collection<String> getAllCmHandleIdsByDmiPluginIdentifier(String dmiPluginIdentifier);
+
+ /**
+ * Get all cm handle IDs by various search criteria.
+ *
+ * @param cmHandleQueryServiceParameters cm handle query parameters
+ * @return collection of cm handle IDs
+ */
+ Collection<String> executeCmHandleIdSearchForInventory(CmHandleQueryServiceParameters
+ cmHandleQueryServiceParameters);
}