From: Anil Vishnoi Date: Tue, 3 Dec 2013 17:59:00 +0000 (+0530) Subject: MD-SAL Statistics Manager - Fixed keys of group and meter models and their sub component X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-1~245 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=59d721b92d6ff421f60601d22de7b272836753dd MD-SAL Statistics Manager - Fixed keys of group and meter models and their sub component Change-Id: I541177511f6b75451312bc98118a7dbdaad2cdcc Signed-off-by: Anil Vishnoi --- diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang index aca70a94c7..f03e28b110 100644 --- a/opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang +++ b/opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang @@ -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; } } diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/meter-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/meter-types.yang index 0548890a00..b380af2212 100644 --- a/opendaylight/md-sal/model/model-flow-base/src/main/yang/meter-types.yang +++ b/opendaylight/md-sal/model/model-flow-base/src/main/yang/meter-types.yang @@ -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; } } diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java index af56a84db5..f22ca00b2a 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java @@ -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 targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance(); NodeRef targetNodeRef = new NodeRef(targetInstanceId); diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java index d1bfe1e972..86e6114b5f 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java @@ -146,7 +146,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList //Update augmented data nodeData.addAugmentation(NodeGroupDescStats.class, groupDesc.build()); - + InstanceIdentifier 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 refValue = ref.getValue(); it.putOperationalData(refValue, nodeData.build()); it.commit(); + +// for (GroupStats groupstat : notification.getGroupStats()) { +// +// GroupStatsKey groupKey = groupstat.getKey(); +// InstanceIdentifier 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