-
/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
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
*
*/
public class PortStatisticsConverter {
+ private static final Logger log = LoggerFactory
+ .getLogger(PortStatisticsConverter.class);
private long switchId;
private List<OFStatistics> ofStatsList;
private List<NodeConnectorStatistics> ncStatsList;
public PortStatisticsConverter(long switchId, List<OFStatistics> statsList) {
this.switchId = switchId;
if (statsList == null || statsList.isEmpty()) {
- this.ofStatsList = new ArrayList<OFStatistics>(1); // dummy list
+ this.ofStatsList = Collections.emptyList();
} else {
this.ofStatsList = new ArrayList<OFStatistics>(statsList);
}
.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;
}