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


Java UnSupportedAttribute类代码示例

本文整理汇总了Java中org.onosproject.bgpio.util.UnSupportedAttribute的典型用法代码示例。如果您正苦于以下问题:Java UnSupportedAttribute类的具体用法?Java UnSupportedAttribute怎么用?Java UnSupportedAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: read

import org.onosproject.bgpio.util.UnSupportedAttribute; //导入依赖的package包/类
/**
 * Reads from channelBuffer and parses BGP path attributes.
 *
 * @param cb channelBuffer
 * @return object of BgpPathAttributes
 * @throws BgpParseException while parsing BGP path attributes
 */
public static BgpPathAttributes read(ChannelBuffer cb)
        throws BgpParseException {

    BgpValueType pathAttribute = null;
    List<BgpValueType> pathAttributeList = new LinkedList<>();
    boolean isOrigin = false;
    boolean isAsPath = false;
    boolean isNextHop = false;
    boolean isMpReach = false;
    boolean isMpUnReach = false;
    while (cb.readableBytes() > 0) {
        cb.markReaderIndex();
        byte flags = cb.readByte();
        byte typeCode = cb.readByte();
        cb.resetReaderIndex();
        switch (typeCode) {
        case Origin.ORIGIN_TYPE:
            pathAttribute = Origin.read(cb);
            isOrigin = ((Origin) pathAttribute).isOriginSet();
            break;
        case AsPath.ASPATH_TYPE:
            pathAttribute = AsPath.read(cb);
            isAsPath = ((AsPath) pathAttribute).isaspathSet();
            break;
        case As4Path.AS4PATH_TYPE:
            pathAttribute = As4Path.read(cb);
            break;
        case NextHop.NEXTHOP_TYPE:
            pathAttribute = NextHop.read(cb);
            isNextHop = ((NextHop) pathAttribute).isNextHopSet();
            break;
        case Med.MED_TYPE:
            pathAttribute = Med.read(cb);
            break;
        case LocalPref.LOCAL_PREF_TYPE:
            pathAttribute = LocalPref.read(cb);
            break;
        case MpReachNlri.MPREACHNLRI_TYPE:
            pathAttribute = MpReachNlri.read(cb);
            isMpReach = ((MpReachNlri) pathAttribute).isMpReachNlriSet();
            break;
        case MpUnReachNlri.MPUNREACHNLRI_TYPE:
            pathAttribute = MpUnReachNlri.read(cb);
            isMpUnReach = ((MpUnReachNlri) pathAttribute)
                    .isMpUnReachNlriSet();
            break;
        case LINK_STATE_ATTRIBUTE_TYPE:
            pathAttribute = LinkStateAttributes.read(cb);
            break;
        case EXTENDED_COMMUNITY_TYPE:
            pathAttribute = BgpExtendedCommunity.read(cb);
            break;
        case WideCommunity.TYPE:
            pathAttribute = WideCommunity.read(cb);
            break;
        default:
            //skip bytes for unsupported attribute types
            UnSupportedAttribute.read(cb);
        }
        pathAttributeList.add(pathAttribute);
    }

    checkMandatoryAttr(isOrigin, isAsPath, isNextHop, isMpReach, isMpUnReach);
    //TODO:if mp_reach or mp_unreach not present ignore the packet
    return new BgpPathAttributes(pathAttributeList);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:74,代码来源:BgpPathAttributes.java

示例2: read

import org.onosproject.bgpio.util.UnSupportedAttribute; //导入依赖的package包/类
/**
 * Reads node descriptors Sub-TLVs.
 *
 * @param cb ChannelBuffer
 * @param desLength node descriptor length
 * @param desType local node descriptor or remote node descriptor type
 * @param protocolId protocol ID
 * @return object of NodeDescriptors
 * @throws BgpParseException while parsing node descriptors
 */
public static NodeDescriptors read(ChannelBuffer cb, short desLength, short desType, byte protocolId)
        throws BgpParseException {
    log.debug("Read NodeDescriptor");
    List<BgpValueType> subTlvs = new LinkedList<>();
    BgpValueType tlv = null;

    while (cb.readableBytes() > 0) {
        ChannelBuffer tempBuf = cb.copy();
        short type = cb.readShort();
        short length = cb.readShort();
        if (cb.readableBytes() < length) {
            throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
                    tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
        }
        ChannelBuffer tempCb = cb.readBytes(length);
        switch (type) {
        case AutonomousSystemTlv.TYPE:
            tlv = AutonomousSystemTlv.read(tempCb);
            break;
        case BgpLSIdentifierTlv.TYPE:
            tlv = BgpLSIdentifierTlv.read(tempCb);
            break;
        case AreaIDTlv.TYPE:
            tlv = AreaIDTlv.read(tempCb);
            break;
        case IGP_ROUTERID_TYPE:
            if (protocolId == IS_IS_LEVEL_1_PROTOCOL_ID || protocolId == IS_IS_LEVEL_2_PROTOCOL_ID) {
                boolean isNonPseudoNode = true;
                if ((length == ISISPSEUDONODE_LEN) && (tempCb.getByte(ISISPSEUDONODE_LEN - 1) != 0)) {
                    isNonPseudoNode = false;
                }
                if (isNonPseudoNode) {
                    tlv = IsIsNonPseudonode.read(tempCb);
                } else {
                    tlv = IsIsPseudonode.read(tempCb);
                }
            } else if (protocolId == OSPF_V2_PROTOCOL_ID || protocolId == OSPF_V3_PROTOCOL_ID) {
                if (length == OSPFNONPSEUDONODE_LEN) {
                    tlv = OspfNonPseudonode.read(tempCb);
                } else if (length == OSPFPSEUDONODE_LEN) {
                    tlv = OspfPseudonode.read(tempCb);
                }
            }
            break;
        default:
            UnSupportedAttribute.skipBytes(tempCb, length);
        }
        subTlvs.add(tlv);
    }
    return new NodeDescriptors(subTlvs, desLength, desType);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:62,代码来源:NodeDescriptors.java

示例3: parseLinkDescriptors

import org.onosproject.bgpio.util.UnSupportedAttribute; //导入依赖的package包/类
/**
 * Parses link descriptors.
 *
 * @param cb ChannelBuffer
 * @return list of link descriptors
 * @throws BgpParseException while parsing link descriptors
 */
public static LinkedList<BgpValueType> parseLinkDescriptors(ChannelBuffer cb) throws BgpParseException {
    LinkedList<BgpValueType> linkDescriptor = new LinkedList<>();
    BgpValueType tlv = null;
    int count = 0;

    while (cb.readableBytes() > 0) {
        ChannelBuffer tempBuf = cb.copy();
        short type = cb.readShort();
        short length = cb.readShort();
        if (cb.readableBytes() < length) {
            throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
                    tempBuf.readBytes(cb.readableBytes() + Constants.TYPE_AND_LEN_AS_SHORT));
        }
        ChannelBuffer tempCb = cb.readBytes(length);
        switch (type) {
        case LinkLocalRemoteIdentifiersTlv.TYPE:
            tlv = LinkLocalRemoteIdentifiersTlv.read(tempCb);
            break;
        case IPV4_INTERFACE_ADDRESS_TYPE:
            tlv = IPv4AddressTlv.read(tempCb, IPV4_INTERFACE_ADDRESS_TYPE);
            break;
        case IPV4_NEIGHBOR_ADDRESS_TYPE:
            tlv = IPv4AddressTlv.read(tempCb, IPV4_NEIGHBOR_ADDRESS_TYPE);
            break;
        case IPV6_INTERFACE_ADDRESS_TYPE:
            tlv = IPv6AddressTlv.read(tempCb, IPV6_INTERFACE_ADDRESS_TYPE);
            break;
        case IPV6_NEIGHBOR_ADDRESS_TYPE:
            tlv = IPv6AddressTlv.read(tempCb, IPV6_NEIGHBOR_ADDRESS_TYPE);
            break;
        case BgpAttrNodeMultiTopologyId.ATTRNODE_MULTITOPOLOGY:
            tlv = BgpAttrNodeMultiTopologyId.read(tempCb);
            count = count++;
            //MultiTopologyId TLV cannot repeat more than once
            if (count > 1) {
                //length + 4 implies data contains type, length and value
                throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
                        BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length
                                + Constants.TYPE_AND_LEN_AS_SHORT));
            }
            break;
        default:
            UnSupportedAttribute.skipBytes(tempCb, length);
        }
        linkDescriptor.add(tlv);
    }
    return linkDescriptor;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:56,代码来源:BgpLinkLSIdentifier.java

示例4: parsePrefixDescriptors

import org.onosproject.bgpio.util.UnSupportedAttribute; //导入依赖的package包/类
/**
 * Parse list of prefix descriptors.
 *
 * @param cb ChannelBuffer
 * @return list of prefix descriptors
 * @throws BgpParseException while parsing list of prefix descriptors
 */
public static List<BgpValueType> parsePrefixDescriptors(ChannelBuffer cb) throws BgpParseException {
    LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>();
    BgpValueType tlv = null;
    boolean isIpReachInfo = false;
    ChannelBuffer tempCb;
    int count = 0;

    while (cb.readableBytes() > 0) {
        ChannelBuffer tempBuf = cb.copy();
        short type = cb.readShort();
        short length = cb.readShort();
        if (cb.readableBytes() < length) {
            //length + 4 implies data contains type, length and value
            throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
                    tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
        }
        tempCb = cb.readBytes(length);
        switch (type) {
        case OspfRouteTypeTlv.TYPE:
            tlv = OspfRouteTypeTlv.read(tempCb);
            break;
        case IPReachabilityInformationTlv.TYPE:
            tlv = IPReachabilityInformationTlv.read(tempCb, length);
            isIpReachInfo = true;
            break;
        case BgpAttrNodeMultiTopologyId.ATTRNODE_MULTITOPOLOGY:
            tlv = BgpAttrNodeMultiTopologyId.read(tempCb);
            count = count + 1;
            if (count > 1) {
                //length + 4 implies data contains type, length and value
                throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
                       BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length + TYPE_AND_LEN));
            }
            break;
        default:
            UnSupportedAttribute.skipBytes(tempCb, length);
        }
        prefixDescriptor.add(tlv);
    }

    if (!isIpReachInfo) {
        throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
                null);
    }
    return prefixDescriptor;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:54,代码来源:BgpPrefixLSIdentifier.java

示例5: read

import org.onosproject.bgpio.util.UnSupportedAttribute; //导入依赖的package包/类
/**
 * Reads from channelBuffer and parses BGP path attributes.
 *
 * @param cb channelBuffer
 * @return object of BgpPathAttributes
 * @throws BgpParseException while parsing BGP path attributes
 */
public static BgpPathAttributes read(ChannelBuffer cb)
        throws BgpParseException {

    BgpValueType pathAttribute = null;
    List<BgpValueType> pathAttributeList = new LinkedList<>();
    boolean isOrigin = false;
    boolean isAsPath = false;
    boolean isNextHop = false;
    boolean isMpReach = false;
    boolean isMpUnReach = false;
    while (cb.readableBytes() > 0) {
        cb.markReaderIndex();
        byte flags = cb.readByte();
        byte typeCode = cb.readByte();
        cb.resetReaderIndex();
        switch (typeCode) {
        case Origin.ORIGIN_TYPE:
            pathAttribute = Origin.read(cb);
            isOrigin = ((Origin) pathAttribute).isOriginSet();
            break;
        case AsPath.ASPATH_TYPE:
            pathAttribute = AsPath.read(cb);
            isAsPath = ((AsPath) pathAttribute).isaspathSet();
            break;
        case As4Path.AS4PATH_TYPE:
            pathAttribute = As4Path.read(cb);
            break;
        case NextHop.NEXTHOP_TYPE:
            pathAttribute = NextHop.read(cb);
            isNextHop = ((NextHop) pathAttribute).isNextHopSet();
            break;
        case Med.MED_TYPE:
            pathAttribute = Med.read(cb);
            break;
        case LocalPref.LOCAL_PREF_TYPE:
            pathAttribute = LocalPref.read(cb);
            break;
        case MpReachNlri.MPREACHNLRI_TYPE:
            pathAttribute = MpReachNlri.read(cb);
            isMpReach = ((MpReachNlri) pathAttribute).isMpReachNlriSet();
            break;
        case MpUnReachNlri.MPUNREACHNLRI_TYPE:
            pathAttribute = MpUnReachNlri.read(cb);
            isMpUnReach = ((MpUnReachNlri) pathAttribute)
                    .isMpUnReachNlriSet();
            break;
        case LINK_STATE_ATTRIBUTE_TYPE:
            pathAttribute = LinkStateAttributes.read(cb);
            break;
        case EXTENDED_COMMUNITY_TYPE:
            pathAttribute = BgpExtendedCommunity.read(cb);
            break;
        case WideCommunity.TYPE:
            pathAttribute = WideCommunity.read(cb);
            break;
        default:
            log.debug("Skip bytes for unsupported attribute types");
            UnSupportedAttribute.read(cb);
        }
        pathAttributeList.add(pathAttribute);
    }

    checkMandatoryAttr(isOrigin, isAsPath, isNextHop, isMpReach, isMpUnReach);
    //TODO:if mp_reach or mp_unreach not present ignore the packet
    return new BgpPathAttributes(pathAttributeList);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:74,代码来源:BgpPathAttributes.java

示例6: parseLinkDescriptors

import org.onosproject.bgpio.util.UnSupportedAttribute; //导入依赖的package包/类
/**
 * Parses link descriptors.
 *
 * @param cb ChannelBuffer
 * @return list of link descriptors
 * @throws BgpParseException while parsing link descriptors
 */
public static LinkedList<BgpValueType> parseLinkDescriptors(ChannelBuffer cb) throws BgpParseException {
    LinkedList<BgpValueType> linkDescriptor = new LinkedList<>();
    BgpValueType tlv = null;
    int count = 0;

    while (cb.readableBytes() > 0) {
        ChannelBuffer tempBuf = cb.copy();
        short type = cb.readShort();
        short length = cb.readShort();
        if (cb.readableBytes() < length) {
            throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
                    tempBuf.readBytes(cb.readableBytes() + Constants.TYPE_AND_LEN_AS_SHORT));
        }
        ChannelBuffer tempCb = cb.readBytes(length);
        switch (type) {
        case LinkLocalRemoteIdentifiersTlv.TYPE:
            tlv = LinkLocalRemoteIdentifiersTlv.read(tempCb);
            break;
        case IPV4_INTERFACE_ADDRESS_TYPE:
            tlv = IPv4AddressTlv.read(tempCb, IPV4_INTERFACE_ADDRESS_TYPE);
            break;
        case IPV4_NEIGHBOR_ADDRESS_TYPE:
            tlv = IPv4AddressTlv.read(tempCb, IPV4_NEIGHBOR_ADDRESS_TYPE);
            break;
        case IPV6_INTERFACE_ADDRESS_TYPE:
            tlv = IPv6AddressTlv.read(tempCb, IPV6_INTERFACE_ADDRESS_TYPE);
            break;
        case IPV6_NEIGHBOR_ADDRESS_TYPE:
            tlv = IPv6AddressTlv.read(tempCb, IPV6_NEIGHBOR_ADDRESS_TYPE);
            break;
        case BgpAttrNodeMultiTopologyId.ATTRNODE_MULTITOPOLOGY:
            tlv = BgpAttrNodeMultiTopologyId.read(tempCb);
            count++;
            log.debug("MultiTopologyId TLV cannot repeat more than once");
            if (count > 1) {
                //length + 4 implies data contains type, length and value
                throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
                        BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length
                                + Constants.TYPE_AND_LEN_AS_SHORT));
            }
            break;
        default:
            UnSupportedAttribute.skipBytes(tempCb, length);
        }
        linkDescriptor.add(tlv);
    }
    return linkDescriptor;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:56,代码来源:BgpLinkLSIdentifier.java


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