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 org.checkerframework.checker.nullness.qual.NonNull;
27 import org.onap.cps.spi.FetchDescendantsOption;
28 import org.onap.cps.spi.model.DataNode;
31 * Datastore interface for handling CPS data.
33 public interface NetworkCmProxyDataService {
36 * Retrieves datanode by XPath for a given cm handle.
38 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
39 * object by managed Network CM Proxy
41 * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
42 * (recursively) as well
43 * @return data node object
45 DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
46 @NonNull FetchDescendantsOption fetchDescendantsOption);
49 * Get datanodes for the given cm handle by cps path.
51 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
52 * object by managed Network CM Proxy
53 * @param cpsPath cps path
54 * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
55 * included in the output
56 * @return a collection of datanodes
58 Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
59 @NonNull FetchDescendantsOption fetchDescendantsOption);
62 * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
64 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
65 * object managed by Network CM Proxy
66 * @param parentNodeXpath xpath to parent node or '/' for root level
67 * @param jsonData data as JSON string
69 void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
72 * Creates one or more child node elements with descendants under existing node from list-node data fragment.
74 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
75 * object managed by Network CM Proxy
76 * @param parentNodeXpath xpath to parent node
77 * @param jsonData data as JSON string
79 void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
82 * Updates data node for given cm handle using xpath to parent node.
84 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
85 * by managed Network CM Proxy
86 * @param parentNodeXpath xpath to parent node
87 * @param jsonData json data
89 void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
92 * Replaces existing data node content including descendants.
94 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
95 * by managed Network CM Proxy
96 * @param parentNodeXpath xpath to parent node
97 * @param jsonData json data
99 void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);