X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FPortStatisticsConverter.java;h=0fe1c72345810e507c372e379f8e4c8fc3153cbb;hb=f853f4cb2c1bd86ec2f227d34fad097073e5c1ee;hp=2b4df3f0c10ce7b3dddf463a29dfc37b7fb978a7;hpb=29f7cfb54b580928c7feac63abce028a7014b0d5;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java index 2b4df3f0c1..0fe1c72345 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/PortStatisticsConverter.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * @@ -10,14 +9,16 @@ package org.opendaylight.controller.protocol_plugin.openflow.internal; import java.util.ArrayList; +import java.util.Collections; import java.util.List; -import org.openflow.protocol.statistics.OFPortStatisticsReply; -import org.openflow.protocol.statistics.OFStatistics; - import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.reader.NodeConnectorStatistics; import org.opendaylight.controller.sal.utils.NodeCreator; +import org.openflow.protocol.statistics.OFPortStatisticsReply; +import org.openflow.protocol.statistics.OFStatistics; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Converts an openflow list of port statistics in a SAL list of @@ -27,6 +28,8 @@ import org.opendaylight.controller.sal.utils.NodeCreator; * */ public class PortStatisticsConverter { + private static final Logger log = LoggerFactory + .getLogger(PortStatisticsConverter.class); private long switchId; private List ofStatsList; private List ncStatsList; @@ -34,7 +37,7 @@ public class PortStatisticsConverter { public PortStatisticsConverter(long switchId, List statsList) { this.switchId = switchId; if (statsList == null || statsList.isEmpty()) { - this.ofStatsList = new ArrayList(1); // dummy list + this.ofStatsList = Collections.emptyList(); } else { this.ofStatsList = new ArrayList(statsList); } @@ -63,13 +66,13 @@ public class PortStatisticsConverter { .getReceiveFrameErrors()); NCStat.setReceiveOverRunErrorCount(ofPortStat .getReceiveOverrunErrors()); - NCStat - .setReceiveCRCErrorCount(ofPortStat - .getReceiveCRCErrors()); + NCStat.setReceiveCRCErrorCount(ofPortStat.getReceiveCRCErrors()); NCStat.setCollisionCount(ofPortStat.getCollisions()); this.ncStatsList.add(NCStat); } } + log.trace("OFStatistics: {} NodeConnectorStatistics: {}", ofStatsList, + ncStatsList); return this.ncStatsList; }