Search in sources :

Example 1 with ExtensionConverterProviderKeeper

use of org.opendaylight.openflowplugin.extension.api.ExtensionConverterProviderKeeper in project openflowplugin by opendaylight.

the class OpenFlowPluginProviderImpl method initialize.

@Override
public void initialize() {
    registerMXBean(MESSAGE_INTELLIGENCE_AGENCY, MESSAGE_INTELLIGENCE_AGENCY_MX_BEAN_NAME);
    // TODO: copied from OpenFlowPluginProvider (Helium) misusesing the old way of distributing extension converters
    // TODO: rewrite later!
    OFSessionUtil.getSessionManager().setExtensionConverterProvider(extensionConverterManager);
    // Creates a thread pool that creates new threads as needed, but will reuse previously
    // constructed threads when they are available.
    // Threads that have not been used for x seconds are terminated and removed from the cache.
    executorService = MoreExecutors.listeningDecorator(new ThreadPoolLoggingExecutor(config.getThreadPoolMinThreads(), config.getThreadPoolMaxThreads().getValue(), config.getThreadPoolTimeout(), TimeUnit.SECONDS, new SynchronousQueue<>(), POOL_NAME));
    deviceManager = new DeviceManagerImpl(config, dataBroker, getMessageIntelligenceAgency(), notificationPublishService, hashedWheelTimer, convertorManager, deviceInitializerProvider);
    TranslatorLibraryUtil.injectBasicTranslatorLibrary(deviceManager, convertorManager);
    ((ExtensionConverterProviderKeeper) deviceManager).setExtensionConverterProvider(extensionConverterManager);
    rpcManager = new RpcManagerImpl(config, rpcProviderRegistry, extensionConverterManager, convertorManager, notificationPublishService);
    statisticsManager = new StatisticsManagerImpl(config, rpcProviderRegistry, convertorManager, executorService);
    roleManager = new RoleManagerImpl(hashedWheelTimer, config);
    contextChainHolder = new ContextChainHolderImpl(executorService, singletonServicesProvider, entityOwnershipService, mastershipChangeServiceManager);
    contextChainHolder.addManager(deviceManager);
    contextChainHolder.addManager(statisticsManager);
    contextChainHolder.addManager(rpcManager);
    contextChainHolder.addManager(roleManager);
    connectionManager = new ConnectionManagerImpl(config, executorService);
    connectionManager.setDeviceConnectedHandler(contextChainHolder);
    connectionManager.setDeviceDisconnectedHandler(contextChainHolder);
    deviceManager.setContextChainHolder(contextChainHolder);
    deviceManager.initialize();
}
Also used : DeviceManagerImpl(org.opendaylight.openflowplugin.impl.device.DeviceManagerImpl) RpcManagerImpl(org.opendaylight.openflowplugin.impl.rpc.RpcManagerImpl) ContextChainHolderImpl(org.opendaylight.openflowplugin.impl.lifecycle.ContextChainHolderImpl) ConnectionManagerImpl(org.opendaylight.openflowplugin.impl.connection.ConnectionManagerImpl) ThreadPoolLoggingExecutor(org.opendaylight.openflowplugin.impl.util.ThreadPoolLoggingExecutor) StatisticsManagerImpl(org.opendaylight.openflowplugin.impl.statistics.StatisticsManagerImpl) RoleManagerImpl(org.opendaylight.openflowplugin.impl.role.RoleManagerImpl) ExtensionConverterProviderKeeper(org.opendaylight.openflowplugin.extension.api.ExtensionConverterProviderKeeper)

Example 2 with ExtensionConverterProviderKeeper

use of org.opendaylight.openflowplugin.extension.api.ExtensionConverterProviderKeeper in project openflowplugin by opendaylight.

the class DeviceManagerImpl method createContext.

@Override
public DeviceContext createContext(@Nonnull final ConnectionContext connectionContext) {
    LOG.info("ConnectionEvent: Device connected to controller, Device:{}, NodeId:{}", connectionContext.getConnectionAdapter().getRemoteAddress(), connectionContext.getDeviceInfo().getNodeId());
    connectionContext.getConnectionAdapter().setPacketInFiltering(true);
    final OutboundQueueProvider outboundQueueProvider = new OutboundQueueProviderImpl(connectionContext.getDeviceInfo().getVersion());
    connectionContext.setOutboundQueueProvider(outboundQueueProvider);
    final OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration = connectionContext.getConnectionAdapter().registerOutboundQueueHandler(outboundQueueProvider, config.getBarrierCountLimit().getValue(), TimeUnit.MILLISECONDS.toNanos(config.getBarrierIntervalTimeoutLimit().getValue()));
    connectionContext.setOutboundQueueHandleRegistration(outboundQueueHandlerRegistration);
    final DeviceContext deviceContext = new DeviceContextImpl(connectionContext, dataBroker, messageSpy, translatorLibrary, convertorExecutor, config.isSkipTableFeatures(), hashedWheelTimer, config.isUseSingleLayerSerialization(), deviceInitializerProvider, config.isEnableFlowRemovedNotification(), config.isSwitchFeaturesMandatory(), contextChainHolder);
    ((ExtensionConverterProviderKeeper) deviceContext).setExtensionConverterProvider(extensionConverterProvider);
    deviceContext.setNotificationPublishService(notificationPublishService);
    deviceContexts.put(connectionContext.getDeviceInfo(), deviceContext);
    updatePacketInRateLimiters();
    final OpenflowProtocolListenerFullImpl messageListener = new OpenflowProtocolListenerFullImpl(connectionContext.getConnectionAdapter(), deviceContext);
    connectionContext.getConnectionAdapter().setMessageListener(messageListener);
    connectionContext.getConnectionAdapter().setAlienMessageListener(messageListener);
    return deviceContext;
}
Also used : OutboundQueueProvider(org.opendaylight.openflowplugin.api.openflow.connection.OutboundQueueProvider) DeviceContext(org.opendaylight.openflowplugin.api.openflow.device.DeviceContext) OpenflowProtocolListenerFullImpl(org.opendaylight.openflowplugin.impl.device.listener.OpenflowProtocolListenerFullImpl) OutboundQueueProviderImpl(org.opendaylight.openflowplugin.impl.connection.OutboundQueueProviderImpl) ExtensionConverterProviderKeeper(org.opendaylight.openflowplugin.extension.api.ExtensionConverterProviderKeeper)

Aggregations

ExtensionConverterProviderKeeper (org.opendaylight.openflowplugin.extension.api.ExtensionConverterProviderKeeper)2 OutboundQueueProvider (org.opendaylight.openflowplugin.api.openflow.connection.OutboundQueueProvider)1 DeviceContext (org.opendaylight.openflowplugin.api.openflow.device.DeviceContext)1 ConnectionManagerImpl (org.opendaylight.openflowplugin.impl.connection.ConnectionManagerImpl)1 OutboundQueueProviderImpl (org.opendaylight.openflowplugin.impl.connection.OutboundQueueProviderImpl)1 DeviceManagerImpl (org.opendaylight.openflowplugin.impl.device.DeviceManagerImpl)1 OpenflowProtocolListenerFullImpl (org.opendaylight.openflowplugin.impl.device.listener.OpenflowProtocolListenerFullImpl)1 ContextChainHolderImpl (org.opendaylight.openflowplugin.impl.lifecycle.ContextChainHolderImpl)1 RoleManagerImpl (org.opendaylight.openflowplugin.impl.role.RoleManagerImpl)1 RpcManagerImpl (org.opendaylight.openflowplugin.impl.rpc.RpcManagerImpl)1 StatisticsManagerImpl (org.opendaylight.openflowplugin.impl.statistics.StatisticsManagerImpl)1 ThreadPoolLoggingExecutor (org.opendaylight.openflowplugin.impl.util.ThreadPoolLoggingExecutor)1