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.restconf.common.context.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.
132 * @return {@link NormalizedNodeContext}
133 * @deprecated do not use this method. It will be replaced by
134 * RestconfOperationsService#getOperations(UriInfo)
140 Draft02.MediaTypes.API + JSON,
141 Draft02.MediaTypes.API + XML,
142 MediaType.APPLICATION_JSON,
143 MediaType.APPLICATION_XML,
146 NormalizedNodeContext getOperations(@Context UriInfo uriInfo);
149 * Valid for mount points. List of operations supported by the server.
155 * @return {@link NormalizedNodeContext}
156 * @deprecated do not use this method. It will be replaced by
157 * RestconfOperationsService#getOperations(String, UriInfo)
161 @Path("/operations/{identifier:.+}")
163 Draft02.MediaTypes.API + JSON,
164 Draft02.MediaTypes.API + XML,
165 MediaType.APPLICATION_JSON,
166 MediaType.APPLICATION_XML,
169 NormalizedNodeContext getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
172 * Invoke RPC operation.
175 * module name and rpc identifier string for the desired operation
177 * {@link NormalizedNodeContext} - the body of the operation
180 * @return {@link NormalizedNodeContext}
181 * @deprecated do not use this method. It will be replaced by
182 * RestconfInvokeOperationsService#invokeRpc(String, NormalizedNodeContext, UriInfo)
186 @Path("/operations/{identifier:.+}")
188 Draft02.MediaTypes.OPERATION + JSON,
189 Draft02.MediaTypes.OPERATION + XML,
190 Draft02.MediaTypes.DATA + JSON,
191 Draft02.MediaTypes.DATA + XML,
192 MediaType.APPLICATION_JSON,
193 MediaType.APPLICATION_XML,
197 Draft02.MediaTypes.OPERATION + JSON,
198 Draft02.MediaTypes.OPERATION + XML,
199 Draft02.MediaTypes.DATA + JSON,
200 Draft02.MediaTypes.DATA + XML,
201 MediaType.APPLICATION_JSON,
202 MediaType.APPLICATION_XML,
205 NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
206 @Context UriInfo uriInfo);
209 * Get target data resource from config data store.
215 * @return {@link NormalizedNodeContext}
216 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
221 @Path("/config/{identifier:.+}")
223 Draft02.MediaTypes.DATA + JSON,
224 Draft02.MediaTypes.DATA + XML,
225 MediaType.APPLICATION_JSON,
226 MediaType.APPLICATION_XML,
229 NormalizedNodeContext readConfigurationData(@Encoded @PathParam("identifier") String identifier,
230 @Context UriInfo uriInfo);
233 * Get target data resource from operational data store.
239 * @return {@link NormalizedNodeContext}
240 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
245 @Path("/operational/{identifier:.+}")
247 Draft02.MediaTypes.DATA + JSON,
248 Draft02.MediaTypes.DATA + XML,
249 MediaType.APPLICATION_JSON,
250 MediaType.APPLICATION_XML,
253 NormalizedNodeContext readOperationalData(@Encoded @PathParam("identifier") String identifier,
254 @Context UriInfo uriInfo);
257 * Create or replace the target data resource.
262 * data node for put to config DS
263 * @return {@link Response}
264 * @deprecated do not use this method. It will be replaced by RestconfDataService#putData(String,
265 * NormalizedNodeContext, UriInfo)
269 @Path("/config/{identifier:.+}")
271 Draft02.MediaTypes.DATA + JSON,
272 Draft02.MediaTypes.DATA + XML,
273 MediaType.APPLICATION_JSON,
274 MediaType.APPLICATION_XML,
277 Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier,
278 NormalizedNodeContext payload, @Context UriInfo uriInfo);
281 * Create a data resource in target.
289 * @return {@link Response}
290 * @deprecated do not use this method. It will be replaced by RestconfDataService#postData(String,
291 * NormalizedNodeContext, UriInfo)
295 @Path("/config/{identifier:.+}")
297 Draft02.MediaTypes.DATA + JSON,
298 Draft02.MediaTypes.DATA + XML,
299 MediaType.APPLICATION_JSON,
300 MediaType.APPLICATION_XML,
303 Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
304 @Context UriInfo uriInfo);
307 * Create a data resource.
313 * @return {@link Response}
314 * @deprecated do not use this method. It will be replaced by
315 * RestconfDataService#postData(NormalizedNodeContext, UriInfo)
321 Draft02.MediaTypes.DATA + JSON,
322 Draft02.MediaTypes.DATA + XML,
323 MediaType.APPLICATION_JSON,
324 MediaType.APPLICATION_XML,
327 Response createConfigurationData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
330 * Delete the target data resource.
334 * @return {@link Response}
335 * @deprecated do not use this method. It will be replaced by RestconfDataService#deleteData(String)
339 @Path("/config/{identifier:.+}")
340 Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
343 * Subscribe to stream.
349 * @return {@link NormalizedNodeContext}
350 * @deprecated do not use this method. It will be replaced by
351 * RestconfStreamsSubscriptionService#subscribeToStream(String, UriInfo)
355 @Path("/streams/stream/{identifier:.+}")
356 NormalizedNodeContext subscribeToStream(@Encoded @PathParam("identifier") String identifier,
357 @Context UriInfo uriInfo);
360 * Get list of all streams.
364 * @return {@link NormalizedNodeContext}
365 * @deprecated do not use this method. It will be replaced by RestconfDataService#readData(String,
372 Draft02.MediaTypes.API + JSON,
373 Draft02.MediaTypes.API + XML,
374 MediaType.APPLICATION_JSON,
375 MediaType.APPLICATION_XML,
378 NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
381 * Ordered list of edits that are applied to the target datastore by the server.
389 * @return {@link PatchStatusContext}
390 * @deprecated do not use this method. It will be replaced by RestconfDataService#patchData(String,
391 * PatchContext, UriInfo)
395 @Path("/config/{identifier:.+}")
397 MediaTypes.PATCH + JSON,
398 MediaTypes.PATCH + XML
401 MediaTypes.PATCH_STATUS + JSON,
402 MediaTypes.PATCH_STATUS + XML
404 PatchStatusContext patchConfigurationData(@Encoded @PathParam("identifier") String identifier, PatchContext
405 context, @Context UriInfo uriInfo);
408 * Ordered list of edits that are applied to the datastore by the server.
414 * @return {@link PatchStatusContext}
415 * @deprecated do not use this method. It will be replaced by RestconfDataService#patchData(PatchContext,
422 MediaTypes.PATCH + JSON,
423 MediaTypes.PATCH + XML
426 MediaTypes.PATCH_STATUS + JSON,
427 MediaTypes.PATCH_STATUS + XML
429 PatchStatusContext patchConfigurationData(PatchContext context, @Context UriInfo uriInfo);