X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Fhosttracker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fhosttracker%2Fnorthbound%2FHostTrackerNorthbound.java;h=74c13d11f129943ba45e449411adfbc9f09d41e3;hp=91185bb40573eea09b8e26c5aeb596e32eb23ab4;hb=caee336f062eba4909ba53cbaccdde0714236134;hpb=97fd2a787cccc23c9224d5aa3d2db1c0ee344b67
diff --git a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java
index 91185bb405..74c13d11f1 100644
--- a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java
+++ b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java
@@ -26,7 +26,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
-import javax.xml.bind.JAXBElement;
import org.codehaus.enunciate.jaxrs.ResponseCode;
import org.codehaus.enunciate.jaxrs.StatusCodes;
@@ -62,11 +61,7 @@ import org.opendaylight.controller.switchmanager.ISwitchManager;
* 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.
*
*/
@@ -135,11 +130,10 @@ public class HostTrackerNorthbound {
*
* Example:
*
- * RequestURL:
+ * Request URL:
+ * http://localhost:8080/controller/nb/v2/hosttracker/default/hosts/active
*
- * http://localhost:8080/controller/nb/v2/host/default
- *
- * Response in XML
+ * Response body in XML
*
* <list>
* <hostConfig>
@@ -164,7 +158,7 @@ public class HostTrackerNorthbound {
* </hostConfig>
* </list>
*
- * Response in JSON:
+ * Response body in JSON:
*
* {
* "hostConfig":[
@@ -192,7 +186,7 @@ public class HostTrackerNorthbound {
* }
*
*/
- @Path("/{containerName}")
+ @Path("/{containerName}/hosts/active")
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@TypeHint(Hosts.class)
@@ -222,11 +216,10 @@ public class HostTrackerNorthbound {
*
* Example:
*
- * RequestURL:
- *
- * http://localhost:8080/controller/nb/v2/host/default/inactive
+ * Request URL:
+ * http://localhost:8080/controller/nb/v2/hosttracker/default/hosts/inactive
*
- * Response in XML
+ * Response body in XML
*
* <list>
* <hostConfig>
@@ -251,7 +244,7 @@ public class HostTrackerNorthbound {
* </hostConfig>
* </list>
*
- * Response in JSON:
+ * Response body in JSON:
*
* {
* "hostConfig":[
@@ -279,7 +272,7 @@ public class HostTrackerNorthbound {
* }
*
*/
- @Path("/{containerName}/inactive")
+ @Path("/{containerName}/hosts/inactive")
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@TypeHint(Hosts.class)
@@ -310,11 +303,10 @@ public class HostTrackerNorthbound {
*
* Example:
*
- * RequestURL:
- *
- * http://localhost:8080/controller/nb/v2/host/default/1.1.1.1
+ * Request URL:
+ * http://localhost:8080/controller/nb/v2/hosttracker/default/address/1.1.1.1
*
- * Response in XML
+ * Response body in XML
*
* <hostConfig>
* <dataLayerAddress>00:00:00:00:01:01</dataLayerAddress>
@@ -327,7 +319,7 @@ public class HostTrackerNorthbound {
* <staticHost>false</staticHost>
* </hostConfig>
*
- * Response in JSON:
+ * Response body in JSON:
*
* {
* "dataLayerAddress":"00:00:00:00:01:01",
@@ -341,7 +333,7 @@ public class HostTrackerNorthbound {
* }
*
*/
- @Path("/{containerName}/{networkAddress}")
+ @Path("/{containerName}/address/{networkAddress}")
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@TypeHint(HostConfig.class)
@@ -374,7 +366,8 @@ public class HostTrackerNorthbound {
}
/**
- * Add a Static Host configuration
+ * Add a Static Host configuration. If a host by the given address already
+ * exists, this method will respond with a non-successful status response.
*
* @param containerName
* Name of the Container. The Container name for the base
@@ -389,11 +382,10 @@ public class HostTrackerNorthbound {
*
* Example:
*
- * RequestURL:
+ * Request URL:
+ * http://localhost:8080/controller/nb/v2/hosttracker/default/address/1.1.1.1
*
- * http://localhost:8080/controller/nb/v2/host/default/1.1.1.1
- *
- * Request in XML
+ * Request body in XML
*
* <hostConfig>
* <dataLayerAddress>00:00:00:00:01:01</dataLayerAddress>
@@ -402,11 +394,11 @@ public class HostTrackerNorthbound {
* <nodeId>00:00:00:00:00:00:00:01</nodeId>
* <nodeConnectorType>OF</nodeConnectorType>
* <nodeConnectorId>9</nodeConnectorId>
- * <vlan>0</vlan>
- * <staticHost>false</staticHost>
+ * <vlan>1</vlan>
+ * <staticHost>true</staticHost>
* </hostConfig>
*
- * Request in JSON:
+ * Request body in JSON:
*
* {
* "dataLayerAddress":"00:00:00:00:01:01",
@@ -414,14 +406,14 @@ public class HostTrackerNorthbound {
* "nodeId":"00:00:00:00:00:00:00:01",
* "nodeConnectorType":"OF",
* "nodeConnectorId":"9",
- * "vlan":"0",
- * "staticHost":"false",
+ * "vlan":"1",
+ * "staticHost":"true",
* "networkAddress":"1.1.1.1"
* }
*
*/
- @Path("/{containerName}/{networkAddress}")
+ @Path("/{containerName}/address/{networkAddress}")
@PUT
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes({
@@ -432,7 +424,7 @@ public class HostTrackerNorthbound {
@ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
public Response addHost(@Context UriInfo uriInfo, @PathParam("containerName") String containerName,
@PathParam("networkAddress") String networkAddress,
- @TypeHint(HostConfig.class) JAXBElement hostConfig) {
+ @TypeHint(HostConfig.class) HostConfig hostConfig) {
if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
return Response.status(Response.Status.UNAUTHORIZED)
@@ -443,7 +435,7 @@ public class HostTrackerNorthbound {
IfIptoHost hostTracker = getIfIpToHostService(containerName);
- HostConfig hc = hostConfig.getValue();
+ HostConfig hc = hostConfig;
if (!networkAddress.equals(hc.getNetworkAddress())) {
return Response.status(Response.Status.CONFLICT)
.entity("Resource name in config object doesn't match URI")
@@ -475,9 +467,15 @@ public class HostTrackerNorthbound {
* @param networkAddress
* IP Address
* @return Response as dictated by the HTTP Response code.
+ *
+ * Example:
+ *
+ * Request URL:
+ * http://localhost:8080/controller/nb/v2/hosttracker/default/address/1.1.1.1
+ *
*/
- @Path("/{containerName}/{networkAddress}")
+ @Path("/{containerName}/address/{networkAddress}")
@DELETE
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes({