本文整理汇总了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())))
);
}
示例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;
}
示例3: availableResources
import org.onosproject.cpman.ControlResource; //导入方法依赖的package包/类
@Override
public CompletableFuture<Set<String>> availableResources(NodeId nodeId,
ControlResource.Type resourceType) {
return null;
}
示例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);
}