CPS-505 Retrieving modules for new CM handle
[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 javax.validation.constraints.NotNull;
27 import org.checkerframework.checker.nullness.qual.NonNull;
28 import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
29 import org.onap.cps.spi.FetchDescendantsOption;
30 import org.onap.cps.spi.model.DataNode;
31
32 /*
33  * Datastore interface for handling CPS data.
34  */
35 public interface NetworkCmProxyDataService {
36
37     /**
38      * Retrieves datanode by XPath for a given cm handle.
39      *
40      * @param cmHandle               The identifier for a network function, network element, subnetwork or any other cm
41      *                               object by managed Network CM Proxy
42      * @param xpath                  xpath
43      * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
44      *                               (recursively) as well
45      * @return data node object
46      */
47     DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
48         @NonNull FetchDescendantsOption fetchDescendantsOption);
49
50     /**
51      * Get datanodes for the given cm handle by cps path.
52      *
53      * @param cmHandle               The identifier for a network function, network element, subnetwork or any other cm
54      *                               object by managed Network CM Proxy
55      * @param cpsPath                cps path
56      * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
57      *                               included in the output
58      * @return a collection of datanodes
59      */
60     Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
61         @NonNull FetchDescendantsOption fetchDescendantsOption);
62
63     /**
64      * Creates data node with descendants at root level or under existing node (if parent node xpath is provided).
65      *
66      * @param cmHandle        The identifier for a network function, network element, subnetwork or any other cm
67      *                        object managed by Network CM Proxy
68      * @param parentNodeXpath xpath to parent node or '/' for root level
69      * @param jsonData        data as JSON string
70      */
71     void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
72
73     /**
74      * Creates one or more child node elements with descendants under existing node from list-node data fragment.
75      *
76      * @param cmHandle        The identifier for a network function, network element, subnetwork or any other cm
77      *                        object managed by Network CM Proxy
78      * @param parentNodeXpath xpath to parent node
79      * @param jsonData        data as JSON string
80      */
81     void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
82
83     /**
84      * Updates data node for given cm handle using xpath to parent node.
85      *
86      * @param cmHandle        The identifier for a network function, network element, subnetwork or any other cm object
87      *                        by managed Network CM Proxy
88      * @param parentNodeXpath xpath to parent node
89      * @param jsonData        json data
90      */
91     void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
92
93     /**
94      * Replaces existing data node content including descendants.
95      *
96      * @param cmHandle        The identifier for a network function, network element, subnetwork or any other cm object
97      *                        by managed Network CM Proxy
98      * @param parentNodeXpath xpath to parent node
99      * @param jsonData        json data
100      */
101     void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
102
103     /**
104      * Registration of New CM Handles.
105      *
106      * @param dmiPluginRegistration Dmi Plugin Registration
107      */
108     void updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
109
110     /**
111      * Get resource data for data store pass-through operational
112      * using dmi.
113      *
114      * @param cmHandle cm handle
115      * @param resourceIdentifier resource identifier
116      * @param accept accept param
117      * @param fields fields query
118      * @param depth depth query
119      * @return {@code Object} resource data
120      */
121     Object getResourceDataOperationalForCmHandle(@NotNull String cmHandle,
122                                                  @NotNull String resourceIdentifier,
123                                                  String accept,
124                                                  String fields,
125                                                  Integer depth);
126
127     /**
128      * Get resource data for data store pass-through running
129      * using dmi.
130      *
131      * @param cmHandle cm handle
132      * @param resourceIdentifier resource identifier
133      * @param acceptParam accept param
134      * @param fields fields query
135      * @param depth depth query
136      * @return {@code Object} resource data
137      */
138     Object getResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle,
139                                                         @NotNull String resourceIdentifier,
140                                                         String acceptParam,
141                                                         String fields,
142                                                         Integer depth);
143
144     /**
145      * Create resource data for data store pass-through running
146      * using dmi for given cm-handle.
147      *
148      * @param cmHandle cm handle
149      * @param resourceIdentifier resource identifier
150      * @param requestBody request body to create resource
151      * @param contentType content type in body
152      */
153     void createResourceDataPassThroughRunningForCmHandle(@NotNull String cmHandle,
154                                                          @NotNull String resourceIdentifier,
155                                                          @NotNull Object requestBody,
156                                                          String contentType);
157 }