getCapabilities method is not needed - removed
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / device / DeviceContext.java
index 68b4e17e38eb30cacaa1c2dd1f7030dcdc8eeb81..956569b21fb14d77ed83916e1bd88db8a780f3f2 100644 (file)
@@ -10,12 +10,13 @@ package org.opendaylight.openflowplugin.api.openflow.device;
 
 import io.netty.util.Timeout;
 import java.math.BigInteger;
-import java.util.Map;
 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.openflowplugin.api.openflow.OpenflowPluginTimer;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceContextClosedHandler;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceReplyProcessor;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MessageHandler;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.OutstandingMessageExtractor;
@@ -30,6 +31,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
+ * <p>
  * The central entity of OFP is the Device Context, which encapsulate the logical state of a switch
  * as seen by the controller. Each OpenFlow session is tracked by a Connection Context.
  * These attach to a particular Device Context in such a way, that there is at most one primary
@@ -42,10 +44,16 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * which is enforced by keeping a cap on the number of outstanding requests a particular Request
  * Context can have at any point in time. Should this quota be exceeded, any further attempt to make
  * a request to the switch will fail immediately, with proper error indication.
- * <p>
+ * </p>
  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 25.2.2015.
  */
-public interface DeviceContext extends AutoCloseable, OpenflowPluginTimer, MessageHandler, TranslatorLibrarian, OutstandingMessageExtractor, DeviceReplyProcessor {
+public interface DeviceContext extends AutoCloseable,
+        OpenflowPluginTimer,
+        MessageHandler,
+        TranslatorLibrarian,
+        OutstandingMessageExtractor,
+        DeviceReplyProcessor,
+        DeviceDisconnectedHandler {
 
 
     /**
@@ -89,13 +97,6 @@ public interface DeviceContext extends AutoCloseable, OpenflowPluginTimer, Messa
     ReadTransaction getReadTransaction();
 
 
-    /**
-     * Method provides capabilities of connected device.
-     *
-     * @return
-     */
-    TableFeatures getCapabilities();
-
     /**
      * Method provides current devices connection context.
      *
@@ -118,9 +119,15 @@ public interface DeviceContext extends AutoCloseable, OpenflowPluginTimer, Messa
     Xid getNextXid();
 
     /**
-     * @return readonly map of outstanding requests
+     * @param xid key
+     * @return request by xid
+     */
+    RequestContext lookupRequest(Xid xid);
+
+    /**
+     * @return number of outstanding requests in map
      */
-    Map<Long, RequestContext> getRequests();
+    int getNumberOfOutstandingRequests();
 
     /**
      * Method writes request context into request context map. This method
@@ -131,6 +138,13 @@ public interface DeviceContext extends AutoCloseable, OpenflowPluginTimer, Messa
      */
     void hookRequestCtx(Xid xid, RequestContext requestFutureContext);
 
+    /**
+     * Method removes request context from request context map.
+     *
+     * @param xid
+     */
+    RequestContext unhookRequestCtx(Xid xid);
+
     /**
      * Method that attaches anyMessageTypeListener to connection adapters as message listener.
      *
@@ -186,5 +200,12 @@ public interface DeviceContext extends AutoCloseable, OpenflowPluginTimer, Messa
 
     MessageSpy getMessageSpy();
 
+    void setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler);
+
+    /**
+     * Method sets reference to handler used for cleanup after device context about to be closed.
+     */
+    void addDeviceContextClosedHandler(DeviceContextClosedHandler deviceContextClosedHandler);
+
 }