Add skeleton affinity northbound API class file. 39/1039/1
authorSuchi Raman <suchi.raman@plexxi.com>
Wed, 28 Aug 2013 22:01:04 +0000 (18:01 -0400)
committerSuchi Raman <suchi.raman@plexxi.com>
Wed, 28 Aug 2013 22:01:04 +0000 (18:01 -0400)
To be completed.

Signed-off-by: Suchi Raman <suchi.raman@plexxi.com>
affinity/api/META-INF/MANIFEST.MF
affinity/implementation/META-INF/MANIFEST.MF
affinity/northbound/src/main/java/org/opendaylight/controller/affinity/northbound/AffinityNorthbound.java

index 1caed0717d2e79bc0ff0211175bb28bb46378596..0725535b687ba849d743387d60e62a6faa86f4b4 100644 (file)
@@ -1,5 +1,5 @@
 Manifest-Version: 1.0\r
-Bnd-LastModified: 1377719211376\r
+Bnd-LastModified: 1377719919818\r
 Build-Jdk: 1.6.0_37\r
 Built-By: sraman\r
 Bundle-ManifestVersion: 2\r
index 2498a063acb81f15c3c7325b0910c8914025cdab..2fbb4a1ecf6ff98dace4c5c05297cf455d548f76 100644 (file)
@@ -1,5 +1,5 @@
 Manifest-Version: 1.0\r
-Bnd-LastModified: 1377719213514\r
+Bnd-LastModified: 1377719922284\r
 Build-Jdk: 1.6.0_37\r
 Built-By: sraman\r
 Bundle-Activator: org.opendaylight.controller.affinity.internal.Activato\r
index 9510b4411963e82f8024c40449c77120c71539ee..082c75fe47809ecfe287aaa454e3e9b2d2b817c9 100644 (file)
@@ -43,9 +43,8 @@ import org.opendaylight.controller.sal.utils.GlobalConstants;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.affinity.IAffinityManager;
-import org.opendaylight.controller.affinity.AffinityConfig;
-import org.opendaylight.controller.affinity.AffinityGroup;
 import org.opendaylight.controller.affinity.AffinityLink;
+import org.opendaylight.controller.affinity.AffinityGroup;
 
 /**
  * The class provides Northbound REST APIs to access affinity configuration.
@@ -264,178 +263,4 @@ public class AffinityNorthbound {
         }
         throw new InternalServerErrorException(ret.getDescription());
     }
-
-
-    /**
-     * Add an affinity group to the configuration database
-     *
-     * @param containerName
-     *            Name of the Container
-     * @param affinityGroup
-     *            Name of the new affinity being added
-     * @return Response as dictated by the HTTP Response Status code
-     */
-
-    @Path("/{containerName}/create/group/{name}")
-    @PUT
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @TypeHint(Response.class)
-    @StatusCodes({
-            @ResponseCode(code = 200, condition = "Operation successful"),
-            @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
-            @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
-    public Response addAffinityGroup(
-            @PathParam("containerName") String containerName,
-            @PathParam("groupName") String groupName) {
-       
-        if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
-            throw new UnauthorizedException("User is not authorized to perform this operation on container "
-                                            + containerName);
-        }
-
-        IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
-        if (affinityManager == null) {
-            throw new ServiceUnavailableException("Affinity Manager "
-                                                  + RestMessages.SERVICEUNAVAILABLE.toString());
-        }
-
-        AffinityGroup ag = new AffinityGroup(groupName);
-        Status ret = affinityManager.addAffinityGroup(ag);
-        if (ret.isSuccess()) {
-            return Response.status(Response.Status.CREATED).build();
-        }
-        throw new InternalServerErrorException(ret.getDescription());
-    }
-
-    /**
-     * Add an element to an affinity group.
-     *
-     * @param containerName
-     *            Name of the Container
-     * @param affinityGroup
-     *            Name of the group
-     * @param address
-     *            IP or Mac address of the 
-     * @return Response as dictated by the HTTP Response Status code
-     */
-
-    @Path("/{containerName}/{groupname}/add/ip/{address}")
-    @PUT
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @TypeHint(Response.class)
-    @StatusCodes({
-            @ResponseCode(code = 200, condition = "Operation successful"),
-            @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
-            @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
-    public Response addIpAddress(
-            @PathParam("containerName") String containerName,
-            @PathParam("groupName") String groupName,
-            @PathParam("address") String ipaddress) {
-       
-        IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
-        if (affinityManager == null) {
-            throw new ServiceUnavailableException("Affinity Manager "
-                                                  + RestMessages.SERVICEUNAVAILABLE.toString());
-        }
-
-        AffinityGroup ag = affinityManager.getGroup(groupName);
-        Status ret = ag.addAffinityElement(ipaddress);
-
-        if (ret.isSuccess()) {
-            return Response.status(Response.Status.CREATED).build();
-        }
-        throw new InternalServerErrorException(ret.getDescription());
-    }
-
-
-    /**
-     * Delete an element from an affinity group.
-     *
-     * @param containerName
-     *            Name of the Container
-     * @param affinityGroup
-     *            Name of the group
-     * @param address
-     *            IP or Mac address of the 
-     * @return Response as dictated by the HTTP Response Status code
-     */
-
-    @Path("/{containerName}/{groupname}/delete/ip/{address}")
-    @PUT
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @TypeHint(Response.class)
-    @StatusCodes({
-            @ResponseCode(code = 200, condition = "Operation successful"),
-            @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
-            @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
-    public Response deleteIpAddress(
-            @PathParam("containerName") String containerName,
-            @PathParam("groupName") String groupName,
-            @PathParam("address") String ipaddress) {
-       
-        IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
-        if (affinityManager == null) {
-            throw new ServiceUnavailableException("Affinity Manager "
-                                                  + RestMessages.SERVICEUNAVAILABLE.toString());
-        }
-
-        AffinityGroup ag = affinityManager.getGroup(groupName);
-        Status ret = ag.removeAffinityElement(ipaddress);
-
-        if (ret.isSuccess()) {
-            return Response.status(Response.Status.CREATED).build();
-        }
-        throw new InternalServerErrorException(ret.getDescription());
-    }
-
-
-
-    /**
-     * Add an affinity link to the database and set its from/to groups.
-     *
-     * @param containerName
-     *            Name of the Container
-     * @param affinityLink
-     *            Name of the affinity link
-     * @param group1
-     *            Name of the affinity group
-     * @param group2
-     *            Name of the affinity group
-     * @return Response as dictated by the HTTP Response Status code
-     */
-
-    @Path("/{containerName}/create/link/{linkName}/from/{group1}/to/{group2}")
-    @PUT
-    @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
-    @TypeHint(Response.class)
-    @StatusCodes({
-            @ResponseCode(code = 200, condition = "Operation successful"),
-            @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
-            @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
-    public Response addAffinityLink(
-            @PathParam("containerName") String containerName,
-            @PathParam("linkName") String linkName,
-            @PathParam("group1") String group1,
-            @PathParam("group2") String group2) {
-        IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
-        if (affinityManager == null) {
-            throw new ServiceUnavailableException("Affinity Manager "
-                                                  + RestMessages.SERVICEUNAVAILABLE.toString());
-        }
-
-       /* Add the new link object. */
-        AffinityLink al = new AffinityLink(linkName);
-        Status ret = affinityManager.addAffinityLink(al);
-        if (!ret.isSuccess()) {
-           throw new InternalServerErrorException(ret.getDescription());
-        } 
-       AffinityGroup ag1 = affinityManager.getAffinityGroup(ag1);
-       AffinityGroup ag2 = affinityManager.getAffinityGroup(ag2);
-       
-       al.setFromGroup(ag1);
-       al.setToGroup(ag2);
-       
-       return Response.status(Response.Status.CREATED).build();
-    }
 }
-