当前位置: 首页>>代码示例>>Java>>正文


Java ControlResource.Type方法代码示例

本文整理汇总了Java中org.onosproject.cpman.ControlResource.Type方法的典型用法代码示例。如果您正苦于以下问题:Java ControlResource.Type方法的具体用法?Java ControlResource.Type怎么用?Java ControlResource.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.cpman.ControlResource的用法示例。


在下文中一共展示了ControlResource.Type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDeviceMetricsMap

import org.onosproject.cpman.ControlResource; //导入方法依赖的package包/类
/**
 * Tests device metrics map update and query.
 */
@Test
public void testDeviceMetricsMap() {
    ControlResource.Type type = ControlResource.Type.CONTROL_MESSAGE;
    DeviceId devId1 = DeviceId.deviceId("of:0000000000000101");
    DeviceId devId2 = DeviceId.deviceId("of:0000000000000102");

    devMetricsMap = Maps.newHashMap();

    Set<DeviceId> devices = ImmutableSet.of(devId1, devId2);
    devices.forEach(dev -> {
        if (!devMetricsMap.containsKey(dev)) {
            devMetricsMap.put(dev, genMDbBuilder(type, ControlResource.CONTROL_MESSAGE_METRICS)
                    .withResourceName(dev.toString())
                    .build());
        }
    });

    Map<String, Double> metrics1 = new HashMap<>();
    ControlResource.CONTROL_MESSAGE_METRICS.forEach(msgType ->
            metrics1.putIfAbsent(msgType.toString(), 10D));

    Map<String, Double> metrics2 = new HashMap<>();
    ControlResource.CONTROL_MESSAGE_METRICS.forEach(msgType ->
            metrics2.putIfAbsent(msgType.toString(), 20D));


    devMetricsMap.get(devId1).updateMetrics(metrics1);
    devMetricsMap.get(devId2).updateMetrics(metrics2);

    ControlResource.CONTROL_MESSAGE_METRICS.forEach(msgType ->
            assertThat(10D, is(devMetricsMap.get(devId1).recentMetric(msgType.toString())))
    );

    ControlResource.CONTROL_MESSAGE_METRICS.forEach(msgType ->
            assertThat(20D, is(devMetricsMap.get(devId2).recentMetric(msgType.toString())))
    );
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:MetricsDatabaseTest.java

示例2: genMDbBuilder

import org.onosproject.cpman.ControlResource; //导入方法依赖的package包/类
private MetricsDatabase.Builder genMDbBuilder(ControlResource.Type resourceType,
                                      Set<ControlMetricType> metricTypes) {
    MetricsDatabase.Builder builder = new DefaultMetricsDatabase.Builder();
    builder.withMetricName(resourceType.toString());
    metricTypes.forEach(type -> builder.addMetricType(type.toString()));
    return builder;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:MetricsDatabaseTest.java

示例3: availableResources

import org.onosproject.cpman.ControlResource; //导入方法依赖的package包/类
@Override
public CompletableFuture<Set<String>> availableResources(NodeId nodeId,
                                                         ControlResource.Type resourceType) {
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:ControlPlaneMonitorServiceAdaptor.java

示例4: createResourceRequest

import org.onosproject.cpman.ControlResource; //导入方法依赖的package包/类
/**
 * Generates a control resource request with given resource type.
 *
 * @param type control resource type
 * @return control resource request instance
 */
private ControlResourceRequest createResourceRequest(ControlResource.Type type) {
    return new ControlResourceRequest(type);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:ControlPlaneMonitor.java


注:本文中的org.onosproject.cpman.ControlResource.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。