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
*/
TableFeatures getCapabilities();
+ /**
+ * Method provides current devices connection context.
+ *
+ * @return
+ */
+ ConnectionContext getPrimaryConnectionContext();
+
+ /**
+ * Method provides current devices auxiliary connection contexts.
+ *
+ * @return
+ */
+ ConnectionContext getAuxiliaryConnectiobContexts(BigInteger cookie);
+
}
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.
*/
public interface RequestContext {
+ <T extends DataObject> Future<RpcResult<T>> createRequestFuture(DataObject dataObject);
}
*/
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
*
* @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();
-
}
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;
/**
*
return null;
}
+ @Override
+ public ConnectionContext getPrimaryConnectionContext() {
+ return null;
+ }
+
+ @Override
+ public ConnectionContext getAuxiliaryConnectiobContexts(final BigInteger cookie) {
+ return null;
+ }
+
+
}
/**
* 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;
+ }
}