evolved API 48/17048/6
authorMartin Bobak <mbobak@cisco.com>
Tue, 24 Mar 2015 10:57:10 +0000 (11:57 +0100)
committerMartin Bobak <mbobak@cisco.com>
Thu, 26 Mar 2015 14:17:54 +0000 (15:17 +0100)
- device context offers primary and auxiliary connection contexts
- RpcContext and RequestContext offers generic way of invoking rpc call

Change-Id: Icafafdb7c64e5c43a0d4675ee360e177d8f0d69e
Signed-off-by: Martin Bobak <mbobak@cisco.com>
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceContext.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/RequestContext.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcContext.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RequestContextImpl.java

index 0ff3d737c805731485157342fff2c2cbde5ede98..c5148e425eb75cfb1165acd41d80ae60c51282e7 100644 (file)
@@ -12,6 +12,8 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MessageHandler;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures;
+import java.math.BigInteger;
+import java.util.Collection;
 
 /**
  * The central entity of OFP is the Device Context, which encapsulate the logical state of a switch
@@ -75,5 +77,19 @@ public interface DeviceContext extends MessageHandler {
      */
     TableFeatures getCapabilities();
 
+    /**
+     * Method provides current devices connection context.
+     *
+     * @return
+     */
+    ConnectionContext getPrimaryConnectionContext();
+
+    /**
+     * Method provides current devices auxiliary connection contexts.
+     *
+     * @return
+     */
+    ConnectionContext getAuxiliaryConnectiobContexts(BigInteger cookie);
+
 }
 
index 2d6ae1989a8c2888f00ad79274fa66062408d4c3..f9380ac99d3a9ad87193018923b92c9877392bcc 100644 (file)
@@ -8,6 +8,10 @@
 package org.opendaylight.openflowplugin.api.openflow.device;
 
 
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
+
 /**
  * Request context handles all requests on device. Number of requests is limited by request quota. When this quota is
  * exceeded all rpc's will end up with exception.
@@ -16,6 +20,7 @@ package org.opendaylight.openflowplugin.api.openflow.device;
  */
 public interface RequestContext {
 
+    <T extends DataObject> Future<RpcResult<T>> createRequestFuture(DataObject dataObject);
 
 
 }
index 59c0c1ab6f49941c87ebe3e6462f7ed1cd4f50aa..19dc4404bc2b87245177669bf7296ba5b81ab38d 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.openflowplugin.api.openflow.rpc;
 
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
 
 /**
  * This context is registered with MD-SAL as a routed RPC provider for the inventory node backed by this switch and
@@ -32,16 +32,14 @@ public interface RpcContext extends AutoCloseable {
      *
      * @param data
      */
-    Future<RpcResult<? extends DataObject>> addNewRequest(DataObject data);
+    <T extends DataObject> Future<RpcResult<T>> addNewRequest(DataObject data);
 
     /**
      * Method for setting request quota value. When the Request Context quota is exceeded, incoming RPCs fail
      * immediately, with a well-defined error.
-     * 
+     *
      * @param maxRequestsPerDevice
      */
     void setRequestContextQuota(int maxRequestsPerDevice);
 
-    boolean isRequestContextCapacityEmpty();
-
 }
index a421938ad6e437eee1c0bb4c87a5369b1841bc36..d2a900b9e8883e9611b9ef92062edc5408240934 100644 (file)
@@ -15,6 +15,8 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.DataObject;
+import java.math.BigInteger;
+import java.util.Collection;
 
 /**
  * 
@@ -63,4 +65,15 @@ public class DeviceContextImpl implements DeviceContext {
         return null;
     }
 
+    @Override
+    public ConnectionContext getPrimaryConnectionContext() {
+        return null;
+    }
+
+    @Override
+    public ConnectionContext getAuxiliaryConnectiobContexts(final BigInteger cookie) {
+        return null;
+    }
+
+
 }
index 053ccf5384e02fd051b2a834361a503db0792a85..12e8f6e7dd07e932e6c085790e16da1b9b13f7c2 100644 (file)
@@ -1,27 +1,33 @@
 /**
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 package org.opendaylight.openflowplugin.impl.rpc;
 
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.SettableFuture;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
 
 /**
  * @author joe
- * 
  */
 public class RequestContextImpl implements RequestContext {
 
     private final Future<RpcResult<? extends DataObject>> result;
+    private SettableFuture requestFuture;
 
     public RequestContextImpl(final Future<RpcResult<? extends DataObject>> result) {
         this.result = result;
     }
 
+    @Override
+    public <T extends DataObject> Future<RpcResult<T>> createRequestFuture(final DataObject dataObject) {
+        requestFuture = SettableFuture.create();
+        return requestFuture;
+    }
 }