Search in sources :

Example 6 with DataContainer

use of org.opendaylight.yangtools.yang.binding.DataContainer in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method testTranslatePortStats.

@Test
public void testTranslatePortStats() {
    DeviceContext mockedDeviceContext = mock(DeviceContext.class);
    MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyPortStats(), MultipartType.OFPMPPORTSTATS);
    DataContainer result = MultipartReplyTranslatorUtil.translate(multipartReplyMessage, mockedDeviceContext.getDeviceInfo(), CONVERTOR_MANAGER, mockedDeviceContext.oook()).get();
    DataContainer dataObject = validateOutput(result);
    assertTrue(dataObject instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap);
    org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatisticsUpdate = (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap) dataObject;
    List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMaps = nodeConnectorStatisticsUpdate.getNodeConnectorStatisticsAndPortNumberMap();
    assertEquals(1, nodeConnectorStatisticsAndPortNumberMaps.size());
    NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatisticsAndPortNumberMap = nodeConnectorStatisticsAndPortNumberMaps.get(0);
    assertEquals("openflow:" + DUMMY_DATAPATH_ID + ":" + DUMMY_PORT_NO, nodeConnectorStatisticsAndPortNumberMap.getNodeConnectorId().getValue());
    assertEquals(DUMMY_RX_BYTES, nodeConnectorStatisticsAndPortNumberMap.getBytes().getReceived());
    assertEquals(DUMMY_TX_BYTES, nodeConnectorStatisticsAndPortNumberMap.getBytes().getTransmitted());
    assertEquals(DUMMY_RX_PACKETS, nodeConnectorStatisticsAndPortNumberMap.getPackets().getReceived());
    assertEquals(DUMMY_TX_PACKETS, nodeConnectorStatisticsAndPortNumberMap.getPackets().getTransmitted());
    assertEquals(DUMMY_COLLISIONS, nodeConnectorStatisticsAndPortNumberMap.getCollisionCount());
    assertEquals(DUMMY_RX_CRC_ERR, nodeConnectorStatisticsAndPortNumberMap.getReceiveCrcError());
    assertEquals(DUMMY_RX_DROPPED, nodeConnectorStatisticsAndPortNumberMap.getReceiveDrops());
    assertEquals(DUMMY_RX_ERRORS, nodeConnectorStatisticsAndPortNumberMap.getReceiveErrors());
    assertEquals(DUMMY_RX_FRAME_ERR, nodeConnectorStatisticsAndPortNumberMap.getReceiveFrameError());
    assertEquals(DUMMY_OVER_ERR, nodeConnectorStatisticsAndPortNumberMap.getReceiveOverRunError());
    assertEquals(DUMMY_TX_DROPPED, nodeConnectorStatisticsAndPortNumberMap.getTransmitDrops());
    assertEquals(DUMMY_TX_ERRORS, nodeConnectorStatisticsAndPortNumberMap.getTransmitErrors());
}
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) NodeConnectorStatisticsAndPortNumberMap(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap) Test(org.junit.Test)

Aggregations

DataContainer (org.opendaylight.yangtools.yang.binding.DataContainer)6 Test (org.junit.Test)5 DeviceContext (org.opendaylight.openflowplugin.api.openflow.device.DeviceContext)5 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)5 OutboundQueue (org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue)1 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)1 ServiceException (org.opendaylight.openflowplugin.impl.services.util.ServiceException)1 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowAndStatisticsMapList)1 GroupDescStatsReply (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupDescStatsReply)1 GroupStatisticsReply (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupStatisticsReply)1 GroupDescStats (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats)1 AggregateFlowStatistics (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.AggregateFlowStatistics)1 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)1 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)1