Search in sources :

Example 1 with NonZeroUint16Type

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

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

the class ConfigurationServiceFactoryImplTest method setUp.

@Before
public void setUp() throws Exception {
    when(config.isIsStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsFlowStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsTableStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsFlowStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsGroupStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsMeterStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsQueueStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsPortStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.getBarrierCountLimit()).thenReturn(new NonZeroUint16Type(BARRIER_COUNT_LIMIT));
    when(config.getBarrierIntervalTimeoutLimit()).thenReturn(new NonZeroUint32Type(BARRIER_INTERVAL_TIMEOUT_LIMIT));
    when(config.getEchoReplyTimeout()).thenReturn(new NonZeroUint32Type(ECHO_REPLY_TIMEOUT));
    when(config.isEnableFlowRemovedNotification()).thenReturn(ENABLE_FLOW_REMOVED_NOTIFICATION);
    when(config.isSkipTableFeatures()).thenReturn(SKIP_TABLE_FEATURES);
    when(config.getBasicTimerDelay()).thenReturn(new NonZeroUint32Type(BASIC_TIMER_DELAY));
    when(config.getMaximumTimerDelay()).thenReturn(new NonZeroUint32Type(MAXIMUM_TIMER_DELAY));
    when(config.isSwitchFeaturesMandatory()).thenReturn(SWITCH_FEATURES_MANDATORY);
    when(config.isIsStatisticsRpcEnabled()).thenReturn(IS_STATISTICS_RPC_ENABLED);
    when(config.isUseSingleLayerSerialization()).thenReturn(USE_SINGLE_LAYER_SERIALIZATION);
    when(config.getRpcRequestsQuota()).thenReturn(new NonZeroUint16Type(RPC_REQUESTS_QUOTA));
    when(config.getGlobalNotificationQuota()).thenReturn(GLOBAL_NOTIFICATION_QUOTA);
    when(config.getThreadPoolMinThreads()).thenReturn(THREAD_POOL_MIN_THREADS);
    when(config.getThreadPoolMaxThreads()).thenReturn(new NonZeroUint16Type(THREAD_POOL_MAX_THREADS));
    when(config.getThreadPoolTimeout()).thenReturn(THREAD_POOL_TIMEOUT);
    final Dictionary<String, Object> properties = new Hashtable<>();
    properties.put(ConfigurationProperty.IS_STATISTICS_POLLING_ON.toString(), IS_STATISTICS_POLLING_ON);
    when(configuration.getProperties()).thenReturn(properties);
    when(configurationAdmin.getConfiguration(OFConstants.CONFIG_FILE_ID)).thenReturn(configuration);
    when(bundleContext.getService(serviceReference)).thenReturn(configurationAdmin);
    when(bundleContext.getServiceReference(ConfigurationAdmin.class)).thenReturn(serviceReference);
    configurationService = new ConfigurationServiceFactoryImpl().newInstance(config, bundleContext);
}
Also used : NonZeroUint16Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type) Hashtable(java.util.Hashtable) NonZeroUint32Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type) Before(org.junit.Before)

Example 3 with NonZeroUint16Type

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

Aggregations

Before (org.junit.Before)3 NonZeroUint16Type (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type)3 NonZeroUint32Type (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type)2 OpenflowProviderConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder)2 HashedWheelTimer (io.netty.util.HashedWheelTimer)1 Hashtable (java.util.Hashtable)1 TransactionChainListener (org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)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 RpcService (org.opendaylight.yangtools.yang.binding.RpcService)1