use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project openflowplugin by opendaylight.
the class OpenflowpluginStatsTestCommandProvider method _flowStats.
public void _flowStats(CommandInterpreter ci) {
int flowCount = 0;
int flowStatsCount = 0;
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) {
List<Table> tables = node.getTable();
for (Table table2 : tables) {
TableKey tableKey = table2.getKey();
InstanceIdentifier<Table> tableRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey);
Table table = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, tableRef);
if (table != null) {
if (table.getFlow() != null) {
List<Flow> flows = table.getFlow();
for (Flow flow2 : flows) {
flowCount++;
FlowKey flowKey = flow2.getKey();
InstanceIdentifier<Flow> flowRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
Flow flow = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, flowRef);
if (flow != null) {
FlowStatisticsData data = flow.getAugmentation(FlowStatisticsData.class);
if (null != data) {
flowStatsCount++;
LOG.debug("--------------------------------------------");
ci.print(data);
}
}
}
}
}
}
}
}
if (flowCount == flowStatsCount) {
LOG.debug("flowStats - Success");
} else {
LOG.debug("flowStats - Failed");
LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project openflowplugin by opendaylight.
the class OpenflowpluginStatsTestCommandProvider method _meterStats.
public void _meterStats(CommandInterpreter ci) {
int meterCount = 0;
int meterStatsCount = 0;
NodeMeterStatistics 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.getMeter() != null) {
List<Meter> meters = node.getMeter();
for (Meter meter2 : meters) {
meterCount++;
MeterKey meterKey = meter2.getKey();
InstanceIdentifier<Meter> meterRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Meter.class, meterKey);
Meter meter = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, meterRef);
if (meter != null) {
data = meter.getAugmentation(NodeMeterStatistics.class);
if (null != data) {
meterStatsCount++;
}
}
}
}
}
}
if (meterCount == meterStatsCount) {
LOG.debug("---------------------------meterStats - Success-------------------------------------");
} else {
LOG.debug("----------------------------meterStats - Failed-------------------------------------");
LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project openflowplugin by opendaylight.
the class OpenflowpluginStatsTestCommandProvider method _groupStats.
public void _groupStats(CommandInterpreter ci) {
int groupCount = 0;
int groupStatsCount = 0;
NodeGroupStatistics 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(NodeGroupStatistics.class);
if (null != data) {
groupStatsCount++;
}
}
}
}
}
}
if (groupCount == groupStatsCount) {
LOG.debug("---------------------groupStats - Success-------------------------------");
} else {
LOG.debug("------------------------------groupStats - Failed--------------------------");
LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project openflowplugin by opendaylight.
the class OpenflowpluginStatsTestCommandProvider method _portDescStats.
public void _portDescStats(CommandInterpreter ci) {
int nodeConnectorCount = 0;
int nodeConnectorDescStatsCount = 0;
List<Node> nodes = getNodes();
for (Node node2 : nodes) {
NodeKey nodeKey = node2.getKey();
InstanceIdentifier<Node> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
Node node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
if (node != null) {
if (node.getNodeConnector() != null) {
List<NodeConnector> ports = node.getNodeConnector();
for (NodeConnector nodeConnector2 : ports) {
nodeConnectorCount++;
NodeConnectorKey nodeConnectorKey = nodeConnector2.getKey();
InstanceIdentifier<FlowCapableNodeConnector> connectorRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).augmentation(FlowCapableNodeConnector.class);
FlowCapableNodeConnector nodeConnector = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, connectorRef);
if (nodeConnector != null) {
if (null != nodeConnector.getName() && null != nodeConnector.getCurrentFeature() && null != nodeConnector.getState() && null != nodeConnector.getHardwareAddress() && null != nodeConnector.getPortNumber()) {
nodeConnectorDescStatsCount++;
}
}
}
}
}
}
if (nodeConnectorCount == nodeConnectorDescStatsCount) {
LOG.debug("portDescStats - Success");
} else {
LOG.debug("portDescStats - Failed");
LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project openflowplugin by opendaylight.
the class GroupDescStatsResponseConvertorTest method test.
/**
* Test empty GroupDescStats conversion.
*/
@Test
public void test() {
List<GroupDesc> groupDescStats = new ArrayList<>();
VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
List<GroupDescStats> statsList = convert(groupDescStats, data);
Assert.assertEquals("Wrong groupDesc stats size", 0, statsList.size());
}
Aggregations