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.DefaultValue;
13 import javax.ws.rs.Encoded;
14 import javax.ws.rs.GET;
15 import javax.ws.rs.POST;
16 import javax.ws.rs.PUT;
17 import javax.ws.rs.Path;
18 import javax.ws.rs.PathParam;
19 import javax.ws.rs.Produces;
20 import javax.ws.rs.core.Context;
21 import javax.ws.rs.core.MediaType;
22 import javax.ws.rs.core.Response;
23 import javax.ws.rs.core.UriInfo;
24 import org.opendaylight.netconf.sal.rest.api.Draft02.MediaTypes;
25 import org.opendaylight.restconf.base.services.api.RestconfOperationsService;
26 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
27 import org.opendaylight.restconf.common.patch.Patch;
28 import org.opendaylight.restconf.common.patch.PatchContext;
29 import org.opendaylight.restconf.common.patch.PatchStatusContext;
30 import org.opendaylight.restconf.restful.services.api.RestconfDataService;
31 import org.opendaylight.restconf.restful.services.api.RestconfInvokeOperationsService;
32 import org.opendaylight.restconf.restful.services.api.RestconfStreamsSubscriptionService;
35 * The URI hierarchy for the RESTCONF resources consists of an entry point
36 * container, 4 top-level resources, and 1 field.
38 * <li><b>/restconf</b> - {@link #getRoot()}
40 * <li><b>/config</b> - {@link #readConfigurationData(String, UriInfo)}
41 * {@link #updateConfigurationData(String, NormalizedNodeContext, UriInfo)}
42 * {@link #createConfigurationData(NormalizedNodeContext, UriInfo)}
43 * {@link #createConfigurationData(String, NormalizedNodeContext, UriInfo)}
44 * {@link #deleteConfigurationData(String)}
45 * <li><b>/operational</b> - {@link #readOperationalData(String, UriInfo)}
46 * <li>/modules - {@link #getModules(UriInfo)}
50 * <li><b>/operations</b> -
51 * {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
52 * {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
53 * <li>/version (field)
58 public interface RestconfService {
61 String JSON = "+json";
67 * Get all modules supported by controller.
69 * @param uriInfo URI info
70 * @return {@link NormalizedNodeContext}
71 * @deprecated do not use this method. It will be replaced by
72 * {@link RestconfDataService#readData(UriInfo)}
77 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
78 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
79 NormalizedNodeContext getModules(@Context UriInfo uriInfo);
82 * Get all modules supported by mount point.
84 * @param identifier mount point identifier
85 * @param uriInfo URI info
86 * @return {@link NormalizedNodeContext}
87 * @deprecated do not use this method. It will be replaced by
88 * {@link RestconfDataService#readData(String, UriInfo)}
92 @Path("/modules/{identifier:.+}")
93 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
94 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
95 NormalizedNodeContext getModules(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
100 * @param identifier path to target
101 * @param uriInfo URI info
102 * @return {@link NormalizedNodeContext}
103 * @deprecated do not use this method. It will be replaced by
104 * {@link RestconfDataService#readData(String, UriInfo)}
108 @Path("/modules/module/{identifier:.+}")
109 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
110 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
111 NormalizedNodeContext getModule(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
114 * List of rpc or action operations supported by the server.
116 * @param uriInfo URI information
117 * @return {@link NormalizedNodeContext}
118 * @deprecated do not use this method. It will be replaced by
119 * {@link RestconfOperationsService#getOperations(UriInfo)}
124 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
125 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
126 NormalizedNodeContext getOperations(@Context UriInfo uriInfo);
129 * Valid for mount points. List of operations supported by the server.
131 * @param identifier path parameter
132 * @param uriInfo URI information
133 * @return {@link NormalizedNodeContext}
134 * @deprecated do not use this method. It will be replaced by
135 * {@link RestconfOperationsService#getOperations(String, UriInfo)}
139 @Path("/operations/{identifier:.+}")
140 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
141 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
142 NormalizedNodeContext getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
145 * Invoke RPC operation.
147 * @param identifier module name and rpc identifier string for the desired operation
148 * @param payload {@link NormalizedNodeContext} - the body of the operation
149 * @param uriInfo URI info
150 * @return {@link NormalizedNodeContext}
151 * @deprecated do not use this method. It will be replaced by
152 * {@link RestconfInvokeOperationsService#invokeRpc(String, NormalizedNodeContext, UriInfo)}
156 @Path("/operations/{identifier:.+}")
157 @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
158 Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
159 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
160 @Consumes({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
161 Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
162 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
163 NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
164 @Context UriInfo uriInfo);
167 * Invoke RPC with default empty payload.
169 * @param identifier module name and rpc identifier string for the desired operation
170 * @param noPayload the body of the operation
171 * @param uriInfo URI info
172 * @return {@link NormalizedNodeContext}
173 * @deprecated Method is not used and will be removed
176 @Path("/operations/{identifier:.+}")
177 @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
178 Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
179 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
180 @Deprecated // method isn't use anywhere
181 NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier,
182 @DefaultValue("") String noPayload, @Context UriInfo uriInfo);
185 * Get target data resource from config data store.
187 * @param identifier path to target
188 * @param uriInfo URI info
189 * @return {@link NormalizedNodeContext}
190 * @deprecated do not use this method. It will be replaced by
191 * {@link RestconfDataService#readData(String, UriInfo)}
195 @Path("/config/{identifier:.+}")
196 @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
197 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
198 NormalizedNodeContext readConfigurationData(@Encoded @PathParam("identifier") String identifier,
199 @Context UriInfo uriInfo);
202 * Get target data resource from operational data store.
204 * @param identifier path to target
205 * @param uriInfo URI info
206 * @return {@link NormalizedNodeContext}
207 * @deprecated do not use this method. It will be replaced by
208 * {@link RestconfDataService#readData(String, UriInfo)}
212 @Path("/operational/{identifier:.+}")
213 @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
214 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
215 NormalizedNodeContext readOperationalData(@Encoded @PathParam("identifier") String identifier,
216 @Context UriInfo uriInfo);
219 * Create or replace the target data resource.
221 * @param identifier path to target
222 * @param payload data node for put to config DS
223 * @return {@link Response}
224 * @deprecated do not use this method. It will be replaced by
225 * {@link RestconfDataService#putData(String, NormalizedNodeContext, UriInfo)}
229 @Path("/config/{identifier:.+}")
230 @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
231 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
232 Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier,
233 NormalizedNodeContext payload, @Context UriInfo uriInfo);
236 * Create a data resource in target.
238 * @param identifier path to target
239 * @param payload new data
240 * @param uriInfo URI info
241 * @return {@link Response}
242 * @deprecated do not use this method. It will be replaced by
243 * {@link RestconfDataService#postData(String, NormalizedNodeContext, UriInfo)}
247 @Path("/config/{identifier:.+}")
248 @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
249 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
250 Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
251 @Context UriInfo uriInfo);
254 * Create a data resource.
256 * @param payload new data
257 * @param uriInfo URI info
258 * @return {@link Response}
259 * @deprecated do not use this method. It will be replaced by
260 * {@link RestconfDataService#postData(NormalizedNodeContext, UriInfo)}
265 @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
266 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
267 Response createConfigurationData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
270 * Delete the target data resource.
272 * @param identifier path to target
273 * @return {@link Response}
274 * @deprecated do not use this method. It will be replaced by
275 * {@link RestconfDataService#deleteData(String)}
279 @Path("/config/{identifier:.+}")
280 Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
283 * Subscribe to stream.
285 * @param identifier stream identifier
286 * @param uriInfo URI info
287 * @return {@link NormalizedNodeContext}
288 * @deprecated do not use this method. It will be replaced by
289 * {@link RestconfStreamsSubscriptionService#subscribeToStream(String, UriInfo)}
293 @Path("/streams/stream/{identifier:.+}")
294 NormalizedNodeContext subscribeToStream(@Encoded @PathParam("identifier") String identifier,
295 @Context UriInfo uriInfo);
298 * Get list of all streams.
300 * @param uriInfo URI info
301 * @return {@link NormalizedNodeContext}
302 * @deprecated do not use this method. It will be replaced by
303 * {@link RestconfDataService#readData(String, UriInfo)}
308 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
309 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
310 NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
313 * Ordered list of edits that are applied to the target datastore by the server.
315 * @param identifier path to target
316 * @param context edits
317 * @param uriInfo URI info
318 * @return {@link PatchStatusContext}
319 * @deprecated do not use this method. It will be replaced by
320 * {@link RestconfDataService#patchData(String, PatchContext, UriInfo)}
324 @Path("/config/{identifier:.+}")
325 @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
326 @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
327 PatchStatusContext patchConfigurationData(@Encoded @PathParam("identifier") String identifier, PatchContext
328 context, @Context UriInfo uriInfo);
331 * Ordered list of edits that are applied to the datastore by the server.
333 * @param context edits
334 * @param uriInfo URI info
335 * @return {@link PatchStatusContext}
336 * @deprecated do not use this method. It will be replaced by
337 * {@link RestconfDataService#patchData(PatchContext, UriInfo)}
342 @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
343 @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
344 PatchStatusContext patchConfigurationData(PatchContext context, @Context UriInfo uriInfo);