Extends L2LbManager
- reacts to device events
- updates/removes l2lb
- implements bookeeping of the l2lb
- extends L2LbEvent to proper notify other components
Change-Id: I944fe6415324d71c361bafc4146dd176493f2dc7
diff --git a/apps/l2lb/src/main/java/org/onosproject/l2lb/api/L2LbService.java b/apps/l2lb/src/main/java/org/onosproject/l2lb/api/L2LbService.java
index 8779192..db5f20c 100644
--- a/apps/l2lb/src/main/java/org/onosproject/l2lb/api/L2LbService.java
+++ b/apps/l2lb/src/main/java/org/onosproject/l2lb/api/L2LbService.java
@@ -16,6 +16,7 @@
package org.onosproject.l2lb.api;
+import org.onosproject.core.ApplicationId;
import org.onosproject.event.ListenerService;
import org.onosproject.net.DeviceId;
@@ -56,4 +57,43 @@
* @return next ID
*/
int getL2LbNexts(DeviceId deviceId, int key);
+
+ /**
+ * Reserves a l2 load balancer. Only one application
+ * at time can reserve a given l2 load balancer.
+ *
+ * @param l2LbId the l2 load balancer id
+ * @param appId the application id
+ * @return true if reservation was successful false otherwise
+ */
+ boolean reserve(L2LbId l2LbId, ApplicationId appId);
+
+ /**
+ * Releases a l2 load balancer. Once released
+ * by the owner the l2 load balancer is eligible
+ * for removal.
+ *
+ * @param l2LbId the l2 load balancer id
+ * @param appId the application id
+ * @return true if release was successful false otherwise
+ */
+ boolean release(L2LbId l2LbId, ApplicationId appId);
+
+ /**
+ * Gets reservation of a l2 load balancer. Only one application
+ * at time can reserve a given l2 load balancer.
+ *
+ * @param l2LbId the l2 load balancer id
+ * @return the id of the application using the l2 load balancer
+ */
+ ApplicationId getReservation(L2LbId l2LbId);
+
+ /**
+ * Gets l2 load balancer reservations. Only one application
+ * at time can reserve a given l2 load balancer.
+ *
+ * @return reservations of the l2 load balancer resources
+ */
+ Map<L2LbId, ApplicationId> getReservations();
+
}