}
}
- grouping group-statistics-request {
- list group-stats {
- key "group-id";
-
- leaf group-id {
- type int32;
- }
- }
- }
-
grouping group-statistics {
leaf group-id {
}
}
+ grouping group-features {
+ uses group-types;
+
+ leaf capabilities {
+ type enumeration {
+ enum select-weight;
+ enum select-liveness;
+ enum chaining;
+ enum chaining-checks;
+ }
+ }
+
+ leaf-list max-groups {
+ type uint32;
+ description "Maximum number of groups for each type";
+ max-elements 4;
+ }
+
+ leaf-list actions {
+ type uint32;
+ description "Bitmap number OFPAT_* that are supported";
+ max-elements 4;
+ }
+ }
+
+ grouping group-statistics-request {
+ list group-stats {
+ key "group-id";
+
+ leaf group-id {
+ type int32;
+ }
+ }
+ }
+
+
grouping group-statistics-reply {
+
list group-stats {
key "group-stats-order";
leaf group-stats-order {
}
}
- grouping group-desc-stats {
+ grouping group-desc-stats-reply {
+
list group-desc-stats {
key "order-id";
-
leaf order-id {
type int32;
}
}
}
- grouping group-features {
- list group-features {
- key "order";
- leaf order {
- type int32;
- }
-
- uses group-types;
-
- leaf capabilities {
- type enumeration {
- enum select-weight;
- enum select-liveness;
- enum chaining;
- enum chaining-checks;
- }
- }
-
- leaf-list max-groups {
- type uint32;
- description "Maximum number of groups for each type";
- max-elements 4;
- }
-
- leaf-list actions {
- type uint32;
- description "Bitmap number OFPAT_* that are supported";
- max-elements 4;
- }
- }
- }
+ grouping group-features-reply {
+ uses group-features;
+ }
+
}
\ No newline at end of file
}
}
- grouping meter-stats-config-request {
- list meter-stats {
- key "meter-id";
-
- leaf meter-id {
- type int32;
- }
- }
- }
-
grouping meter-statistics {
leaf meter-id {
}
}
+ grouping meter-features {
+
+ leaf max_meter {
+ type yang:counter32;
+ }
+
+ leaf band_types {
+ type yang:counter32;
+ }
+
+ leaf capabilities {
+ type yang:counter32;
+ }
+
+ leaf max_bands {
+ type uint8;
+ }
+
+ leaf max_color {
+ type uint8;
+ }
+ }
+
+ grouping meter-stats-config-request {
+ list meter-stats {
+ key "meter-id";
+
+ leaf meter-id {
+ type int32;
+ }
+ }
+ }
+
grouping meter-statistics-reply {
list meter-stats {
key "meter-stats-order";
}
}
- grouping meter-config-stats {
+ grouping meter-config-stats-reply {
list meter-config-stats {
key "meter-config-order";
-
leaf meter-config-order {
type int32;
}
}
}
- grouping meter-features {
- list meter-features {
- key "meter-feature-order";
-
- leaf meter-feature-order {
- type yang:counter32;
- }
-
- leaf max_meter {
- type yang:counter32;
- }
-
- leaf band_types {
- type yang:counter32;
- }
-
- leaf capabilities {
- type yang:counter32;
- }
-
- leaf max_bands {
- type uint8;
- }
-
- leaf max_color {
- type uint8;
- }
- }
- }
+ grouping meter-features-reply {
+ uses meter-features;
+ }
+
}
\ No newline at end of file
import opendaylight-group-types {prefix group-types;revision-date "2013-10-18";}
import flow-capable-transaction {prefix tr;}
+ contact
+ "Anilkumar Vishnoi
+ Email: avishnoi@in.ibm.com";
+
revision "2013-11-11" {
description "Initial revision of group statistics service";
}
- typedef group-stats-ref {
- type instance-identifier;
- }
-
- grouping group-stats-response {
- uses "inv:node-context-ref";
-
- list group-statistics{
- uses group-types:group-statistics;
+ augment "/inv:nodes/inv:node" {
+ ext:augment-identifier "node-group-statistics";
+ container group-statistics {
+ config "false";
+ uses group-types:group-statistics-reply;
}
}
- typedef group-features-ref {
- type instance-identifier;
- }
-
- grouping group-features-response {
- uses "inv:node-context-ref";
-
- uses group-types:group-features;
- }
-
- typedef group-desc-ref {
- type instance-identifier;
- }
-
- grouping group-desc-response {
- uses "inv:node-context-ref";
-
- list group-desc-stats {
- uses group-types:group-desc-stats;
+ augment "/inv:nodes/inv:node" {
+ ext:augment-identifier "node-group-desc-stats";
+ container group-desc {
+ config "false";
+ uses group-types:group-desc-stats-reply;
}
}
-
- container group-all-statistics {
- container group-stats {
- uses group-stats-response;
- }
-
- container group-features {
- uses group-features-response;
- }
-
- container group-desc {
- uses group-desc-response;
- }
+
+ augment "/inv:nodes/inv:node" {
+ ext:augment-identifier "node-group-features";
+ container group-features {
+ config "false";
+ uses group-types:group-features-reply;
+ }
}
// RPC calls
rpc get-all-group-statistics {
input {
- uses inv:node-context-ref;
+ uses inv:node;
}
output {
- uses group-stats-response;
+ uses group-types:group-statistics-reply;
uses tr:transaction-aware;
}
rpc get-group-statistics {
input {
- uses inv:node-context-ref;
- leaf group-id{
- type group-types:group-id;
- }
+ uses inv:node;
}
output {
- uses group-stats-response;
+ uses group-types:group-statistics-reply;
uses tr:transaction-aware;
}
rpc get-group-description {
input {
- uses inv:node-context-ref;
+ uses inv:node;
}
output {
- uses group-desc-response;
+ uses group-types:group-desc-stats-reply;
uses tr:transaction-aware;
}
}
rpc get-group-features {
input {
- uses inv:node-context-ref;
+ uses inv:node;
}
output {
- uses group-features-response;
+ uses group-types:group-features-reply;
uses tr:transaction-aware;
}
}
//Notification calls
notification group-statistics-updated {
- leaf group-stats-id {
- type group-stats-ref;
- }
-
- uses group-stats-response;
+ leaf moreReplies {
+ type boolean;
+ }
+ uses inv:node;
+ uses group-types:group-statistics-reply;
uses tr:transaction-aware;
}
notification group-desc-stats-updated {
- leaf group-desc-id {
- type group-desc-ref;
- }
-
- uses group-desc-response;
+ leaf moreReplies {
+ type boolean;
+ }
+ uses inv:node;
+ uses group-types:group-desc-stats-reply;
uses tr:transaction-aware;
}
notification group-features-updated {
- leaf group-features-id {
- type group-features-ref;
- }
-
- uses group-features-response;
+ leaf moreReplies {
+ type boolean;
+ }
+ uses inv:node;
+ uses group-types:group-features-reply;
uses tr:transaction-aware;
}
}
import opendaylight-meter-types {prefix meter-types;revision-date "2013-09-18";}
import flow-capable-transaction {prefix tr;}
+ contact
+ "Anilkumar Vishnoi
+ Email: avishnoi@in.ibm.com";
revision "2013-11-11" {
description "Initial revision of meter statistics service";
}
- typedef meter-stats-ref {
- type instance-identifier;
- }
-
- grouping meter-stats-response {
- uses "inv:node-context-ref";
-
- list meter-statistics {
- uses meter-types:meter-statistics;
+ augment "/inv:nodes/inv:node" {
+ ext:augment-identifier "node-meter-statistics";
+ container meter-statistics {
+ config "false";
+ uses meter-types:meter-statistics-reply;
}
}
- typedef meter-config-ref {
- type instance-identifier;
- }
-
- grouping meter-config-response {
- uses "inv:node-context-ref";
-
- list meter-config-stats {
- uses meter-types:meter-config-stats;
+ augment "/inv:nodes/inv:node" {
+ ext:augment-identifier "node-meter-config-stats";
+ container meter-config-stats {
+ config "false";
+ uses meter-types:meter-config-stats-reply;
}
}
-
- typedef meter-features-ref {
- type instance-identifier;
- }
-
- grouping meter-features-response {
- uses "inv:node-context-ref";
-
- uses meter-types:meter-features;
+
+ augment "/inv:nodes/inv:node" {
+ ext:augment-identifier "node-meter-features";
+ container meter-features {
+ config "false";
+ uses meter-types:meter-features-reply;
+ }
}
- container meter-all-stats {
- container meter-stats {
- uses meter-stats-response;
- }
-
- container meter-config {
- uses meter-config-response;
- }
-
- container meter-features {
- uses meter-features-response;
- }
- }
// RPC calls
rpc get-all-meter-statistics {
input {
- uses inv:node-context-ref;
+ uses inv:node;
}
output {
- uses meter-stats-response;
+ uses meter-types:meter-statistics-reply;
uses tr:transaction-aware;
}
rpc get-meter-statistics {
input {
- uses inv:node-context-ref;
+ uses inv:node;
leaf meter-id{
type meter-types:meter-id;
}
}
output {
- uses meter-stats-response;
+ uses meter-types:meter-statistics-reply;
uses tr:transaction-aware;
}
rpc get-all-meter-config-statistics {
input {
- uses inv:node-context-ref;
+ uses inv:node;
}
output {
- uses meter-config-response;
+ uses meter-types:meter-config-stats-reply;
uses tr:transaction-aware;
}
}
rpc get-meter-features {
input {
- uses inv:node-context-ref;
+ uses inv:node;
}
output {
- uses meter-features-response;
+ uses meter-types:meter-features-reply;
uses tr:transaction-aware;
}
}
//Notification calls
notification meter-statistics-updated {
- leaf meter-stats-id {
- type meter-stats-ref;
- }
- uses meter-stats-response;
+ leaf moreReplies {
+ type boolean;
+ }
+
+ uses inv:node;
+ uses meter-types:meter-statistics-reply;
uses tr:transaction-aware;
}
notification meter-config-stats-updated {
- leaf meter-config-id {
- type meter-config-ref;
- }
-
- uses meter-config-response;
- uses tr:transaction-aware;
+ leaf moreReplies {
+ type boolean;
+ }
+
+ uses inv:node;
+ uses meter-types:meter-config-stats-reply;
+ uses tr:transaction-aware;
}
notification meter-features-updated {
- leaf meter-features-id {
- type meter-features-ref;
- }
-
- uses meter-features-response;
+ leaf moreReplies {
+ type boolean;
+ }
+
+ uses inv:node;
+ uses meter-types:meter-features-reply;
uses tr:transaction-aware;
}
}
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.eclipse.xtend</groupId>
- <artifactId>xtend-maven-plugin</artifactId>
- </plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.md.statistics.manager;
import java.util.List;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.desc.response.GroupDescStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.stats.response.GroupStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.nodes.node.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.meter.statistics.rev131111.meter.config.response.MeterConfigStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.meter.stats.response.MeterStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
public class NodeStatistics {
private NodeRef targetNode;
- private List<GroupStatistics> groupStatistics;
+ private List<GroupStats> groupStatistics;
- private List<MeterStatistics> meterStatistics;
+ private List<MeterStats> meterStatistics;
private List<GroupDescStats> groupDescStats;
private List<MeterConfigStats> meterConfigStats;
- private List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.features.GroupFeatures> groupFeatures;
+ private GroupFeatures groupFeatures;
- private List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.features.MeterFeatures> meterFeatures;
+ private MeterFeatures meterFeatures;
public NodeStatistics(){
this.targetNode = targetNode;
}
- public List<GroupStatistics> getGroupStatistics() {
+ public List<GroupStats> getGroupStatistics() {
return groupStatistics;
}
- public void setGroupStatistics(List<GroupStatistics> groupStatistics) {
+ public void setGroupStatistics(List<GroupStats> groupStatistics) {
this.groupStatistics = groupStatistics;
}
- public List<MeterStatistics> getMeterStatistics() {
+ public List<MeterStats> getMeterStatistics() {
return meterStatistics;
}
- public void setMeterStatistics(List<MeterStatistics> meterStatistics) {
+ public void setMeterStatistics(List<MeterStats> meterStatistics) {
this.meterStatistics = meterStatistics;
}
this.meterConfigStats = meterConfigStats;
}
- public List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.features.GroupFeatures> getGroupFeatures() {
+ public GroupFeatures getGroupFeatures() {
return groupFeatures;
}
- public void setGroupFeatures(
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.features.GroupFeatures> groupFeatures) {
+ public void setGroupFeatures(GroupFeatures groupFeatures) {
this.groupFeatures = groupFeatures;
}
- public List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.features.MeterFeatures> getMeterFeatures() {
+ public MeterFeatures getMeterFeatures() {
return meterFeatures;
}
- public void setMeterFeatures(
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.features.MeterFeatures> meterFeatures) {
+ public void setMeterFeatures(MeterFeatures meterFeatures) {
this.meterFeatures = meterFeatures;
}
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+/*
+ * TODO: Handle multipart messages with following flag true
+ * OFPMPF_REPLY_MORE = 1 << 0
+ * Better accumulate all the messages and update local cache
+ * and configurational data store
+ */
package org.opendaylight.controller.md.statistics.manager;
import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.md.statistics.manager;
-import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
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.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInputBuilder;
//Local caching of stats
- private final ConcurrentMap<NodeRef,NodeStatistics> statisticsCache =
- new ConcurrentHashMap<NodeRef,NodeStatistics>();
+ private final ConcurrentMap<NodeId,NodeStatistics> statisticsCache =
+ new ConcurrentHashMap<NodeId,NodeStatistics>();
public DataProviderService getDataService() {
return this.dps;
public void run() {
while(true){
try {
+ spLogger.info("Statistics requester thread started with timer interval : {}",5000);
+
statsRequestSender();
Thread.sleep(5000);
}catch (Exception e){
- spLogger.error("Exception occurred while sending stats request : {}",e.getMessage());
- e.printStackTrace();
+ spLogger.error("Exception occurred while sending stats request : {}",e);
}
}
}
private void statsRequestSender(){
//Need to call API to receive all the nodes connected to controller.
-
- List<NodeRef> targetNodes = new ArrayList<NodeRef>();
-
- for (NodeRef targetNode : targetNodes){
-
- sendAllGroupStatisticsRequest(targetNode);
-
- sendAllMeterStatisticsRequest(targetNode);
+ List<Node> targetNodes = getAllConnectedNodes();
- //We need to add check, so see if groups/meters are supported
- //by the target node.
- sendGroupDescriptionRequest(targetNode);
-
- sendGroupFeaturesRequest(targetNode);
-
- sendMeterConfigStatisticsRequest(targetNode);
+ for (Node targetNode : targetNodes){
+ spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
- sendMeterFeaturesRequest(targetNode);
+ //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:")){
+ sendAllGroupStatisticsRequest(targetNode);
+
+ sendAllMeterStatisticsRequest(targetNode);
+
+ sendGroupDescriptionRequest(targetNode);
+
+ sendGroupFeaturesRequest(targetNode);
+
+ sendMeterConfigStatisticsRequest(targetNode);
+
+ sendMeterFeaturesRequest(targetNode);
+ }
}
}
- private void sendAllGroupStatisticsRequest(NodeRef targetNode){
+ private void sendAllGroupStatisticsRequest(Node targetNode){
- GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
+ final GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
- input.setNode(targetNode);
+ input.setId(targetNode.getId());
Future<RpcResult<GetAllGroupStatisticsOutput>> response =
groupStatsService.getAllGroupStatistics(input.build());
}
- private void sendGroupDescriptionRequest(NodeRef targetNode){
- GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
+ private void sendGroupDescriptionRequest(Node targetNode){
+ final GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
- input.setNode(targetNode);
+ input.setId(targetNode.getId());
Future<RpcResult<GetGroupDescriptionOutput>> response =
groupStatsService.getGroupDescription(input.build());
}
- private void sendGroupFeaturesRequest(NodeRef targetNode){
+ private void sendGroupFeaturesRequest(Node targetNode){
GetGroupFeaturesInputBuilder input = new GetGroupFeaturesInputBuilder();
- input.setNode(targetNode);
+ input.setId(targetNode.getId());
Future<RpcResult<GetGroupFeaturesOutput>> response =
groupStatsService.getGroupFeatures(input.build());
}
- private void sendAllMeterStatisticsRequest(NodeRef targenetNode){
+ private void sendAllMeterStatisticsRequest(Node targetNode){
GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder();
- input.setNode(targenetNode);
+ input.setId(targetNode.getId());
Future<RpcResult<GetAllMeterStatisticsOutput>> response =
meterStatsService.getAllMeterStatistics(input.build());
}
- private void sendMeterConfigStatisticsRequest(NodeRef targetNode){
+ private void sendMeterConfigStatisticsRequest(Node targetNode){
GetAllMeterConfigStatisticsInputBuilder input = new GetAllMeterConfigStatisticsInputBuilder();
- input.setNode(targetNode);
+ input.setId(targetNode.getId());
Future<RpcResult<GetAllMeterConfigStatisticsOutput>> response =
meterStatsService.getAllMeterConfigStatistics(input.build());
}
- private void sendMeterFeaturesRequest(NodeRef targetNode){
+ private void sendMeterFeaturesRequest(Node targetNode){
GetMeterFeaturesInputBuilder input = new GetMeterFeaturesInputBuilder();
- input.setNode(targetNode);
+ input.setId(targetNode.getId());
Future<RpcResult<GetMeterFeaturesOutput>> response =
meterStatsService.getMeterFeatures(input.build());
}
- public ConcurrentMap<NodeRef, NodeStatistics> getStatisticsCache() {
+ public ConcurrentMap<NodeId, NodeStatistics> getStatisticsCache() {
return statisticsCache;
}
private List<Node> getAllConnectedNodes(){
Nodes nodes = (Nodes) dps.readOperationalData(nodesIdentifier);
+ spLogger.info("Number of connected nodes : {}",nodes.getNode().size());
return nodes.getNode();
}
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.md.statistics.manager;
import java.util.concurrent.ConcurrentMap;
import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatsRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupFeaturesBuilder;
+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.group.all.statistics.GroupDescBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.all.statistics.GroupFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.all.statistics.GroupStatsBuilder;
+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.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.MeterConfigRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterConfigStatsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterFeaturesRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterFeaturesUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatsRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatisticsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.meter.all.stats.MeterConfigBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.meter.all.stats.MeterFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.meter.all.stats.MeterStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterConfigStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterStatisticsBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsListener,
OpendaylightMeterStatisticsListener {
this.statisticsManager = manager;
}
+
public StatisticsProvider getStatisticsManager(){
return statisticsManager;
}
+
@Override
public void onMeterConfigStatsUpdated(MeterConfigStatsUpdated notification) {
+
//Add statistics to local cache
- ConcurrentMap<NodeRef, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
- if(!cache.containsKey(notification.getNode())){
- cache.put(notification.getNode(), new NodeStatistics());
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
}
- cache.get(notification.getNode()).setMeterConfigStats(notification.getMeterConfigStats());
+ cache.get(notification.getId()).setMeterConfigStats(notification.getMeterConfigStats());
//Publish data to configuration data store
DataModificationTransaction it = this.statisticsManager.startChange();
- MeterConfigRef ref = notification.getMeterConfigId();
-
- MeterConfigBuilder meterConfig = new MeterConfigBuilder();
- meterConfig.setNode(notification.getNode());
- meterConfig.setMeterConfigStats(notification.getMeterConfigStats());
+ NodeKey key = new NodeKey(notification.getId());
+ NodeRef ref = getNodeRef(key);
+
+ final NodeBuilder nodeData = new NodeBuilder();
+ nodeData.setKey(key);
+
+ NodeMeterConfigStatsBuilder meterConfig= new NodeMeterConfigStatsBuilder();
+ MeterConfigStatsBuilder stats = new MeterConfigStatsBuilder();
+ stats.setMeterConfigStats(notification.getMeterConfigStats());
+ meterConfig.setMeterConfigStats(stats.build());
+
+ //Update augmented data
+ nodeData.addAugmentation(NodeMeterConfigStats.class, meterConfig.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, meterConfig.build());
+ it.putRuntimeData(refValue, nodeData.build());
it.commit();
+
}
@Override
public void onMeterStatisticsUpdated(MeterStatisticsUpdated notification) {
//Add statistics to local cache
- ConcurrentMap<NodeRef, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
- if(!cache.containsKey(notification.getNode())){
- cache.put(notification.getNode(), new NodeStatistics());
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
}
- cache.get(notification.getNode()).setMeterStatistics(notification.getMeterStatistics());
+ cache.get(notification.getId()).setMeterStatistics(notification.getMeterStats());
//Publish data to configuration data store
DataModificationTransaction it = this.statisticsManager.startChange();
- MeterStatsRef ref = notification.getMeterStatsId();
-
- MeterStatsBuilder meterStats = new MeterStatsBuilder();
- meterStats.setNode(notification.getNode());
- meterStats.setMeterStatistics(notification.getMeterStatistics());
+ NodeKey key = new NodeKey(notification.getId());
+ NodeRef ref = getNodeRef(key);
+
+ final NodeBuilder nodeData = new NodeBuilder();
+ nodeData.setKey(key);
+
+ NodeMeterStatisticsBuilder meterStats= new NodeMeterStatisticsBuilder();
+ MeterStatisticsBuilder stats = new MeterStatisticsBuilder();
+ stats.setMeterStats(notification.getMeterStats());
+ meterStats.setMeterStatistics(stats.build());
+
+ //Update augmented data
+ nodeData.addAugmentation(NodeMeterStatistics.class, meterStats.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, meterStats.build());
+ it.putRuntimeData(refValue, nodeData.build());
it.commit();
+
}
@Override
public void onGroupDescStatsUpdated(GroupDescStatsUpdated notification) {
//Add statistics to local cache
- ConcurrentMap<NodeRef, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
- if(!cache.containsKey(notification.getNode())){
- cache.put(notification.getNode(), new NodeStatistics());
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
}
- cache.get(notification.getNode()).setGroupDescStats(notification.getGroupDescStats());
+ cache.get(notification.getId()).setGroupDescStats(notification.getGroupDescStats());
//Publish data to configuration data store
DataModificationTransaction it = this.statisticsManager.startChange();
- GroupDescRef ref = notification.getGroupDescId();
-
- GroupDescBuilder descStats = new GroupDescBuilder();
- descStats.setNode(notification.getNode());
- descStats.setGroupDescStats(notification.getGroupDescStats());
+ NodeKey key = new NodeKey(notification.getId());
+ NodeRef ref = getNodeRef(key);
+
+ final NodeBuilder nodeData = new NodeBuilder();
+ nodeData.setKey(key);
+
+ NodeGroupDescStatsBuilder groupDesc= new NodeGroupDescStatsBuilder();
+ GroupDescBuilder stats = new GroupDescBuilder();
+ stats.setGroupDescStats(notification.getGroupDescStats());
+ groupDesc.setGroupDesc(stats.build());
+
+ //Update augmented data
+ nodeData.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, descStats.build());
+ it.putRuntimeData(refValue, nodeData.build());
it.commit();
+
}
@Override
public void onGroupStatisticsUpdated(GroupStatisticsUpdated notification) {
//Add statistics to local cache
- ConcurrentMap<NodeRef, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
- if(!cache.containsKey(notification.getNode())){
- cache.put(notification.getNode(), new NodeStatistics());
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
}
- cache.get(notification.getNode()).setGroupStatistics(notification.getGroupStatistics());
+ cache.get(notification.getId()).setGroupStatistics(notification.getGroupStats());
//Publish data to configuration data store
+
DataModificationTransaction it = this.statisticsManager.startChange();
- GroupStatsRef ref = notification.getGroupStatsId();
-
- GroupStatsBuilder groupStats = new GroupStatsBuilder();
- groupStats.setNode(notification.getNode());
- groupStats.setGroupStatistics(notification.getGroupStatistics());
+ NodeKey key = new NodeKey(notification.getId());
+ NodeRef ref = getNodeRef(key);
+
+ final NodeBuilder nodeData = new NodeBuilder();
+ nodeData.setKey(key);
+
+ NodeGroupStatisticsBuilder groupStats = new NodeGroupStatisticsBuilder();
+ 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.putRuntimeData(refValue, groupStats.build());
+ it.putRuntimeData(refValue, nodeData.build());
it.commit();
}
+
@Override
public void onMeterFeaturesUpdated(MeterFeaturesUpdated notification) {
//Add statistics to local cache
- ConcurrentMap<NodeRef, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
- if(!cache.containsKey(notification.getNode())){
- cache.put(notification.getNode(), new NodeStatistics());
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
}
- cache.get(notification.getNode()).setMeterFeatures(notification.getMeterFeatures());
+ MeterFeaturesBuilder meterFeature = new MeterFeaturesBuilder();
+ meterFeature.setBandTypes(notification.getBandTypes());
+ meterFeature.setCapabilities(notification.getCapabilities());
+ meterFeature.setMaxBands(notification.getMaxBands());
+ meterFeature.setMaxColor(notification.getMaxColor());
+ meterFeature.setMaxMeter(notification.getMaxMeter());
+
+ cache.get(notification.getId()).setMeterFeatures(meterFeature.build());
//Publish data to configuration data store
DataModificationTransaction it = this.statisticsManager.startChange();
- MeterFeaturesRef ref = notification.getMeterFeaturesId();
-
- MeterFeaturesBuilder meterFeatures = new MeterFeaturesBuilder();
- meterFeatures.setNode(notification.getNode());
- meterFeatures.setMeterFeatures(notification.getMeterFeatures());
+ NodeKey key = new NodeKey(notification.getId());
+ NodeRef ref = getNodeRef(key);
+
+ final NodeBuilder nodeData = new NodeBuilder();
+ nodeData.setKey(key);
+
+ NodeMeterFeaturesBuilder nodeMeterFeatures= new NodeMeterFeaturesBuilder();
+ nodeMeterFeatures.setMeterFeatures(meterFeature.build());
+
+ //Update augmented data
+ nodeData.addAugmentation(NodeMeterFeatures.class, nodeMeterFeatures.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, meterFeatures.build());
+ it.putRuntimeData(refValue, nodeData.build());
it.commit();
}
@Override
public void onGroupFeaturesUpdated(GroupFeaturesUpdated notification) {
-
//Add statistics to local cache
- ConcurrentMap<NodeRef, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
- if(!cache.containsKey(notification.getNode())){
- cache.put(notification.getNode(), new NodeStatistics());
+ ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+ if(!cache.containsKey(notification.getId())){
+ cache.put(notification.getId(), new NodeStatistics());
}
- cache.get(notification.getNode()).setGroupFeatures(notification.getGroupFeatures());
+
+ GroupFeaturesBuilder groupFeatures = new GroupFeaturesBuilder();
+ groupFeatures.setActions(notification.getActions());
+ groupFeatures.setCapabilities(notification.getCapabilities());
+ groupFeatures.setGroupType(notification.getGroupType());
+ groupFeatures.setMaxGroups(notification.getMaxGroups());
+ cache.get(notification.getId()).setGroupFeatures(groupFeatures.build());
//Publish data to configuration data store
DataModificationTransaction it = this.statisticsManager.startChange();
- GroupFeaturesRef ref = notification.getGroupFeaturesId();
-
- GroupFeaturesBuilder featuresStats = new GroupFeaturesBuilder();
- featuresStats.setNode(notification.getNode());
- featuresStats.setGroupFeatures(notification.getGroupFeatures());
+ NodeKey key = new NodeKey(notification.getId());
+ NodeRef ref = getNodeRef(key);
+
+ final NodeBuilder nodeData = new NodeBuilder();
+ nodeData.setKey(key);
+
+ NodeGroupFeaturesBuilder nodeGroupFeatures= new NodeGroupFeaturesBuilder();
+ nodeGroupFeatures.setGroupFeatures(groupFeatures.build());
+
+ //Update augmented data
+ nodeData.addAugmentation(NodeGroupFeatures.class, nodeGroupFeatures.build());
InstanceIdentifier<? extends Object> refValue = ref.getValue();
- it.putRuntimeData(refValue, featuresStats.build());
+ it.putRuntimeData(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());
+ }
+
}