Merge "Add retry mechanism on Subscription loader"
[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-2023 Nordix Foundation
5  *  Modifications Copyright (C) 2021 Pantheon.tech
6  *  Modifications Copyright (C) 2022 Bell Canada
7  *  ================================================================================
8  *  Licensed under the Apache License, Version 2.0 (the "License");
9  *  you may not use this file except in compliance with the License.
10  *  You may obtain a copy of the License at
11  *
12  *        http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *  Unless required by applicable law or agreed to in writing, software
15  *  distributed under the License is distributed on an "AS IS" BASIS,
16  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *  See the License for the specific language governing permissions and
18  *  limitations under the License.
19  *
20  *  SPDX-License-Identifier: Apache-2.0
21  *  ============LICENSE_END=========================================================
22  */
23
24 package org.onap.cps.ncmp.api;
25
26 import java.util.Collection;
27 import java.util.List;
28 import java.util.Map;
29 import org.onap.cps.ncmp.api.impl.operations.OperationEnum;
30 import org.onap.cps.ncmp.api.inventory.CompositeState;
31 import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
32 import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters;
33 import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
34 import org.onap.cps.ncmp.api.models.DmiPluginRegistrationResponse;
35 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
36 import org.onap.cps.spi.FetchDescendantsOption;
37 import org.onap.cps.spi.model.ModuleDefinition;
38 import org.onap.cps.spi.model.ModuleReference;
39
40 /*
41  * Datastore interface for handling CPS data.
42  */
43 public interface NetworkCmProxyDataService {
44
45     /**
46      * Registration of New CM Handles.
47      *
48      * @param dmiPluginRegistration Dmi Plugin Registration
49      * @return dmiPluginRegistrationResponse
50      */
51     DmiPluginRegistrationResponse updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
52
53     /**
54      * Get resource data for given data store using dmi.
55      *
56      * @param dataStoreName       data store name
57      * @param cmHandleId          cm handle identifier
58      * @param resourceIdentifier  resource identifier
59      * @param optionsParamInQuery options query
60      * @param topicParamInQuery   topic name for (triggering) async responses
61      * @param requestId           unique requestId for async request
62      * @return {@code Object} resource data
63      */
64     Object getResourceDataForCmHandle(String dataStoreName,
65                                       String cmHandleId,
66                                       String resourceIdentifier,
67                                       String optionsParamInQuery,
68                                       String topicParamInQuery,
69                                       String requestId);
70
71     /**
72      * Get resource data for operational.
73      *
74      * @param dataStoreName       data store name
75      * @param cmHandleId cm handle identifier
76      * @param resourceIdentifier resource identifier
77      * @Link FetchDescendantsOption fetch descendants option
78      * @return {@code Object} resource data
79      */
80     Object getResourceDataForCmHandle(String dataStoreName,
81                                       String cmHandleId,
82                                       String resourceIdentifier,
83                                       FetchDescendantsOption fetchDescendantsOption);
84
85     /**
86      * Get resource data for given batch of cm handles using dmi.
87      *
88      * @param dataStoreName       data store name
89      * @param cmHandleIds         cm handle identifiers
90      * @param resourceIdentifier  resource identifier
91      * @param optionsParamInQuery options query
92      * @param topicParamInQuery   topic name for (triggering) async responses
93      * @param requestId           unique requestId for async request
94      * @return {@code Object} resource data
95      */
96     Object getResourceDataForCmHandleBatch(String dataStoreName,
97                                        List<String> cmHandleIds,
98                                        String resourceIdentifier,
99                                        String optionsParamInQuery,
100                                        String topicParamInQuery,
101                                        String requestId);
102
103
104     /**
105      * Write resource data for data store pass-through running
106      * using dmi for given cm-handle.
107      *  @param cmHandleId cm handle identifier
108      * @param resourceIdentifier resource identifier
109      * @param operation required operation
110      * @param requestBody request body to create resource
111      * @param contentType content type in body
112      * @return {@code Object} return data
113      */
114     Object writeResourceDataPassThroughRunningForCmHandle(String cmHandleId,
115                                                         String resourceIdentifier,
116                                                         OperationEnum operation,
117                                                         String requestBody,
118                                                         String contentType);
119
120     /**
121      * Retrieve module references for the given cm handle.
122      *
123      * @param cmHandleId cm handle identifier
124      * @return a collection of modules names and revisions
125      */
126     Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandleId);
127
128     /**
129      * Retrieve module definitions for the given cm handle.
130      *
131      * @param cmHandleId cm handle identifier
132      * @return a collection of module definition (moduleName, revision and yang resource content)
133      */
134     Collection<ModuleDefinition> getModuleDefinitionsByCmHandleId(String cmHandleId);
135
136     /**
137      * Query cm handle details by cm handle's name.
138      *
139      * @param cmHandleId cm handle identifier
140      * @return a collection of cm handle details.
141      */
142     NcmpServiceCmHandle getNcmpServiceCmHandle(String cmHandleId);
143
144     /**
145      * Get cm handle public properties by cm handle id.
146      *
147      * @param cmHandleId cm handle identifier
148      * @return a collection of cm handle public properties.
149      */
150     Map<String, String> getCmHandlePublicProperties(String cmHandleId);
151
152     /**
153      * Get cm handle composite state by cm handle id.
154      *
155      * @param cmHandleId cm handle identifier
156      * @return a cm handle composite state
157      */
158     CompositeState getCmHandleCompositeState(String cmHandleId);
159
160     /**
161      * Query and return cm handles that match the given query parameters.
162      *
163      * @param cmHandleQueryApiParameters the cm handle query parameters
164      * @return collection of cm handles
165      */
166     Collection<NcmpServiceCmHandle> executeCmHandleSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
167
168     /**
169      * Query and return cm handle ids that match the given query parameters.
170      *
171      * @param cmHandleQueryApiParameters the cm handle query parameters
172      * @return collection of cm handle ids
173      */
174     Collection<String> executeCmHandleIdSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
175
176     /**
177      * Set the data sync enabled flag, along with the data sync state to true or false based on the cm handle id.
178      *
179      * @param cmHandleId cm handle id
180      * @param dataSyncEnabled data sync enabled flag
181      */
182     void setDataSyncEnabled(String cmHandleId, boolean dataSyncEnabled);
183
184     /**
185      * Get all cm handle IDs by DMI plugin identifier.
186      *
187      * @param dmiPluginIdentifier DMI plugin identifier
188      * @return collection of cm handle IDs
189      */
190     Collection<String> getAllCmHandleIdsByDmiPluginIdentifier(String dmiPluginIdentifier);
191
192     /**
193      * Get all cm handle IDs by various search criteria.
194      *
195      * @param cmHandleQueryServiceParameters cm handle query parameters
196      * @return collection of cm handle IDs
197      */
198     Collection<String> executeCmHandleIdSearchForInventory(CmHandleQueryServiceParameters
199                                                                cmHandleQueryServiceParameters);
200 }