コード例 #1
0
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with empty flow stats
   */
  @Test
  public void testEmptyFlowCase() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPFLOW);

    MultipartReplyFlowCaseBuilder caseBuilder = new MultipartReplyFlowCaseBuilder();
    MultipartReplyFlowBuilder flowBuilder = new MultipartReplyFlowBuilder();
    List<FlowStats> flowStats = new ArrayList<>();
    flowBuilder.setFlowStats(flowStats);
    caseBuilder.setMultipartReplyFlow(flowBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    FlowsStatisticsUpdate flowUpdate = (FlowsStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", flowUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, flowUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, flowUpdate.getTransactionId().getValue().intValue());
    List<FlowAndStatisticsMapList> mapList = flowUpdate.getFlowAndStatisticsMapList();
    Assert.assertEquals("Wrong flow stats size", 0, mapList.size());
  }
コード例 #2
0
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with empty port stats
   */
  @Test
  public void testEmptyPortStats() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPPORTSTATS);

    MultipartReplyPortStatsCaseBuilder caseBuilder = new MultipartReplyPortStatsCaseBuilder();
    MultipartReplyPortStatsBuilder statsBuilder = new MultipartReplyPortStatsBuilder();
    List<PortStats> portStats = new ArrayList<>();
    statsBuilder.setPortStats(portStats);
    caseBuilder.setMultipartReplyPortStats(statsBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    NodeConnectorStatisticsUpdate statUpdate = (NodeConnectorStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", statUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, statUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, statUpdate.getTransactionId().getValue().intValue());
    Assert.assertEquals(
        "Wrong port stats size", 0, statUpdate.getNodeConnectorStatisticsAndPortNumberMap().size());
  }
コード例 #3
0
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with experimenter MultipartReply message
   */
  @Test
  public void testExperimenterCase() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPEXPERIMENTER);
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 0, list.size());
  }
コード例 #4
0
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with table stats
   */
  @Test
  public void testTableStats() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPTABLE);

    MultipartReplyTableCaseBuilder caseBuilder = new MultipartReplyTableCaseBuilder();
    MultipartReplyTableBuilder statsBuilder = new MultipartReplyTableBuilder();
    List<TableStats> tableStats = new ArrayList<>();
    TableStatsBuilder builder = new TableStatsBuilder();
    builder.setTableId((short) 1);
    builder.setActiveCount(2L);
    builder.setLookupCount(new BigInteger("3"));
    builder.setMatchedCount(new BigInteger("4"));
    tableStats.add(builder.build());
    builder = new TableStatsBuilder();
    builder.setTableId((short) 10);
    builder.setActiveCount(20L);
    builder.setLookupCount(new BigInteger("30"));
    builder.setMatchedCount(new BigInteger("40"));
    tableStats.add(builder.build());
    statsBuilder.setTableStats(tableStats);
    caseBuilder.setMultipartReplyTable(statsBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    FlowTableStatisticsUpdate statUpdate = (FlowTableStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", statUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, statUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, statUpdate.getTransactionId().getValue().intValue());
    Assert.assertEquals(
        "Wrong table stats size", 2, statUpdate.getFlowTableAndStatisticsMap().size());
    FlowTableAndStatisticsMap stat = statUpdate.getFlowTableAndStatisticsMap().get(0);
    Assert.assertEquals("Wrong table-id", 1, stat.getTableId().getValue().intValue());
    Assert.assertEquals("Wrong active count", 2, stat.getActiveFlows().getValue().intValue());
    Assert.assertEquals("Wrong lookup count", 3, stat.getPacketsLookedUp().getValue().intValue());
    Assert.assertEquals("Wrong matched count", 4, stat.getPacketsMatched().getValue().intValue());
    stat = statUpdate.getFlowTableAndStatisticsMap().get(1);
    Assert.assertEquals("Wrong table-id", 10, stat.getTableId().getValue().intValue());
    Assert.assertEquals("Wrong active count", 20, stat.getActiveFlows().getValue().intValue());
    Assert.assertEquals("Wrong lookup count", 30, stat.getPacketsLookedUp().getValue().intValue());
    Assert.assertEquals("Wrong matched count", 40, stat.getPacketsMatched().getValue().intValue());
  }
コード例 #5
0
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with experimenter MultipartReply message
   */
  @Test
  public void testFlowCase() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPFLOW);

    MultipartReplyFlowCaseBuilder caseBuilder = new MultipartReplyFlowCaseBuilder();
    MultipartReplyFlowBuilder flowBuilder = new MultipartReplyFlowBuilder();
    List<FlowStats> flowStats = new ArrayList<>();
    FlowStatsBuilder statsBuilder = new FlowStatsBuilder();
    statsBuilder.setTableId((short) 1);
    statsBuilder.setDurationSec(2L);
    statsBuilder.setDurationNsec(3L);
    statsBuilder.setPriority(4);
    statsBuilder.setIdleTimeout(5);
    statsBuilder.setHardTimeout(6);
    FlowModFlags flags = new FlowModFlags(true, false, true, false, true);
    statsBuilder.setFlags(flags);
    statsBuilder.setCookie(new BigInteger("7"));
    statsBuilder.setPacketCount(new BigInteger("8"));
    statsBuilder.setByteCount(new BigInteger("9"));
    MatchBuilder matchBuilder = new MatchBuilder();
    matchBuilder.setType(OxmMatchType.class);
    matchBuilder.setMatchEntry(new ArrayList<MatchEntry>());
    statsBuilder.setMatch(matchBuilder.build());
    statsBuilder.setInstruction(new ArrayList<Instruction>());
    flowStats.add(statsBuilder.build());
    statsBuilder = new FlowStatsBuilder();
    statsBuilder.setTableId((short) 10);
    statsBuilder.setDurationSec(20L);
    statsBuilder.setDurationNsec(30L);
    statsBuilder.setPriority(40);
    statsBuilder.setIdleTimeout(50);
    statsBuilder.setHardTimeout(60);
    flags = new FlowModFlags(false, true, false, true, false);
    statsBuilder.setFlags(flags);
    statsBuilder.setCookie(new BigInteger("70"));
    statsBuilder.setPacketCount(new BigInteger("80"));
    statsBuilder.setByteCount(new BigInteger("90"));
    matchBuilder = new MatchBuilder();
    matchBuilder.setType(OxmMatchType.class);
    matchBuilder.setMatchEntry(new ArrayList<MatchEntry>());
    statsBuilder.setMatch(matchBuilder.build());
    statsBuilder.setInstruction(new ArrayList<Instruction>());
    flowStats.add(statsBuilder.build());
    flowBuilder.setFlowStats(flowStats);
    caseBuilder.setMultipartReplyFlow(flowBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    FlowsStatisticsUpdate flowUpdate = (FlowsStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", flowUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, flowUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, flowUpdate.getTransactionId().getValue().intValue());
    List<FlowAndStatisticsMapList> mapList = flowUpdate.getFlowAndStatisticsMapList();
    Assert.assertEquals("Wrong flow stats size", 2, mapList.size());
    FlowAndStatisticsMapList stat = mapList.get(0);
    Assert.assertEquals("Wrong table-id", 1, stat.getTableId().intValue());
    Assert.assertEquals(
        "Wrong duration sec", 2, stat.getDuration().getSecond().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration n sec", 3, stat.getDuration().getNanosecond().getValue().intValue());
    Assert.assertEquals("Wrong priority", 4, stat.getPriority().intValue());
    Assert.assertEquals("Wrong idle-timeout", 5, stat.getIdleTimeout().intValue());
    Assert.assertEquals("Wrong hard-timeout", 6, stat.getHardTimeout().intValue());
    org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags expectedFlags =
        new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags(
            !flags.isOFPFFCHECKOVERLAP(),
            !flags.isOFPFFNOBYTCOUNTS(),
            !flags.isOFPFFNOPKTCOUNTS(),
            !flags.isOFPFFRESETCOUNTS(),
            !flags.isOFPFFSENDFLOWREM());
    Assert.assertEquals("Wrong flags", expectedFlags, stat.getFlags());
    Assert.assertEquals("Wrong cookie", 7, stat.getCookie().getValue().intValue());
    Assert.assertEquals("Wrong packet count", 8, stat.getPacketCount().getValue().intValue());
    Assert.assertEquals("Wrong byte count", 9, stat.getByteCount().getValue().intValue());
    org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder
        emptyMatchBuilder =
            new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow
                .MatchBuilder();
    Match emptyMatch = emptyMatchBuilder.build();
    Assert.assertEquals("Wrong match", emptyMatch, stat.getMatch());
    Assert.assertEquals("Wrong instructions", 0, stat.getInstructions().getInstruction().size());
    stat = mapList.get(1);
    Assert.assertEquals("Wrong table-id", 10, stat.getTableId().intValue());
    Assert.assertEquals(
        "Wrong duration sec", 20, stat.getDuration().getSecond().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration n sec", 30, stat.getDuration().getNanosecond().getValue().intValue());
    Assert.assertEquals("Wrong priority", 40, stat.getPriority().intValue());
    Assert.assertEquals("Wrong idle-timeout", 50, stat.getIdleTimeout().intValue());
    Assert.assertEquals("Wrong hard-timeout", 60, stat.getHardTimeout().intValue());
    expectedFlags =
        new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags(
            flags.isOFPFFCHECKOVERLAP(),
            flags.isOFPFFNOBYTCOUNTS(),
            flags.isOFPFFNOPKTCOUNTS(),
            flags.isOFPFFRESETCOUNTS(),
            flags.isOFPFFSENDFLOWREM());
    Assert.assertEquals("Wrong flags", expectedFlags, stat.getFlags());
    Assert.assertEquals("Wrong cookie", 70, stat.getCookie().getValue().intValue());
    Assert.assertEquals("Wrong packet count", 80, stat.getPacketCount().getValue().intValue());
    Assert.assertEquals("Wrong byte count", 90, stat.getByteCount().getValue().intValue());
    Assert.assertEquals("Wrong match", emptyMatch, stat.getMatch());
    Assert.assertEquals("Wrong instructions", 0, stat.getInstructions().getInstruction().size());
  }
コード例 #6
0
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with queue stats
   */
  @Test
  public void testQueueStats() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPQUEUE);

    MultipartReplyQueueCaseBuilder caseBuilder = new MultipartReplyQueueCaseBuilder();
    MultipartReplyQueueBuilder statsBuilder = new MultipartReplyQueueBuilder();
    List<QueueStats> queueStats = new ArrayList<>();
    QueueStatsBuilder builder = new QueueStatsBuilder();
    builder.setPortNo(BinContent.intToUnsignedLong(PortNumberValues.FLOOD.getIntValue()));
    builder.setQueueId(2L);
    builder.setTxPackets(new BigInteger("3"));
    builder.setTxBytes(new BigInteger("4"));
    builder.setTxErrors(new BigInteger("5"));
    builder.setDurationSec(6L);
    builder.setDurationNsec(7L);
    queueStats.add(builder.build());
    builder = new QueueStatsBuilder();
    builder.setPortNo(BinContent.intToUnsignedLong(PortNumberValues.INPORT.getIntValue()));
    builder.setQueueId(20L);
    builder.setTxPackets(new BigInteger("30"));
    builder.setTxBytes(new BigInteger("40"));
    builder.setTxErrors(new BigInteger("50"));
    builder.setDurationSec(60L);
    builder.setDurationNsec(70L);
    queueStats.add(builder.build());
    statsBuilder.setQueueStats(queueStats);
    caseBuilder.setMultipartReplyQueue(statsBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    QueueStatisticsUpdate statUpdate = (QueueStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", statUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, statUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, statUpdate.getTransactionId().getValue().intValue());
    Assert.assertEquals(
        "Wrong queue stats size", 2, statUpdate.getQueueIdAndStatisticsMap().size());
    QueueIdAndStatisticsMap stat = statUpdate.getQueueIdAndStatisticsMap().get(0);
    Assert.assertEquals(
        "Wrong port number", "openflow:42:FLOOD", stat.getNodeConnectorId().getValue());
    Assert.assertEquals("Wrong queue-id", 2, stat.getQueueId().getValue().intValue());
    Assert.assertEquals("Wrong tx packets", 3, stat.getTransmittedPackets().getValue().intValue());
    Assert.assertEquals("Wrong tx bytes", 4, stat.getTransmittedBytes().getValue().intValue());
    Assert.assertEquals("Wrong tx errors", 5, stat.getTransmissionErrors().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration sec", 6, stat.getDuration().getSecond().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration n sec", 7, stat.getDuration().getNanosecond().getValue().intValue());
    stat = statUpdate.getQueueIdAndStatisticsMap().get(1);
    Assert.assertEquals(
        "Wrong port number", "openflow:42:INPORT", stat.getNodeConnectorId().getValue());
    Assert.assertEquals("Wrong queue-id", 20, stat.getQueueId().getValue().intValue());
    Assert.assertEquals("Wrong tx packets", 30, stat.getTransmittedPackets().getValue().intValue());
    Assert.assertEquals("Wrong tx bytes", 40, stat.getTransmittedBytes().getValue().intValue());
    Assert.assertEquals("Wrong tx errors", 50, stat.getTransmissionErrors().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration sec", 60, stat.getDuration().getSecond().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration n sec", 70, stat.getDuration().getNanosecond().getValue().intValue());
  }
コード例 #7
0
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with port stats
   */
  @Test
  public void testPortStats() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPPORTSTATS);

    MultipartReplyPortStatsCaseBuilder caseBuilder = new MultipartReplyPortStatsCaseBuilder();
    MultipartReplyPortStatsBuilder statsBuilder = new MultipartReplyPortStatsBuilder();
    List<PortStats> portStats = new ArrayList<>();
    PortStatsBuilder builder = new PortStatsBuilder();
    builder.setPortNo(1L);
    builder.setRxPackets(new BigInteger("2"));
    builder.setTxPackets(new BigInteger("3"));
    builder.setRxBytes(new BigInteger("4"));
    builder.setTxBytes(new BigInteger("5"));
    builder.setRxDropped(new BigInteger("6"));
    builder.setTxDropped(new BigInteger("7"));
    builder.setRxErrors(new BigInteger("8"));
    builder.setTxErrors(new BigInteger("9"));
    builder.setRxFrameErr(new BigInteger("10"));
    builder.setRxOverErr(new BigInteger("11"));
    builder.setRxCrcErr(new BigInteger("12"));
    builder.setCollisions(new BigInteger("13"));
    builder.setDurationSec(14L);
    builder.setDurationNsec(15L);
    portStats.add(builder.build());
    builder = new PortStatsBuilder();
    builder.setPortNo(BinContent.intToUnsignedLong(PortNumberValues.CONTROLLER.getIntValue()));
    builder.setRxPackets(new BigInteger("20"));
    builder.setTxPackets(new BigInteger("30"));
    builder.setRxBytes(new BigInteger("40"));
    builder.setTxBytes(new BigInteger("50"));
    builder.setRxDropped(new BigInteger("60"));
    builder.setTxDropped(new BigInteger("70"));
    builder.setRxErrors(new BigInteger("80"));
    builder.setTxErrors(new BigInteger("90"));
    builder.setRxFrameErr(new BigInteger("100"));
    builder.setRxOverErr(new BigInteger("110"));
    builder.setRxCrcErr(new BigInteger("120"));
    builder.setCollisions(new BigInteger("130"));
    portStats.add(builder.build());
    statsBuilder.setPortStats(portStats);
    caseBuilder.setMultipartReplyPortStats(statsBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    NodeConnectorStatisticsUpdate statUpdate = (NodeConnectorStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", statUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, statUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, statUpdate.getTransactionId().getValue().intValue());
    Assert.assertEquals(
        "Wrong port stats size", 2, statUpdate.getNodeConnectorStatisticsAndPortNumberMap().size());
    NodeConnectorStatisticsAndPortNumberMap stat =
        statUpdate.getNodeConnectorStatisticsAndPortNumberMap().get(0);
    Assert.assertEquals("Wrong port number", "openflow:42:1", stat.getNodeConnectorId().getValue());
    Assert.assertEquals("Wrong rx packets", 2, stat.getPackets().getReceived().intValue());
    Assert.assertEquals("Wrong tx packets", 3, stat.getPackets().getTransmitted().intValue());
    Assert.assertEquals("Wrong rx bytes", 4, stat.getBytes().getReceived().intValue());
    Assert.assertEquals("Wrong tx bytes", 5, stat.getBytes().getTransmitted().intValue());
    Assert.assertEquals("Wrong rx dropped", 6, stat.getReceiveDrops().intValue());
    Assert.assertEquals("Wrong tx dropped", 7, stat.getTransmitDrops().intValue());
    Assert.assertEquals("Wrong rx errors", 8, stat.getReceiveErrors().intValue());
    Assert.assertEquals("Wrong tx errors", 9, stat.getTransmitErrors().intValue());
    Assert.assertEquals("Wrong rx frame error", 10, stat.getReceiveFrameError().intValue());
    Assert.assertEquals("Wrong rx over error", 11, stat.getReceiveOverRunError().intValue());
    Assert.assertEquals("Wrong rx crc error", 12, stat.getReceiveCrcError().intValue());
    Assert.assertEquals("Wrong collision count", 13, stat.getCollisionCount().intValue());
    Assert.assertEquals(
        "Wrong duration sec", 14, stat.getDuration().getSecond().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration n sec", 15, stat.getDuration().getNanosecond().getValue().intValue());
    stat = statUpdate.getNodeConnectorStatisticsAndPortNumberMap().get(1);
    Assert.assertEquals(
        "Wrong port number", "openflow:42:CONTROLLER", stat.getNodeConnectorId().getValue());
    Assert.assertEquals("Wrong rx packets", 20, stat.getPackets().getReceived().intValue());
    Assert.assertEquals("Wrong tx packets", 30, stat.getPackets().getTransmitted().intValue());
    Assert.assertEquals("Wrong rx bytes", 40, stat.getBytes().getReceived().intValue());
    Assert.assertEquals("Wrong tx bytes", 50, stat.getBytes().getTransmitted().intValue());
    Assert.assertEquals("Wrong rx dropped", 60, stat.getReceiveDrops().intValue());
    Assert.assertEquals("Wrong tx dropped", 70, stat.getTransmitDrops().intValue());
    Assert.assertEquals("Wrong rx errors", 80, stat.getReceiveErrors().intValue());
    Assert.assertEquals("Wrong tx errors", 90, stat.getTransmitErrors().intValue());
    Assert.assertEquals("Wrong rx frame error", 100, stat.getReceiveFrameError().intValue());
    Assert.assertEquals("Wrong rx over error", 110, stat.getReceiveOverRunError().intValue());
    Assert.assertEquals("Wrong rx crc error", 120, stat.getReceiveCrcError().intValue());
    Assert.assertEquals("Wrong collision count", 130, stat.getCollisionCount().intValue());
    Assert.assertEquals("Wrong duration sec", null, stat.getDuration().getSecond());
    Assert.assertEquals("Wrong duration n sec", null, stat.getDuration().getNanosecond());
  }