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);
}
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());
}
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();
}
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());
}
Aggregations