bug 7201 skip monitoring stats tables 62/48462/4
authorK.V Suneelu Verma <k.v.suneelu.verma@ericsson.com>
Fri, 18 Nov 2016 06:18:18 +0000 (11:48 +0530)
committerVishal Thapar <vishal.thapar@ericsson.com>
Tue, 22 Nov 2016 16:01:58 +0000 (21:31 +0530)
skip monitoring stats table and version columns
which are generating huge traffic to controller

Change-Id: Icb84f92262d7e9464291a6f233a741a767d79003
Signed-off-by: K.V Suneelu Verma <k.v.suneelu.verma@ericsson.com>
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundConstants.java

index d7df865d018aedd66cf506f06f2e7d650da8553a..43ca350f3bd238952abf9aab22b07070f9600c58 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.ovsdb.hwvtepsouthbound;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -123,14 +124,21 @@ public class HwvtepConnectionInstance {
         if (tables != null) {
             List<MonitorRequest> monitorRequests = Lists.newArrayList();
             for (String tableName : tables) {
-                LOG.debug("HwvtepSouthbound monitoring table {} in {}", tableName, dbSchema.getName());
-                GenericTableSchema tableSchema = dbSchema.table(tableName, GenericTableSchema.class);
-                Set<String> columns = tableSchema.getColumns();
-                monitorRequests.add(new MonitorRequestBuilder<>(tableSchema)
-                        .addColumns(columns)
-                        .with(new MonitorSelect(true, true, true, true)).build());
+                if (!HwvtepSouthboundConstants.SKIP_HWVTEP_TABLE.containsKey(tableName)) {
+                    LOG.info("HwvtepSouthbound monitoring Hwvtep schema table {}", tableName);
+                    GenericTableSchema tableSchema = dbSchema.table(tableName, GenericTableSchema.class);
+                    Set<String> columns = new HashSet<>(tableSchema.getColumns());
+                    List<String> skipColumns = HwvtepSouthboundConstants.SKIP_COLUMN_FROM_HWVTEP_TABLE.get(tableName);
+                    if (skipColumns != null) {
+                        LOG.info("HwvtepSouthbound NOT monitoring columns {} in table {}", skipColumns, tableName);
+                        columns.removeAll(skipColumns);
+                    }
+                    monitorRequests.add(new MonitorRequestBuilder<>(tableSchema)
+                            .addColumns(columns)
+                            .with(new MonitorSelect(true, true, true, true)).build());
+                }
             }
-            this.callback.update(monitor(dbSchema, monitorRequests, callback),dbSchema);
+            this.callback.update(monitor(dbSchema, monitorRequests, callback), dbSchema);
         } else {
             LOG.warn("No tables for schema {} for database {} for key {}",dbSchema,database,connectionInfo);
         }
index c9cb33525feca81acb4f88149746ddbd434dbd76..d594115e8eabd044ea3026bb9d1a6272a0db06dd 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.ovsdb.hwvtepsouthbound;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.EncapsulationTypeBase;
@@ -15,6 +18,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
 
 import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.ImmutableMap;
 
 public class HwvtepSouthboundConstants {
 
@@ -31,4 +35,13 @@ public class HwvtepSouthboundConstants {
     public static final String HWVTEP_URI_PREFIX = "hwvtep";
     public static final String PSWITCH_URI_PREFIX = "physicalswitch";
     public static final String LOGICALSWITCH_UUID_PREFIX = "LogicalSwitch_";
+    public static final ImmutableMap<String,String> SKIP_HWVTEP_TABLE
+            = new ImmutableMap.Builder<String,String>()
+            .put("Logical_Binding_Stats", "Update callback registration for Logical_Binding_Stats Table is skipped")
+            .build();
+
+    public static final ImmutableMap<String,List<String>> SKIP_COLUMN_FROM_HWVTEP_TABLE
+            = new ImmutableMap.Builder<String,List<String>>()
+            .put("Manager", Arrays.asList(new String[]{"_version", "status"}))
+            .build();
 }