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;
33 * Datastore interface for handling CPS data.
35 public interface NetworkCmProxyDataService {
38 * Retrieves datanode by XPath for a given cm handle.
40 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
41 * object by managed Network CM Proxy
43 * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
44 * (recursively) as well
45 * @return data node object
47 DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
48 @NonNull FetchDescendantsOption fetchDescendantsOption);
51 * Get datanodes for the given cm handle by cps path.
53 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
54 * object by managed Network CM Proxy
55 * @param cpsPath cps path
56 * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
57 * included in the output
58 * @return a collection of datanodes
60 Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
61 @NonNull FetchDescendantsOption fetchDescendantsOption);
64 * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
66 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
67 * object managed by Network CM Proxy
68 * @param parentNodeXpath xpath to parent node or '/' for root level
69 * @param jsonData data as JSON string
71 void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
74 * Creates one or more child node elements with descendants under existing node from list-node data fragment.
76 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
77 * object managed by Network CM Proxy
78 * @param parentNodeXpath xpath to parent node
79 * @param jsonData data as JSON string
81 void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
84 * Updates data node for given cm handle using xpath to parent node.
86 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
87 * by managed Network CM Proxy
88 * @param parentNodeXpath xpath to parent node
89 * @param jsonData json data
91 void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
94 * Replaces existing data node content including descendants.
96 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
97 * by managed Network CM Proxy
98 * @param parentNodeXpath xpath to parent node
99 * @param jsonData json data
101 void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
104 * Registration of New CM Handles.
106 * @param dmiPluginRegistration Dmi Plugin Registration
108 void updateDmiPluginRegistration(DmiPluginRegistration dmiPluginRegistration);
111 * Get resource data for data store pass-through operational
114 * @param cmHandle cm handle
115 * @param resourceIdentifier resource identifier
116 * @param accept accept param
117 * @param fields fields query
118 * @param depth depth query
119 * @return {@code Object} resource data
121 Object getResourceDataOperationalForCmHandle(@NotNull String cmHandle,
122 @NotNull String resourceIdentifier,
128 * Get resource data for data store pass-through running
131 * @param cmHandle cm handle
132 * @param resourceIdentifier resource identifier
133 * @param acceptParam accept param
134 * @param fields fields query
135 * @param depth depth query
136 * @return {@code Object} resource data
138 Object getResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle,
139 @NotNull String resourceIdentifier,
145 * Create resource data for data store pass-through running
146 * using dmi for given cm-handle.
148 * @param cmHandle cm handle
149 * @param resourceIdentifier resource identifier
150 * @param requestBody request body to create resource
151 * @param contentType content type in body
153 void createResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle,
154 @NotNull String resourceIdentifier,
155 @NotNull Object requestBody,