use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartRequestCallbackTest method testOnSuccess3.
/**
* Successfully added to collection.
*/
@Test
public void testOnSuccess3() throws Exception {
final MultipartReplyMessage replyMessage = new MultipartReplyMessageBuilder().build();
multipartRequestCallback.onSuccess(replyMessage);
Mockito.verify(multiMsgCollector).addMultipartMsg(Matchers.eq(replyMessage), Matchers.eq(false), Matchers.any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorTest method testTranslateAggregate.
@Test
public void testTranslateAggregate() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyAggregate(), MultipartType.OFPMPAGGREGATE);
DataContainer result = MultipartReplyTranslatorUtil.translate(multipartReplyMessage, mockedDeviceContext.getDeviceInfo(), CONVERTOR_MANAGER, mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
assertTrue(dataObject instanceof AggregateFlowStatistics);
AggregateFlowStatistics message = (AggregateFlowStatistics) dataObject;
assertEquals(DUMMY_BYTE_COUNT, message.getByteCount().getValue());
assertEquals(DUMMY_PACKET_COUNT, message.getPacketCount().getValue());
assertEquals(DUMMY_FLOW_COUNT, message.getFlowCount().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorTest method testTranslateGroup.
@Test
public void testTranslateGroup() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyGroup(), MultipartType.OFPMPGROUP);
DataContainer result = MultipartReplyTranslatorUtil.translate(multipartReplyMessage, mockedDeviceContext.getDeviceInfo(), CONVERTOR_MANAGER, mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
assertTrue(dataObject instanceof GroupStatisticsReply);
GroupStatisticsReply groupStatisticsUpdate = (GroupStatisticsReply) dataObject;
List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> groupStats = groupStatisticsUpdate.getGroupStats();
assertEquals(1, groupStats.size());
org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats groupStat = groupStats.get(0);
assertEquals(DUMMY_BYTE_COUNT, groupStat.getByteCount().getValue());
assertEquals(DUMMY_DURATION_SEC, groupStat.getDuration().getSecond().getValue());
assertEquals(DUMMY_DURATION_NSEC, groupStat.getDuration().getNanosecond().getValue());
assertEquals(DUMMY_GROUP_ID.getValue(), groupStat.getGroupId().getValue());
assertEquals(DUMMY_PACKET_COUNT, groupStat.getPacketCount().getValue());
assertEquals(DUMMY_REF_COUNT, groupStat.getRefCount().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorTest method testTranslateGroupDesc.
@Test
public void testTranslateGroupDesc() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyGroupDesc(), MultipartType.OFPMPGROUPDESC);
DataContainer result = MultipartReplyTranslatorUtil.translate(multipartReplyMessage, mockedDeviceContext.getDeviceInfo(), CONVERTOR_MANAGER, mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
assertTrue(dataObject instanceof GroupDescStatsReply);
GroupDescStatsReply groupStatistics = (GroupDescStatsReply) dataObject;
List<GroupDescStats> groupDescStats = groupStatistics.getGroupDescStats();
assertEquals(1, groupDescStats.size());
GroupDescStats groupDescStat = groupDescStats.get(0);
assertEquals(DUMMY_GROUP_ID.getValue(), groupDescStat.getGroupId().getValue());
assertEquals(DUMMY_GROUPS_TYPE, groupDescStat.getGroupType());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorTest method prepareMocks.
private MultipartReplyMessage prepareMocks(DeviceContext mockedDeviceContext, MultipartReplyBody multipartReplyBody, final MultipartType multipartType) {
ConnectionContext mockedConnectionContext = mock(ConnectionContext.class);
FeaturesReply mockedFeaturesReply = mock(FeaturesReply.class);
when(mockedFeaturesReply.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(mockedFeaturesReply.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
DeviceInfo deviceInfo = mock(DeviceInfo.class);
when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(deviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
when(mockedDeviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeaturesReply);
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext);
MultipartReplyMessage multipartReplyMessage = mock(MultipartReplyMessage.class);
when(multipartReplyMessage.getType()).thenReturn(multipartType);
when(multipartReplyMessage.getFlags()).thenReturn(new MultipartRequestFlags(true));
when(multipartReplyMessage.getXid()).thenReturn(DUMMY_XID);
when(multipartReplyMessage.getMultipartReplyBody()).thenReturn(multipartReplyBody);
return multipartReplyMessage;
}
Aggregations