+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.openflowplugin.impl.services;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@Mock
private DeviceState mockedDeviceState;
@Mock
+ private DeviceInfo mockedDeviceInfo;
+ @Mock
private GetFeaturesOutput mocketGetFeaturesOutput;
@Mock
private DeviceFlowRegistry mockedFlowRegistry;
when(mocketGetFeaturesOutput.getDatapathId()).thenReturn(BigInteger.valueOf(123L));
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimaryConnection);
- when(mockedDeviceState.getNodeInstanceIdentifier()).thenReturn(NODE_PATH);
- when(mockedDeviceState.getFeatures()).thenReturn(mocketGetFeaturesOutput);
- when(mockedDeviceState.deviceSynchronized()).thenReturn(true);
- when(mockedDeviceState.getNodeId()).thenReturn(mockedNodeId);
+ 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);
- final InstanceIdentifier<FlowCapableNode> nodePath = mockedDeviceState.getNodeInstanceIdentifier().augmentation(FlowCapableNode.class);
+ 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());
//NOOP
}
};
+
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
multipartRequestOnTheFlyCallback = new MultipartRequestOnTheFlyCallback(dummyRequestContext, String.class,
- mockedDeviceContext.getMessageSpy(),dummyEventIdentifier, mockedDeviceContext.getDeviceState(),
- mockedDeviceContext.getDeviceFlowRegistry(), mockedDeviceContext);
+ mockedDeviceContext.getMessageSpy(),dummyEventIdentifier, mockedDeviceInfo,
+ mockedDeviceContext.getDeviceFlowRegistry(), mockedDeviceContext, convertorManager);
}
.setMultipartReplyBody(multipartReplyFlowCaseBuilder.build())
.setXid(21L);
- final InstanceIdentifier<FlowCapableNode> nodePath = mockedDeviceState.getNodeInstanceIdentifier()
+ final InstanceIdentifier<FlowCapableNode> nodePath = mockedDeviceInfo.getNodeInstanceIdentifier()
.augmentation(FlowCapableNode.class);
final FlowCapableNodeBuilder flowNodeBuilder = new FlowCapableNodeBuilder();
final TableBuilder tableDataBld = new TableBuilder();
verify(mockedReadOnlyTx, times(1)).read(LogicalDatastoreType.OPERATIONAL, nodePath);
verify(mockedReadOnlyTx, times(1)).close();
- verify(mockedFlowRegistry).storeIfNecessary(Matchers.<FlowRegistryKey> any(), Matchers.anyShort());
+ verify(mockedFlowRegistry).storeIfNecessary(Matchers.<FlowRegistryKey> any());
verify(mockedDeviceContext, times(1)).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL),
eq(tableIdent), Matchers.<Table> any());
/*
assertNotNull(actualResult.getResult());
assertTrue(actualResult.getResult().isEmpty());
- Mockito.verify(mockedFlowRegistry, Mockito.never()).storeIfNecessary(Matchers.<FlowRegistryKey>any(), Matchers.anyShort());
+ Mockito.verify(mockedFlowRegistry, Mockito.never()).storeIfNecessary(Matchers.any());
Mockito.verify(mockedDeviceContext, Mockito.never()).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
Matchers.<InstanceIdentifier>any(), Matchers.<DataObject>any());
}
-}
\ No newline at end of file
+}