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.controller.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.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.Encoded;
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;
25 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
26 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
29 * The URI hierarchy for the RESTCONF resources consists of an entry
30 * point container, 4 top-level resources, and 1 field.
32 * <li><b>/restconf</b> - {@link #getRoot()}
34 * <li><b>/config</b> - {@link #readConfigurationData(String)}
35 * {@link #updateConfigurationData(String, CompositeNode)}
36 * {@link #createConfigurationData(CompositeNode)}
37 * {@link #createConfigurationData(String, CompositeNode)}
38 * {@link #deleteConfigurationData(String)}
39 * <li><b>/operational</b> - {@link #readOperationalData(String)}
40 * <li>/modules - {@link #getModules()}
44 * <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
45 * {@link #invokeRpc(String, CompositeNode)}
46 * <li>/version (field)
51 public interface RestconfService {
53 public static final String XML = "+xml";
54 public static final String JSON = "+json";
57 public Object getRoot();
61 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
62 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
63 public StructuredData getModules();
66 @Path("/modules/{identifier:.+}")
67 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
68 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
69 public StructuredData getModules(@PathParam("identifier") String identifier);
72 @Path("/modules/module/{identifier:.+}")
73 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
74 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
75 public StructuredData getModule(@PathParam("identifier") String identifier);
79 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
80 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
81 public StructuredData getOperations();
84 @Path("/operations/{identifier:.+}")
85 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
86 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
87 public StructuredData getOperations(@PathParam("identifier") String identifier);
90 @Path("/operations/{identifier:.+}")
91 @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
92 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
93 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
94 @Consumes({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
95 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
96 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
97 public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
100 @Path("/operations/{identifier:.+}")
101 @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
102 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
103 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
104 public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier, @DefaultValue("") String noPayload);
107 @Path("/config/{identifier:.+}")
108 @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
109 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
110 public StructuredData readConfigurationData(@Encoded @PathParam("identifier") String identifier,
111 @Context UriInfo depth);
114 @Path("/operational/{identifier:.+}")
115 @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
116 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
117 public StructuredData readOperationalData(@Encoded @PathParam("identifier") String identifier,
118 @Context UriInfo depth);
121 @Path("/config/{identifier:.+}")
122 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
123 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
124 public Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
127 @Path("/config/{identifier:.+}")
128 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
129 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
130 public Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
134 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
135 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
136 public Response createConfigurationData(CompositeNode payload);
139 @Path("/config/{identifier:.+}")
140 public Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
143 @Path("/streams/stream/{identifier:.+}")
144 public Response subscribeToStream(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
148 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
149 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
150 public StructuredData getAvailableStreams();