本文整理了Java中org.onlab.util.Bandwidth.bps()
方法的一些代码示例,展示了Bandwidth.bps()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bandwidth.bps()
方法的具体详情如下:
包路径:org.onlab.util.Bandwidth
类名称:Bandwidth
方法名:bps
[英]Creates a new instance with given bandwidth in bps.
[中]创建具有给定带宽(bps)的新实例。
代码示例来源:origin: org.onosproject/onlab-misc
/**
* Returns a Bandwidth whose value is (this + value).
*
* @param value value to be added to this Frequency
* @return this + value
*/
default Bandwidth add(Bandwidth value) {
return bps(this.bps() + value.bps());
}
代码示例来源:origin: org.onosproject/onlab-misc
/**
* Returns a Bandwidth whose value is (this - value).
*
* @param value value to be added to this Frequency
* @return this - value
*/
default Bandwidth subtract(Bandwidth value) {
return bps(this.bps() - value.bps());
}
代码示例来源:origin: org.onosproject/onlab-misc
/**
* Returns a Bandwidth whose value is (this + value).
*
* @param value value to be added to this Frequency
* @return this + value
*/
public Bandwidth add(Bandwidth value) {
if (value instanceof LongBandwidth) {
return Bandwidth.bps(this.bps + ((LongBandwidth) value).bps);
}
return Bandwidth.bps(this.bps + value.bps());
}
代码示例来源:origin: org.onosproject/onlab-misc
/**
* Returns a Bandwidth whose value is (this - value).
*
* @param value value to be added to this Frequency
* @return this - value
*/
public Bandwidth subtract(Bandwidth value) {
if (value instanceof LongBandwidth) {
return Bandwidth.bps(this.bps - ((LongBandwidth) value).bps);
}
return Bandwidth.bps(this.bps - value.bps());
}
代码示例来源:origin: org.onosproject/onlab-misc
@Override
default int compareTo(Bandwidth other) {
return ComparisonChain.start()
.compare(this.bps(), other.bps())
.result();
}
}
代码示例来源:origin: org.onosproject/onlab-misc
@Override
public int compareTo(Bandwidth other) {
if (other instanceof LongBandwidth) {
return ComparisonChain.start()
.compare(this.bps, ((LongBandwidth) other).bps)
.result();
}
return ComparisonChain.start()
.compare(this.bps, other.bps())
.result();
}
代码示例来源:origin: org.onosproject/onos-core-common
/**
* Decodes a bandwidth constraint.
*
* @return bandwidth constraint object.
*/
private Constraint decodeBandwidthConstraint() {
double bandwidth = nullIsIllegal(json.get(ConstraintCodec.BANDWIDTH),
ConstraintCodec.BANDWIDTH + ConstraintCodec.MISSING_MEMBER_MESSAGE)
.asDouble();
return new BandwidthConstraint(Bandwidth.bps(bandwidth));
}
代码示例来源:origin: org.onosproject/onos-core-common
/**
* Encodes a bandwidth constraint.
*
* @return JSON ObjectNode representing the constraint
*/
private ObjectNode encodeBandwidthConstraint() {
checkNotNull(constraint, "Bandwidth constraint cannot be null");
final BandwidthConstraint bandwidthConstraint =
(BandwidthConstraint) constraint;
return context.mapper().createObjectNode()
.put("bandwidth", bandwidthConstraint.bandwidth().bps());
}
代码示例来源:origin: org.onosproject/onos-apps-pce-app
@Override
public boolean isValid(Link link, ResourceContext context) {
changedBwValue = requestBwValue;
if (links.contains(link)) {
changedBwValue = requestBwValue.isGreaterThan(sharedBwValue) ? requestBwValue.subtract(sharedBwValue)
: Bandwidth.bps(0);
}
return Stream
.of(link.src(), link.dst())
.map(cp -> Resources.continuous(cp.deviceId(), cp.port(), Bandwidth.class).resource(
changedBwValue.bps())).allMatch(context::isAvailable);
}
代码示例来源:origin: org.onosproject/onos-app-pce
@Override
public boolean isValid(Link link, ResourceContext context) {
changedBwValue = requestBwValue;
if (links.contains(link)) {
changedBwValue = requestBwValue.isGreaterThan(sharedBwValue) ? requestBwValue.subtract(sharedBwValue)
: Bandwidth.bps(0);
}
return Stream
.of(link.src(), link.dst())
.map(cp -> Resources.continuous(cp.deviceId(), cp.port(), Bandwidth.class).resource(
changedBwValue.bps())).allMatch(context::isAvailable);
}
代码示例来源:origin: org.onosproject/onos-protocols-ovsdb-api
/**
* Constructs a builder with a given queue description.
*
* @param queueDescription queue description
*/
private Builder(QueueDescription queueDescription) {
if (queueDescription.maxRate().isPresent()) {
otherConfigs.put(MAX_RATE, String.valueOf((long) queueDescription.maxRate().get().bps()));
}
if (queueDescription.minRate().isPresent()) {
otherConfigs.put(MIN_RATE, String.valueOf((long) queueDescription.minRate().get().bps()));
}
if (queueDescription.burst().isPresent()) {
otherConfigs.put(BURST, queueDescription.burst().get().toString());
}
if (queueDescription.priority().isPresent()) {
otherConfigs.put(PRIORITY, queueDescription.priority().get().toString());
}
if (queueDescription.dscp().isPresent()) {
dscp = Optional.of(queueDescription.dscp().get().longValue());
}
externalIds.putAll(((DefaultAnnotations) queueDescription.annotations()).asMap());
externalIds.put(QUEUE_EXTERNAL_ID_KEY, queueDescription.queueId().name());
}
代码示例来源:origin: org.onosproject/onos-protocols-ovsdb-api
/**
* Constructs a builder with a given Qos description.
*
* @param qosDesc Qos description
*/
private Builder(QosDescription qosDesc) {
if (qosDesc.maxRate().isPresent()) {
otherConfigs.put(MAX_RATE, String.valueOf((long) qosDesc.maxRate().get().bps()));
}
if (qosDesc.cir().isPresent()) {
otherConfigs.put(CIR, qosDesc.cir().get().toString());
}
if (qosDesc.cbs().isPresent()) {
otherConfigs.put(CBS, qosDesc.cbs().get().toString());
}
if (qosDesc.queues().isPresent()) {
Map<Long, String> map = new HashMap<>();
qosDesc.queues().get().forEach((k, v) -> map.put(k, v.queueId().name()));
queues = Optional.ofNullable(map);
}
type = qosDesc.type() == QosDescription.Type.EGRESS_POLICER ?
QOS_EGRESS_POLICER :
QOS_TYPE_PREFIX.concat(qosDesc.type().name().toLowerCase());
externalIds.putAll(((DefaultAnnotations) qosDesc.annotations()).asMap());
externalIds.put(QOS_EXTERNAL_ID_KEY, qosDesc.qosId().name());
}
代码示例来源:origin: org.onosproject/onos-core-trivial
/**
* Finds and returns {@link BandwidthResourceAllocation} object from a given
* set.
*
* @param freeRes a set of ResourceAllocation object.
* @return {@link BandwidthResourceAllocation} object if found, otherwise
* {@link BandwidthResourceAllocation} object with 0 bandwidth
*
*/
private synchronized BandwidthResourceAllocation getBandwidth(
Set<ResourceAllocation> freeRes) {
for (ResourceAllocation res : freeRes) {
if (res.type() == ResourceType.BANDWIDTH) {
return (BandwidthResourceAllocation) res;
}
}
return new BandwidthResourceAllocation(new BandwidthResource(Bandwidth.bps(0)));
}
代码示例来源:origin: org.onosproject/onos-isis-provider-topology
/**
* Builds the annotation details.
*
* @param annotationBuilder default annotation builder instance
* @param isisLink ISIS link instance
* @return annotation builder instance
*/
private DefaultAnnotations.Builder buildAnnotations(DefaultAnnotations.Builder annotationBuilder,
IsisLink isisLink) {
int administrativeGroup = 0;
long teMetric = 0;
Bandwidth maxReservableBandwidth = Bandwidth.bps(0);
String routerId = null;
String neighborId = null;
//TE Info
IsisLinkTed isisLinkTed = isisLink.linkTed();
log.info("Ted Information: {}", isisLinkTed.toString());
administrativeGroup = isisLinkTed.administrativeGroup();
teMetric = isisLinkTed.teDefaultMetric();
maxReservableBandwidth = isisLinkTed.maximumReservableLinkBandwidth();
routerId = isisLink.localSystemId();
neighborId = isisLink.remoteSystemId();
annotationBuilder.set(ADMINISTRATIVEGROUP, String.valueOf(administrativeGroup));
annotationBuilder.set(TE_METRIC, String.valueOf(teMetric));
annotationBuilder.set(MAXRESERVABLEBANDWIDTH, String.valueOf(maxReservableBandwidth));
annotationBuilder.set(ROUTERID, String.valueOf(routerId));
annotationBuilder.set(NEIGHBORID, String.valueOf(neighborId));
return annotationBuilder;
}
代码示例来源:origin: org.onosproject/onos-core-trivial
freeRes.remove(ba);
freeRes.add(new BandwidthResourceAllocation(
new BandwidthResource(Bandwidth.bps(newBandwidth))));
break;
case LAMBDA:
代码示例来源:origin: org.onosproject/onos-protocols-isis-ctl
MaximumBandwidth maxLinkBandwidth = (MaximumBandwidth) teSubTlv;
isisLinkTed.setMaximumLinkBandwidth(
Bandwidth.bps(maxLinkBandwidth.getMaximumBandwidthValue()));
Bandwidth.bps(maxReservableBw.getMaximumBandwidthValue()));
List<Float> unReservedBandwidthList = unReservedBandwidth.unReservedBandwidthValue();
for (Float unReservedBandwidthFloatValue : unReservedBandwidthList) {
Bandwidth bandwidth = Bandwidth.bps(unReservedBandwidthFloatValue);
bandwidthList.add(bandwidth);
代码示例来源:origin: org.onosproject/onos-core-net
private boolean updateRegistration(ConnectPoint cp, BandwidthCapacity bwCapacity) {
// FIXME workaround until replace/update semantics become available
// this potentially blows up existing registration
// or end up as no-op
//
// Current code end up in situation like below:
// PortNumber: 2
// MplsLabel: [[16‥240)]
// VlanId: [[0‥4095)]
// Bandwidth: 2000000.000000
// Bandwidth: 20000000.000000
//
// but both unregisterResources(..) and registerResources(..)
// returns true (success)
if (!adminService.unregister(
Resources.continuous(cp.deviceId(), cp.port(), Bandwidth.class).id())) {
log.warn("unregisterResources for {} failed", cp);
}
return adminService.register(Resources.continuous(cp.deviceId(),
cp.port(),
Bandwidth.class).resource(bwCapacity.capacity().bps()));
}
代码示例来源:origin: org.onosproject/onos-isis-provider-topology
/**
* Registers the bandwidth for source and destination points.
*
* @param linkDes link description instance
* @param isisLink ISIS link instance
*/
private void registerBandwidth(LinkDescription linkDes, IsisLink isisLink) {
if (isisLink == null) {
log.error("Could not able to register bandwidth ");
return;
}
IsisLinkTed isisLinkTed = isisLink.linkTed();
Bandwidth maxReservableBw = isisLinkTed.maximumReservableLinkBandwidth();
if (maxReservableBw != null) {
if (maxReservableBw.compareTo(Bandwidth.bps(0)) == 0) {
return;
}
//Configure bandwidth for src and dst port
BandwidthCapacity config = networkConfigService.addConfig(linkDes.src(), BandwidthCapacity.class);
config.capacity(maxReservableBw).apply();
config = networkConfigService.addConfig(linkDes.dst(), BandwidthCapacity.class);
config.capacity(maxReservableBw).apply();
}
}
}
代码示例来源:origin: org.onosproject/onos-app-pce
BandwidthConstraint localConst = new BandwidthConstraint(Bandwidth.bps(Double.parseDouble(tunnel
.annotations().value(BANDWIDTH))));
constraintList.add(localConst);
代码示例来源:origin: org.onosproject/onos-apps-pce-app
BandwidthConstraint localConst = new BandwidthConstraint(Bandwidth.bps(Double.parseDouble(tunnel
.annotations().value(BANDWIDTH))));
constraintList.add(localConst);
内容来源于网络,如有侵权,请联系作者删除!