當前位置: 首頁>>代碼示例>>Java>>正文


Java TableStatisticsEntry類代碼示例

本文整理匯總了Java中org.onosproject.net.flow.TableStatisticsEntry的典型用法代碼示例。如果您正苦於以下問題:Java TableStatisticsEntry類的具體用法?Java TableStatisticsEntry怎麽用?Java TableStatisticsEntry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TableStatisticsEntry類屬於org.onosproject.net.flow包,在下文中一共展示了TableStatisticsEntry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTableStatistics

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
/**
 * Gets table statistics for all tables of all devices.
 *
 * @onos.rsModel StatisticsFlowsTables
 * @return 200 OK with JSON encoded array of table statistics
 */
@GET
@Path("flows/tables")
@Produces(MediaType.APPLICATION_JSON)
public Response getTableStatistics() {
    final FlowRuleService service = get(FlowRuleService.class);
    final Iterable<Device> devices = get(DeviceService.class).getDevices();
    final ObjectNode root = mapper().createObjectNode();
    final ArrayNode rootArrayNode = root.putArray("statistics");
    for (final Device device : devices) {
        final ObjectNode deviceStatsNode = mapper().createObjectNode();
        deviceStatsNode.put("device", device.id().toString());
        final ArrayNode statisticsNode = deviceStatsNode.putArray("table");
        final Iterable<TableStatisticsEntry> tableStatsEntries = service.getFlowTableStatistics(device.id());
        if (tableStatsEntries != null) {
            for (final TableStatisticsEntry entry : tableStatsEntries) {
                statisticsNode.add(codec(TableStatisticsEntry.class).encode(entry, this));
            }
        }
        rootArrayNode.add(deviceStatsNode);
    }

    return ok(root).build();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:30,代碼來源:StatisticsWebResource.java

示例2: getTableStatisticsByDeviceId

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
/**
 * Gets table statistics for all tables of a specified device.
 *
 * @onos.rsModel StatisticsFlowsTables
 * @param deviceId device ID
 * @return 200 OK with JSON encoded array of table statistics
 */
@GET
@Path("flows/tables/{deviceId}")
@Produces(MediaType.APPLICATION_JSON)
public Response getTableStatisticsByDeviceId(@PathParam("deviceId") String deviceId) {
    final FlowRuleService service = get(FlowRuleService.class);
    final Iterable<TableStatisticsEntry> tableStatisticsEntries =
            service.getFlowTableStatistics(DeviceId.deviceId(deviceId));
    final ObjectNode root = mapper().createObjectNode();
    final ArrayNode rootArrayNode = root.putArray("statistics");

    final ObjectNode deviceStatsNode = mapper().createObjectNode();
    deviceStatsNode.put("device", deviceId);
    final ArrayNode statisticsNode = deviceStatsNode.putArray("table");
    for (final TableStatisticsEntry entry : tableStatisticsEntries) {
        statisticsNode.add(codec(TableStatisticsEntry.class).encode(entry, this));
    }
    rootArrayNode.add(deviceStatsNode);
    return ok(root).build();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:27,代碼來源:StatisticsWebResource.java

示例3: getTableStatistics

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Override
public Iterable<TableStatisticsEntry> getTableStatistics(NetworkId networkId, DeviceId deviceId) {
    MastershipService mastershipService =
            vnaService.get(networkId, MastershipService.class);
    NodeId master = mastershipService.getMasterFor(deviceId);

    if (master == null) {
        log.debug("Failed to getTableStats: No master for {}", deviceId);
        return Collections.emptyList();
    }

    if (deviceTableStats.get(networkId) == null) {
        deviceTableStats.put(networkId, Maps.newConcurrentMap());
    }

    List<TableStatisticsEntry> tableStats = deviceTableStats.get(networkId).get(deviceId);
    if (tableStats == null) {
        return Collections.emptyList();
    }
    return ImmutableList.copyOf(tableStats);
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:22,代碼來源:DistributedVirtualFlowRuleStore.java

示例4: pushTableStatistics

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
private void pushTableStatistics(Dpid dpid, OFTableStatsReply replies) {

            DeviceId did = DeviceId.deviceId(Dpid.uri(dpid));
            List<TableStatisticsEntry> tableStatsEntries = replies.getEntries().stream()
                    .map(entry -> buildTableStatistics(did, entry))
                    .filter(Objects::nonNull)
                    .collect(Collectors.toList());
            providerService.pushTableStatistics(did, tableStatsEntries);
        }
 
開發者ID:shlee89,項目名稱:athena,代碼行數:10,代碼來源:OpenFlowRuleProvider.java

示例5: execute

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Override
protected void execute() {
    FlowRuleService flowService = get(FlowRuleService.class);
    DeviceService deviceService = get(DeviceService.class);

    SortedMap<Device, List<TableStatisticsEntry>> deviceTableStats =
            getSortedTableStats(deviceService, flowService);

    if (outputJson()) {
        print("%s", json(deviceTableStats.keySet(), deviceTableStats));
    } else {
        deviceTableStats.forEach((device, tableStats) -> printTableStats(device, tableStats));
    }
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:15,代碼來源:TableStatisticsCommand.java

示例6: json

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
/**
 * Produces a JSON array of table statistics grouped by the each device.
 *
 * @param devices     collection of devices
 * @param deviceTableStats collection of table statistics per each device
 * @return JSON array
 */
private JsonNode json(Iterable<Device> devices,
                      Map<Device, List<TableStatisticsEntry>> deviceTableStats) {
    ObjectMapper mapper = new ObjectMapper();
    ArrayNode result = mapper.createArrayNode();
    for (Device device : devices) {
        result.add(json(mapper, device, deviceTableStats.get(device)));
    }
    return result;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:17,代碼來源:TableStatisticsCommand.java

示例7: printTableStats

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
/**
 * Prints flow table statistics.
 *
 * @param d     the device
 * @param tableStats the set of flow table statistics for that device
 */
protected void printTableStats(Device d,
                               List<TableStatisticsEntry> tableStats) {
    boolean empty = tableStats == null || tableStats.isEmpty();
    print("deviceId=%s, tableCount=%d", d.id(), empty ? 0 : tableStats.size());
    if (!empty) {
        for (TableStatisticsEntry t : tableStats) {
            print(FORMAT, t.tableId(), t.activeFlowEntries(),
                  t.packetsLookedup(), t.packetsMatched());
        }
    }
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:18,代碼來源:TableStatisticsCommand.java

示例8: getSortedTableStats

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
/**
 * Returns the list of table statistics sorted using the device ID URIs and table IDs.
 *
 * @param deviceService device service
 * @param flowService flow rule service
 * @return sorted table statistics list
 */
protected SortedMap<Device, List<TableStatisticsEntry>> getSortedTableStats(DeviceService deviceService,
                                                      FlowRuleService flowService) {
    SortedMap<Device, List<TableStatisticsEntry>> deviceTableStats = new TreeMap<>(Comparators.ELEMENT_COMPARATOR);
    List<TableStatisticsEntry> tableStatsList;
    Iterable<Device> devices = uri == null ? deviceService.getDevices() :
            Collections.singletonList(deviceService.getDevice(DeviceId.deviceId(uri)));
    for (Device d : devices) {
        tableStatsList = newArrayList(flowService.getFlowTableStatistics(d.id()));
        tableStatsList.sort((p1, p2) -> Integer.valueOf(p1.tableId()).compareTo(Integer.valueOf(p2.tableId())));
        deviceTableStats.put(d, tableStatsList);
    }
    return deviceTableStats;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:21,代碼來源:TableStatisticsCommand.java

示例9: encode

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Override
public ObjectNode encode(TableStatisticsEntry entry, CodecContext context) {
    checkNotNull(entry, "Table Statistics entry cannot be null");

    final ObjectNode result = context.mapper().createObjectNode()
            .put("tableId", entry.tableId())
            .put("deviceId", entry.deviceId().toString())
            .put("activeEntries", entry.activeFlowEntries())
            .put("packetsLookedUp", entry.packetsLookedup())
            .put("packetsMatched", entry.packetsMatched());

    return result;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:14,代碼來源:TableStatisticsEntryCodec.java

示例10: getTableStatistics

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Override
public Iterable<TableStatisticsEntry> getTableStatistics(DeviceId deviceId) {
    List<TableStatisticsEntry> tableStats = deviceTableStats.get(deviceId);
    if (tableStats == null) {
        return Collections.emptyList();
    }
    return ImmutableList.copyOf(tableStats);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:9,代碼來源:SimpleFlowRuleStore.java

示例11: activate

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Activate
public void activate(ComponentContext context) {
    configService.registerProperties(getClass());

    idGenerator = coreService.getIdGenerator(FlowRuleService.FLOW_OP_TOPIC);

    local = clusterService.getLocalNode().id();

    eventHandler = Executors.newSingleThreadExecutor(
            groupedThreads("onos/flow", "event-handler", log));
    messageHandlingExecutor = Executors.newFixedThreadPool(
            msgHandlerPoolSize, groupedThreads("onos/store/flow", "message-handlers", log));

    registerMessageHandlers(messageHandlingExecutor);

    if (backupEnabled) {
        replicaInfoManager.addListener(flowTable);
        backupTask = backupSenderExecutor.scheduleWithFixedDelay(
                flowTable::backup,
                0,
                backupPeriod,
                TimeUnit.MILLISECONDS);
    }

    deviceTableStats = storageService.<DeviceId, List<TableStatisticsEntry>>eventuallyConsistentMapBuilder()
            .withName("onos-flow-table-stats")
            .withSerializer(SERIALIZER_BUILDER)
            .withAntiEntropyPeriod(5, TimeUnit.SECONDS)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .withTombstonesDisabled()
            .build();
    deviceTableStats.addListener(tableStatsListener);

    logConfig("Started");
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:36,代碼來源:DistributedFlowRuleStore.java

示例12: getTableStatistics

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Override
public Iterable<TableStatisticsEntry> getTableStatistics(DeviceId deviceId) {
    NodeId master = mastershipService.getMasterFor(deviceId);

    if (master == null) {
        log.debug("Failed to getTableStats: No master for {}", deviceId);
        return Collections.emptyList();
    }

    List<TableStatisticsEntry> tableStats = deviceTableStats.get(deviceId);
    if (tableStats == null) {
        return Collections.emptyList();
    }
    return ImmutableList.copyOf(tableStats);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:16,代碼來源:DistributedFlowRuleStore.java

示例13: activate

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Activate
public void activate(ComponentContext context) {
    configService.registerProperties(getClass());

    idGenerator = coreService.getIdGenerator(FLOW_OP_TOPIC);

    local = clusterService.getLocalNode().id();

    eventHandler = Executors.newSingleThreadExecutor(
            groupedThreads("onos/virtual-flow", "event-handler", log));
    messageHandlingExecutor = Executors.newFixedThreadPool(
            msgHandlerPoolSize, groupedThreads("onos/store/virtual-flow", "message-handlers", log));

    registerMessageHandlers(messageHandlingExecutor);

    deviceTableStats = storageService
            .<NetworkId, Map<DeviceId, List<TableStatisticsEntry>>>eventuallyConsistentMapBuilder()
            .withName("onos-virtual-flow-table-stats")
            .withSerializer(serializerBuilder)
            .withAntiEntropyPeriod(5, TimeUnit.SECONDS)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .withTombstonesDisabled()
            .build();
    deviceTableStats.addListener(tableStatsListener);

    logConfig("Started");
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:28,代碼來源:DistributedVirtualFlowRuleStore.java

示例14: updateTableStatistics

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
@Override
public FlowRuleEvent updateTableStatistics(NetworkId networkId,
                                           DeviceId deviceId,
                                           List<TableStatisticsEntry> tableStats) {
    if (deviceTableStats.get(networkId) == null) {
        deviceTableStats.put(networkId, Maps.newConcurrentMap());
    }
    deviceTableStats.get(networkId).put(deviceId, tableStats);
    return null;
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:11,代碼來源:DistributedVirtualFlowRuleStore.java

示例15: ofFlowTableStatsEntry

import org.onosproject.net.flow.TableStatisticsEntry; //導入依賴的package包/類
private OFTableStatsEntry ofFlowTableStatsEntry(TableStatisticsEntry tableStatisticsEntry) {
    OFTableStatsEntry ofTableStatsEntry = FACTORY.buildTableStatsEntry()
            .setTableId(TableId.of(tableStatisticsEntry.tableId()))
            .setActiveCount(tableStatisticsEntry.activeFlowEntries())
            .setLookupCount(U64.of(tableStatisticsEntry.packetsLookedup()))
            .setMatchedCount(U64.of(tableStatisticsEntry.packetsLookedup()))
            .build();
    return ofTableStatsEntry;
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:10,代碼來源:DefaultOFSwitch.java


注:本文中的org.onosproject.net.flow.TableStatisticsEntry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。