Search in sources :

Example 11 with ConvertorManager

use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager in project openflowplugin by opendaylight.

the class OpendaylightGroupStatisticsServiceImplTest method setUp.

public void setUp() {
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    groupStatisticsService = new OpendaylightGroupStatisticsServiceImpl(rqContextStack, deviceContext, new AtomicLong(), notificationPublishService, convertorManager);
    Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider).commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) FutureCallback(com.google.common.util.concurrent.FutureCallback)

Example 12 with ConvertorManager

use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager in project openflowplugin by opendaylight.

the class ActionConvertorTest method testActionConvertorwithallParameters.

@Test
public void testActionConvertorwithallParameters() {
    outputActionData();
    copyTtlData();
    mplsTtlActionData();
    vlanActionData();
    mplsActionData();
    setQueueActionData();
    setGroupAction();
    nwTtlAction();
    pbbActionData();
    setFieldData();
    setExperimenterData();
    dropActionData();
    ActionConvertorData data = new ActionConvertorData((short) 0X4);
    data.setDatapathId(BigInteger.ONE);
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>> ofActionsList = convertorManager.convert(actions, data);
    outputActions(ofActionsList.orElse(Collections.emptyList()));
}
Also used : ActionConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData) List(java.util.List) ArrayList(java.util.ArrayList) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) Test(org.junit.Test)

Example 13 with ConvertorManager

use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager 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 14 with ConvertorManager

use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager in project openflowplugin by opendaylight.

the class OpendaylightFlowStatisticsServiceImpl3Test method setUp.

public void setUp() {
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
    flowStatisticsService.setDelegate(flowStatisticsDelegate);
}
Also used : ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager)

Example 15 with ConvertorManager

use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager in project openflowplugin by opendaylight.

the class StatisticsContextImplParamTest method gatherDynamicDataTest.

@Test
public void gatherDynamicDataTest() throws InterruptedException {
    when(mockedDeviceState.isTableStatisticsAvailable()).thenReturn(Boolean.TRUE);
    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(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    final StatisticsContextImpl<MultipartReply> statisticsContext = new StatisticsContextImpl<>(mockedDeviceContext, convertorManager, MultipartWriterProviderFactory.createDefaultProvider(mockedDeviceContext), MoreExecutors.newDirectExecutorService(), config, true, false);
    final ListenableFuture<RpcResult<List<MultipartReply>>> rpcResult = immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build());
    when(mockedStatisticsGatheringService.getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class))).thenReturn(rpcResult);
    when(mockedStatisticsOnFlyGatheringService.getStatisticsOfType(any(EventIdentifier.class), any(MultipartType.class))).thenReturn(rpcResult);
    statisticsContext.registerMastershipWatcher(mockedMastershipWatcher);
    statisticsContext.setStatisticsGatheringService(mockedStatisticsGatheringService);
    statisticsContext.setStatisticsGatheringOnTheFlyService(mockedStatisticsOnFlyGatheringService);
    statisticsContext.instantiateServiceInstance();
    verify(mockedStatisticsGatheringService, times(7)).getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class));
    verify(mockedStatisticsOnFlyGatheringService).getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class));
}
Also used : EventIdentifier(org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MultipartType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) Test(org.junit.Test)

Aggregations

ConvertorManager (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager)19 List (java.util.List)5 FutureCallback (com.google.common.util.concurrent.FutureCallback)4 Test (org.junit.Test)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)3 Before (org.junit.Before)3 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)3 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)3 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)3 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)3 EventIdentifier (org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier)2 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)2 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)2 Optional (com.google.common.base.Optional)1 SettableFuture (com.google.common.util.concurrent.SettableFuture)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 Assert (org.junit.Assert)1