本文整理了Java中org.onlab.util.Bandwidth.mbps()
方法的一些代码示例,展示了Bandwidth.mbps()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bandwidth.mbps()
方法的具体详情如下:
包路径:org.onlab.util.Bandwidth
类名称:Bandwidth
方法名:mbps
[英]Creates a new instance with given bandwidth in Mbps.
[中]创建具有给定带宽(以Mbps为单位)的新实例。
代码示例来源:origin: org.onosproject/onos-core-net
/**
* Query bandwidth capacity on a port.
*
* @param did {@link DeviceId}
* @param number {@link PortNumber}
* @return bandwidth capacity
*/
private Optional<Bandwidth> queryBandwidth(DeviceId did, PortNumber number) {
// Check and use netcfg first.
ConnectPoint cp = new ConnectPoint(did, number);
BandwidthCapacity config = netcfgService.getConfig(cp, BandwidthCapacity.class);
if (config != null) {
log.trace("Registering configured bandwidth {} for {}/{}", config.capacity(), did, number);
return Optional.of(config.capacity());
}
// populate bandwidth value, assuming portSpeed == bandwidth
Port port = deviceService.getPort(did, number);
if (port != null) {
return Optional.of(Bandwidth.mbps(port.portSpeed()));
}
return Optional.empty();
}
代码示例来源:origin: org.onosproject/onos-core-trivial
/**
* Returns free resources for a given link obtaining from topology
* information.
*
* @param link the target link
* @return free resources
*/
private synchronized Set<ResourceAllocation> readOriginalFreeResources(Link link) {
Annotations annotations = link.annotations();
Set<ResourceAllocation> allocations = new HashSet<>();
try {
int waves = Integer.parseInt(annotations.value(AnnotationKeys.OPTICAL_WAVES));
for (int i = 1; i <= waves; i++) {
allocations.add(new LambdaResourceAllocation(LambdaResource.valueOf(i)));
}
} catch (NumberFormatException e) {
log.debug("No optical.wave annotation on link %s", link);
}
BandwidthResource bandwidth = DEFAULT_BANDWIDTH;
try {
bandwidth = new BandwidthResource(
Bandwidth.mbps((Double.parseDouble(annotations.value(AnnotationKeys.BANDWIDTH)))));
} catch (NumberFormatException e) {
log.debug("No bandwidth annotation on link %s", link);
}
allocations.add(
new BandwidthResourceAllocation(bandwidth));
return allocations;
}
内容来源于网络,如有侵权,请联系作者删除!