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


Java Link.Type方法代码示例

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


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

示例1: translate

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Translates gRPC message to corresponding ONOS object.
 *
 * @param type gRPC message enum
 * @return {@link org.onosproject.net.Link.Type Link.Type}
 */
private Link.Type translate(LinkType type) {
    switch (type) {
    case DIRECT:
        return Link.Type.DIRECT;
    case EDGE:
        return Link.Type.EDGE;
    case INDIRECT:
        return Link.Type.INDIRECT;
    case OPTICAL:
        return Link.Type.INDIRECT;
    case TUNNEL:
        return Link.Type.TUNNEL;
    case VIRTUAL:
        return Link.Type.VIRTUAL;

    case UNRECOGNIZED:
    default:
        return Link.Type.DIRECT;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:LinkProviderServiceServerProxy.java

示例2: combine

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Generates a LinkDescription containing fields from a LinkDescription and
 * a LinkConfig.
 *
 * @param cfg the link config entity from network config
 * @param descr a LinkDescription
 * @return LinkDescription based on both sources
 */
public static LinkDescription combine(BasicLinkConfig cfg, LinkDescription descr) {
    if (cfg == null) {
        return descr;
    }

    // cfg.type() defaults to DIRECT, so there is a risk of unwanted override.
    // do we want this behavior?
    Link.Type type = descr.type();
    if (cfg.type() != type) {
        type = cfg.type();
    }

    SparseAnnotations sa = combine(cfg, descr.annotations());
    return new DefaultLinkDescription(descr.src(), descr.dst(), type, sa);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:BasicLinkOperator.java

示例3: decodeLinkTypeConstraint

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Decodes a link type constraint.
 *
 * @return link type constraint object.
 */
private Constraint decodeLinkTypeConstraint() {
    boolean inclusive = nullIsIllegal(json.get(ConstraintCodec.INCLUSIVE),
            ConstraintCodec.INCLUSIVE + ConstraintCodec.MISSING_MEMBER_MESSAGE).asBoolean();

    JsonNode types = nullIsIllegal(json.get(ConstraintCodec.TYPES),
            ConstraintCodec.TYPES + ConstraintCodec.MISSING_MEMBER_MESSAGE);
    if (types.size() < 1) {
        throw new IllegalArgumentException(
                "types array in link constraint must have at least one value");
    }

    ArrayList<Link.Type> typesEntries = new ArrayList<>(types.size());
    IntStream.range(0, types.size())
            .forEach(index ->
                    typesEntries.add(Link.Type.valueOf(types.get(index).asText())));

    return new LinkTypeConstraint(inclusive,
            typesEntries.toArray(new Link.Type[types.size()]));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:DecodeConstraintCodecHelper.java

示例4: encodeLinkTypeConstraint

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Encodes a link type constraint.
 *
 * @return JSON ObjectNode representing the constraint
 */
private ObjectNode encodeLinkTypeConstraint() {
    checkNotNull(constraint, "Link type constraint cannot be null");

    final LinkTypeConstraint linkTypeConstraint =
            (LinkTypeConstraint) constraint;

    final ObjectNode result = context.mapper().createObjectNode()
            .put(ConstraintCodec.INCLUSIVE, linkTypeConstraint.isInclusive());

    final ArrayNode jsonTypes = result.putArray(ConstraintCodec.TYPES);

    if (linkTypeConstraint.types() != null) {
        for (Link.Type type : linkTypeConstraint.types()) {
            jsonTypes.add(type.name());
        }
    }

    return result;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:EncodeConstraintCodecHelper.java

示例5: matchLinkTypeConstraint

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Matches a link type constraint against a JSON representation of the
 * constraint.
 *
 * @param linkTypeConstraint constraint object to match
 * @param constraintJson JSON representation of the constraint
 * @return true if the constraint and JSON match, false otherwise.
 */
private boolean matchLinkTypeConstraint(LinkTypeConstraint linkTypeConstraint,
                                        JsonNode constraintJson) {
    final JsonNode inclusiveJson = constraintJson.get("inclusive");
    final JsonNode typesJson = constraintJson.get("types");

    if (typesJson.size() != linkTypeConstraint.types().size()) {
        return false;
    }

    int foundType = 0;
    for (Link.Type type : linkTypeConstraint.types()) {
        for (int jsonIndex = 0; jsonIndex < typesJson.size(); jsonIndex++) {
            if (type.name().equals(typesJson.get(jsonIndex).asText())) {
                foundType++;
                break;
            }
        }
    }
    return (inclusiveJson != null &&
            inclusiveJson.asBoolean() == linkTypeConstraint.isInclusive()) &&
            foundType == typesJson.size();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:IntentJsonMatcher.java

示例6: DefaultLinkDescription

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Creates a link description using the supplied information.
 *
 * @param src         link source
 * @param dst         link destination
 * @param type        link type
 * @param isExpected  is the link expected to be part of this configuration
 * @param annotations optional key/value annotations
 */
public DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
                              Link.Type type,
                              boolean isExpected,
                              SparseAnnotations... annotations) {
    super(annotations);
    this.src = src;
    this.dst = dst;
    this.type = type;
    this.isExpected = isExpected;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:DefaultLinkDescription.java

示例7: addLink

import org.onosproject.net.Link; //导入方法依赖的package包/类
private Link addLink(DeviceId sd, PortNumber sp, DeviceId dd, PortNumber dp,
                     Link.Type type) {
    providerService.linkDetected(new DefaultLinkDescription(cp(sd, sp), cp(dd, dp), type));
    Link link = listener.events.get(0).subject();
    validateEvents(LINK_ADDED);
    return link;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:LinkManagerTest.java

示例8: type

import org.onosproject.net.Link; //导入方法依赖的package包/类
@Override
public Link.Type type() {
    return type;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:DefaultLinkDescription.java

示例9: LinkTypeConstraint

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Creates a new constraint for requesting connectivity using or avoiding
 * the specified link types.
 *
 * @param inclusive indicates whether the given link types are to be
 *                  permitted or avoided
 * @param types     link types
 */
public LinkTypeConstraint(boolean inclusive, Link.Type... types) {
    checkNotNull(types, "Link types cannot be null");
    checkArgument(types.length > 0, "There must be more than one type");
    this.types = ImmutableSet.copyOf(types);
    this.isInclusive = inclusive;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:LinkTypeConstraint.java

示例10: type

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Returns the link type.
 *
 * @return link type
 */
Link.Type type();
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:LinkDescription.java

示例11: types

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Returns the set of link types.
 *
 * @return set of link types
 */
public Set<Link.Type> types() {
    return types;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:LinkTypeConstraint.java

示例12: type

import org.onosproject.net.Link; //导入方法依赖的package包/类
/**
 * Returns the link type.
 *
 * @return link type override
 */
public Link.Type type() {
    return get(TYPE, Link.Type.DIRECT, Link.Type.class);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:BasicLinkConfig.java


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