Search in sources :

Example 1 with MessageIntelligenceAgencyImpl

use of org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl in project openflowplugin by opendaylight.

the class AbstractRequestCallbackTest method initialization.

@Before
public void initialization() {
    dummyRequestContext = new AbstractRequestContext(DUMMY_XID) {

        @Override
        public void close() {
        }
    };
    abstractRequestCallback = new AbstractRequestCallback(dummyRequestContext, DUMMY_REQUEST_TYPE, new MessageIntelligenceAgencyImpl(), DUMMY_EVENT_IDENTIFIER) {

        @Override
        public void onSuccess(Object object) {
        }
    };
}
Also used : MessageIntelligenceAgencyImpl(org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl) AbstractRequestContext(org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext) Before(org.junit.Before)

Example 2 with MessageIntelligenceAgencyImpl

use of org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl 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

Before (org.junit.Before)2 MessageIntelligenceAgencyImpl (org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl)2 Optional (com.google.common.base.Optional)1 List (java.util.List)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 FlowRegistryKey (org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey)1 AbstractRequestContext (org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext)1 ConvertorManager (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager)1 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)1 FlowCapableNodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder)1