2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.sal.rest.api;
10 import javax.ws.rs.Consumes;
11 import javax.ws.rs.DELETE;
12 import javax.ws.rs.Encoded;
13 import javax.ws.rs.GET;
14 import javax.ws.rs.POST;
15 import javax.ws.rs.PUT;
16 import javax.ws.rs.Path;
17 import javax.ws.rs.PathParam;
18 import javax.ws.rs.Produces;
19 import javax.ws.rs.core.Context;
20 import javax.ws.rs.core.MediaType;
21 import javax.ws.rs.core.Response;
22 import javax.ws.rs.core.UriInfo;
23 import org.opendaylight.netconf.sal.rest.api.Draft02.MediaTypes;
24 import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext;
25 import org.opendaylight.restconf.common.patch.Patch;
26 import org.opendaylight.restconf.common.patch.PatchContext;
27 import org.opendaylight.restconf.common.patch.PatchStatusContext;
30 * The URI hierarchy for the RESTCONF resources consists of an entry point
31 * container, 4 top-level resources, and 1 field.
33 * <li><b>/restconf</b> - {@link #getRoot()}
35 * <li><b>/config</b> - {@link #readConfigurationData(String, UriInfo)}
36 * {@link #updateConfigurationData(String, NormalizedNodeContext, UriInfo)}
37 * {@link #createConfigurationData(NormalizedNodeContext, UriInfo)}
38 * {@link #createConfigurationData(String, NormalizedNodeContext, UriInfo)}
39 * {@link #deleteConfigurationData(String)}
40 * <li><b>/operational</b> - {@link #readOperationalData(String, UriInfo)}
41 * <li>/modules - {@link #getModules(UriInfo)}
45 * <li><b>/operations</b> -
46 * {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
47 * {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
48 * <li>/version (field)
53 public interface RestconfService {
56 String JSON = "+json";
62 * Get all modules supported by controller.
66 * @return {@link NormalizedNodeContext}
67 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(UriInfo)
73 Draft02.MediaTypes.API + JSON,
74 Draft02.MediaTypes.API + XML,
75 MediaType.APPLICATION_JSON,
76 MediaType.APPLICATION_XML,
79 NormalizedNodeContext getModules(@Context UriInfo uriInfo);
82 * Get all modules supported by mount point.
85 * mount point identifier
88 * @return {@link NormalizedNodeContext}
89 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
94 @Path("/modules/{identifier:.+}")
96 Draft02.MediaTypes.API + JSON,
97 Draft02.MediaTypes.API + XML,
98 MediaType.APPLICATION_JSON,
99 MediaType.APPLICATION_XML,
102 NormalizedNodeContext getModules(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
111 * @return {@link NormalizedNodeContext}
112 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
117 @Path("/modules/module/{identifier:.+}")
119 Draft02.MediaTypes.API + JSON,
120 Draft02.MediaTypes.API + XML,
121 MediaType.APPLICATION_JSON,
122 MediaType.APPLICATION_XML,
125 NormalizedNodeContext getModule(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
128 * List of rpc or action operations supported by the server.
130 * @return A JSON document string
131 * @deprecated do not use this method. It will be replaced by
132 * RestconfOperationsService#getOperations(UriInfo)
137 @Produces({ Draft02.MediaTypes.API + JSON, MediaType.APPLICATION_JSON })
138 String getOperationsJSON();
141 * List of rpc or action operations supported by the server.
143 * @return A XML document string
144 * @deprecated do not use this method. It will be replaced by
145 * RestconfOperationsService#getOperations(UriInfo)
150 @Produces({ Draft02.MediaTypes.API + XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
151 String getOperationsXML();
154 * Valid for mount points. List of operations supported by the server.
160 * @return {@link NormalizedNodeContext}
161 * @deprecated do not use this method. It will be replaced by
162 * RestconfOperationsService#getOperations(String, UriInfo)
166 @Path("/operations/{identifier:.+}")
168 Draft02.MediaTypes.API + JSON,
169 Draft02.MediaTypes.API + XML,
170 MediaType.APPLICATION_JSON,
171 MediaType.APPLICATION_XML,
174 NormalizedNodeContext getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
177 * Invoke RPC operation.
180 * module name and rpc identifier string for the desired operation
182 * {@link NormalizedNodeContext} - the body of the operation
185 * @return {@link NormalizedNodeContext}
186 * @deprecated do not use this method. It will be replaced by
187 * RestconfInvokeOperationsService#invokeRpc(String, NormalizedNodeContext, UriInfo)
191 @Path("/operations/{identifier:.+}")
193 Draft02.MediaTypes.OPERATION + JSON,
194 Draft02.MediaTypes.OPERATION + XML,
195 Draft02.MediaTypes.DATA + JSON,
196 Draft02.MediaTypes.DATA + XML,
197 MediaType.APPLICATION_JSON,
198 MediaType.APPLICATION_XML,
202 Draft02.MediaTypes.OPERATION + JSON,
203 Draft02.MediaTypes.OPERATION + XML,
204 Draft02.MediaTypes.DATA + JSON,
205 Draft02.MediaTypes.DATA + XML,
206 MediaType.APPLICATION_JSON,
207 MediaType.APPLICATION_XML,
210 NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
211 @Context UriInfo uriInfo);
214 * Get target data resource from config data store.
220 * @return {@link NormalizedNodeContext}
221 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
226 @Path("/config/{identifier:.+}")
228 Draft02.MediaTypes.DATA + JSON,
229 Draft02.MediaTypes.DATA + XML,
230 MediaType.APPLICATION_JSON,
231 MediaType.APPLICATION_XML,
234 NormalizedNodeContext readConfigurationData(@Encoded @PathParam("identifier") String identifier,
235 @Context UriInfo uriInfo);
238 * Get target data resource from operational data store.
244 * @return {@link NormalizedNodeContext}
245 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
250 @Path("/operational/{identifier:.+}")
252 Draft02.MediaTypes.DATA + JSON,
253 Draft02.MediaTypes.DATA + XML,
254 MediaType.APPLICATION_JSON,
255 MediaType.APPLICATION_XML,
258 NormalizedNodeContext readOperationalData(@Encoded @PathParam("identifier") String identifier,
259 @Context UriInfo uriInfo);
262 * Create or replace the target data resource.
267 * data node for put to config DS
268 * @return {@link Response}
269 * @deprecated do not use this method. It will be replaced by RestconfDataService#putData(String,
270 * NormalizedNodeContext, UriInfo)
274 @Path("/config/{identifier:.+}")
276 Draft02.MediaTypes.DATA + JSON,
277 Draft02.MediaTypes.DATA + XML,
278 MediaType.APPLICATION_JSON,
279 MediaType.APPLICATION_XML,
282 Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier,
283 NormalizedNodeContext payload, @Context UriInfo uriInfo);
286 * Create a data resource in target.
294 * @return {@link Response}
295 * @deprecated do not use this method. It will be replaced by RestconfDataService#postData(String,
296 * NormalizedNodeContext, UriInfo)
300 @Path("/config/{identifier:.+}")
302 Draft02.MediaTypes.DATA + JSON,
303 Draft02.MediaTypes.DATA + XML,
304 MediaType.APPLICATION_JSON,
305 MediaType.APPLICATION_XML,
308 Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
309 @Context UriInfo uriInfo);
312 * Create a data resource.
318 * @return {@link Response}
319 * @deprecated do not use this method. It will be replaced by
320 * RestconfDataService#postData(NormalizedNodeContext, UriInfo)
326 Draft02.MediaTypes.DATA + JSON,
327 Draft02.MediaTypes.DATA + XML,
328 MediaType.APPLICATION_JSON,
329 MediaType.APPLICATION_XML,
332 Response createConfigurationData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
335 * Delete the target data resource.
339 * @return {@link Response}
340 * @deprecated do not use this method. It will be replaced by RestconfDataService#deleteData(String)
344 @Path("/config/{identifier:.+}")
345 Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
348 * Subscribe to stream.
354 * @return {@link NormalizedNodeContext}
355 * @deprecated do not use this method. It will be replaced by
356 * RestconfStreamsSubscriptionService#subscribeToStream(String, UriInfo)
360 @Path("/streams/stream/{identifier:.+}")
361 NormalizedNodeContext subscribeToStream(@Encoded @PathParam("identifier") String identifier,
362 @Context UriInfo uriInfo);
365 * Get list of all streams.
369 * @return {@link NormalizedNodeContext}
370 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
377 Draft02.MediaTypes.API + JSON,
378 Draft02.MediaTypes.API + XML,
379 MediaType.APPLICATION_JSON,
380 MediaType.APPLICATION_XML,
383 NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
386 * Ordered list of edits that are applied to the target datastore by the server.
394 * @return {@link PatchStatusContext}
395 * @deprecated do not use this method. It will be replaced by RestconfDataService#patchData(String,
396 * PatchContext, UriInfo)
400 @Path("/config/{identifier:.+}")
402 MediaTypes.PATCH + JSON,
403 MediaTypes.PATCH + XML
406 MediaTypes.PATCH_STATUS + JSON,
407 MediaTypes.PATCH_STATUS + XML
409 PatchStatusContext patchConfigurationData(@Encoded @PathParam("identifier") String identifier, PatchContext
410 context, @Context UriInfo uriInfo);
413 * Ordered list of edits that are applied to the datastore by the server.
419 * @return {@link PatchStatusContext}
420 * @deprecated do not use this method. It will be replaced by RestconfDataService#patchData(PatchContext,
427 MediaTypes.PATCH + JSON,
428 MediaTypes.PATCH + XML
431 MediaTypes.PATCH_STATUS + JSON,
432 MediaTypes.PATCH_STATUS + XML
434 PatchStatusContext patchConfigurationData(PatchContext context, @Context UriInfo uriInfo);