MD-SAL Statistics Manager - Fixed keys of group and meter models and their sub component 13/3413/3
authorAnil Vishnoi <avishnoi@in.ibm.com>
Tue, 3 Dec 2013 17:59:00 +0000 (23:29 +0530)
committerAnil Vishnoi <avishnoi@in.ibm.com>
Fri, 6 Dec 2013 08:36:54 +0000 (14:06 +0530)
Change-Id: I541177511f6b75451312bc98118a7dbdaad2cdcc
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/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

index aca70a94c720f93608f68e16b77c6ae4b4a6a3d1..f03e28b1108a1dee502b3550fbdfa241d0467d41 100644 (file)
@@ -14,6 +14,10 @@ module opendaylight-group-types {
         type uint32;
     }
     
+    typedef bucket-id {
+       type uint32;
+    }
+    
     typedef group-types {        
         type enumeration {
             enum group-all;
@@ -108,9 +112,9 @@ module opendaylight-group-types {
         
         container buckets {
             list bucket {
-                key "order";
-                leaf order {
-                    type int32;
+                key "bucket-id";
+                leaf bucket-id {
+                    type bucket-id;
                 }
                 
                 leaf weight {
@@ -133,7 +137,7 @@ module opendaylight-group-types {
     grouping group-statistics {
             
         leaf group-id {
-            type int32;
+            type group-id;
         }
         
         leaf ref-count {
@@ -159,9 +163,9 @@ module opendaylight-group-types {
         
         container buckets {
             list bucket-counter {
-                key "order";
-                leaf order {
-                    type int32;
+                key "bucket-id";
+                leaf bucket-id {
+                    type bucket-id;
                 }
                 
                 leaf packet-count {
@@ -205,9 +209,8 @@ module opendaylight-group-types {
     grouping group-statistics-request {
         list group-stats {
             key "group-id";         
-            
             leaf group-id {
-                type int32;
+                type group-id;
             }           
         }
     }
@@ -216,11 +219,7 @@ module opendaylight-group-types {
     grouping group-statistics-reply {
        
         list group-stats {
-            key "group-stats-order";
-            leaf group-stats-order {
-                type int32;
-            }
-            
+            key "group-id";
             uses group-statistics;
         }
     }
@@ -228,11 +227,7 @@ module opendaylight-group-types {
     grouping group-desc-stats-reply {
        
         list group-desc-stats {
-            key "order-id";         
-            leaf order-id {
-                type int32;
-            }
-            
+            key "group-id";         
             uses group;
         }
     }
index 0548890a00bcd87637d564002c7754780fa6821c..b380af22129c44f068bb02d50aa57283e8bfbac0 100644 (file)
@@ -11,7 +11,10 @@ module opendaylight-meter-types {
     }
 
     typedef meter-id {
-            type uint32;
+        type uint32;
+    }
+    typedef band-id {
+       type uint32;
     }
     
     typedef meter-flags {        
@@ -132,9 +135,9 @@ module opendaylight-meter-types {
         
         container meter-band-headers {
             list meter-band-header {
-                key "order";
-                leaf order {
-                    type int32;
+                key "band-id";
+                leaf band-id {
+                    type band-id;
                 }
                 
                 container meter-band-types {
@@ -158,7 +161,7 @@ module opendaylight-meter-types {
     grouping meter-statistics {
             
         leaf meter-id {
-            type int32;
+            type meter-id;
         }
         
         leaf flow-count {
@@ -184,9 +187,9 @@ module opendaylight-meter-types {
         
         container meter-band-stats {
             list band-stat {
-                key "order";
-                leaf order {
-                    type int32;
+                key "band-id";
+                leaf band-id {
+                    type band-id;
                 }
             
                 leaf packet-band-count {
@@ -230,30 +233,22 @@ module opendaylight-meter-types {
     grouping meter-stats-config-request {
         list meter-stats {
             key "meter-id";         
-            
             leaf meter-id {
-                type int32;
+                type meter-id;
             }           
         }
     }
     
     grouping meter-statistics-reply {
         list meter-stats {
-            key "meter-stats-order";
-            leaf meter-stats-order {
-                type int32;
-            }
+            key "meter-id";
             uses meter-statistics;
         }
     }
     
     grouping meter-config-stats-reply {
         list meter-config-stats {
-            key "meter-config-order";
-            leaf meter-config-order {
-                type int32;
-            }
-            
+            key "meter-id";
             uses meter;
         } 
     }
index af56a84db5611974d0537d65b914df6acbf4adc0..f22ca00b2ab4d0dc20d551aa08d58522848923a7 100644 (file)
@@ -16,6 +16,7 @@ import org.eclipse.xtext.xbase.lib.Exceptions;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 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;
@@ -130,12 +131,11 @@ public class StatisticsProvider implements AutoCloseable {
             return;
 
         for (Node targetNode : targetNodes){
-            
-            
-            //We need to add check, so see if groups/meters are supported
-            //by the target node. Below check doesn't look good.
-            if(targetNode.getId().getValue().contains("openflow:")){
+
+            if(targetNode.getAugmentation(FlowCapableNode.class) != null){
+
                 spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
+                
                 InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
                 NodeRef targetNodeRef = new NodeRef(targetInstanceId);
                 
index d1bfe1e972a6b0273cfe002a4ee3eb1a8549f677..86e6114b5f67a9df25f02e8ae98677d0d842cc54 100644 (file)
@@ -146,7 +146,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         
         //Update augmented data
         nodeData.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
-        
+
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
         it.putOperationalData(refValue, nodeData.build());
         it.commit();
@@ -168,7 +168,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         DataModificationTransaction it = this.statisticsManager.startChange();
         NodeKey key = new NodeKey(notification.getId());
         NodeRef ref = getNodeRef(key);
-        
+
         final NodeBuilder nodeData = new NodeBuilder(); 
         nodeData.setKey(key);
         
@@ -176,13 +176,21 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         GroupStatisticsBuilder stats = new GroupStatisticsBuilder();
         stats.setGroupStats(notification.getGroupStats());
         groupStats.setGroupStatistics(stats.build());
-        
+                
         //Update augmented data
         nodeData.addAugmentation(NodeGroupStatistics.class, groupStats.build());
-        
+
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
         it.putOperationalData(refValue, nodeData.build());
         it.commit();
+
+//        for (GroupStats groupstat : notification.getGroupStats()) {
+//        
+//            GroupStatsKey groupKey = groupstat.getKey();
+//            InstanceIdentifier<? extends Object> id = InstanceIdentifier.builder(Nodes.class).child(Node.class, key).augmentation(NodeGroupStatistics.class).child(GroupStatistics.class).child(GroupStats.class,groupKey).toInstance();
+//            it.putOperationalData(id, groupstat);
+//            it.commit();
+//        }
     }
     
     @Override