}
}
+ 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 {
}
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;
type uint32;
}
- // field types
- identity meter-flags {
- description "Base identity for match Fields";
- }
-
typedef meter-flags {
type bits {
bit meter-kbps;
}
}
+ 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;
}
}
+ 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 {
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;
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 {
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;
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;
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;
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 =
try {
statsRequestSender();
- Thread.sleep(5000);
+ Thread.sleep(STATS_THREAD_EXECUTION_TIME);
}catch (Exception e){
spLogger.error("Exception occurred while sending stats request : {}",e);
}
}
});
- 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.");
}
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);
+ }
}
}
}
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();
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;
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;
nodeData.addAugmentation(NodeMeterConfigStats.class, meterConfig.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, nodeData.build());
+ it.putOperationalData(refValue, nodeData.build());
it.commit();
}
nodeData.addAugmentation(NodeMeterStatistics.class, meterStats.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, nodeData.build());
+ it.putOperationalData(refValue, nodeData.build());
it.commit();
}
nodeData.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, nodeData.build());
+ it.putOperationalData(refValue, nodeData.build());
it.commit();
}
nodeData.addAugmentation(NodeGroupStatistics.class, groupStats.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, nodeData.build());
+ it.putOperationalData(refValue, nodeData.build());
it.commit();
}
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());
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())){
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());
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());
}
}