2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 highstreet technologies GmbH
4 * 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
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.cps.ncmp.api;
24 import java.util.Collection;
25 import org.checkerframework.checker.nullness.qual.NonNull;
26 import org.onap.cps.spi.FetchDescendantsOption;
27 import org.onap.cps.spi.model.DataNode;
30 * Datastore interface for handling CPS data.
32 public interface NetworkCmProxyDataService {
35 * Retrieves datanode by XPath for a given cm handle.
37 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
38 * object by managed Network CM Proxy
40 * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
41 * (recursively) as well
42 * @return data node object
44 DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
45 @NonNull FetchDescendantsOption fetchDescendantsOption);
48 * Get datanodes for the given cm handle by cps path.
50 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
51 * object by managed Network CM Proxy
52 * @param cpsPath cps path
53 * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
54 * included in the output
55 * @return a collection of datanodes
57 Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
58 @NonNull FetchDescendantsOption fetchDescendantsOption);
61 * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
63 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
64 * object managed by Network CM Proxy
65 * @param parentNodeXpath xpath to parent node or '/' for root level
66 * @param jsonData data as JSON string
68 void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
71 * Updates data node for given cm handle using xpath to parent node.
73 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
74 * by managed Network CM Proxy
75 * @param parentNodeXpath xpath to parent node
76 * @param jsonData json data
78 void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
81 * Replaces existing data node content including descendants.
83 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
84 * by managed Network CM Proxy
85 * @param parentNodeXpath xpath to parent node
86 * @param jsonData json data
88 void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);