Search in sources :

Example 1 with DeviceFlowRegistryImpl

use of org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl in project openflowplugin by opendaylight.

the class DeviceContextImpl method lazyTransactionManagerInitialization.

@VisibleForTesting
void lazyTransactionManagerInitialization() {
    if (!this.initialized.get()) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Transaction chain manager for node {} created", deviceInfo);
        }
        this.transactionChainManager = new TransactionChainManager(dataBroker, deviceInfo.getNodeId().getValue());
        this.deviceFlowRegistry = new DeviceFlowRegistryImpl(deviceInfo.getVersion(), dataBroker, deviceInfo.getNodeInstanceIdentifier());
        this.deviceGroupRegistry = new DeviceGroupRegistryImpl();
        this.deviceMeterRegistry = new DeviceMeterRegistryImpl();
    }
    transactionChainManager.activateTransactionManager();
    initialized.set(true);
}
Also used : DeviceGroupRegistryImpl(org.opendaylight.openflowplugin.impl.registry.group.DeviceGroupRegistryImpl) TransactionChainManager(org.opendaylight.openflowplugin.common.txchain.TransactionChainManager) DeviceMeterRegistryImpl(org.opendaylight.openflowplugin.impl.registry.meter.DeviceMeterRegistryImpl) DeviceFlowRegistryImpl(org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 2 with DeviceFlowRegistryImpl

use of org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl in project openflowplugin by opendaylight.

the class StatisticsManagerImplTest method initialization.

@Before
public void initialization() {
    final KeyedInstanceIdentifier<Node, NodeKey> nodePath = KeyedInstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:10")));
    when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures);
    when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter);
    when(mockedPrimConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING);
    when(mockedPrimConnectionContext.getNodeId()).thenReturn(NODE_ID);
    when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(outboundQueue);
    when(mockedDeviceState.isFlowStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isGroupAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isMetersAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isTableStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
    when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN);
    when(mockedDeviceInfo.getNodeId()).thenReturn(NODE_ID);
    when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
    when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext);
    when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy);
    when(mockedDeviceContext.getDeviceFlowRegistry()).thenReturn(new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodePath));
    when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
    when(mockedDeviceContext.getMultiMsgCollector(Matchers.<RequestContext<List<MultipartReply>>>any())).thenAnswer(invocation -> {
        currentRequestContext = (RequestContext<List<MultipartReply>>) invocation.getArguments()[0];
        return multiMagCollector;
    });
    when(rpcProviderRegistry.addRpcImplementation(Matchers.eq(StatisticsManagerControlService.class), Matchers.<StatisticsManagerControlService>any())).thenReturn(serviceControlRegistration);
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    final long basicTimerDelay = 3000L;
    final long maximumTimerDelay = 900000L;
    statisticsManager = new StatisticsManagerImpl(new OpenflowProviderConfigBuilder().setBasicTimerDelay(new NonZeroUint32Type(basicTimerDelay)).setMaximumTimerDelay(new NonZeroUint32Type(maximumTimerDelay)).setIsStatisticsPollingOn(false).build(), rpcProviderRegistry, convertorManager, MoreExecutors.newDirectExecutorService());
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) StatisticsManagerControlService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService) OpenflowProviderConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NonZeroUint32Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type) List(java.util.List) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) DeviceFlowRegistryImpl(org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) Before(org.junit.Before)

Example 3 with DeviceFlowRegistryImpl

use of org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl in project openflowplugin by opendaylight.

the class ServiceMocking method initialization.

@Before
@SuppressWarnings("unchecked")
public void initialization() throws Exception {
    when(mockedExtensionConverter.getExperimenterId()).thenReturn(new ExperimenterId(DUMMY_EXPERIMENTER_ID));
    when(mockedExtensionConverterProvider.getMessageConverter(Matchers.<TypeVersionKey>any())).thenReturn(mockedExtensionConverter);
    when(mockedRequestContextStack.createRequestContext()).thenReturn(mockedRequestContext);
    when(mockedRequestContext.getXid()).thenReturn(DUMMY_XID);
    when(mockedFeatures.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    when(mockedFeatures.getVersion()).thenReturn(DUMMY_VERSION);
    when(mockedFeaturesOutput.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    when(mockedFeaturesOutput.getVersion()).thenReturn(DUMMY_VERSION);
    when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures);
    when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter);
    when(mockedPrimConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING);
    when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(mockedOutboundQueue);
    when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_II);
    when(mockedDeviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    when(mockedDeviceInfo.getVersion()).thenReturn(DUMMY_VERSION);
    when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext);
    when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy);
    when(mockedDeviceContext.getDeviceFlowRegistry()).thenReturn(new DeviceFlowRegistryImpl(DUMMY_VERSION, dataBroker, DUMMY_NODE_II));
    when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
    when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
    when(mockedDeviceContext.getMultiMsgCollector(Matchers.any())).thenReturn(multiMessageCollector);
    setup();
}
Also used : ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) DeviceFlowRegistryImpl(org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl) Before(org.junit.Before)

Aggregations

DeviceFlowRegistryImpl (org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl)3 Before (org.junit.Before)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 List (java.util.List)1 TransactionChainManager (org.opendaylight.openflowplugin.common.txchain.TransactionChainManager)1 DeviceGroupRegistryImpl (org.opendaylight.openflowplugin.impl.registry.group.DeviceGroupRegistryImpl)1 DeviceMeterRegistryImpl (org.opendaylight.openflowplugin.impl.registry.meter.DeviceMeterRegistryImpl)1 ConvertorManager (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager)1 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)1 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)1 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)1 ExperimenterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)1 NonZeroUint32Type (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type)1 OpenflowProviderConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder)1 StatisticsManagerControlService (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService)1