@Override public OFStatistics instantiate() { return new OFTableStatistics(); } }, new Instantiable<OFStatistics>() {
@Override public List<OFStatistics> getOFTableStatistics(Long switchId, Byte tableId) { if (!tableStatistics.containsKey(switchId)) { return Collections.emptyList(); } List<OFStatistics> list = new ArrayList<OFStatistics>(1); for (OFStatistics stats : tableStatistics.get(switchId)) { if (((OFTableStatistics) stats).getTableId() == tableId) { list.add(stats); break; } } return list; }
public List<NodeTableStatistics> getNodeTableStatsList() { if (this.ofStatsList != null && this.ntStatsList == null) { this.ntStatsList = new ArrayList<NodeTableStatistics>(); 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; } }
OFTableStatistics specificReq = new OFTableStatistics(); specificReq.setTableId(targetTable); req.setStatistics(Collections .singletonList((OFStatistics) specificReq)); requestLength += specificReq.getLength();
public List<NodeTableStatistics> getNodeTableStatsList() { if (this.ofStatsList != null && this.ntStatsList == null) { this.ntStatsList = new ArrayList<NodeTableStatistics>(); 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()); this.ntStatsList.add(ntStat); } } log.trace("OFStatistics: {} NodeTableStatistics: {}", ofStatsList, ntStatsList); return this.ntStatsList; } }
OFTableStatistics specificReq = new OFTableStatistics(); specificReq.setTableId(targetTable); req.setStatistics(Collections .singletonList((OFStatistics) specificReq)); requestLength += specificReq.getLength();
@Override public OFStatistics instantiate() { return new OFTableStatistics(); } }), PORT(4, OFPortStatisticsRequest.class,
@Override public List<OFStatistics> getOFTableStatistics(Long switchId, Byte tableId) { if (!tableStatistics.containsKey(switchId)) { return this.dummyList; } List<OFStatistics> list = new ArrayList<OFStatistics>(1); for (OFStatistics stats : tableStatistics.get(switchId)) { if (((OFTableStatistics) stats).getTableId() == tableId) { list.add(stats); break; } } return list; }
private List<OFStatistics> filterTableListPerContainer( String container, long switchId, List<OFStatistics> list) { if (list == null) { return Collections.emptyList(); } // Create new filtered list of node tables List<OFStatistics> newList = new ArrayList<OFStatistics>(); for (OFStatistics stat : list) { OFTableStatistics target = (OFTableStatistics) stat; NodeTable nt = NodeTableCreator.createOFNodeTable(target.getTableId(), NodeCreator.createOFNode(switchId)); if (containerOwnsNodeTable(container, nt)) { newList.add(target); } } return newList; }
public List<OFStatistics> filterTableListPerContainer( String container, long switchId, List<OFStatistics> list) { if (list == null) { return null; } // Create new filtered list of node tables List<OFStatistics> newList = new ArrayList<OFStatistics>(); for (OFStatistics stat : list) { OFTableStatistics target = (OFTableStatistics) stat; NodeTable nt = NodeTableCreator.createOFNodeTable( target.getTableId(), NodeCreator.createOFNode(switchId)); if (containerOwnsNodeTable(container, nt)) { newList.add(target); } } return newList; }