2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 highstreet technologies GmbH
4 * Modifications Copyright (C) 2021 Nordix Foundation
5 * Modifications Copyright (C) 2021 Pantheon.tech
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * SPDX-License-Identifier: Apache-2.0
20 * ============LICENSE_END=========================================================
23 package org.onap.cps.ncmp.api;
25 import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum;
27 import java.util.Collection;
28 import org.checkerframework.checker.nullness.qual.NonNull;
29 import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
30 import org.onap.cps.spi.FetchDescendantsOption;
31 import org.onap.cps.spi.model.DataNode;
32 import org.onap.cps.spi.model.ModuleReference;
35 * Datastore interface for handling CPS data.
37 public interface NetworkCmProxyDataService {
40 * Retrieves datanode by XPath for a given cm handle.
42 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
43 * object by managed Network CM Proxy
45 * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
46 * (recursively) as well
47 * @return data node object
49 DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
50 @NonNull FetchDescendantsOption fetchDescendantsOption);
53 * Get datanodes for the given cm handle by cps path.
55 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
56 * object by managed Network CM Proxy
57 * @param cpsPath cps path
58 * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
59 * included in the output
60 * @return a collection of datanodes
62 Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
63 @NonNull FetchDescendantsOption fetchDescendantsOption);
66 * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
68 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
69 * object managed by Network CM Proxy
70 * @param parentNodeXpath xpath to parent node or '/' for root level
71 * @param jsonData data as JSON string
73 void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
76 * Creates one or more child node elements with descendants under existing node from list-node data fragment.
78 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
79 * object managed by Network CM Proxy
80 * @param parentNodeXpath xpath to parent node
81 * @param jsonData data as JSON string
83 void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
86 * Updates data node for given cm handle using xpath to parent node.
88 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
89 * by managed Network CM Proxy
90 * @param parentNodeXpath xpath to parent node
91 * @param jsonData json data
93 void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
96 * Replaces existing data node content including descendants.
98 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
99 * by managed Network CM Proxy
100 * @param parentNodeXpath xpath to parent node
101 * @param jsonData json data
103 void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
106 * Registration of New CM Handles.
108 * @param dmiPluginRegistration Dmi Plugin Registration
110 void updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
113 * Get resource data for data store pass-through operational
116 * @param cmHandle cm handle
117 * @param resourceIdentifier resource identifier
118 * @param acceptParamInHeader accept param
119 * @param optionsParamInQuery options query
120 * @return {@code Object} resource data
122 Object getResourceDataOperationalForCmHandle(String cmHandle,
123 String resourceIdentifier,
124 String acceptParamInHeader,
125 String optionsParamInQuery);
128 * Get resource data for data store pass-through running
131 * @param cmHandle cm handle
132 * @param resourceIdentifier resource identifier
133 * @param acceptParamInHeader accept param
134 * @param optionsParamInQuery options query
135 * @return {@code Object} resource data
137 Object getResourceDataPassThroughRunningForCmHandle(String cmHandle,
138 String resourceIdentifier,
139 String acceptParamInHeader,
140 String optionsParamInQuery);
143 * Write resource data for data store pass-through running
144 * using dmi for given cm-handle.
145 * @param cmHandle cm handle
146 * @param resourceIdentifier resource identifier
147 * @param operation required operation
148 * @param requestBody request body to create resource
149 * @param contentType content type in body
151 void writeResourceDataPassThroughRunningForCmHandle(String cmHandle,
152 String resourceIdentifier,
153 OperationEnum operation,
158 * Retrieve module references for the given cm handle.
160 * @param cmHandle cm handle
161 * @return a collection of modules names and revisions
163 Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandle);
166 * Query cm handle identifiers for the given collection of module names.
168 * @param moduleNames module names.
169 * @return a collection of cm handle identifiers. The schema set for each cm handle must include all the
172 Collection<String> executeCmHandleHasAllModulesSearch(Collection<String> moduleNames);