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.core.Context;
20 import javax.ws.rs.core.MediaType;
21 import javax.ws.rs.core.Response;
22 import javax.ws.rs.core.UriInfo;
24 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
25 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
28 * The URI hierarchy for the RESTCONF resources consists of an entry
29 * point container, 4 top-level resources, and 1 field.
31 * <li><b>/restconf</b> - {@link #getRoot()}
33 * <li><b>/config</b> - {@link #readConfigurationData(String)}
34 * {@link #updateConfigurationData(String, CompositeNode)}
35 * {@link #createConfigurationData(CompositeNode)}
36 * {@link #createConfigurationData(String, CompositeNode)}
37 * {@link #deleteConfigurationData(String)}
38 * <li><b>/operational</b> - {@link #readOperationalData(String)}
39 * <li>/modules - {@link #getModules()}
43 * <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
44 * {@link #invokeRpc(String, CompositeNode)}
45 * <li>/version (field)
50 public interface RestconfService {
52 public static final String XML = "+xml";
53 public static final String JSON = "+json";
56 public Object getRoot();
60 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
61 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
62 public StructuredData getModules();
65 @Path("/modules/{identifier:.+}")
66 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
67 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
68 public StructuredData getModules(@PathParam("identifier") String identifier);
71 @Path("/modules/module/{identifier:.+}")
72 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
73 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
74 public StructuredData getModule(@PathParam("identifier") String identifier);
78 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
79 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
80 public StructuredData getOperations();
83 @Path("/operations/{identifier:.+}")
84 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
85 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
86 public StructuredData getOperations(@PathParam("identifier") String identifier);
89 @Path("/operations/{identifier:.+}")
90 @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
91 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
92 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
93 @Consumes({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
94 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
95 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
96 public StructuredData invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload);
99 @Path("/operations/{identifier:.+}")
100 @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
101 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
102 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
103 public StructuredData invokeRpc(@PathParam("identifier") String identifier, @DefaultValue("") String noPayload);
106 @Path("/config/{identifier:.+}")
107 @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
108 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
109 public StructuredData readConfigurationData(@PathParam("identifier") String identifier);
112 @Path("/operational/{identifier:.+}")
113 @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
114 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
115 public StructuredData readOperationalData(@PathParam("identifier") String identifier);
118 @Path("/config/{identifier:.+}")
119 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
120 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
121 public Response updateConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
124 @Path("/config/{identifier:.+}")
125 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
126 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
127 public Response createConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
131 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
132 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
133 public Response createConfigurationData(CompositeNode payload);
136 @Path("/config/{identifier:.+}")
137 public Response deleteConfigurationData(@PathParam("identifier") String identifier);
140 @Path("/streams/stream/{identifier:.+}")
141 public Response subscribeToStream(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);