description "Initial revision of flow service";
}
- typedef table-id {
- type uint8;
- }
typedef output-port-values {
type enumeration {
enum MAX {
description "Initial revision of table service";
}
+ typedef table-id {
+ type uint8;
+ }
+
typedef table-ref {
type instance-identifier;
}
import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
import opendaylight-flow-types {prefix flow-types;revision-date "2013-10-26";}
import opendaylight-statistics-types {prefix stat-types;revision-date "2013-09-25";}
+ import opendaylight-table-types {prefix table-types;revision-date "2013-10-26";}
import flow-node-inventory {prefix flow-node;revision-date "2013-08-19";}
import flow-capable-transaction {prefix tr;}
import sal-flow {prefix flow;}
input {
uses inv:node-context-ref;
leaf table-id {
- type flow-types:table-id;
+ type table-types:table-id;
}
}
output {
input {
uses inv:node-context-ref;
leaf table-id {
- type flow-types:table-id;
+ type table-types:table-id;
}
}
output {
--- /dev/null
+module opendaylight-flow-table-statistics {
+ namespace "urn:opendaylight:flow:table:statistics";
+ prefix flowtablestat;
+
+ import flow-capable-transaction {prefix tr;}
+ import yang-ext {prefix ext; revision-date "2013-07-09";}
+ import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+ import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
+ import flow-node-inventory {prefix flow-node;revision-date "2013-08-19";}
+ import opendaylight-table-types {prefix table-types;revision-date "2013-10-26";}
+ import opendaylight-statistics-types {prefix stat-types;revision-date "2013-09-25";}
+
+
+ contact
+ "Anilkumar Vishnoi
+ Email: avishnoi@in.ibm.com";
+
+ revision "2013-12-15" {
+ description "Initial revision of flow table statistics model";
+ }
+
+ //Augment flow table statistics data to the table
+ augment "/inv:nodes/inv:node/flow-node:table" {
+ ext:augment-identifier "flow-table-statistics-data";
+ uses flow-table-statistics;
+ }
+
+ grouping flow-table-statistics {
+ container flow-table-statistics {
+ //config "false";
+ uses stat-types:generic-table-statistics;
+ }
+ }
+
+ //RPC calls to fetch flow table statistics
+ grouping flow-table-and-statistics-map {
+ list flow-table-and-statistics-map {
+ key "table-id";
+ leaf table-id {
+ type table-types:table-id;
+ }
+ uses stat-types:generic-table-statistics;
+ }
+ }
+
+ rpc get-flow-tables-statistics {
+ description "Fetch statistics of all the flow tables present on the tarnet node";
+ input {
+ uses inv:node-context-ref;
+ }
+ output {
+ uses flow-table-and-statistics-map;
+ uses tr:transaction-aware;
+ }
+ }
+
+ //Notification to receive table statistics update
+
+ notification flow-table-statistics-update {
+ description "Receive flow table statistics update";
+
+ leaf moreReplies {
+ type boolean;
+ }
+ uses inv:node;
+ uses flow-table-and-statistics-map;
+ uses tr:transaction-aware;
+ }
+}
--- /dev/null
+module opendaylight-port-statistics {
+ namespace "urn:opendaylight:port:statistics";
+ prefix portstat;
+
+ import flow-capable-transaction {prefix tr;}
+ import yang-ext {prefix ext; revision-date "2013-07-09";}
+ import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+ import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
+ import opendaylight-statistics-types {prefix stat-types;revision-date "2013-09-25";}
+
+ contact
+ "Anilkumar Vishnoi
+ Email: avishnoi@in.ibm.com";
+
+ revision "2013-12-14" {
+ description "Initial revision of port statistics model";
+ }
+
+ //Augment port statistics data to the flow-capable-node-connector
+ augment "/inv:nodes/inv:node/inv:node-connector" {
+ ext:augment-identifier "flow-capable-node-connector-statistics-data";
+ uses flow-capable-node-connector-statistics;
+ }
+
+ grouping flow-capable-node-connector-statistics {
+ container flow-capable-node-connector-statistics {
+ //config "false";
+ uses stat-types:node-connector-statistics;
+ }
+ }
+
+ // RPC calls
+ rpc get-all-ports-statistics {
+ description "Get statistics for all the ports from the node";
+ input {
+ uses inv:node-context-ref;
+ }
+ output {
+ uses stat-types:node-connector-statistics;
+ uses tr:transaction-aware;
+ }
+ }
+
+ rpc get-port-statistics {
+ description "Get statistics for given port from the node";
+ input {
+ uses inv:node-context-ref;
+ leaf node-connector-id {
+ type inv:node-connector-id;
+ }
+ }
+ output {
+ uses stat-types:node-connector-statistics;
+ uses tr:transaction-aware;
+ }
+ }
+
+ //Notification for port statistics update
+ grouping node-connector-statistics-and-port-number-map {
+ description "List of flow and statistics map";
+ list node-connector-statistics-and-port-number-map {
+ key "node-connector-id";
+ leaf node-connector-id {
+ type inv:node-connector-id;
+ }
+ uses stat-types:node-connector-statistics;
+ }
+ }
+
+ notification port-statistics-update {
+ leaf moreReplies {
+ type boolean;
+ }
+ uses inv:node;
+ uses node-connector-statistics-and-port-number-map;
+ uses tr:transaction-aware;
+ }
+}
}
}
+ grouping generic-table-statistics {
+ description "Generic grouping holding generic statistics related to switch table";
+ leaf active-flows {
+ type yang:counter32;
+ }
+ leaf packets-looked-up {
+ type yang:counter64;
+ }
+ leaf packets-matched {
+ type yang:counter64;
+ }
+ }
+
grouping aggregate-flow-statistics {
description "Aggregate flow statistics";
leaf packet-count {
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
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.aggregate.flow.statistics.AggregateFlowStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.features.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.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.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.GenericStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericTableStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics;
public class NodeStatistics {
private final Map<Short,AggregateFlowStatistics> tableAndAggregateFlowStatsMap =
new HashMap<Short,AggregateFlowStatistics>();
- public NodeStatistics(){}
+ private final Map<NodeConnectorId,NodeConnectorStatistics> nodeConnectorStats =
+ new ConcurrentHashMap<NodeConnectorId,NodeConnectorStatistics>();
+ private final Map<Short,GenericTableStatistics> flowTableAndStatisticsMap =
+ new HashMap<Short,GenericTableStatistics>();
+
+ public NodeStatistics(){
+
+ }
+
public NodeRef getTargetNode() {
return targetNode;
}
return flowAndStatsMap;
}
+ public Map<Short, GenericTableStatistics> getFlowTableAndStatisticsMap() {
+ return flowTableAndStatisticsMap;
+ }
+
public Map<Short, AggregateFlowStatistics> getTableAndAggregateFlowStatsMap() {
return tableAndAggregateFlowStatsMap;
}
-
+ public Map<NodeConnectorId, NodeConnectorStatistics> getNodeConnectorStats() {
+ return nodeConnectorStats;
+ }
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.TableId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllPortsStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllPortsStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.NotificationListener;
private OpendaylightFlowStatisticsService flowStatsService;
+ private OpendaylightPortStatisticsService portStatsService;
+
+ private OpendaylightFlowTableStatisticsService flowTableStatsService;
+
private final MultipartMessageManager multipartMessageManager = new MultipartMessageManager();
private Thread statisticsRequesterThread;
flowStatsService = StatisticsManagerActivator.getProviderContext().
getRpcService(OpendaylightFlowStatisticsService.class);
+ portStatsService = StatisticsManagerActivator.getProviderContext().
+ getRpcService(OpendaylightPortStatisticsService.class);
+
+ flowTableStatsService = StatisticsManagerActivator.getProviderContext().
+ getRpcService(OpendaylightFlowTableStatisticsService.class);
+
statisticsRequesterThread = new Thread( new Runnable(){
@Override
private void statsRequestSender(){
- //Need to call API to receive all the nodes connected to controller.
List<Node> targetNodes = getAllConnectedNodes();
if(targetNodes == null)
return;
+
for (Node targetNode : targetNodes){
sendAllFlowsStatsFromAllTablesRequest(targetNodeRef);
+ sendAllPortStatisticsRequest(targetNodeRef);
+
+ sendAllFlowTablesStatisticsRequest(targetNodeRef);
+
}catch(Exception e){
- spLogger.error("Exception occured while sending flow statistics request : {}",e);
+ spLogger.error("Exception occured while sending statistics requests : {}",e);
}
if(targetNode.getAugmentation(FlowCapableNode.class) != null){
spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
-
+
try{
sendAllGroupStatisticsRequest(targetNodeRef);
Thread.sleep(1000);
sendMeterConfigStatisticsRequest(targetNodeRef);
Thread.sleep(1000);
}catch(Exception e){
- spLogger.error("Exception occured while sending statistics request : {}", e);
+ spLogger.error("Exception occured while sending statistics requests : {}", e);
}
}
}
}
-
+
+ private void sendAllFlowTablesStatisticsRequest(NodeRef targetNodeRef) {
+ final GetFlowTablesStatisticsInputBuilder input =
+ new GetFlowTablesStatisticsInputBuilder();
+
+ input.setNode(targetNodeRef);
+
+ @SuppressWarnings("unused")
+ Future<RpcResult<GetFlowTablesStatisticsOutput>> response =
+ flowTableStatsService.getFlowTablesStatistics(input.build());
+ }
+
private void sendAllFlowsStatsFromAllTablesRequest(NodeRef targetNode){
final GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder();
new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder();
input.setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey).toInstance()));
- input.setTableId(new TableId(id));
+ input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId(id));
Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> response =
flowStatsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
// multipartMessageManager.setTxIdAndTableIdMapEntry(response.get().getResult().getTransactionId(), (short)1);
}
+ private void sendAllPortStatisticsRequest(NodeRef targetNode){
+
+ final GetAllPortsStatisticsInputBuilder input = new GetAllPortsStatisticsInputBuilder();
+
+ input.setNode(targetNode);
+
+ @SuppressWarnings("unused")
+ Future<RpcResult<GetAllPortsStatisticsOutput>> response =
+ portStatsService.getAllPortsStatistics(input.build());
+ }
+
private void sendAllGroupStatisticsRequest(NodeRef targetNode){
final GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
package org.opendaylight.controller.md.statistics.manager;
import java.util.HashMap;
+import java.util.List;
import java.util.concurrent.ConcurrentMap;
import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.statistics.FlowStatisticsBuilder;
+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.FlowTableStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener;
+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.FlowTableStatisticsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
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.nodes.node.MeterFeaturesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterStatisticsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericStatistics;
+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.OpendaylightPortStatisticsListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.PortStatisticsUpdate;
+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.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
import org.slf4j.Logger;
public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsListener,
OpendaylightMeterStatisticsListener,
- OpendaylightFlowStatisticsListener{
+ OpendaylightFlowStatisticsListener,
+ OpendaylightPortStatisticsListener,
+ OpendaylightFlowTableStatisticsListener{
public final static Logger sucLogger = LoggerFactory.getLogger(StatisticsUpdateCommiter.class);
@Override
public void onAggregateFlowStatisticsUpdate(AggregateFlowStatisticsUpdate notification) {
NodeKey key = new NodeKey(notification.getId());
- sucLogger.info("Received aggregate flow statistics update : {}",notification.toString());
+ sucLogger.debug("Received aggregate flow statistics update : {}",notification.toString());
Short tableId = this.statisticsManager.getMultipartMessageManager().getTableIdForTxId(notification.getTransactionId());
if(tableId != null){
}
cache.get(notification.getId()).getTableAndAggregateFlowStatsMap().put(tableId,aggregateFlowStatisticsBuilder.build());
- sucLogger.info("Augment aggregate statistics: {} for table {} on Node {}",aggregateFlowStatisticsBuilder.build().toString(),tableId,key);
+ sucLogger.debug("Augment aggregate statistics: {} for table {} on Node {}",aggregateFlowStatisticsBuilder.build().toString(),tableId,key);
TableBuilder tableBuilder = new TableBuilder();
tableBuilder.setKey(new TableKey(tableId));
}
}
+ @Override
+ public void onPortStatisticsUpdate(PortStatisticsUpdate notification) {
+ NodeKey key = new NodeKey(notification.getId());
+ sucLogger.info("Received port stats update : {}",notification.toString());
+
+ //Add statistics to local cache
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
+ }
+
+
+ List<NodeConnectorStatisticsAndPortNumberMap> portsStats = notification.getNodeConnectorStatisticsAndPortNumberMap();
+ for(NodeConnectorStatisticsAndPortNumberMap portStats : portsStats){
+
+ DataModificationTransaction it = this.statisticsManager.startChange();
+
+ 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());
+
+ //Update data in the cache
+ cache.get(notification.getId()).getNodeConnectorStats().put(portStats.getNodeConnectorId(), statisticsBuilder.build());
+
+ //Augment data to the node-connector
+ FlowCapableNodeConnectorStatisticsDataBuilder statisticsDataBuilder =
+ new FlowCapableNodeConnectorStatisticsDataBuilder();
+
+ statisticsDataBuilder.setFlowCapableNodeConnectorStatistics(statisticsBuilder.build());
+
+ InstanceIdentifier<NodeConnector> nodeConnectorRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key).child(NodeConnector.class, new NodeConnectorKey(portStats.getNodeConnectorId())).toInstance();
+
+ NodeConnector nodeConnector = (NodeConnector)it.readOperationalData(nodeConnectorRef);
+
+ if(nodeConnector != null){
+ sucLogger.debug("Augmenting port statistics {} to port {}",statisticsDataBuilder.build().toString(),nodeConnectorRef.toString());
+ NodeConnectorBuilder nodeConnectorBuilder = new NodeConnectorBuilder();
+ nodeConnectorBuilder.addAugmentation(FlowCapableNodeConnectorStatisticsData.class, statisticsDataBuilder.build());
+ it.putOperationalData(nodeConnectorRef, nodeConnectorBuilder.build());
+ it.commit();
+ }
+ }
+ }
+
+ @Override
+ public void onFlowTableStatisticsUpdate(FlowTableStatisticsUpdate notification) {
+ NodeKey key = new NodeKey(notification.getId());
+ sucLogger.debug("Received flow table statistics update : {}",notification.toString());
+
+ List<FlowTableAndStatisticsMap> flowTablesStatsList = notification.getFlowTableAndStatisticsMap();
+ for (FlowTableAndStatisticsMap ftStats : flowTablesStatsList){
+
+ DataModificationTransaction it = this.statisticsManager.startChange();
+
+ InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
+ .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());
+
+ statisticsDataBuilder.setFlowTableStatistics(statisticsBuilder.build());
+
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
+ }
+ cache.get(notification.getId()).getFlowTableAndStatisticsMap().put(ftStats.getTableId().getValue(),statisticsBuilder.build());
+
+ sucLogger.debug("Augment flow table statistics: {} for table {} on Node {}",statisticsBuilder.build().toString(),ftStats.getTableId(),key);
+
+ TableBuilder tableBuilder = new TableBuilder();
+ tableBuilder.setKey(new TableKey(ftStats.getTableId().getValue()));
+ tableBuilder.addAugmentation(FlowTableStatisticsData.class, statisticsDataBuilder.build());
+ it.putOperationalData(tableRef, tableBuilder.build());
+ it.commit();
+ }
+ }
+
@Override
public void onFlowStatisticsUpdated(FlowStatisticsUpdated notification) {
// TODO Auto-generated method stub
}
-
-
private NodeRef getNodeRef(NodeKey nodeKey){
InstanceIdentifierBuilder<?> builder = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey);
return new NodeRef(builder.toInstance());
}
return true;
}
-
}