X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fstatistics-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fstatistics%2Fmanager%2FNodeStatisticsAger.java;h=8e68515c325bc1acba4b9ca64a10984f4e2619ce;hb=5d845929062a5370b50b2d059fb2a0fa33340896;hp=2460e1ea9a9f56e6f48a4b3773b0c6577ad890aa;hpb=0a40bd5b8ca97e933ca5d2aaf4b01aa79ccb1c21;p=controller.git diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsAger.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsAger.java index 2460e1ea9a..8e68515c32 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsAger.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsAger.java @@ -18,31 +18,73 @@ import org.opendaylight.controller.sal.binding.api.data.DataModificationTransact import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsData; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsDataBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.aggregate.flow.statistics.AggregateFlowStatisticsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsDataBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatisticsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStatsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupFeatures; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupFeaturesBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatisticsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.desc.GroupDescBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.features.GroupFeaturesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatisticsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupFeatures; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStats; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStatsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterFeatures; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterFeaturesBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatisticsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterFeaturesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterConfigStatsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatisticsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterFeatures; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.AggregateFlowStatistics; +import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData; +import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatisticsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap; import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData; +import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsDataBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.flow.capable.node.connector.queue.statistics.FlowCapableNodeConnectorQueueStatisticsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; @@ -53,18 +95,21 @@ import com.google.common.base.Preconditions; * */ public class NodeStatisticsAger { + private static final Logger logger = LoggerFactory.getLogger(NodeStatisticsAger.class); private static final int NUMBER_OF_WAIT_CYCLES = 2; private final Map groupDescStatsUpdate = new HashMap<>(); private final Map meterConfigStatsUpdate = new HashMap<>(); private final Map flowStatsUpdate = new HashMap<>(); private final Map queuesStatsUpdate = new HashMap<>(); + private final InstanceIdentifier targetNodeIdentifier; private final StatisticsProvider statisticsProvider; private final NodeKey targetNodeKey; public NodeStatisticsAger(StatisticsProvider statisticsProvider, NodeKey nodeKey){ this.statisticsProvider = Preconditions.checkNotNull(statisticsProvider); this.targetNodeKey = Preconditions.checkNotNull(nodeKey); + this.targetNodeIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey).build(); } public class FlowEntry { @@ -123,7 +168,7 @@ public class NodeStatisticsAger { } } - public class QueueEntry{ + private static final class QueueEntry{ private final NodeConnectorId nodeConnectorId; private final QueueId queueId; public QueueEntry(NodeConnectorId ncId, QueueId queueId){ @@ -140,7 +185,6 @@ public class NodeStatisticsAger { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + getOuterType().hashCode(); result = prime * result + ((nodeConnectorId == null) ? 0 : nodeConnectorId.hashCode()); result = prime * result + ((queueId == null) ? 0 : queueId.hashCode()); return result; @@ -157,9 +201,6 @@ public class NodeStatisticsAger { return false; } QueueEntry other = (QueueEntry) obj; - if (!getOuterType().equals(other.getOuterType())) { - return false; - } if (nodeConnectorId == null) { if (other.nodeConnectorId != null) { return false; @@ -176,9 +217,6 @@ public class NodeStatisticsAger { } return true; } - private NodeStatisticsAger getOuterType() { - return NodeStatisticsAger.this; - } } public NodeKey getTargetNodeKey() { @@ -186,23 +224,299 @@ public class NodeStatisticsAger { } public synchronized void updateGroupDescStats(List list){ - Long expiryTime = getExpiryTime(); - for(GroupDescStats groupDescStats : list) + final Long expiryTime = getExpiryTime(); + final DataModificationTransaction trans = statisticsProvider.startChange(); + + for (GroupDescStats groupDescStats : list) { + GroupBuilder groupBuilder = new GroupBuilder(); + GroupKey groupKey = new GroupKey(groupDescStats.getGroupId()); + groupBuilder.setKey(groupKey); + + InstanceIdentifier groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey) + .augmentation(FlowCapableNode.class) + .child(Group.class,groupKey).toInstance(); + + NodeGroupDescStatsBuilder groupDesc= new NodeGroupDescStatsBuilder(); + GroupDescBuilder stats = new GroupDescBuilder(); + stats.fieldsFrom(groupDescStats); + groupDesc.setGroupDesc(stats.build()); + + //Update augmented data + groupBuilder.addAugmentation(NodeGroupDescStats.class, groupDesc.build()); + + trans.putOperationalData(groupRef, groupBuilder.build()); this.groupDescStatsUpdate.put(groupDescStats, expiryTime); + } + + trans.commit(); } - public synchronized void updateMeterConfigStats(List list){ - Long expiryTime = getExpiryTime(); - for(MeterConfigStats meterConfigStats: list) + + public synchronized void updateGroupStats(List list) { + final DataModificationTransaction trans = statisticsProvider.startChange(); + + for(GroupStats groupStats : list) { + GroupBuilder groupBuilder = new GroupBuilder(); + GroupKey groupKey = new GroupKey(groupStats.getGroupId()); + groupBuilder.setKey(groupKey); + + InstanceIdentifier groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey) + .augmentation(FlowCapableNode.class) + .child(Group.class,groupKey).toInstance(); + + NodeGroupStatisticsBuilder groupStatisticsBuilder= new NodeGroupStatisticsBuilder(); + GroupStatisticsBuilder stats = new GroupStatisticsBuilder(); + stats.fieldsFrom(groupStats); + groupStatisticsBuilder.setGroupStatistics(stats.build()); + + //Update augmented data + groupBuilder.addAugmentation(NodeGroupStatistics.class, groupStatisticsBuilder.build()); + trans.putOperationalData(groupRef, groupBuilder.build()); + + // FIXME: should we be tracking this data? + } + + trans.commit(); + } + + public synchronized void updateMeterConfigStats(List list) { + final Long expiryTime = getExpiryTime(); + final DataModificationTransaction trans = statisticsProvider.startChange(); + + for(MeterConfigStats meterConfigStats : list) { + MeterBuilder meterBuilder = new MeterBuilder(); + MeterKey meterKey = new MeterKey(meterConfigStats.getMeterId()); + meterBuilder.setKey(meterKey); + + InstanceIdentifier meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey) + .augmentation(FlowCapableNode.class) + .child(Meter.class,meterKey).toInstance(); + + NodeMeterConfigStatsBuilder meterConfig= new NodeMeterConfigStatsBuilder(); + MeterConfigStatsBuilder stats = new MeterConfigStatsBuilder(); + stats.fieldsFrom(meterConfigStats); + meterConfig.setMeterConfigStats(stats.build()); + + //Update augmented data + meterBuilder.addAugmentation(NodeMeterConfigStats.class, meterConfig.build()); + + trans.putOperationalData(meterRef, meterBuilder.build()); this.meterConfigStatsUpdate.put(meterConfigStats, expiryTime); + } + + trans.commit(); + } + + + public synchronized void updateMeterStats(List list) { + final DataModificationTransaction trans = statisticsProvider.startChange(); + + for(MeterStats meterStats : list) { + MeterBuilder meterBuilder = new MeterBuilder(); + MeterKey meterKey = new MeterKey(meterStats.getMeterId()); + meterBuilder.setKey(meterKey); + + InstanceIdentifier meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey) + .augmentation(FlowCapableNode.class) + .child(Meter.class,meterKey).toInstance(); + + NodeMeterStatisticsBuilder meterStatsBuilder= new NodeMeterStatisticsBuilder(); + MeterStatisticsBuilder stats = new MeterStatisticsBuilder(); + stats.fieldsFrom(meterStats); + meterStatsBuilder.setMeterStatistics(stats.build()); + + //Update augmented data + meterBuilder.addAugmentation(NodeMeterStatistics.class, meterStatsBuilder.build()); + trans.putOperationalData(meterRef, meterBuilder.build()); + + // FIXME: should we be tracking this data? + } + + trans.commit(); + } + + public synchronized void updateQueueStats(List list) { + final Long expiryTime = getExpiryTime(); + final DataModificationTransaction trans = statisticsProvider.startChange(); + + for (QueueIdAndStatisticsMap swQueueStats : list) { + + QueueEntry queueEntry = new QueueEntry(swQueueStats.getNodeConnectorId(),swQueueStats.getQueueId()); + + FlowCapableNodeConnectorQueueStatisticsDataBuilder queueStatisticsDataBuilder = new FlowCapableNodeConnectorQueueStatisticsDataBuilder(); + + FlowCapableNodeConnectorQueueStatisticsBuilder queueStatisticsBuilder = new FlowCapableNodeConnectorQueueStatisticsBuilder(); + + queueStatisticsBuilder.fieldsFrom(swQueueStats); + + queueStatisticsDataBuilder.setFlowCapableNodeConnectorQueueStatistics(queueStatisticsBuilder.build()); + + InstanceIdentifier queueRef + = InstanceIdentifier.builder(Nodes.class) + .child(Node.class, targetNodeKey) + .child(NodeConnector.class, new NodeConnectorKey(swQueueStats.getNodeConnectorId())) + .augmentation(FlowCapableNodeConnector.class) + .child(Queue.class, new QueueKey(swQueueStats.getQueueId())).toInstance(); + + QueueBuilder queueBuilder = new QueueBuilder(); + FlowCapableNodeConnectorQueueStatisticsData qsd = queueStatisticsDataBuilder.build(); + queueBuilder.addAugmentation(FlowCapableNodeConnectorQueueStatisticsData.class, qsd); + queueBuilder.setKey(new QueueKey(swQueueStats.getQueueId())); + + logger.debug("Augmenting queue statistics {} of queue {} to port {}", + qsd, + swQueueStats.getQueueId(), + swQueueStats.getNodeConnectorId()); + + trans.putOperationalData(queueRef, queueBuilder.build()); + this.queuesStatsUpdate.put(queueEntry, expiryTime); + } + + trans.commit(); + } + + public synchronized void updateFlowTableStats(List list) { + final DataModificationTransaction trans = statisticsProvider.startChange(); + + for (FlowTableAndStatisticsMap ftStats : list) { + + InstanceIdentifier tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey) + .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(ftStats.getTableId().getValue())).toInstance(); + + FlowTableStatisticsDataBuilder statisticsDataBuilder = new FlowTableStatisticsDataBuilder(); + + FlowTableStatisticsBuilder statisticsBuilder = new FlowTableStatisticsBuilder(); + statisticsBuilder.setActiveFlows(ftStats.getActiveFlows()); + statisticsBuilder.setPacketsLookedUp(ftStats.getPacketsLookedUp()); + statisticsBuilder.setPacketsMatched(ftStats.getPacketsMatched()); + + final FlowTableStatistics stats = statisticsBuilder.build(); + statisticsDataBuilder.setFlowTableStatistics(stats); + + logger.debug("Augment flow table statistics: {} for table {} on Node {}", + stats,ftStats.getTableId(), targetNodeKey); + + TableBuilder tableBuilder = new TableBuilder(); + tableBuilder.setKey(new TableKey(ftStats.getTableId().getValue())); + tableBuilder.addAugmentation(FlowTableStatisticsData.class, statisticsDataBuilder.build()); + trans.putOperationalData(tableRef, tableBuilder.build()); + + // FIXME: should we be tracking this data? + } + + trans.commit(); + } + + public synchronized void updateNodeConnectorStats(List list) { + final DataModificationTransaction trans = statisticsProvider.startChange(); + + for(NodeConnectorStatisticsAndPortNumberMap portStats : list) { + + FlowCapableNodeConnectorStatisticsBuilder statisticsBuilder + = new FlowCapableNodeConnectorStatisticsBuilder(); + statisticsBuilder.setBytes(portStats.getBytes()); + statisticsBuilder.setCollisionCount(portStats.getCollisionCount()); + statisticsBuilder.setDuration(portStats.getDuration()); + statisticsBuilder.setPackets(portStats.getPackets()); + statisticsBuilder.setReceiveCrcError(portStats.getReceiveCrcError()); + statisticsBuilder.setReceiveDrops(portStats.getReceiveDrops()); + statisticsBuilder.setReceiveErrors(portStats.getReceiveErrors()); + statisticsBuilder.setReceiveFrameError(portStats.getReceiveFrameError()); + statisticsBuilder.setReceiveOverRunError(portStats.getReceiveOverRunError()); + statisticsBuilder.setTransmitDrops(portStats.getTransmitDrops()); + statisticsBuilder.setTransmitErrors(portStats.getTransmitErrors()); + + //Augment data to the node-connector + FlowCapableNodeConnectorStatisticsDataBuilder statisticsDataBuilder = + new FlowCapableNodeConnectorStatisticsDataBuilder(); + + statisticsDataBuilder.setFlowCapableNodeConnectorStatistics(statisticsBuilder.build()); + + InstanceIdentifier nodeConnectorRef = InstanceIdentifier.builder(Nodes.class) + .child(Node.class, targetNodeKey) + .child(NodeConnector.class, new NodeConnectorKey(portStats.getNodeConnectorId())).toInstance(); + + // FIXME: can we bypass this read? + NodeConnector nodeConnector = (NodeConnector)trans.readOperationalData(nodeConnectorRef); + if(nodeConnector != null){ + final FlowCapableNodeConnectorStatisticsData stats = statisticsDataBuilder.build(); + logger.debug("Augmenting port statistics {} to port {}",stats,nodeConnectorRef.toString()); + NodeConnectorBuilder nodeConnectorBuilder = new NodeConnectorBuilder(); + nodeConnectorBuilder.addAugmentation(FlowCapableNodeConnectorStatisticsData.class, stats); + trans.putOperationalData(nodeConnectorRef, nodeConnectorBuilder.build()); + } + + // FIXME: should we be tracking this data? + } + + trans.commit(); + } + + public synchronized void updateAggregateFlowStats(Short tableId, AggregateFlowStatistics flowStats) { + if (tableId != null) { + final DataModificationTransaction trans = statisticsProvider.startChange(); + + + InstanceIdentifier
tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey) + .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId)).toInstance(); + + AggregateFlowStatisticsDataBuilder aggregateFlowStatisticsDataBuilder = new AggregateFlowStatisticsDataBuilder(); + AggregateFlowStatisticsBuilder aggregateFlowStatisticsBuilder = new AggregateFlowStatisticsBuilder(flowStats); + + aggregateFlowStatisticsDataBuilder.setAggregateFlowStatistics(aggregateFlowStatisticsBuilder.build()); + + logger.debug("Augment aggregate statistics: {} for table {} on Node {}", + aggregateFlowStatisticsBuilder.build().toString(),tableId,targetNodeKey); + + TableBuilder tableBuilder = new TableBuilder(); + tableBuilder.setKey(new TableKey(tableId)); + tableBuilder.addAugmentation(AggregateFlowStatisticsData.class, aggregateFlowStatisticsDataBuilder.build()); + trans.putOperationalData(tableRef, tableBuilder.build()); + + // FIXME: should we be tracking this data? + trans.commit(); + } + } + + public synchronized void updateGroupFeatures(GroupFeatures notification) { + final DataModificationTransaction trans = statisticsProvider.startChange(); + + final NodeBuilder nodeData = new NodeBuilder(); + nodeData.setKey(targetNodeKey); + + NodeGroupFeaturesBuilder nodeGroupFeatures = new NodeGroupFeaturesBuilder(); + GroupFeaturesBuilder groupFeatures = new GroupFeaturesBuilder(notification); + nodeGroupFeatures.setGroupFeatures(groupFeatures.build()); + + //Update augmented data + nodeData.addAugmentation(NodeGroupFeatures.class, nodeGroupFeatures.build()); + trans.putOperationalData(targetNodeIdentifier, nodeData.build()); + + // FIXME: should we be tracking this data? + trans.commit(); + } + + public synchronized void updateMeterFeatures(MeterFeatures features) { + final DataModificationTransaction trans = statisticsProvider.startChange(); + + final NodeBuilder nodeData = new NodeBuilder(); + nodeData.setKey(targetNodeKey); + + NodeMeterFeaturesBuilder nodeMeterFeatures = new NodeMeterFeaturesBuilder(); + MeterFeaturesBuilder meterFeature = new MeterFeaturesBuilder(features); + nodeMeterFeatures.setMeterFeatures(meterFeature.build()); + + //Update augmented data + nodeData.addAugmentation(NodeMeterFeatures.class, nodeMeterFeatures.build()); + trans.putOperationalData(targetNodeIdentifier, nodeData.build()); + + // FIXME: should we be tracking this data? + trans.commit(); } public synchronized void updateFlowStats(FlowEntry flowEntry){ this.flowStatsUpdate.put(flowEntry, getExpiryTime()); } - public synchronized void updateQueueStats(QueueEntry queueEntry){ - this.queuesStatsUpdate.put(queueEntry, getExpiryTime()); - } private static Long getExpiryTime(){ final long now = System.nanoTime(); @@ -298,4 +612,5 @@ public class NodeStatisticsAger { InstanceIdentifier nodeGroupStatisticsAugmentation = groupRef.augmentation(NodeGroupStatistics.class).toInstance(); trans.removeOperationalData(nodeGroupStatisticsAugmentation); } + }