Search in sources :

Example 1 with OpenflowProviderConfigBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder in project openflowplugin by opendaylight.

the class RpcManagerImplTest method setUp.

@Before
public void setUp() {
    final NodeKey nodeKey = new NodeKey(nodeId);
    rpcManager = new RpcManagerImpl(new OpenflowProviderConfigBuilder().setRpcRequestsQuota(new NonZeroUint16Type(QUOTA_VALUE)).setIsStatisticsRpcEnabled(false).build(), rpcProviderRegistry, extensionConverterProvider, convertorExecutor, notificationPublishService);
    FeaturesReply features = new GetFeaturesOutputBuilder().setVersion(OFConstants.OFP_VERSION_1_3).build();
    Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeKey.getId());
    Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
    Mockito.when(connectionContext.getFeatures()).thenReturn(features);
    Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
    Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState);
    Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
    Mockito.when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
    Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(Matchers.any(), Matchers.any(RpcService.class))).thenReturn(routedRpcRegistration);
    Mockito.when(contexts.remove(deviceInfo)).thenReturn(removedContexts);
}
Also used : NonZeroUint16Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type) GetFeaturesOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder) OpenflowProviderConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder) FeaturesReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply) RpcService(org.opendaylight.yangtools.yang.binding.RpcService) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Before(org.junit.Before)

Example 2 with OpenflowProviderConfigBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder in project openflowplugin by opendaylight.

the class ConnectionManagerImplTest method setUp.

@Before
public void setUp() {
    final ThreadPoolLoggingExecutor threadPool = new ThreadPoolLoggingExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), "ofppool");
    connectionManagerImpl = new ConnectionManagerImpl(new OpenflowProviderConfigBuilder().setEchoReplyTimeout(new NonZeroUint32Type(ECHO_REPLY_TIMEOUT)).build(), threadPool);
    connectionManagerImpl.setDeviceConnectedHandler(deviceConnectedHandler);
    final InetSocketAddress deviceAddress = InetSocketAddress.createUnresolved("yahoo", 42);
    Mockito.when(connection.getRemoteAddress()).thenReturn(deviceAddress);
    Mockito.when(connection.isAlive()).thenReturn(true);
    Mockito.when(connection.barrier(Matchers.<BarrierInput>any())).thenReturn(RpcResultBuilder.success(new BarrierOutputBuilder().build()).buildFuture());
}
Also used : OpenflowProviderConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder) InetSocketAddress(java.net.InetSocketAddress) NonZeroUint32Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type) ThreadPoolLoggingExecutor(org.opendaylight.openflowplugin.impl.util.ThreadPoolLoggingExecutor) BarrierOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder) Before(org.junit.Before)

Example 3 with OpenflowProviderConfigBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder in project openflowplugin by opendaylight.

the class DeviceManagerImplTest method setUp.

@Before
public void setUp() throws Exception {
    when(mockConnectionContext.getNodeId()).thenReturn(DUMMY_NODE_ID);
    when(mockConnectionContext.getFeatures()).thenReturn(mockFeatures);
    when(mockConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter);
    when(mockConnectionContext.getDeviceInfo()).thenReturn(deviceInfo);
    when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockConnectionContext);
    when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_IDENTIFIER);
    when(deviceInfo.getNodeId()).thenReturn(DUMMY_NODE_ID);
    when(mockFeatures.getCapabilities()).thenReturn(capabilities);
    when(mockFeatures.getCapabilitiesV10()).thenReturn(capabilitiesV10);
    when(mockFeatures.getDatapathId()).thenReturn(BigInteger.valueOf(21L));
    when(mockedFuture.isDone()).thenReturn(true);
    when(writeTransaction.submit()).thenReturn(mockedFuture);
    when(transactionChain.newWriteOnlyTransaction()).thenReturn(writeTransaction);
    when(dataBroker.createTransactionChain(any(TransactionChainListener.class))).thenReturn(transactionChain);
    when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction);
    deviceManager = new DeviceManagerImpl(new OpenflowProviderConfigBuilder().setBarrierCountLimit(new NonZeroUint16Type(BARRIER_COUNT_LIMIT)).setBarrierIntervalTimeoutLimit(new NonZeroUint32Type(BARRIER_INTERVAL_NANOS)).setGlobalNotificationQuota(TEST_VALUE_GLOBAL_NOTIFICATION_QUOTA).setSwitchFeaturesMandatory(false).setEnableFlowRemovedNotification(true).setSkipTableFeatures(false).setUseSingleLayerSerialization(true).build(), dataBroker, messageIntelligenceAgency, notificationPublishService, new HashedWheelTimer(), convertorExecutor, DeviceInitializerProviderFactory.createDefaultProvider());
    deviceManager.setTranslatorLibrary(translatorLibrary);
    verify(dataBroker).newWriteOnlyTransaction();
    verify(writeTransaction).merge(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
    verify(writeTransaction).submit();
}
Also used : NonZeroUint16Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type) OpenflowProviderConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder) TransactionChainListener(org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener) NonZeroUint32Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type) HashedWheelTimer(io.netty.util.HashedWheelTimer) Before(org.junit.Before)

Example 4 with OpenflowProviderConfigBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder 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)

Aggregations

Before (org.junit.Before)4 OpenflowProviderConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder)4 NonZeroUint32Type (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type)3 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)2 NonZeroUint16Type (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type)2 HashedWheelTimer (io.netty.util.HashedWheelTimer)1 InetSocketAddress (java.net.InetSocketAddress)1 List (java.util.List)1 TransactionChainListener (org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener)1 DeviceFlowRegistryImpl (org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl)1 ThreadPoolLoggingExecutor (org.opendaylight.openflowplugin.impl.util.ThreadPoolLoggingExecutor)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 BarrierOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder)1 FeaturesReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply)1 GetFeaturesOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder)1 StatisticsManagerControlService (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService)1 RpcService (org.opendaylight.yangtools.yang.binding.RpcService)1