MD-SAL Statistics Manager - Minor change in group/meter type/capabilities 06/3306/1
authorAnil Vishnoi <avishnoi@in.ibm.com>
Sun, 1 Dec 2013 09:33:30 +0000 (15:03 +0530)
committerAnil Vishnoi <avishnoi@in.ibm.com>
Sun, 1 Dec 2013 21:16:50 +0000 (02:46 +0530)
Group/Meter feature request is now moved to plugin. Plugin will send request
whenever switch will connect to the plugin.

Change-Id: I8821fcb6c1c3d0ebcf9df11611103e846e8c6ccf
Signed-off-by: Anil Vishnoi <avishnoi@in.ibm.com>
opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/meter-types.yang
opendaylight/md-sal/model/model-flow-statistics/src/main/yang/group-statistics.yang
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java
opendaylight/netconf/config-persister-impl/configuration/current/controller.config.2.txt [new file with mode: 0644]

index 244fedb3e7e0dc0baf4dc59455749156babe0e8a..aca70a94c720f93608f68e16b77c6ae4b4a6a3d1 100644 (file)
@@ -32,6 +32,53 @@ module opendaylight-group-types {
         }   
     }
     
+    identity group-type {
+       description "Base identity for all the available group types"; 
+    }
+    
+    identity group-all {
+       base group-type;
+       description "All (multicast/broadcast) group";
+    }
+    
+    identity group-select {
+       base group-type;
+       description "Select group";
+    }
+    
+    identity group-indirect {
+       base group-type;
+       description "Indirect group";
+    }
+    
+    identity group-ff {
+       base group-type;
+       description "Fast failover group";
+    }
+    
+    identity group-capability {
+       description "Base identity for all the supported group capabilities";
+    }
+    
+    identity select-weight{
+       base group-capability;
+       description "Support weight for select groups";
+    }
+
+    identity select-liveness{
+       base group-capability;
+       description "Support liveness for select groups";
+    }
+
+    identity chaining{
+       base group-capability;
+       description "Support chaining groups";
+    }
+
+    identity chaining-checks{
+       base group-capability;
+       description "Check chaining for loops and delete";
+    }
     
     grouping group {
         
@@ -129,23 +176,18 @@ module opendaylight-group-types {
     }
 
     grouping group-features {
-        leaf types {
-            type bits {
-               bit group-all;
-               bit group-select;
-               bit group-indirect;
-               bit group-ff;
-            }
-        }
+    
+       leaf-list group-types-supported {
+               type identityref {
+                       base group-type;
+               }
+               }
             
-        leaf capabilities { 
-               type bits {
-                bit select-weight;
-                bit select-liveness;
-                bit chaining;
-                bit chaining-checks;
-            }   
-        }
+       leaf-list group-capabilities-supported {
+               type identityref {
+                       base group-capability;
+               }
+               }
 
         leaf-list max-groups {
             type uint32;
index fc9be63ec89f0ec986fa386e6af0df3d1b36b607..0548890a00bcd87637d564002c7754780fa6821c 100644 (file)
@@ -14,11 +14,6 @@ module opendaylight-meter-types {
             type uint32;
     }
     
-    // field types
-    identity meter-flags {
-        description "Base identity for match Fields";
-    }
-    
     typedef meter-flags {        
         type bits {
             bit meter-kbps;
@@ -28,6 +23,26 @@ module opendaylight-meter-types {
         }        
     }
     
+    identity meter-capability {
+       description "Base identity for all the supported meter capabilities/flags";
+    }
+    identity meter-kbps {
+       base meter-capability;
+       description "Rate value in kb/s (kilo-bit per second)";
+    } 
+    identity meter-pktps {
+       base meter-capability;
+       description "Rate value in packet/sec.";
+    } 
+    identity meter-burst {
+       base meter-capability;
+       description "Do burst size.";
+    } 
+    identity meter-stats {
+       base meter-capability;
+       description "Collect statistics.";
+    } 
+    
     typedef meter-band-type {
         type bits {
             bit ofpmbt-drop;
@@ -36,6 +51,22 @@ module opendaylight-meter-types {
         }
     }
     
+    identity meter-band {
+       description "Base identity for all the band type available";
+    }
+    identity meter-band-drop {
+       base meter-band;
+       description "Drop packet";
+    }
+    identity meter-band-dscp-remark {
+       base meter-band;
+       description "Remark DSCP in the IP header";
+    }
+    identity meter-band-experimenter {
+       base meter-band;
+       description "Experimenter meter band";
+    }
+
     grouping band-type {
         choice band-type {
             case drop {
@@ -175,13 +206,17 @@ module opendaylight-meter-types {
             type yang:counter32;
         }
            
-        leaf band_types {
-            type yang:counter32;
-        }
+       leaf-list meter-band-supported {
+               type identityref {
+                       base meter-band;
+               }
+               }
         
-        leaf capabilities {
-            type yang:counter32;
-        }
+       leaf-list meter-capabilities-supported {
+               type identityref {
+                       base meter-capability;
+               }
+               }
         
         leaf max_bands {
             type uint8;
index 1b6a9df9ad514fbccdf4fb0d7de043421e968e4c..ebc6ead25e227cfce37cf6a216304fee3e083504 100644 (file)
@@ -15,29 +15,41 @@ module opendaylight-group-statistics {
         description "Initial revision of group statistics service";
     }
     
-    augment "/inv:nodes/inv:node" {
-        ext:augment-identifier "node-group-statistics";
+       grouping group-statistics {
         container group-statistics {
             //config "false";
             uses group-types:group-statistics-reply;
         }
+       }    
+    
+    augment "/inv:nodes/inv:node" {
+        ext:augment-identifier "node-group-statistics";
+        uses group-statistics;
     }
 
-    augment "/inv:nodes/inv:node" {
-        ext:augment-identifier "node-group-desc-stats";
+       grouping group-desc {
         container group-desc {
             //config "false";
             uses group-types:group-desc-stats-reply;
         }
-    }
+       }
     
     augment "/inv:nodes/inv:node" {
-        ext:augment-identifier "node-group-features";
-        container group-features {
+        ext:augment-identifier "node-group-desc-stats";
+        uses group-desc;
+    }
+
+       grouping group-features {
+               container group-features {
             //config "false";
             uses group-types:group-features-reply;
         }
     }
+           
+    augment "/inv:nodes/inv:node" {
+        ext:augment-identifier "node-group-features";
+        uses group-features;
+    }
 
     // RPC calls
     rpc get-all-group-statistics {
index 0cc7beb356a38a508a1cdd52138f88b4a45a4a0c..c48ac311abb33dc0ffdfe5ee1ca4c3f26595111b 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.statistics.manager;
 
 import java.util.List;
 
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.nodes.node.GroupFeatures;
+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.NodeRef;
index cdcd1ef32edde93dbc83745a62c97f81a2f42a83..7dda447e6ae524c60f7075cb2c470ad2155ee5b9 100644 (file)
@@ -20,8 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
 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.group.statistics.rev131111.GetGroupDescriptionOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
@@ -31,8 +29,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
 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.GetMeterFeaturesInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -55,8 +51,9 @@ public class StatisticsProvider implements AutoCloseable {
     
     private Thread statisticsRequesterThread;
     
-    private final  InstanceIdentifier<Nodes> nodesIdentifier = InstanceIdentifier.builder().node(Nodes.class).toInstance();
+    private final  InstanceIdentifier<Nodes> nodesIdentifier = InstanceIdentifier.builder(Nodes.class).toInstance();
     
+    private final int STATS_THREAD_EXECUTION_TIME= 50000;
     //Local caching of stats
     
     private final ConcurrentMap<NodeId,NodeStatistics> statisticsCache = 
@@ -103,7 +100,7 @@ public class StatisticsProvider implements AutoCloseable {
                     try {
                         statsRequestSender();
                         
-                        Thread.sleep(5000);
+                        Thread.sleep(STATS_THREAD_EXECUTION_TIME);
                     }catch (Exception e){
                         spLogger.error("Exception occurred while sending stats request : {}",e);
                     }
@@ -111,9 +108,9 @@ public class StatisticsProvider implements AutoCloseable {
             }
         });
         
-        spLogger.debug("Statistics requester thread started with timer interval : {}",5000);
+        spLogger.debug("Statistics requester thread started with timer interval : {}",STATS_THREAD_EXECUTION_TIME);
         
-        //statisticsRequesterThread.start();
+        statisticsRequesterThread.start();
         
         spLogger.info("Statistics Provider started.");
     }
@@ -141,17 +138,18 @@ public class StatisticsProvider implements AutoCloseable {
                 InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
                 NodeRef targetNodeRef = new NodeRef(targetInstanceId);
                 
-                sendAllGroupStatisticsRequest(targetNodeRef);
-                
-                sendAllMeterStatisticsRequest(targetNodeRef);
-                
-                sendGroupDescriptionRequest(targetNodeRef);
-                
-                sendGroupFeaturesRequest(targetNodeRef);
-                
-                sendMeterConfigStatisticsRequest(targetNodeRef);
-                
-                sendMeterFeaturesRequest(targetNodeRef);
+                try{
+                  sendAllGroupStatisticsRequest(targetNodeRef);
+                  Thread.sleep(1000);
+                  sendAllMeterStatisticsRequest(targetNodeRef);
+                  Thread.sleep(1000);
+                  sendGroupDescriptionRequest(targetNodeRef);
+                  Thread.sleep(1000);
+                  sendMeterConfigStatisticsRequest(targetNodeRef);
+                  Thread.sleep(1000);
+                }catch(Exception e){
+                    spLogger.error("Exception occured while sending statistics request : {}", e);
+                }
             }
         }
     }
@@ -178,17 +176,6 @@ public class StatisticsProvider implements AutoCloseable {
                 groupStatsService.getGroupDescription(input.build());
     }
     
-    private void sendGroupFeaturesRequest(NodeRef targetNode){
-        
-        GetGroupFeaturesInputBuilder input = new GetGroupFeaturesInputBuilder();
-        
-        input.setNode(targetNode);
-
-        @SuppressWarnings("unused")
-        Future<RpcResult<GetGroupFeaturesOutput>> response = 
-                groupStatsService.getGroupFeatures(input.build());
-    }
-    
     private void sendAllMeterStatisticsRequest(NodeRef targetNode){
         
         GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder();
@@ -211,16 +198,6 @@ public class StatisticsProvider implements AutoCloseable {
                 meterStatsService.getAllMeterConfigStatistics(input.build());
         
     }
-    private void sendMeterFeaturesRequest(NodeRef targetNode){
-     
-        GetMeterFeaturesInputBuilder input = new GetMeterFeaturesInputBuilder();
-        
-        input.setNode(targetNode);
-
-        @SuppressWarnings("unused")
-        Future<RpcResult<GetMeterFeaturesOutput>> response = 
-                meterStatsService.getMeterFeatures(input.build());
-    }
     
     public ConcurrentMap<NodeId, NodeStatistics> getStatisticsCache() {
         return statisticsCache;
index bbbb5c856646cf273445f47e84e8a1a5e46df844..d1bfe1e972a6b0273cfe002a4ee3eb1a8549f677 100644 (file)
@@ -20,9 +20,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
 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.OpendaylightGroupStatisticsListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.nodes.node.GroupDescBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.nodes.node.GroupFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.nodes.node.GroupStatisticsBuilder;
+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.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;
@@ -86,7 +86,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         nodeData.addAugmentation(NodeMeterConfigStats.class, meterConfig.build());
         
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
-        it.putRuntimeData(refValue, nodeData.build());
+        it.putOperationalData(refValue, nodeData.build());
         it.commit();
 
     }
@@ -117,7 +117,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         nodeData.addAugmentation(NodeMeterStatistics.class, meterStats.build());
         
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
-        it.putRuntimeData(refValue, nodeData.build());
+        it.putOperationalData(refValue, nodeData.build());
         it.commit();
 
     }
@@ -148,7 +148,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         nodeData.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
         
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
-        it.putRuntimeData(refValue, nodeData.build());
+        it.putOperationalData(refValue, nodeData.build());
         it.commit();
 
     }
@@ -181,7 +181,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         nodeData.addAugmentation(NodeGroupStatistics.class, groupStats.build());
         
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
-        it.putRuntimeData(refValue, nodeData.build());
+        it.putOperationalData(refValue, nodeData.build());
         it.commit();
     }
     
@@ -194,8 +194,8 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             cache.put(notification.getId(), new NodeStatistics());
         }
         MeterFeaturesBuilder meterFeature = new MeterFeaturesBuilder();
-        meterFeature.setBandTypes(notification.getBandTypes());
-        meterFeature.setCapabilities(notification.getCapabilities());
+        meterFeature.setMeterBandSupported(notification.getMeterBandSupported());
+        meterFeature.setMeterCapabilitiesSupported(notification.getMeterCapabilitiesSupported());
         meterFeature.setMaxBands(notification.getMaxBands());
         meterFeature.setMaxColor(notification.getMaxColor());
         meterFeature.setMaxMeter(notification.getMaxMeter());
@@ -217,12 +217,13 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         nodeData.addAugmentation(NodeMeterFeatures.class, nodeMeterFeatures.build());
         
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
-        it.putRuntimeData(refValue, nodeData.build());
+        it.putOperationalData(refValue, nodeData.build());
         it.commit();
     }
     
     @Override
     public void onGroupFeaturesUpdated(GroupFeaturesUpdated notification) {
+
         //Add statistics to local cache
         ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
         if(!cache.containsKey(notification.getId())){
@@ -231,8 +232,8 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         
         GroupFeaturesBuilder groupFeatures = new GroupFeaturesBuilder();
         groupFeatures.setActions(notification.getActions());
-        groupFeatures.setCapabilities(notification.getCapabilities());
-        groupFeatures.setTypes(notification.getTypes());
+        groupFeatures.setGroupCapabilitiesSupported(notification.getGroupCapabilitiesSupported());
+        groupFeatures.setGroupTypesSupported(notification.getGroupTypesSupported());
         groupFeatures.setMaxGroups(notification.getMaxGroups());
         cache.get(notification.getId()).setGroupFeatures(groupFeatures.build());
         
@@ -251,13 +252,13 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         nodeData.addAugmentation(NodeGroupFeatures.class, nodeGroupFeatures.build());
         
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
-        it.putRuntimeData(refValue, nodeData.build());
+        it.putOperationalData(refValue, nodeData.build());
         it.commit();
     }
 
     private NodeRef getNodeRef(NodeKey nodeKey){
-        InstanceIdentifierBuilder<?> builder = InstanceIdentifier.builder().node(Nodes.class);
-        return new NodeRef(builder.node(Node.class,nodeKey).toInstance());
+        InstanceIdentifierBuilder<?> builder = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey);
+        return new NodeRef(builder.toInstance());
     }
 
 }
diff --git a/opendaylight/netconf/config-persister-impl/configuration/current/controller.config.2.txt b/opendaylight/netconf/config-persister-impl/configuration/current/controller.config.2.txt
new file mode 100644 (file)
index 0000000..e69de29