Implement DMI Registration (NCMP-Side)
[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.ncmp.api.models.DmiPluginRegistration;
28 import org.onap.cps.spi.FetchDescendantsOption;
29 import org.onap.cps.spi.model.DataNode;
30
31 /*
32  * Datastore interface for handling CPS data.
33  */
34 public interface NetworkCmProxyDataService {
35
36     /**
37      * Retrieves datanode by XPath for a given cm handle.
38      *
39      * @param cmHandle               The identifier for a network function, network element, subnetwork or any other cm
40      *                               object by managed Network CM Proxy
41      * @param xpath                  xpath
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
45      */
46     DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
47         @NonNull FetchDescendantsOption fetchDescendantsOption);
48
49     /**
50      * Get datanodes for the given cm handle by cps path.
51      *
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
58      */
59     Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
60         @NonNull FetchDescendantsOption fetchDescendantsOption);
61
62     /**
63      * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
64      *
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
69      */
70     void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
71
72     /**
73      * Creates one or more child node elements with descendants under existing node from list-node data fragment.
74      *
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
79      */
80     void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
81
82     /**
83      * Updates data node for given cm handle using xpath to parent node.
84      *
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
89      */
90     void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
91
92     /**
93      * Replaces existing data node content including descendants.
94      *
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
99      */
100     void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
101
102     /**
103      * Registration of New CM Handles.
104      *
105      * @param dmiPluginRegistration Dmi Plugin Registration
106      */
107     void updateDmiPluginRegistration(DmiPluginRegistration dmiPluginRegistration);
108
109 }