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.netconf.sal.rest.impl.PATCH;
26 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
27 import org.opendaylight.netconf.sal.restconf.impl.PATCHContext;
28 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusContext;
29 import org.opendaylight.restconf.rest.api.services.RestconfModulesService;
30 import org.opendaylight.restconf.rest.api.services.RestconfOperationsService;
31 import org.opendaylight.restconf.rest.api.services.RestconfStreamsService;
32 import org.opendaylight.restconf.restful.services.api.RestconfDataService;
33 import org.opendaylight.restconf.restful.services.api.RestconfInvokeOperationsService;
36 * The URI hierarchy for the RESTCONF resources consists of an entry point container, 4 top-level resources, and 1
39 * <li><b>/restconf</b> - {@link #getRoot()}
41 * <li><b>/config</b> - {@link #readConfigurationData(String, UriInfo)}
42 * {@link #updateConfigurationData(String, NormalizedNodeContext)}
43 * {@link #createConfigurationData(NormalizedNodeContext, UriInfo)}
44 * {@link #createConfigurationData(String, NormalizedNodeContext, UriInfo)}
45 * {@link #deleteConfigurationData(String)}
46 * <li><b>/operational</b> - {@link #readOperationalData(String, UriInfo)}
47 * <li>/modules - {@link #getModules(UriInfo)}
51 * <li><b>/operations</b> - {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
52 * {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
53 * <li>/version (field)
58 public interface RestconfService {
60 public static final String XML = "+xml";
61 public static final String JSON = "+json";
64 public Object getRoot();
67 * @deprecated do not use this method. It will be replaced by
68 * {@link RestconfModulesService#getModules(UriInfo)}
73 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
74 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
75 public NormalizedNodeContext getModules(@Context UriInfo uriInfo);
78 * @deprecated do not use this method. It will be replaced by
79 * {@link RestconfModulesService#getModules(String, UriInfo)}
83 @Path("/modules/{identifier:.+}")
84 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
85 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
86 public NormalizedNodeContext getModules(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
89 * @deprecated do not use this method. It will be replaced by
90 * {@link RestconfModulesService#getModule(String, UriInfo)}
94 @Path("/modules/module/{identifier:.+}")
95 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
96 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
97 public NormalizedNodeContext getModule(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
100 * @deprecated do not use this method. It will be replaced by
101 * {@link RestconfOperationsService#getOperations(UriInfo)}
106 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
107 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
108 public NormalizedNodeContext getOperations(@Context UriInfo uriInfo);
111 * @deprecated do not use this method. It will be replaced by
112 * {@link RestconfOperationsService#getOperations(String, UriInfo)}
116 @Path("/operations/{identifier:.+}")
117 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
118 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
119 public NormalizedNodeContext getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
122 * @deprecated do not use this method. It will be replaced by
123 * {@link RestconfInvokeOperationsService#invokeRpc(String, NormalizedNodeContext, UriInfo)}
127 @Path("/operations/{identifier:.+}")
128 @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
129 Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
130 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
131 @Consumes({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
132 Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
133 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
134 public NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
135 @Context UriInfo uriInfo);
138 @Path("/operations/{identifier:.+}")
139 @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
140 Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
141 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
142 @Deprecated // method isn't use anywhere
143 public NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier,
144 @DefaultValue("") String noPayload, @Context UriInfo uriInfo);
147 * @deprecated do not use this method. It will be replaced by
148 * {@link RestconfDataService#readData(String, UriInfo)}
152 @Path("/config/{identifier:.+}")
153 @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
154 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
155 public NormalizedNodeContext readConfigurationData(@Encoded @PathParam("identifier") String identifier,
156 @Context UriInfo uriInfo);
159 * @deprecated do not use this method. It will be replaced by
160 * {@link RestconfDataService#readData(String, UriInfo)}
164 @Path("/operational/{identifier:.+}")
165 @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
166 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
167 public NormalizedNodeContext readOperationalData(@Encoded @PathParam("identifier") String identifier,
168 @Context UriInfo uriInfo);
171 * @deprecated do not use this method. It will be replaced by
172 * {@link RestconfDataService#putData(String, NormalizedNodeContext)}
176 @Path("/config/{identifier:.+}")
177 @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
178 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
179 public Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload);
182 * @deprecated do not use this method. It will be replaced by
183 * {@link RestconfDataService#postData(String, NormalizedNodeContext, UriInfo)}
187 @Path("/config/{identifier:.+}")
188 @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
189 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
190 public Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
191 @Context UriInfo uriInfo);
194 * @deprecated do not use this method. It will be replaced by
195 * {@link RestconfDataService#postData(NormalizedNodeContext, UriInfo)}
200 @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
201 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
202 public Response createConfigurationData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
205 * @deprecated do not use this method. It will be replaced by
206 * {@link RestconfDataService#deleteData(String)}
210 @Path("/config/{identifier:.+}")
211 public Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
214 @Path("/streams/stream/{identifier:.+}")
215 public Response subscribeToStream(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
218 * @deprecated do not use this method. It will be replaced by
219 * {@link RestconfStreamsService#getAvailableStreams(UriInfo)}
224 @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
225 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
226 public NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
229 * @deprecated do not use this method. It will be replaced by
230 * {@link RestconfDataService#patchData(String, PATCHContext, UriInfo)}
234 @Path("/config/{identifier:.+}")
235 @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
236 @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
237 PATCHStatusContext patchConfigurationData(@Encoded @PathParam("identifier") String identifier, PATCHContext
238 context, @Context UriInfo uriInfo);
241 * @deprecated do not use this method. It will be replaced by
242 * {@link RestconfDataService#patchData(PATCHContext, UriInfo)}
247 @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
248 @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
249 PATCHStatusContext patchConfigurationData(PATCHContext context, @Context UriInfo uriInfo);