Search in sources :

Example 11 with QosPolicy

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy in project netvirt by opendaylight.

the class QosAlertPortData method calculateAlertCondition.

private void calculateAlertCondition(NodeConnectorStatisticsAndPortNumberMap statsData) {
    BigInteger rxDiff = statsData.getPackets().getReceived().subtract(rxPackets);
    BigInteger rxDroppedDiff = statsData.getReceiveDrops().subtract(rxDroppedPackets);
    BigInteger rxTotalDiff = rxDiff.add(rxDroppedDiff);
    LOG.trace("Port {} rxDiff:{} rxDropped diff:{} total diff:{}", port.getUuid(), rxDiff, rxDroppedDiff, rxTotalDiff);
    QosPolicy qosPolicy = qosNeutronUtils.getQosPolicy(port);
    if (qosPolicy == null) {
        return;
    }
    if (rxDroppedDiff.multiply(BIG_HUNDRED).compareTo(rxTotalDiff.multiply(alertThreshold.get())) > 0) {
        LOG.trace(QosConstants.ALERT_MSG_FORMAT, qosPolicy.getName(), qosPolicy.getUuid().getValue(), port.getUuid().getValue(), port.getNetworkId().getValue(), statsData.getPackets().getReceived(), statsData.getReceiveDrops());
        QosAlertGenerator.raiseAlert(qosPolicy.getName(), qosPolicy.getUuid().getValue(), port.getUuid().getValue(), port.getNetworkId().getValue(), statsData.getPackets().getReceived(), statsData.getReceiveDrops());
    }
}
Also used : BigInteger(java.math.BigInteger) QosPolicy(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)

Aggregations

QosPolicy (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)11 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)7 ArrayList (java.util.ArrayList)7 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)7 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)6 QosNetworkExtension (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension)4 QosPortExtension (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension)4 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)3 BandwidthLimitRulesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.BandwidthLimitRulesBuilder)3 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)2 BigInteger (java.math.BigInteger)1 Nullable (javax.annotation.Nullable)1