Merge "Expose Prometheus metrics for monitoring"
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / NetworkCmProxyDataService.java
1 /*
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
10  *
11  *        http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  *  SPDX-License-Identifier: Apache-2.0
20  *  ============LICENSE_END=========================================================
21  */
22
23 package org.onap.cps.ncmp.api;
24
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;
29
30 /*
31  * Datastore interface for handling CPS data.
32  */
33 public interface NetworkCmProxyDataService {
34
35     /**
36      * Retrieves datanode by XPath for a given cm handle.
37      *
38      * @param cmHandle               The identifier for a network function, network element, subnetwork or any other cm
39      *                               object by managed Network CM Proxy
40      * @param xpath                  xpath
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
44      */
45     DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
46         @NonNull FetchDescendantsOption fetchDescendantsOption);
47
48     /**
49      * Get datanodes for the given cm handle by cps path.
50      *
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
57      */
58     Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
59         @NonNull FetchDescendantsOption fetchDescendantsOption);
60
61     /**
62      * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
63      *
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
68      */
69     void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
70
71     /**
72      * Creates one or more child node elements with descendants under existing node from list-node data fragment.
73      *
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
78      */
79     void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
80
81     /**
82      * Updates data node for given cm handle using xpath to parent node.
83      *
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
88      */
89     void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
90
91     /**
92      * Replaces existing data node content including descendants.
93      *
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
98      */
99     void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
100
101 }