Search in sources :

Example 16 with ConvertorManager

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

the class OpendaylightFlowStatisticsServiceImpl2Test method setUp.

public void setUp() {
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
    rqContextMp = new AbstractRequestContext<List<MultipartReply>>(42L) {

        @Override
        public void close() {
        // NOOP
        }
    };
    Mockito.when(rqContextStack.<List<MultipartReply>>createRequestContext()).thenReturn(rqContextMp);
    Mockito.when(translatorLibrary.<MultipartReply, AggregatedFlowStatistics>lookupTranslator(Matchers.any(TranslatorKey.class))).thenReturn(translator);
}
Also used : MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) TranslatorKey(org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey) List(java.util.List) AggregatedFlowStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatistics) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager)

Example 17 with ConvertorManager

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

the class TranslatorLibratyUtilTest method setBasicTranslatorLibraryTest.

@Test
public void setBasicTranslatorLibraryTest() {
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    TranslatorLibraryUtil.injectBasicTranslatorLibrary(translatorLibrarian, convertorManager);
    TranslatorLibrary translatorLibrary = translatorLibrarian.oook();
    TranslatorKeyFactory of13TranslatorKeyFactory = new TranslatorKeyFactory(OFP_VERSION_1_3);
    MessageTranslator<Object, Object> translator;
    translator = translatorLibrary.lookupTranslator(of13TranslatorKeyFactory.createTranslatorKey(PacketIn.class));
    assertNotNull(translator);
    translator = translatorLibrary.lookupTranslator(of13TranslatorKeyFactory.createTranslatorKey(PortGrouping.class));
    assertNotNull(translator);
    translator = translatorLibrary.lookupTranslator(of13TranslatorKeyFactory.createTranslatorKey(MultipartReplyAggregateCase.class));
    assertNotNull(translator);
    TranslatorKeyFactory of10TranslatorKeyFactory = new TranslatorKeyFactory(OFP_VERSION_1_0);
    translator = translatorLibrary.lookupTranslator(of10TranslatorKeyFactory.createTranslatorKey(PacketIn.class));
    assertNotNull(translator);
    translator = translatorLibrary.lookupTranslator(of10TranslatorKeyFactory.createTranslatorKey(PortGrouping.class));
    assertNotNull(translator);
    translator = translatorLibrary.lookupTranslator(of10TranslatorKeyFactory.createTranslatorKey(MultipartReplyAggregateCase.class));
    assertNotNull(translator);
}
Also used : TranslatorLibrary(org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary) TranslatorKeyFactory(org.opendaylight.openflowplugin.impl.translator.TranslatorKeyFactory) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) Test(org.junit.Test)

Example 18 with ConvertorManager

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

the class FlowRemovedTranslatorTest method setUp.

@Before
public void setUp() throws Exception {
    final KeyedInstanceIdentifier<Node, NodeKey> nodeId = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId("dummyNodeId")));
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    translator = new FlowRemovedTranslator(convertorManager);
    translatorV10 = new FlowRemovedV10Translator(convertorManager);
    when(deviceContext.getDeviceState()).thenReturn(deviceState);
    when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeId);
    when(features.getDatapathId()).thenReturn(BigInteger.TEN);
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Before(org.junit.Before)

Example 19 with ConvertorManager

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

the class MultipartRequestOnTheFlyCallbackTest method initialization.

@Before
public void initialization() {
    when(mockedDeviceContext.getMessageSpy()).thenReturn(new MessageIntelligenceAgencyImpl());
    when(mockedNodeId.toString()).thenReturn(DUMMY_NODE_ID);
    when(mockedPrimaryConnection.getNodeId()).thenReturn(mockedNodeId);
    when(mockedPrimaryConnection.getFeatures()).thenReturn(mockedFeaturesReply);
    when(mockedFeaturesReply.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    when(mockedFeaturesReply.getDatapathId()).thenReturn(BigInteger.valueOf(123L));
    when(mocketGetFeaturesOutput.getTables()).thenReturn(tableId);
    when(mocketGetFeaturesOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    when(mocketGetFeaturesOutput.getDatapathId()).thenReturn(BigInteger.valueOf(123L));
    when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimaryConnection);
    when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(NODE_PATH);
    when(mockedDeviceInfo.getNodeId()).thenReturn(mockedNodeId);
    when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN);
    when(mockedDeviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
    when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
    when(mockedDeviceContext.getDeviceFlowRegistry()).thenReturn(mockedFlowRegistry);
    when(mockedFlowRegistry.retrieveDescriptor(Matchers.any(FlowRegistryKey.class))).thenReturn(mockedFlowDescriptor);
    final InstanceIdentifier<FlowCapableNode> nodePath = mockedDeviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableNode.class);
    final FlowCapableNodeBuilder flowNodeBuilder = new FlowCapableNodeBuilder();
    flowNodeBuilder.setTable(Collections.<Table>emptyList());
    final Optional<FlowCapableNode> flowNodeOpt = Optional.of(flowNodeBuilder.build());
    final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> flowNodeFuture = Futures.immediateCheckedFuture(flowNodeOpt);
    when(mockedReadOnlyTx.read(LogicalDatastoreType.OPERATIONAL, nodePath)).thenReturn(flowNodeFuture);
    when(mockedDeviceContext.getReadTransaction()).thenReturn(mockedReadOnlyTx);
    dummyRequestContext = new AbstractRequestContext<List<MultipartReply>>(DUMMY_XID) {

        @Override
        public void close() {
        // NOOP
        }
    };
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    multipartRequestOnTheFlyCallback = new MultiLayerFlowMultipartRequestOnTheFlyCallback<>(dummyRequestContext, String.class, mockedDeviceContext, dummyEventIdentifier, MultipartWriterProviderFactory.createDefaultProvider(mockedDeviceContext), convertorManager);
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) FlowRegistryKey(org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey) Optional(com.google.common.base.Optional) MessageIntelligenceAgencyImpl(org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) FlowCapableNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder) List(java.util.List) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) Before(org.junit.Before)

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