Fixed RESTCONF integration, added IT skeleton
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / api / RestconfService.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.rest.api;
9
10 import static org.opendaylight.controller.sal.restconf.impl.MediaTypes.API;
11
12 import javax.ws.rs.GET;
13 import javax.ws.rs.POST;
14 import javax.ws.rs.PUT;
15 import javax.ws.rs.Path;
16 import javax.ws.rs.PathParam;
17 import javax.ws.rs.Produces;
18
19 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
20 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
21
22 /**
23  *   The URI hierarchy for the RESTCONF resources consists of an entry
24  *   point container, 3 top-level resources, and 1 field.  Refer to
25  *  Section 5 for details on each URI.
26  *    <ul>
27  *    <li><b>/restconf</b> - {@link #getRoot()}
28  *     <ul><li><b>/datastore</b> - {@link #readAllData()}
29  *         <ul>
30  *            <li>/(top-level-data-nodes) (config=true or false)
31  *         </ul>
32  *         <li>/modules
33  *          <ul><li>/module
34  *              <li>/name
35  *              <li>/revision
36  *              <li>/namespace
37  *              <li>/feature
38  *             <li>/deviation
39  *          </ul>
40  *          <li>/operations
41  *          <ul>
42  *             <li>/(custom protocol operations)
43  *          </ul>
44  *         <li>/version (field)
45  *     </ul>
46  */
47 @Path("/")
48 public interface RestconfService {
49
50     public static final String XML = "+xml";
51     public static final String JSON = "+json";
52
53     @GET
54     public Object getRoot();
55
56     @GET
57     @Path("/datastore")
58     @Produces({API+JSON,API+XML})
59     public Object readAllData();
60
61     @GET
62     @Path("/datastore/{identifier:.+}")
63     @Produces({API+JSON,API+XML})
64     public StructuredData readData(@PathParam("identifier") String identifier);
65
66     @PUT
67     @Path("/datastore/{identifier:.+}")
68     @Produces({API+JSON,API+XML})
69     public Object createConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
70
71     @POST
72     @Path("/datastore/{identifier:.+}")
73     @Produces({API+JSON,API+XML})
74     public Object updateConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
75
76     @GET
77     @Path("/modules")
78     @Produces({API+JSON,API+XML})
79     public Object getModules();
80
81     @POST
82     @Path("/operations/{identifier}")
83     @Produces({API+JSON,API+XML})
84     public StructuredData invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload);
85 }