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.MediaType;
20 import javax.ws.rs.core.Response;
22 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
23 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
26 * The URI hierarchy for the RESTCONF resources consists of an entry
27 * point container, 4 top-level resources, and 1 field.
29 * <li><b>/restconf</b> - {@link #getRoot()}
31 * <li><b>/config</b> - {@link #readConfigurationData(String)}
32 * {@link #updateConfigurationData(String, CompositeNode)}
33 * {@link #createConfigurationData(CompositeNode)}
34 * {@link #createConfigurationData(String, CompositeNode)}
35 * {@link #deleteConfigurationData(String)}
36 * <li><b>/operational</b> - {@link #readOperationalData(String)}
37 * <li>/modules - {@link #getModules()}
41 * <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
42 * {@link #invokeRpc(String, CompositeNode)}
43 * <li>/version (field)
48 public interface RestconfService {
50 public static final String XML = "+xml";
51 public static final String JSON = "+json";
54 public Object getRoot();
58 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
59 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
60 public StructuredData getModules();
63 @Path("/modules/{identifier:.+}")
64 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
65 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
66 public StructuredData getModules(@PathParam("identifier") String identifier);
69 @Path("/modules/module/{identifier:.+}")
70 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
71 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
72 public StructuredData getModule(@PathParam("identifier") String identifier);
76 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
77 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
78 public StructuredData getOperations();
81 @Path("/operations/{identifier:.+}")
82 @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
83 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
84 public StructuredData getOperations(@PathParam("identifier") String identifier);
87 @Path("/operations/{identifier:.+}")
88 @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
89 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
90 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
91 @Consumes({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 public StructuredData invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload);
97 @Path("/operations/{identifier:.+}")
98 @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
99 Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
100 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
101 public StructuredData invokeRpc(@PathParam("identifier") String identifier, @DefaultValue("") String noPayload);
104 @Path("/config/{identifier:.+}")
105 @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
106 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
107 public StructuredData readConfigurationData(@PathParam("identifier") String identifier);
110 @Path("/operational/{identifier:.+}")
111 @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
112 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
113 public StructuredData readOperationalData(@PathParam("identifier") String identifier);
116 @Path("/config/{identifier:.+}")
117 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
118 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
119 public Response updateConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
122 @Path("/config/{identifier:.+}")
123 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
124 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
125 public Response createConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
129 @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
130 MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
131 public Response createConfigurationData(CompositeNode payload);
134 @Path("/config/{identifier:.+}")
135 public Response deleteConfigurationData(@PathParam("identifier") String identifier);