use of org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext in project openflowplugin by opendaylight.
the class ContextChainHolderImpl method createContextChain.
@VisibleForTesting
void createContextChain(final ConnectionContext connectionContext) {
final DeviceInfo deviceInfo = connectionContext.getDeviceInfo();
final DeviceContext deviceContext = deviceManager.createContext(connectionContext);
deviceContext.registerMastershipWatcher(this);
LOG.debug("Device" + CONTEXT_CREATED_FOR_CONNECTION, deviceInfo);
final RpcContext rpcContext = rpcManager.createContext(deviceContext);
rpcContext.registerMastershipWatcher(this);
LOG.debug("RPC" + CONTEXT_CREATED_FOR_CONNECTION, deviceInfo);
final StatisticsContext statisticsContext = statisticsManager.createContext(deviceContext, ownershipChangeListener.isReconciliationFrameworkRegistered());
statisticsContext.registerMastershipWatcher(this);
LOG.debug("Statistics" + CONTEXT_CREATED_FOR_CONNECTION, deviceInfo);
final RoleContext roleContext = roleManager.createContext(deviceContext);
roleContext.registerMastershipWatcher(this);
LOG.debug("Role" + CONTEXT_CREATED_FOR_CONNECTION, deviceInfo);
final ContextChain contextChain = new ContextChainImpl(this, connectionContext, executorService);
contextChain.registerDeviceRemovedHandler(deviceManager);
contextChain.registerDeviceRemovedHandler(rpcManager);
contextChain.registerDeviceRemovedHandler(statisticsManager);
contextChain.registerDeviceRemovedHandler(roleManager);
contextChain.registerDeviceRemovedHandler(this);
contextChain.addContext(deviceContext);
contextChain.addContext(rpcContext);
contextChain.addContext(statisticsContext);
contextChain.addContext(roleContext);
contextChainMap.put(deviceInfo, contextChain);
connectingDevices.remove(deviceInfo);
LOG.debug("Context chain" + CONTEXT_CREATED_FOR_CONNECTION, deviceInfo);
deviceContext.onPublished();
contextChain.registerServices(singletonServiceProvider);
}
use of org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext in project openflowplugin by opendaylight.
the class RpcManagerImplTest method createContext.
@Test
public void createContext() throws Exception {
final RpcContext context = rpcManager.createContext(deviceContext);
assertEquals(deviceInfo, context.getDeviceInfo());
}
use of org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext in project openflowplugin by opendaylight.
the class RpcContextImplTest method testStoreOrFail.
@Test
public void testStoreOrFail() throws Exception {
try (RpcContext rpcContext = new RpcContextImpl(rpcProviderRegistry, 100, deviceContext, extensionConverterProvider, convertorExecutor, notificationPublishService, true)) {
final RequestContext<?> requestContext = rpcContext.createRequestContext();
assertNotNull(requestContext);
}
}
use of org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext in project openflowplugin by opendaylight.
the class RpcContextImplTest method testStoreOrFailThatFails.
@Test
public void testStoreOrFailThatFails() throws Exception {
try (RpcContext rpcContext = new RpcContextImpl(rpcProviderRegistry, 0, deviceContext, extensionConverterProvider, convertorExecutor, notificationPublishService, true)) {
final RequestContext<?> requestContext = rpcContext.createRequestContext();
assertNull(requestContext);
}
}
use of org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext in project openflowplugin by opendaylight.
the class RpcContextImplTest method testStoreAndCloseOrFail.
@Test
public void testStoreAndCloseOrFail() throws Exception {
try (RpcContext rpcContext = new RpcContextImpl(rpcProviderRegistry, 100, deviceContext, extensionConverterProvider, convertorExecutor, notificationPublishService, true)) {
final RequestContext<?> requestContext = rpcContext.createRequestContext();
assertNotNull(requestContext);
requestContext.close();
verify(messageSpy).spyMessage(RpcContextImpl.class, MessageSpy.StatisticsGroup.REQUEST_STACK_FREED);
}
}
Aggregations