Search in sources :

Example 1 with PortStatisticsDiscovery

use of org.onosproject.net.device.PortStatisticsDiscovery in project onos by opennetworkinglab.

the class NetconfDeviceProvider method updatePortStatistics.

private void updatePortStatistics(Device device) {
    if (device.is(PortStatisticsDiscovery.class)) {
        PortStatisticsDiscovery d = device.as(PortStatisticsDiscovery.class);
        Collection<PortStatistics> portStatistics = d.discoverPortStatistics();
        if (portStatistics != null) {
            providerService.updatePortStatistics(device.id(), portStatistics);
        }
    } else {
        log.debug("No port statistics getter behaviour for device {}", device.id());
    }
}
Also used : PortStatisticsDiscovery(org.onosproject.net.device.PortStatisticsDiscovery) PortStatistics(org.onosproject.net.device.PortStatistics)

Example 2 with PortStatisticsDiscovery

use of org.onosproject.net.device.PortStatisticsDiscovery in project onos by opennetworkinglab.

the class RestDeviceProvider method updatePortStatistics.

private void updatePortStatistics(DeviceId deviceId) {
    Device device = deviceService.getDevice(deviceId);
    checkNotNull(device, "device cannot be null");
    if (device.is(PortStatisticsDiscovery.class)) {
        PortStatisticsDiscovery portStatisticsDiscovery = device.as(PortStatisticsDiscovery.class);
        Collection<PortStatistics> portStatistics = portStatisticsDiscovery.discoverPortStatistics();
        if (portStatistics != null && !portStatistics.isEmpty()) {
            providerService.updatePortStatistics(deviceId, portStatistics);
        }
    } else {
        log.debug("No port statistics getter behaviour for device {}", deviceId);
    }
}
Also used : PortStatisticsDiscovery(org.onosproject.net.device.PortStatisticsDiscovery) RestSBDevice(org.onosproject.protocol.rest.RestSBDevice) DefaultRestSBDevice(org.onosproject.protocol.rest.DefaultRestSBDevice) Device(org.onosproject.net.Device) PortStatistics(org.onosproject.net.device.PortStatistics)

Example 3 with PortStatisticsDiscovery

use of org.onosproject.net.device.PortStatisticsDiscovery in project onos by opennetworkinglab.

the class StatsPoller method updatePortStatistics.

private void updatePortStatistics(DeviceId deviceId) {
    final Device device = deviceService.getDevice(deviceId);
    if (!device.is(PortStatisticsDiscovery.class)) {
        log.error("Missing PortStatisticsDiscovery behaviour for {}", deviceId);
    }
    final Collection<PortStatistics> statistics = device.as(PortStatisticsDiscovery.class).discoverPortStatistics();
    if (!statistics.isEmpty()) {
        providerService.updatePortStatistics(deviceId, statistics);
    }
}
Also used : PortStatisticsDiscovery(org.onosproject.net.device.PortStatisticsDiscovery) Device(org.onosproject.net.Device) PortStatistics(org.onosproject.net.device.PortStatistics)

Aggregations

PortStatistics (org.onosproject.net.device.PortStatistics)3 PortStatisticsDiscovery (org.onosproject.net.device.PortStatisticsDiscovery)3 Device (org.onosproject.net.Device)2 DefaultRestSBDevice (org.onosproject.protocol.rest.DefaultRestSBDevice)1 RestSBDevice (org.onosproject.protocol.rest.RestSBDevice)1