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 OpendaylightFlowTableStatisticsServiceImpl method buildRequest.
@Override
protected OfHeader buildRequest(final Xid xid, final GetFlowTablesStatisticsInput input) throws ServiceException {
// Create multipart request body for fetch all the group stats
final MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
final MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
multipartRequestTableBuilder.setEmpty(true);
multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
// Set request body to main multipart request
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPTABLE, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
return mprInput.build();
}
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 TestFlowHelper method createFlowAndStatisticsMapListBuilder.
/**
* Creates flow and statistics builder.
* @param index data seed
* @return flow stats builder with dummy content
*/
protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int index) {
FlowAndStatisticsMapListBuilder flowAndStatisticsMapListBuilder = new FlowAndStatisticsMapListBuilder();
flowAndStatisticsMapListBuilder.setPriority(index);
flowAndStatisticsMapListBuilder.setTableId((short) index);
flowAndStatisticsMapListBuilder.setCookie(new FlowCookie(BigInteger.TEN));
EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + index);
ethernetSourceBuilder.setAddress(macAddress);
ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build());
EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + index + ":00:00"));
ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());
MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
return flowAndStatisticsMapListBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project lispflowmapping by opendaylight.
the class LispSouthboundRpcTest method getStatsTest.
/**
* Tests {@link LispSouthboundRPC#getStats} method.
*/
@Test
public void getStatsTest() throws ExecutionException, InterruptedException {
final ConcurrentLispSouthboundStats stats = new ConcurrentLispSouthboundStats();
incrementAll(stats);
Mockito.when(lispSouthboundPlugin.getStats()).thenReturn(stats);
// result
final ControlMessageStats resultStats = lispSouthboundRPC.getStats().get().getResult().getControlMessageStats();
assertEquals(stats.getRx()[0], (long) resultStats.getControlMessage().get(0).getRxCount());
assertEquals(stats.getRx()[1], (long) resultStats.getControlMessage().get(1).getRxCount());
assertEquals(stats.getRx()[2], (long) resultStats.getControlMessage().get(2).getRxCount());
assertEquals(stats.getRx()[3], (long) resultStats.getControlMessage().get(3).getRxCount());
assertEquals(stats.getRx()[4], (long) resultStats.getControlMessage().get(4).getRxCount());
assertEquals(stats.getRx()[6], (long) resultStats.getControlMessage().get(5).getRxCount());
assertEquals(stats.getRx()[7], (long) resultStats.getControlMessage().get(6).getRxCount());
assertEquals(stats.getRx()[8], (long) resultStats.getControlMessage().get(7).getRxCount());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project netvirt by opendaylight.
the class QosAlertManager method pollDirectStatisticsForAllNodes.
private void pollDirectStatisticsForAllNodes() {
LOG.trace("Polling direct statistics from nodes");
for (Entry<Uint64, ConcurrentMap<String, QosAlertPortData>> entry : qosAlertDpnPortNumberMap.entrySet()) {
Uint64 dpn = entry.getKey();
LOG.trace("Polling DPN ID {}", dpn);
GetNodeConnectorStatisticsInputBuilder input = new GetNodeConnectorStatisticsInputBuilder().setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(IfmConstants.OF_URI_PREFIX + dpn))).build())).setStoreStats(false);
Future<RpcResult<GetNodeConnectorStatisticsOutput>> rpcResultFuture = odlDirectStatisticsService.getNodeConnectorStatistics(input.build());
RpcResult<GetNodeConnectorStatisticsOutput> rpcResult = null;
try {
rpcResult = rpcResultFuture.get();
} catch (InterruptedException | ExecutionException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Could not get Direct-Statistics for node {} Exception occurred ", dpn, e);
} else {
LOG.info("Could not get Direct-Statistics for node {}", dpn);
}
}
if (rpcResult != null && rpcResult.isSuccessful() && rpcResult.getResult() != null) {
GetNodeConnectorStatisticsOutput nodeConnectorStatisticsOutput = rpcResult.getResult();
Map<NodeConnectorStatisticsAndPortNumberMapKey, NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMap = nodeConnectorStatisticsOutput.nonnullNodeConnectorStatisticsAndPortNumberMap();
ConcurrentMap<String, QosAlertPortData> portDataMap = entry.getValue();
for (NodeConnectorStatisticsAndPortNumberMap stats : nodeConnectorStatisticsAndPortNumberMap.values()) {
QosAlertPortData portData = portDataMap.get(stats.getNodeConnectorId().getValue());
if (portData != null) {
portData.updatePortStatistics(stats);
}
}
} else {
LOG.info("Direct-Statistics not available for node {}", dpn);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project netvirt by opendaylight.
the class AclLiveStatisticsHelper method getAclDropStats.
/**
* Gets the acl drop stats.
*
* @param direction the direction
* @param aclStatsBuilder the acl stats builder
* @param flowStatsOutput the flow stats output
*/
private static void getAclDropStats(Direction direction, AclPortStatsBuilder aclStatsBuilder, GetFlowStatisticsOutput flowStatsOutput) {
List<FlowAndStatisticsMapList> flowAndStatisticsMapList = flowStatsOutput.getFlowAndStatisticsMapList();
if (flowAndStatisticsMapList == null || flowAndStatisticsMapList.isEmpty()) {
String errMsg = "Unable to retrieve drop counts as interface is not configured for statistics collection.";
aclStatsBuilder.setError(new ErrorBuilder().setErrorMessage(errMsg).build());
return;
}
BytesBuilder portEgressBytesBuilder = new BytesBuilder();
BytesBuilder portIngressBytesBuilder = new BytesBuilder();
PacketsBuilder portEgressPacketsBuilder = new PacketsBuilder();
PacketsBuilder portIngressPacketsBuilder = new PacketsBuilder();
for (FlowAndStatisticsMapList flowStats : flowAndStatisticsMapList) {
switch(flowStats.getTableId().toJava()) {
case NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE:
if (AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY.equals(flowStats.getPriority().toJava())) {
portEgressBytesBuilder.setInvalidDropCount(flowStats.getByteCount().getValue());
portEgressPacketsBuilder.setInvalidDropCount(flowStats.getPacketCount().getValue());
} else if (AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY.equals(flowStats.getPriority().toJava()) || AclConstants.ACE_LAST_REMOTE_ACL_PRIORITY.equals(flowStats.getPriority().toJava())) {
BigInteger portEgressBytesBuilderDropCount = BigInteger.valueOf(0);
BigInteger portEgressPacketsBuilderDropCount = BigInteger.valueOf(0);
if (portEgressBytesBuilder.getDropCount() != null) {
portEgressBytesBuilderDropCount = portEgressBytesBuilder.getDropCount().toJava().add(flowStats.getByteCount().getValue().toJava());
portEgressPacketsBuilderDropCount = portEgressPacketsBuilder.getDropCount().toJava().add(flowStats.getPacketCount().getValue().toJava());
} else {
portEgressBytesBuilderDropCount = flowStats.getByteCount().getValue().toJava();
portEgressPacketsBuilderDropCount = flowStats.getPacketCount().getValue().toJava();
}
portEgressBytesBuilder.setDropCount(portEgressBytesBuilderDropCount);
portEgressPacketsBuilder.setDropCount(portEgressPacketsBuilderDropCount);
}
// TODO: Update stats for other drops
break;
case NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE:
if (AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY.equals(flowStats.getPriority().toJava())) {
portIngressBytesBuilder.setInvalidDropCount(flowStats.getByteCount().getValue());
portIngressPacketsBuilder.setInvalidDropCount(flowStats.getPacketCount().getValue());
} else if (AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY.equals(flowStats.getPriority().toJava()) || AclConstants.ACE_LAST_REMOTE_ACL_PRIORITY.equals(flowStats.getPriority().toJava())) {
BigInteger portIngressBytesBuilderDropCount = BigInteger.valueOf(0);
BigInteger portIngressPacketsBuilderDropCount = BigInteger.valueOf(0);
if (portIngressBytesBuilder.getDropCount() != null) {
portIngressBytesBuilderDropCount = portIngressBytesBuilder.getDropCount().toJava().add(flowStats.getByteCount().getValue().toJava());
portIngressPacketsBuilderDropCount = portIngressPacketsBuilder.getDropCount().toJava().add(flowStats.getPacketCount().getValue().toJava());
} else {
portIngressBytesBuilderDropCount = flowStats.getByteCount().getValue().toJava();
portIngressPacketsBuilderDropCount = flowStats.getPacketCount().getValue().toJava();
}
portIngressBytesBuilder.setDropCount(portIngressBytesBuilderDropCount);
portIngressPacketsBuilder.setDropCount(portIngressPacketsBuilderDropCount);
}
// TODO: Update stats for other drops
break;
case NwConstants.INGRESS_ACL_COMMITTER_TABLE:
if (AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY.equals(flowStats.getPriority().toJava())) {
portEgressBytesBuilder.setAntiSpoofDropCount(flowStats.getByteCount().getValue());
portEgressPacketsBuilder.setAntiSpoofDropCount(flowStats.getPacketCount().getValue());
}
break;
case NwConstants.EGRESS_ACL_COMMITTER_TABLE:
if (AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY.equals(flowStats.getPriority().toJava())) {
portIngressBytesBuilder.setAntiSpoofDropCount(flowStats.getByteCount().getValue());
portIngressPacketsBuilder.setAntiSpoofDropCount(flowStats.getPacketCount().getValue());
}
break;
default:
LOG.warn("Invalid table ID filtered for Acl flow stats: {}", flowStats);
break;
}
}
List<AclDropStats> lstAclDropStats = new ArrayList<>();
if (direction == Direction.Egress || direction == Direction.Both) {
updateTotalDropCount(portEgressBytesBuilder, portEgressPacketsBuilder);
AclDropStats aclEgressDropStats = new AclDropStatsBuilder().setDirection(Direction.Egress).setBytes(portEgressBytesBuilder.build()).setPackets(portEgressPacketsBuilder.build()).build();
lstAclDropStats.add(aclEgressDropStats);
}
if (direction == Direction.Ingress || direction == Direction.Both) {
updateTotalDropCount(portIngressBytesBuilder, portIngressPacketsBuilder);
AclDropStats aclIngressDropStats = new AclDropStatsBuilder().setDirection(Direction.Ingress).setBytes(portIngressBytesBuilder.build()).setPackets(portIngressPacketsBuilder.build()).build();
lstAclDropStats.add(aclIngressDropStats);
}
aclStatsBuilder.setAclDropStats(lstAclDropStats);
}
Aggregations