Conditional cps change events
[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-2024 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.Map;
28 import org.onap.cps.ncmp.api.impl.inventory.CompositeState;
29 import org.onap.cps.ncmp.api.impl.operations.OperationType;
30 import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
31 import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters;
32 import org.onap.cps.ncmp.api.models.CmResourceAddress;
33 import org.onap.cps.ncmp.api.models.DataOperationRequest;
34 import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
35 import org.onap.cps.ncmp.api.models.DmiPluginRegistrationResponse;
36 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
37 import org.onap.cps.spi.FetchDescendantsOption;
38 import org.onap.cps.spi.model.ModuleDefinition;
39 import org.onap.cps.spi.model.ModuleReference;
40
41 /*
42  * Datastore interface for handling CPS data.
43  */
44 public interface NetworkCmProxyDataService {
45
46     /**
47      * Registration of New CM Handles.
48      *
49      * @param dmiPluginRegistration Dmi Plugin Registration
50      * @return dmiPluginRegistrationResponse
51      */
52     DmiPluginRegistrationResponse updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
53
54     /**
55      * Get resource data for given data store using dmi.
56      *
57      * @param cmResourceAddress   target datastore, cm handle and resource identifier
58      * @param optionsParamInQuery options query
59      * @param topicParamInQuery   topic name for (triggering) async responses
60      * @param requestId           unique requestId for async request
61      * @param authorization       contents of Authorization header, or null if not present
62      * @return {@code Object} resource data
63      */
64     Object getResourceDataForCmHandle(CmResourceAddress cmResourceAddress,
65                                       String optionsParamInQuery,
66                                       String topicParamInQuery,
67                                       String requestId,
68                                       String authorization);
69
70     /**
71      * Get resource data for operational.
72      *
73      * @param cmResourceAddress     target datastore, cm handle and resource identifier
74      * @Link FetchDescendantsOption fetch descendants option
75      * @return {@code Object} resource data
76      */
77     Object getResourceDataForCmHandle(CmResourceAddress cmResourceAddress,
78                                       FetchDescendantsOption fetchDescendantsOption);
79
80     /**
81      * Execute (async) data operation for group of cm handles using dmi.
82      *
83      * @param topicParamInQuery        topic name for (triggering) async responses
84      * @param dataOperationRequest     contains a list of operation definitions(multiple operations)
85      * @param requestId                request ID
86      * @param authorization            contents of Authorization header, or null if not present
87      */
88     void executeDataOperationForCmHandles(String topicParamInQuery,
89                                           DataOperationRequest dataOperationRequest,
90                                           String requestId,
91                                           String authorization);
92
93
94     /**
95      * Write resource data for data store pass-through running using dmi for given cm-handle.
96      *
97      * @param cmHandleId         cm handle identifier
98      * @param resourceIdentifier resource identifier
99      * @param operationType      required operation type
100      * @param requestBody        request body to create resource
101      * @param contentType        content type in body
102      * @param authorization       contents of Authorization header, or null if not present
103      * @return {@code Object} return data
104      */
105     Object writeResourceDataPassThroughRunningForCmHandle(String cmHandleId,
106                                                           String resourceIdentifier,
107                                                           OperationType operationType,
108                                                           String requestBody,
109                                                           String contentType,
110                                                           String authorization);
111
112     /**
113      * Retrieve module references for the given cm handle.
114      *
115      * @param cmHandleId cm handle identifier
116      * @return a collection of modules names and revisions
117      */
118     Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandleId);
119
120     /**
121      * Retrieve module definitions for the given cm handle.
122      *
123      * @param cmHandleId cm handle identifier
124      * @return a collection of module definition (moduleName, revision and yang resource content)
125      */
126     Collection<ModuleDefinition> getModuleDefinitionsByCmHandleId(String cmHandleId);
127
128     /**
129      * Get module definitions for the given parameters.
130      *
131      * @param cmHandleId        cm-handle identifier
132      * @param moduleName        module name
133      * @param moduleRevision    the revision of the module
134      * @return list of module definitions (module name, revision, yang resource content)
135      */
136     Collection<ModuleDefinition> getModuleDefinitionsByCmHandleAndModule(String cmHandleId,
137                                                                          String moduleName,
138                                                                          String moduleRevision);
139
140     /**
141      * Query cm handle details by cm handle's name.
142      *
143      * @param cmHandleId cm handle identifier
144      * @return a collection of cm handle details.
145      */
146     NcmpServiceCmHandle getNcmpServiceCmHandle(String cmHandleId);
147
148     /**
149      * Get cm handle public properties by cm handle id.
150      *
151      * @param cmHandleId cm handle identifier
152      * @return a collection of cm handle public properties.
153      */
154     Map<String, String> getCmHandlePublicProperties(String cmHandleId);
155
156     /**
157      * Get cm handle composite state by cm handle id.
158      *
159      * @param cmHandleId cm handle identifier
160      * @return a cm handle composite state
161      */
162     CompositeState getCmHandleCompositeState(String cmHandleId);
163
164     /**
165      * Query and return cm handles that match the given query parameters.
166      *
167      * @param cmHandleQueryApiParameters the cm handle query parameters
168      * @return collection of cm handles
169      */
170     Collection<NcmpServiceCmHandle> executeCmHandleSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
171
172     /**
173      * Query and return cm handle ids that match the given query parameters.
174      *
175      * @param cmHandleQueryApiParameters the cm handle query parameters
176      * @return collection of cm handle ids
177      */
178     Collection<String> executeCmHandleIdSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
179
180     /**
181      * Set the data sync enabled flag, along with the data sync state to true or false based on the cm handle id.
182      *
183      * @param cmHandleId cm handle id
184      * @param dataSyncEnabled data sync enabled flag
185      */
186     void setDataSyncEnabled(String cmHandleId, Boolean dataSyncEnabled);
187
188     /**
189      * Get all cm handle IDs by DMI plugin identifier.
190      *
191      * @param dmiPluginIdentifier DMI plugin identifier
192      * @return collection of cm handle IDs
193      */
194     Collection<String> getAllCmHandleIdsByDmiPluginIdentifier(String dmiPluginIdentifier);
195
196     /**
197      * Get all cm handle IDs by various search criteria.
198      *
199      * @param cmHandleQueryServiceParameters cm handle query parameters
200      * @return collection of cm handle IDs
201      */
202     Collection<String> executeCmHandleIdSearchForInventory(CmHandleQueryServiceParameters
203                                                                cmHandleQueryServiceParameters);
204 }