From 1bd8f4df538150512bab41e1a3de946aedd9fc5f Mon Sep 17 00:00:00 2001 From: Anil Vishnoi Date: Sun, 1 Dec 2013 15:03:30 +0530 Subject: [PATCH] MD-SAL Statistics Manager - Minor change in group/meter type/capabilities 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 --- .../src/main/yang/group-types.yang | 74 +++++++++++++++---- .../src/main/yang/meter-types.yang | 57 +++++++++++--- .../src/main/yang/group-statistics.yang | 26 +++++-- .../md/statistics/manager/NodeStatistics.java | 2 +- .../manager/StatisticsProvider.java | 57 +++++--------- .../manager/StatisticsUpdateCommiter.java | 31 ++++---- .../current/controller.config.2.txt | 0 7 files changed, 157 insertions(+), 90 deletions(-) create mode 100644 opendaylight/netconf/config-persister-impl/configuration/current/controller.config.2.txt 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 244fedb3e7..aca70a94c7 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 @@ -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; 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 fc9be63ec8..0548890a00 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 @@ -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; diff --git a/opendaylight/md-sal/model/model-flow-statistics/src/main/yang/group-statistics.yang b/opendaylight/md-sal/model/model-flow-statistics/src/main/yang/group-statistics.yang index 1b6a9df9ad..ebc6ead25e 100644 --- a/opendaylight/md-sal/model/model-flow-statistics/src/main/yang/group-statistics.yang +++ b/opendaylight/md-sal/model/model-flow-statistics/src/main/yang/group-statistics.yang @@ -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 { diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java index 0cc7beb356..c48ac311ab 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java @@ -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; 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 cdcd1ef32e..7dda447e6a 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 @@ -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 nodesIdentifier = InstanceIdentifier.builder().node(Nodes.class).toInstance(); + private final InstanceIdentifier nodesIdentifier = InstanceIdentifier.builder(Nodes.class).toInstance(); + private final int STATS_THREAD_EXECUTION_TIME= 50000; //Local caching of stats private final ConcurrentMap 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 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> 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> response = - meterStatsService.getMeterFeatures(input.build()); - } public ConcurrentMap getStatisticsCache() { return statisticsCache; 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 bbbb5c8566..d1bfe1e972 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 @@ -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 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 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 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 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 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 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 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 index 0000000000..e69de29bb2 -- 2.36.6