OPNFLWPLUG-1074: table stats not available after a switch flap 24/87624/3
authorSomashekhar Javalagi <somashekhar.manohara.javalagi@ericsson.com>
Wed, 12 Feb 2020 16:31:06 +0000 (22:01 +0530)
committerSomashekhar Javalagi <somashekhar.manohara.javalagi@ericsson.com>
Mon, 17 Feb 2020 16:46:27 +0000 (16:46 +0000)
Problem: csit test cases failing due to empty table stats

Root Casue: First time when table stats are collected, they
are written into operational inventory. But consequently at
the time of writing flow stats to datastore, table stats
transaction was still not complete. So when fow stats are
written with empty table stats which are read from
operational inventory

Fix: Collecting flow stats first followed by table stats,
which prevents overwrite of table stats.

Signed-off-by: Somashekhar Javalagi <somashekhar.manohara.javalagi@ericsson.com>
Change-Id: I39bf7ffe9b12a4d3a03efbec95f75dd1a0ef70f6

openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java

index 3a6d111f7fe454dc77a590d0a4c054d3d28f464b..10cab8da801a79453b2a6cdb6d119312d161edb6 100644 (file)
@@ -158,10 +158,6 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext, De
     public void initializeDevice() {
         final List<MultipartType> statListForCollecting = new ArrayList<>();
 
-        if (devState.isTableStatisticsAvailable() && config.isIsTableStatisticsPollingOn()) {
-            statListForCollecting.add(MultipartType.OFPMPTABLE);
-        }
-
         if (devState.isGroupAvailable() && config.isIsGroupStatisticsPollingOn()) {
             statListForCollecting.add(MultipartType.OFPMPGROUPDESC);
             statListForCollecting.add(MultipartType.OFPMPGROUP);
@@ -176,6 +172,10 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext, De
             statListForCollecting.add(MultipartType.OFPMPFLOW);
         }
 
+        if (devState.isTableStatisticsAvailable() && config.isIsTableStatisticsPollingOn()) {
+            statListForCollecting.add(MultipartType.OFPMPTABLE);
+        }
+
         if (devState.isPortStatisticsAvailable() && config.isIsPortStatisticsPollingOn()) {
             statListForCollecting.add(MultipartType.OFPMPPORTSTATS);
         }