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.ncmp.api.models.DmiPluginRegistration;
28 import org.onap.cps.spi.FetchDescendantsOption;
29 import org.onap.cps.spi.model.DataNode;
32 * Datastore interface for handling CPS data.
34 public interface NetworkCmProxyDataService {
37 * Retrieves datanode by XPath for a given cm handle.
39 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
40 * object by managed Network CM Proxy
42 * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
43 * (recursively) as well
44 * @return data node object
46 DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
47 @NonNull FetchDescendantsOption fetchDescendantsOption);
50 * Get datanodes for the given cm handle by cps path.
52 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
53 * object by managed Network CM Proxy
54 * @param cpsPath cps path
55 * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
56 * included in the output
57 * @return a collection of datanodes
59 Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
60 @NonNull FetchDescendantsOption fetchDescendantsOption);
63 * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
65 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
66 * object managed by Network CM Proxy
67 * @param parentNodeXpath xpath to parent node or '/' for root level
68 * @param jsonData data as JSON string
70 void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
73 * Creates one or more child node elements with descendants under existing node from list-node data fragment.
75 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
76 * object managed by Network CM Proxy
77 * @param parentNodeXpath xpath to parent node
78 * @param jsonData data as JSON string
80 void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
83 * Updates data node for given cm handle using xpath to parent node.
85 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
86 * by managed Network CM Proxy
87 * @param parentNodeXpath xpath to parent node
88 * @param jsonData json data
90 void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
93 * Replaces existing data node content including descendants.
95 * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
96 * by managed Network CM Proxy
97 * @param parentNodeXpath xpath to parent node
98 * @param jsonData json data
100 void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
103 * Registration of New CM Handles.
105 * @param dmiPluginRegistration Dmi Plugin Registration
107 void updateDmiPluginRegistration(DmiPluginRegistration dmiPluginRegistration);
110 * Get resource data for data store pass-through operational
113 * @param cmHandle cm handle
114 * @param resourceIdentifier resource identifier
115 * @param accept accept param
116 * @param fields fields query
117 * @param depth depth query
118 * @return {@code Object} resource data
120 Object getResourceDataOperationalFoCmHandle(@NonNull String cmHandle,
121 @NonNull String resourceIdentifier,