Search in sources :

Example 11 with TableStatisticsEntry

use of org.onosproject.net.flow.TableStatisticsEntry in project onos by opennetworkinglab.

the class ServerHandshaker method probeReachability.

@Override
public CompletableFuture<Boolean> probeReachability() {
    // Retrieve the device ID from the handler
    DeviceId deviceId = super.getDeviceId();
    checkNotNull(deviceId, MSG_DEVICE_ID_NULL);
    // Probe the driver to ask for flow rule service
    FlowRuleService flowService = getHandler().get(FlowRuleService.class);
    List<TableStatisticsEntry> tableStats = Lists.newArrayList(flowService.getFlowTableStatistics(deviceId));
    // If no statistics fetched, the server is not reachable
    return completedFuture(tableStats.isEmpty() ? false : true);
}
Also used : DeviceId(org.onosproject.net.DeviceId) FlowRuleService(org.onosproject.net.flow.FlowRuleService) TableStatisticsEntry(org.onosproject.net.flow.TableStatisticsEntry)

Example 12 with TableStatisticsEntry

use of org.onosproject.net.flow.TableStatisticsEntry in project onos by opennetworkinglab.

the class OFSwitchManager method getFlowTableStatistics.

@Override
public List<TableStatisticsEntry> getFlowTableStatistics(NetworkId networkId, DeviceId deviceId) {
    FlowRuleService flowRuleService = virtualNetService.get(networkId, FlowRuleService.class);
    Iterable<TableStatisticsEntry> entries = flowRuleService.getFlowTableStatistics(deviceId);
    if (entries == null) {
        entries = new ArrayList<>();
    }
    return Lists.newArrayList(entries);
}
Also used : FlowRuleService(org.onosproject.net.flow.FlowRuleService) TableStatisticsEntry(org.onosproject.net.flow.TableStatisticsEntry)

Aggregations

TableStatisticsEntry (org.onosproject.net.flow.TableStatisticsEntry)12 FlowRuleService (org.onosproject.net.flow.FlowRuleService)5 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 DefaultTableStatisticsEntry (org.onosproject.net.flow.DefaultTableStatisticsEntry)3 FlowEntry (org.onosproject.net.flow.FlowEntry)3 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 Map (java.util.Map)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 NodeId (org.onosproject.cluster.NodeId)2 Device (org.onosproject.net.Device)2 DeviceId (org.onosproject.net.DeviceId)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1