Search in sources :

Example 1 with GroupStatisticsReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupStatisticsReply 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());
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) DeviceContext(org.opendaylight.openflowplugin.api.openflow.device.DeviceContext) DataContainer(org.opendaylight.yangtools.yang.binding.DataContainer) GroupStatisticsReply(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupStatisticsReply) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DeviceContext (org.opendaylight.openflowplugin.api.openflow.device.DeviceContext)1 GroupStatisticsReply (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupStatisticsReply)1 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)1 DataContainer (org.opendaylight.yangtools.yang.binding.DataContainer)1