本文整理汇总了Java中org.onosproject.net.Link.state方法的典型用法代码示例。如果您正苦于以下问题:Java Link.state方法的具体用法?Java Link.state怎么用?Java Link.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.Link
的用法示例。
在下文中一共展示了Link.state方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeOrDownLink
import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst) {
Link link = getLink(src, dst);
if (link == null) {
return null;
}
if (link.isDurable()) {
return link.state() == INACTIVE ? null :
updateLink(linkKey(link.src(), link.dst()), link,
DefaultLink.builder()
.providerId(link.providerId())
.src(link.src())
.dst(link.dst())
.type(link.type())
.state(INACTIVE)
.isExpected(link.isExpected())
.annotations(link.annotations()).build());
}
return removeLink(src, dst);
}
示例2: removeOrDownLink
import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst) {
Link link = getLink(src, dst);
if (link == null) {
return null;
}
if (linkDiscoveryMode == LinkDiscoveryMode.PERMISSIVE && link.isExpected()) {
// FIXME: this will not sync link state!!!
return link.state() == INACTIVE ? null :
updateLink(linkKey(link.src(), link.dst()), link,
DefaultLink.builder()
.providerId(link.providerId())
.src(link.src())
.dst(link.dst())
.type(link.type())
.state(INACTIVE)
.isExpected(link.isExpected())
.annotations(link.annotations())
.build());
}
return removeLink(src, dst);
}
示例3: weight
import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public double weight(TopologyEdge edge) {
Link l = edge.link();
// Avoid inactive links
if (l.state() == Link.State.INACTIVE) {
return -1.0;
}
// Avoid cross connect links with used ports
if (isCrossConnectLink(l) && usedCrossConnectLinks.contains(l)) {
return -1.0;
}
// Check availability of bandwidth
if (bandwidth != null) {
if (hasEnoughBandwidth(l.src()) && hasEnoughBandwidth(l.dst())) {
return 1.0;
} else {
return -1.0;
}
} else {
// TODO needs to differentiate optical and packet?
if (l.type() == Link.Type.OPTICAL) {
// Transport links
return 1.0;
} else {
// Packet links
return 1.0;
}
}
}
示例4: encode
import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public ObjectNode encode(Link link, CodecContext context) {
checkNotNull(link, "Link cannot be null");
JsonCodec<ConnectPoint> codec = context.codec(ConnectPoint.class);
ObjectNode result = context.mapper().createObjectNode();
result.set(SRC, codec.encode(link.src(), context));
result.set(DST, codec.encode(link.dst(), context));
result.put(TYPE, link.type().toString());
if (link.state() != null) {
result.put(STATE, link.state().toString());
}
return annotate(result, link, context);
}
示例5: updateLink
import org.onosproject.net.Link; //导入方法依赖的package包/类
private LinkEvent updateLink(LinkKey key, Link oldLink, Link newLink) {
if (oldLink.state() != newLink.state() ||
(oldLink.type() == INDIRECT && newLink.type() == DIRECT) ||
!AnnotationsUtil.isEqual(oldLink.annotations(), newLink.annotations())) {
links.put(key, newLink);
// strictly speaking following can be ommitted
srcLinks.put(oldLink.src().deviceId(), key);
dstLinks.put(oldLink.dst().deviceId(), key);
return new LinkEvent(LINK_UPDATED, newLink);
}
return null;
}
示例6: updateLink
import org.onosproject.net.Link; //导入方法依赖的package包/类
private LinkEvent updateLink(LinkKey key, Link oldLink, Link newLink) {
// Note: INDIRECT -> DIRECT transition only
// so that BDDP discovered Link will not overwrite LDDP Link
if (oldLink.state() != newLink.state() ||
(oldLink.type() == INDIRECT && newLink.type() == DIRECT) ||
!AnnotationsUtil.isEqual(oldLink.annotations(), newLink.annotations())) {
links.put(key, newLink);
return new LinkEvent(LINK_UPDATED, newLink);
}
return null;
}