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 java.util.Collection;
26 import javax.validation.constraints.NotNull;
27 import org.checkerframework.checker.nullness.qual.NonNull;
28 import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
29 import org.onap.cps.spi.FetchDescendantsOption;
30 import org.onap.cps.spi.model.DataNode;
31 import org.onap.cps.spi.model.ModuleReference;
34 * Datastore interface for handling CPS data.
36 public interface NetworkCmProxyDataService {
39 * Retrieves datanode by XPath for a given cm handle.
41 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
42 * object by managed Network CM Proxy
44 * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
45 * (recursively) as well
46 * @return data node object
48 DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
49 @NonNull FetchDescendantsOption fetchDescendantsOption);
52 * Get datanodes for the given cm handle by cps path.
54 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
55 * object by managed Network CM Proxy
56 * @param cpsPath cps path
57 * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
58 * included in the output
59 * @return a collection of datanodes
61 Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
62 @NonNull FetchDescendantsOption fetchDescendantsOption);
65 * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
67 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
68 * object managed by Network CM Proxy
69 * @param parentNodeXpath xpath to parent node or '/' for root level
70 * @param jsonData data as JSON string
72 void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
75 * Creates one or more child node elements with descendants under existing node from list-node data fragment.
77 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
78 * object managed by Network CM Proxy
79 * @param parentNodeXpath xpath to parent node
80 * @param jsonData data as JSON string
82 void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
85 * Updates data node for given cm handle using xpath to parent node.
87 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
88 * by managed Network CM Proxy
89 * @param parentNodeXpath xpath to parent node
90 * @param jsonData json data
92 void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
95 * Replaces existing data node content including descendants.
97 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
98 * by managed Network CM Proxy
99 * @param parentNodeXpath xpath to parent node
100 * @param jsonData json data
102 void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
105 * Registration of New CM Handles.
107 * @param dmiPluginRegistration Dmi Plugin Registration
109 void updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
112 * Get resource data for data store pass-through operational
115 * @param cmHandle cm handle
116 * @param resourceIdentifier resource identifier
117 * @param acceptParamInHeader accept param
118 * @param optionsParamInQuery options query
119 * @return {@code Object} resource data
121 Object getResourceDataOperationalForCmHandle(@NotNull String cmHandle,
122 @NotNull String resourceIdentifier,
123 String acceptParamInHeader,
124 String optionsParamInQuery);
127 * Get resource data for data store pass-through running
130 * @param cmHandle cm handle
131 * @param resourceIdentifier resource identifier
132 * @param acceptParamInHeader accept param
133 * @param optionsParamInQuery options query
134 * @return {@code Object} resource data
136 Object getResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle,
137 @NotNull String resourceIdentifier,
138 String acceptParamInHeader,
139 String optionsParamInQuery);
142 * Create resource data for data store pass-through running
143 * using dmi for given cm-handle.
145 * @param cmHandle cm handle
146 * @param resourceIdentifier resource identifier
147 * @param requestBody request body to create resource
148 * @param contentType content type in body
150 void createResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle,
151 @NotNull String resourceIdentifier,
152 @NotNull String requestBody,
156 * Retrieve module references for the given cm handle.
158 * @param cmHandle cm handle
159 * @return a collection of modules names and revisions
161 Collection<ModuleReference> getYangResourcesModuleReferences(@NotNull String cmHandle);
164 * Query cm handle identifiers for the given collection of module names.
166 * @param moduleNames module names.
167 * @return a collection of cm handle identifiers. The schema set for each cm handle must include all the
170 Collection<String> executeCmHandleHasAllModulesSearch(Collection<String> moduleNames);
173 * Update resource data for data store pass-through running using dmi for the given cm-handle.
175 * @param cmHandle cm handle
176 * @param resourceIdentifier resource identifier
177 * @param requestBody request body to create resource
178 * @param contentType content type in body
180 void updateResourceDataPassThroughRunningForCmHandle(String cmHandle, String resourceIdentifier,
181 String requestBody, String contentType);