import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
/**
* The URI hierarchy for the RESTCONF resources consists of an entry
- * point container, 3 top-level resources, and 1 field. Refer to
- * Section 5 for details on each URI.
- * <ul>
+ * point container, 4 top-level resources, and 1 field.
+ * <ul>
* <li><b>/restconf</b> - {@link #getRoot()}
- * <ul><li><b>/config</b>
- * <li><b>/operational</b> - {@link #readAllData()} - Added in Draft02
- * <li><b>/datastore</b> - {@link #readAllData()}
- * <ul>
- * <li>/(top-level-data-nodes) (config=true or false)
- * </ul>
- * <li>/modules
- * <ul><li>/module
- * <li>/name
- * <li>/revision
- * <li>/namespace
- * <li>/feature
- * <li>/deviation
- * </ul>
- * <li>/operations
- * <ul>
- * <li>/(custom protocol operations)
- * </ul>
- * <li>/version (field)
+ * <ul>
+ * <li><b>/config</b> - {@link #readConfigurationData(String)}
+ * {@link #updateConfigurationData(String, CompositeNode)}
+ * {@link #createConfigurationData(CompositeNode)}
+ * {@link #createConfigurationData(String, CompositeNode)}
+ * {@link #deleteConfigurationData(String)}
+ * <li><b>/operational</b> - {@link #readOperationalData(String)}
+ * <li>/modules - {@link #getModules()}
+ * <ul>
+ * <li>/module
+ * </ul>
+ * <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
+ * {@link #invokeRpc(String, CompositeNode)}
+ * <li>/version (field)
* </ul>
+ * </ul>
*/
@Path("/")
public interface RestconfService {
@POST
@Path("/operations/{identifier}")
- @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
+ @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
+ Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
- @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
+ @Consumes({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
+ Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
public StructuredData invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload);
@POST
@Path("/operations/{identifier}")
- @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
+ @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
+ Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
- public StructuredData invokeRpc(@PathParam("identifier") String identifier);
+ public StructuredData invokeRpc(@PathParam("identifier") String identifier, @DefaultValue("") String noPayload);
@GET
@Path("/config/{identifier:.+}")
String uriPath = "ietf-interfaces:interfaces";
String uri = createUri(uriPrefix, uriPath);
when(restconfService.invokeRpc(eq(uriPath), any(CompositeNode.class))).thenReturn(null);
- post(uri, Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+JSON, jsonData);
+ post(uri, Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+JSON, jsonData);
verify(restconfService, times(1)).invokeRpc(eq(uriPath), any(CompositeNode.class));
- post(uri, Draft02.MediaTypes.DATA+XML, Draft02.MediaTypes.DATA+XML, xmlData);
+ post(uri, Draft02.MediaTypes.OPERATION+XML, Draft02.MediaTypes.OPERATION+XML, xmlData);
verify(restconfService, times(2)).invokeRpc(eq(uriPath), any(CompositeNode.class));
post(uri, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, jsonData);
verify(restconfService, times(3)).invokeRpc(eq(uriPath), any(CompositeNode.class));