public final static Logger sucLogger = LoggerFactory.getLogger(StatisticsUpdateCommiter.class);
private final StatisticsProvider statisticsManager;
+ private final MultipartMessageManager messageManager;
private int unaccountedFlowsCounter = 1;
public StatisticsUpdateCommiter(final StatisticsProvider manager){
this.statisticsManager = manager;
+ this.messageManager = this.statisticsManager.getMultipartMessageManager();
}
public StatisticsProvider getStatisticsManager(){
@Override
public void onMeterConfigStatsUpdated(MeterConfigStatsUpdated notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
public void onMeterStatisticsUpdated(MeterStatisticsUpdated notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
public void onGroupDescStatsUpdated(GroupDescStatsUpdated notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
public void onGroupStatisticsUpdated(GroupStatisticsUpdated notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
//Publish data to configuration data store
public void onFlowsStatisticsUpdate(FlowsStatisticsUpdate notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
.child(Flow.class,existingFlow.getKey()).toInstance();
flowBuilder.setKey(existingFlow.getKey());
flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
- sucLogger.info("Found matching flow in the datastore, augmenting statistics");
+ sucLogger.debug("Found matching flow in the datastore, augmenting statistics");
foundOriginalFlow = true;
it.putOperationalData(flowRef, flowBuilder.build());
it.commit();
.child(Flow.class,existingFlow.getKey()).toInstance();
flowBuilder.setKey(existingFlow.getKey());
flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
- sucLogger.debug("Found matching flow in the operational datastore, augmenting statistics");
+ sucLogger.debug("Found matching unaccounted flow in the operational datastore, augmenting statistics");
foundOriginalFlow = true;
it.putOperationalData(flowRef, flowBuilder.build());
it.commit();
}
}
if(!foundOriginalFlow){
- sucLogger.debug("Associated original flow is not found in data store. Augmenting flow in operational data store");
long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"0"+Integer.toString(this.unaccountedFlowsCounter)));
this.unaccountedFlowsCounter++;
FlowKey newFlowKey = new FlowKey(new FlowId(Long.toString(flowKey)));
.child(Flow.class,newFlowKey).toInstance();
flowBuilder.setKey(newFlowKey);
flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
- sucLogger.info("Flow was no present in data store, augmenting statistics as an unaccounted flow");
+ sucLogger.debug("Flow {} is not present in config data store, augmenting statistics as an unaccounted flow",flowBuilder.build());
it.putOperationalData(flowRef, flowBuilder.build());
it.commit();
}
@Override
public void onAggregateFlowStatisticsUpdate(AggregateFlowStatisticsUpdate notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
- sucLogger.debug("Received aggregate flow statistics update : {}",notification.toString());
- Short tableId = this.statisticsManager.getMultipartMessageManager().getTableIdForTxId(notification.getTransactionId());
+ Short tableId = messageManager.getTableIdForTxId(notification.getId(),notification.getTransactionId());
if(tableId != null){
DataModificationTransaction it = this.statisticsManager.startChange();
@Override
public void onNodeConnectorStatisticsUpdate(NodeConnectorStatisticsUpdate notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
- sucLogger.debug("Received port stats update : {}",notification.toString());
List<NodeConnectorStatisticsAndPortNumberMap> portsStats = notification.getNodeConnectorStatisticsAndPortNumberMap();
for(NodeConnectorStatisticsAndPortNumberMap portStats : portsStats){
@Override
public void onFlowTableStatisticsUpdate(FlowTableStatisticsUpdate notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
- sucLogger.debug("Received flow table statistics update : {}",notification.toString());
List<FlowTableAndStatisticsMap> flowTablesStatsList = notification.getFlowTableAndStatisticsMap();
for (FlowTableAndStatisticsMap ftStats : flowTablesStatsList){
public void onQueueStatisticsUpdate(QueueStatisticsUpdate notification) {
//Check if response is for the request statistics-manager sent.
- if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
+ if(!messageManager.isRequestTxIdExist(notification.getId(),notification.getTransactionId(),notification.isMoreReplies()))
return;
NodeKey key = new NodeKey(notification.getId());
- sucLogger.debug("Received queue stats update : {}",notification.toString());
//Add statistics to local cache
ConcurrentMap<NodeId, NodeStatisticsAger> cache = this.statisticsManager.getStatisticsCache();
queueBuilder.addAugmentation(FlowCapableNodeConnectorQueueStatisticsData.class, queueStatisticsDataBuilder.build());
queueBuilder.setKey(new QueueKey(swQueueStats.getQueueId()));
- sucLogger.info("Augmenting queue statistics {} of queue {} to port {}"
+ sucLogger.debug("Augmenting queue statistics {} of queue {} to port {}"
,queueStatisticsDataBuilder.build().toString(),
swQueueStats.getQueueId(),
swQueueStats.getNodeConnectorId());
InstanceIdentifierBuilder<?> builder = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey);
return new NodeRef(builder.toInstance());
}
-
+
public boolean flowEquals(Flow statsFlow, Flow storedFlow) {
if (statsFlow.getClass() != storedFlow.getClass()) {
return false;
}
- if (statsFlow.getBufferId()== null) {
- if (storedFlow.getBufferId() != null) {
- return false;
- }
- } else if(!statsFlow.getBufferId().equals(storedFlow.getBufferId())) {
- return false;
- }
if (statsFlow.getContainerName()== null) {
if (storedFlow.getContainerName()!= null) {
return false;
} else if(!statsFlow.getContainerName().equals(storedFlow.getContainerName())) {
return false;
}
- if (statsFlow.getCookie()== null) {
- if (storedFlow.getCookie()!= null) {
- return false;
- }
- } else if(!statsFlow.getCookie().equals(storedFlow.getCookie())) {
- return false;
- }
if (statsFlow.getMatch()== null) {
if (storedFlow.getMatch() != null) {
return false;
else if(!matchEquals(statsFlow.getMatch(), storedFlow.getMatch())) {
return false;
}
- if (statsFlow.getHardTimeout() == null) {
- if (storedFlow.getHardTimeout() != null) {
- return false;
- }
- } else if(!statsFlow.getHardTimeout().equals(storedFlow.getHardTimeout() )) {
- return false;
- }
- if (statsFlow.getIdleTimeout()== null) {
- if (storedFlow.getIdleTimeout() != null) {
- return false;
- }
- } else if(!statsFlow.getIdleTimeout().equals(storedFlow.getIdleTimeout())) {
- return false;
- }
if (statsFlow.getPriority() == null) {
if (storedFlow.getPriority() != null) {
return false;