X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2FNetworkCmProxyDataService.java;h=e7ffaa624f3c479f4cc3e976b79e0e76ca588fc9;hb=21171253eb47349832e1e1d4952a42051c19be05;hp=cb2f78206ca625afc6e673df7cc90b2d7a9bdb66;hpb=66b598a4243bb702059902af2903d1c3da01d5fa;p=cps.git diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java index cb2f78206..e7ffaa624 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java @@ -1,8 +1,9 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 highstreet technologies GmbH - * Modifications Copyright (C) 2021 Nordix Foundation + * Modifications Copyright (C) 2021-2023 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. @@ -23,11 +24,17 @@ package org.onap.cps.ncmp.api; import java.util.Collection; -import javax.validation.constraints.NotNull; -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; /* @@ -36,127 +43,150 @@ 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 + * @return {@code Object} resource data */ - Collection queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath, - @NonNull FetchDescendantsOption fetchDescendantsOption); + Object getResourceDataForCmHandle(String datastoreName, + String cmHandleId, + String resourceIdentifier, + String optionsParamInQuery, + String topicParamInQuery, + String requestId); /** - * 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) */ - void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData); + void executeDataOperationForCmHandles(String topicParamInQuery, + DataOperationRequest dataOperationRequest, + String requestId); + /** - * 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 + * @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); /** - * 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 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 getModuleDefinitionsByCmHandleId(String cmHandleId); /** - * Get resource data for data store pass-through operational - * 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 getResourceDataOperationalForCmHandle(@NotNull String cmHandle, - @NotNull String resourceIdentifier, - String acceptParamInHeader, - String optionsParamInQuery); + NcmpServiceCmHandle getNcmpServiceCmHandle(String cmHandleId); /** - * Get resource data for data store pass-through running - * using dmi. + * Get cm handle public properties by cm handle id. * - * @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 public properties. */ - Object getResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle, - @NotNull String resourceIdentifier, - String acceptParamInHeader, - String optionsParamInQuery); + Map getCmHandlePublicProperties(String cmHandleId); /** - * Create resource data for data store pass-through running - * using dmi for given cm-handle. + * Get cm handle composite state by cm handle id. * - * @param cmHandle cm handle - * @param resourceIdentifier resource identifier - * @param requestBody request body to create resource - * @param contentType content type in body + * @param cmHandleId cm handle identifier + * @return a cm handle composite state */ - void createResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle, - @NotNull String resourceIdentifier, - @NotNull String requestBody, - String contentType); + CompositeState getCmHandleCompositeState(String cmHandleId); /** - * Retrieve module references for the given cm handle. + * Query and return cm handles that match the given query parameters. * - * @param cmHandle cm handle - * @return a collection of modules names and revisions + * @param cmHandleQueryApiParameters the cm handle query parameters + * @return collection of cm handles + */ + Collection 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 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 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 getYangResourcesModuleReferences(@NotNull String cmHandle); + Collection executeCmHandleIdSearchForInventory(CmHandleQueryServiceParameters + cmHandleQueryServiceParameters); }