X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fadsal%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FTableStatisticsConverter.java;fp=opendaylight%2Fadsal%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FTableStatisticsConverter.java;h=0000000000000000000000000000000000000000;hp=35a763869b20f2e73c2c773d748930970212820c;hb=50f88249a65c52ba56a48852b71ce432fed2bbeb;hpb=abfa9a03550cbe9fccc4420684dced175dd6d119 diff --git a/opendaylight/adsal/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TableStatisticsConverter.java b/opendaylight/adsal/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TableStatisticsConverter.java deleted file mode 100644 index 35a763869b..0000000000 --- a/opendaylight/adsal/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TableStatisticsConverter.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2013 Big Switch Networks, Inc. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.protocol_plugin.openflow.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opendaylight.controller.sal.core.Node; -import org.opendaylight.controller.sal.reader.NodeTableStatistics; -import org.opendaylight.controller.sal.utils.NodeCreator; -import org.openflow.protocol.statistics.OFStatistics; -import org.openflow.protocol.statistics.OFTableStatistics; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Converts an openflow list of table statistics in a SAL list of - * NodeTableStatistics objects - */ -public class TableStatisticsConverter { - private static final Logger log = LoggerFactory - .getLogger(TableStatisticsConverter.class); - - private final long switchId; - private List ofStatsList; - private List ntStatsList; - - public TableStatisticsConverter(long switchId, List statsList) { - this.switchId = switchId; - if (statsList == null || statsList.isEmpty()) { - this.ofStatsList = Collections.emptyList(); - } else { - this.ofStatsList = new ArrayList(statsList); - } - this.ntStatsList = null; - } - - public List getNodeTableStatsList() { - if (this.ofStatsList != null && this.ntStatsList == null) { - this.ntStatsList = new ArrayList(); - OFTableStatistics ofTableStat; - Node node = NodeCreator.createOFNode(switchId); - for (OFStatistics ofStat : this.ofStatsList) { - ofTableStat = (OFTableStatistics) ofStat; - NodeTableStatistics ntStat = new NodeTableStatistics(); - ntStat.setNodeTable(TableConverter.toNodeTable( - ofTableStat.getTableId(), node)); - ntStat.setActiveCount(ofTableStat.getActiveCount()); - ntStat.setLookupCount(ofTableStat.getLookupCount()); - ntStat.setMatchedCount(ofTableStat.getMatchedCount()); - ntStat.setMaximumEntries(ofTableStat.getMaximumEntries()); - this.ntStatsList.add(ntStat); - } - } - log.trace("OFStatistics: {} NodeTableStatistics: {}", ofStatsList, - ntStatsList); - return this.ntStatsList; - } -}