}
if(groupStatsService != null){
sendAllGroupStatisticsRequest(h);
- sendGroupDescriptionRequest(h.getTargetNodeRef());
+ sendGroupDescriptionRequest(h);
}
if(meterStatsService != null){
sendAllMeterStatisticsRequest(h);
- sendMeterConfigStatisticsRequest(h.getTargetNodeRef());
+ sendMeterConfigStatisticsRequest(h);
}
if(queueStatsService != null){
sendAllQueueStatsFromAllNodeConnector(h);
}
- public void sendFlowStatsFromTableRequest(NodeRef targetNode,Flow flow) throws InterruptedException, ExecutionException{
+ public void sendFlowStatsFromTableRequest(NodeKey node, Flow flow) throws InterruptedException, ExecutionException {
+ final NodeStatisticsHandler h = getStatisticsHandler(node.getId());
+ if (h != null) {
+ sendFlowStatsFromTableRequest(h, flow);
+ }
+ }
+
+ private void sendFlowStatsFromTableRequest(NodeStatisticsHandler h, Flow flow) throws InterruptedException, ExecutionException{
final GetFlowStatisticsFromFlowTableInputBuilder input =
new GetFlowStatisticsFromFlowTableInputBuilder();
- input.setNode(targetNode);
+ input.setNode(h.getTargetNodeRef());
input.fieldsFrom(flow);
Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> response =
flowStatsService.getFlowStatisticsFromFlowTable(input.build());
- this.multipartMessageManager.addTxIdToRequestTypeEntry(getNodeId(targetNode), response.get().getResult().getTransactionId()
- , StatsRequestType.ALL_FLOW);
-
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(h.getTargetNodeKey().getId(),
+ response.get().getResult().getTransactionId(), StatsRequestType.ALL_FLOW);
}
private void sendAggregateFlowsStatsFromAllTablesRequest(final NodeStatisticsHandler h) throws InterruptedException, ExecutionException{
}
- public void sendGroupDescriptionRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+ public void sendGroupDescriptionRequest(NodeKey node) throws InterruptedException, ExecutionException{
+ final NodeStatisticsHandler h = getStatisticsHandler(node.getId());
+ if (h != null) {
+ sendGroupDescriptionRequest(h);
+ }
+ }
+
+ private void sendGroupDescriptionRequest(NodeStatisticsHandler h) throws InterruptedException, ExecutionException{
final GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
- input.setNode(targetNode);
+ input.setNode(h.getTargetNodeRef());
Future<RpcResult<GetGroupDescriptionOutput>> response =
groupStatsService.getGroupDescription(input.build());
- this.multipartMessageManager.addTxIdToRequestTypeEntry(getNodeId(targetNode), response.get().getResult().getTransactionId()
- , StatsRequestType.GROUP_DESC);
-
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(h.getTargetNodeKey().getId(),
+ response.get().getResult().getTransactionId(), StatsRequestType.GROUP_DESC);
}
private void sendAllMeterStatisticsRequest(NodeStatisticsHandler h) throws InterruptedException, ExecutionException{
}
- public void sendMeterConfigStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+ public void sendMeterConfigStatisticsRequest(NodeKey node) throws InterruptedException, ExecutionException {
+ final NodeStatisticsHandler h = getStatisticsHandler(node.getId());
+ if (h != null) {
+ sendMeterConfigStatisticsRequest(h);
+ }
+ }
+
+ private void sendMeterConfigStatisticsRequest(NodeStatisticsHandler h) throws InterruptedException, ExecutionException{
GetAllMeterConfigStatisticsInputBuilder input = new GetAllMeterConfigStatisticsInputBuilder();
- input.setNode(targetNode);
+ input.setNode(h.getTargetNodeRef());
Future<RpcResult<GetAllMeterConfigStatisticsOutput>> response =
meterStatsService.getAllMeterConfigStatistics(input.build());
- this.multipartMessageManager.addTxIdToRequestTypeEntry(getNodeId(targetNode), response.get().getResult().getTransactionId()
- , StatsRequestType.METER_CONFIG);;
-
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(h.getTargetNodeKey().getId(),
+ response.get().getResult().getTransactionId(), StatsRequestType.METER_CONFIG);;
}
private void sendAllQueueStatsFromAllNodeConnector(NodeStatisticsHandler h) throws InterruptedException, ExecutionException {
Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> response =
queueStatsService.getAllQueuesStatisticsFromAllPorts(input.build());
- this.multipartMessageManager.addTxIdToRequestTypeEntry(h.getTargetNodeKey().getId(), response.get().getResult().getTransactionId()
- , StatsRequestType.ALL_QUEUE_STATS);;
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(h.getTargetNodeKey().getId(),
+ response.get().getResult().getTransactionId(), StatsRequestType.ALL_QUEUE_STATS);;
+ }
+ public void sendQueueStatsFromGivenNodeConnector(NodeKey node,NodeConnectorId nodeConnectorId, QueueId queueId) throws InterruptedException, ExecutionException {
+ final NodeStatisticsHandler h = getStatisticsHandler(node.getId());
+ if (h != null) {
+ sendQueueStatsFromGivenNodeConnector(h, nodeConnectorId, queueId);
+ }
}
- public void sendQueueStatsFromGivenNodeConnector(NodeRef targetNode,NodeConnectorId nodeConnectorId, QueueId queueId) throws InterruptedException, ExecutionException {
+ private void sendQueueStatsFromGivenNodeConnector(NodeStatisticsHandler h, NodeConnectorId nodeConnectorId, QueueId queueId) throws InterruptedException, ExecutionException {
GetQueueStatisticsFromGivenPortInputBuilder input = new GetQueueStatisticsFromGivenPortInputBuilder();
- input.setNode(targetNode);
+ input.setNode(h.getTargetNodeRef());
input.setNodeConnectorId(nodeConnectorId);
input.setQueueId(queueId);
Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> response =
queueStatsService.getQueueStatisticsFromGivenPort(input.build());
- this.multipartMessageManager.addTxIdToRequestTypeEntry(getNodeId(targetNode), response.get().getResult().getTransactionId()
- , StatsRequestType.ALL_QUEUE_STATS);;
-
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(h.getTargetNodeKey().getId(),
+ response.get().getResult().getTransactionId(), StatsRequestType.ALL_QUEUE_STATS);;
}
/**
return handler;
}
- @SuppressWarnings("unchecked")
- private NodeId getNodeId(NodeRef nodeRef){
- InstanceIdentifier<Node> nodeII = (InstanceIdentifier<Node>) nodeRef.getValue();
- NodeKey nodeKey = InstanceIdentifier.keyOf(nodeII);
- return nodeKey.getId();
- }
-
@Override
public void close() {
try {
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData;
Map<InstanceIdentifier<?>, DataObject> additions = change.getCreatedConfigurationData();
for (InstanceIdentifier<? extends DataObject> dataObjectInstance : additions.keySet()) {
DataObject dataObject = additions.get(dataObjectInstance);
- InstanceIdentifier<Node> nodeII = dataObjectInstance.firstIdentifierOf(Node.class);
- NodeRef nodeRef = new NodeRef(nodeII);
+ NodeKey nodeII = dataObjectInstance.firstKeyOf(Node.class, NodeKey.class);
if(dataObject instanceof Flow){
Flow flow = (Flow) dataObject;
try {
- this.statisticsManager.sendFlowStatsFromTableRequest(nodeRef, flow);
+ this.statisticsManager.sendFlowStatsFromTableRequest(nodeII, flow);
} catch (InterruptedException | ExecutionException e) {
suhLogger.warn("Following exception occured while sending flow statistics request newly added flow: {}", e);
}
}
if(dataObject instanceof Meter){
try {
- this.statisticsManager.sendMeterConfigStatisticsRequest(nodeRef);
+ this.statisticsManager.sendMeterConfigStatisticsRequest(nodeII);
} catch (InterruptedException | ExecutionException e) {
suhLogger.warn("Following exception occured while sending meter statistics request for newly added meter: {}", e);
}
}
if(dataObject instanceof Group){
try {
- this.statisticsManager.sendGroupDescriptionRequest(nodeRef);
+ this.statisticsManager.sendGroupDescriptionRequest(nodeII);
} catch (InterruptedException | ExecutionException e) {
suhLogger.warn("Following exception occured while sending group description request for newly added group: {}", e);
}
InstanceIdentifier<NodeConnector> nodeConnectorII = dataObjectInstance.firstIdentifierOf(NodeConnector.class);
NodeConnectorKey nodeConnectorKey = InstanceIdentifier.keyOf(nodeConnectorII);
try {
- this.statisticsManager.sendQueueStatsFromGivenNodeConnector(nodeRef, nodeConnectorKey.getId(), queue.getQueueId());
+ this.statisticsManager.sendQueueStatsFromGivenNodeConnector(nodeII,
+ nodeConnectorKey.getId(), queue.getQueueId());
} catch (InterruptedException | ExecutionException e) {
suhLogger.warn("Following exception occured while sending queue statistics request for newly added group: {}", e);
}