Search in sources :

Example 1 with NodeGroupDescStats

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats in project openflowplugin by opendaylight.

the class OpenflowpluginStatsTestCommandProvider method _groupDescStats.

public void _groupDescStats(CommandInterpreter ci) {
    int groupCount = 0;
    int groupDescStatsCount = 0;
    NodeGroupDescStats data = null;
    List<Node> nodes = getNodes();
    for (Node node2 : nodes) {
        NodeKey nodeKey = node2.getKey();
        InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class);
        ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
        FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
        if (node != null) {
            if (node.getGroup() != null) {
                List<Group> groups = node.getGroup();
                for (Group group2 : groups) {
                    groupCount++;
                    GroupKey groupKey = group2.getKey();
                    InstanceIdentifier<Group> groupRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Group.class, groupKey);
                    Group group = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, groupRef);
                    if (group != null) {
                        data = group.getAugmentation(NodeGroupDescStats.class);
                        if (null != data) {
                            groupDescStatsCount++;
                        }
                    }
                }
            }
        }
        if (groupCount == groupDescStatsCount) {
            LOG.debug("---------------------groupDescStats - Success-------------------------------");
        } else {
            LOG.debug("------------------------------groupDescStats - Failed--------------------------");
            LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
        }
    }
}
Also used : Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) NodeGroupDescStats(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) GroupKey(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Aggregations

ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)1 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)1 NodeGroupDescStats (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats)1 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)1 GroupKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey)1 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)1 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)1