X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Ftopology%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Ftopology%2Fnorthbound%2FTopologyNorthboundJAXRS.java;h=ff26bfd21f30a6b67f683607924b366ef32a1011;hb=refs%2Fchanges%2F49%2F1149%2F2;hp=c20cb26885006f0f5a3234466bfb4445ed641033;hpb=f5ae77b71afeee5667bf2a8ad9d0753025ee1947;p=controller.git diff --git a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java index c20cb26885..ff26bfd21f 100644 --- a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java +++ b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java @@ -52,11 +52,7 @@ import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig; * Authentication realm : opendaylight
* Transport : HTTP and HTTPS
*
- * HTTPS Authentication is disabled by default. Administrator can enable it in - * tomcat-server.xml after adding a proper keystore / SSL certificate from a - * trusted authority.
- * More info : - * http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration + * HTTPS Authentication is disabled by default. */ @Path("/") @@ -81,7 +77,7 @@ public class TopologyNorthboundJAXRS { * The container for which we want to retrieve the topology (Eg. * 'default') * - * @return A List of EdgeProps each EdgeProp represent an Edge of the grap + * @return A List of EdgeProps each EdgeProp represent an Edge of the graph * with the corresponding properties attached to it. * *
@@ -200,8 +196,7 @@ public class TopologyNorthboundJAXRS {
         if (topo != null) {
             List res = new ArrayList();
             for (Map.Entry> entry : topo.entrySet()) {
-                EdgeProperties el = new EdgeProperties(entry.getKey(),
-                        entry.getValue());
+                EdgeProperties el = new EdgeProperties(entry.getKey(), entry.getValue());
                 res.add(el);
             }
             return new Topology(res);
@@ -223,7 +218,7 @@ public class TopologyNorthboundJAXRS {
      * Example:
      *
      * RequestURL:
-     * http://localhost:8080/controller/nb/v2/topology/default/user-link
+     * http://localhost:8080/controller/nb/v2/topology/default/userLinks
      *
      * Response in XML:
      * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -242,7 +237,7 @@ public class TopologyNorthboundJAXRS {
      *
      * 
*/ - @Path("/{containerName}/user-link") + @Path("/{containerName}/userLinks") @GET @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @TypeHint(TopologyUserLinks.class) @@ -279,6 +274,8 @@ public class TopologyNorthboundJAXRS { * * @param containerName * Name of the Container (Eg. 'default') + * @param name + * Name of the user link * @param TopologyUserLinkConfig * in JSON or XML format * @return Response as dictated by the HTTP Response Status code @@ -288,7 +285,7 @@ public class TopologyNorthboundJAXRS { * Example: * * RequestURL: - * http://localhost:8080/controller/nb/v2/topology/default/user-link + * http://localhost:8080/controller/nb/v2/topology/default/userLink/link1 * * Request in XML: * <?xml version="1.0" encoding="UTF-8" standalone="yes"?> @@ -304,7 +301,7 @@ public class TopologyNorthboundJAXRS { * * */ - @Path("/{containerName}/user-link") + @Path("/{containerName}/userLink/{name}") @PUT @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @@ -316,7 +313,8 @@ public class TopologyNorthboundJAXRS { @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") }) public Response addUserLink( @PathParam(value = "containerName") String containerName, - @TypeHint(TopologyUserLinkConfig.class) JAXBElement userLinkConfig) { + @PathParam(value = "name") String name, + @TypeHint(TopologyUserLinkConfig.class) TopologyUserLinkConfig userLinkConfig) { if (!NorthboundUtils.isAuthorized( getUserName(), containerName, Privilege.WRITE, this)) { @@ -331,9 +329,9 @@ public class TopologyNorthboundJAXRS { RestMessages.NOCONTAINER.toString()); } - Status status = topologyManager.addUserLink(userLinkConfig.getValue()); + Status status = topologyManager.addUserLink(userLinkConfig); if (status.isSuccess()) { - NorthboundUtils.auditlog("User Link", username, "added", userLinkConfig.getValue().getName(), containerName); + NorthboundUtils.auditlog("User Link", username, "added", userLinkConfig.getName(), containerName); return Response.status(Response.Status.CREATED).build(); } throw new InternalServerErrorException(status.getDescription()); @@ -353,16 +351,16 @@ public class TopologyNorthboundJAXRS { * Example: * * RequestURL: - * http://localhost:8080/controller/nb/v2/topology/default/user-link/config1 + * http://localhost:8080/controller/nb/v2/topology/default/userLink/config1 * * */ - @Path("/{containerName}/user-link/{name}") + @Path("/{containerName}/userLink/{name}") @DELETE @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @StatusCodes({ - @ResponseCode(code = 200, condition = "Operation successful"), + @ResponseCode(code = 204, condition = "User link removed successfully"), @ResponseCode(code = 404, condition = "The Container Name or Link Configuration Name was not found"), @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") }) public Response deleteUserLink( @@ -385,8 +383,8 @@ public class TopologyNorthboundJAXRS { Status ret = topologyManager.deleteUserLink(name); if (ret.isSuccess()) { NorthboundUtils.auditlog("User Link", username, "removed", name, containerName); - return Response.ok().build(); + return Response.noContent().build(); } - throw new ResourceNotFoundException(ret.getDescription()); + return NorthboundUtils.getResponse(ret); } }