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


Java RemoteInterfaceIpAddress类代码示例

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


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

示例1: getTlvBodyAsByteArray

import org.onosproject.ospf.protocol.lsa.linksubtype.RemoteInterfaceIpAddress; //导入依赖的package包/类
/**
 * Gets tlv body as byte array.
 *
 * @return tlv body as byte array
 * @throws Exception might throws exception while parsing buffer
 */
public byte[] getTlvBodyAsByteArray() throws Exception {

    List<Byte> bodyLst = new ArrayList<>();
    for (LinkSubType tlv : subTlv) {
        //Check the type of tlv and build bytes accordingly
        if (tlv instanceof LinkType) {
            LinkType linkType = (LinkType) tlv;
            bodyLst.addAll(Bytes.asList(linkType.asBytes()));
        } else if (tlv instanceof LinkId) {
            LinkId linkId = (LinkId) tlv;
            bodyLst.addAll(Bytes.asList(linkId.asBytes()));
        } else if (tlv instanceof LocalInterfaceIpAddress) {
            LocalInterfaceIpAddress localInterfaceIpAddress = (LocalInterfaceIpAddress) tlv;
            bodyLst.addAll(Bytes.asList(localInterfaceIpAddress.asBytes()));
        } else if (tlv instanceof RemoteInterfaceIpAddress) {
            RemoteInterfaceIpAddress remoteInterfaceIpAddress = (RemoteInterfaceIpAddress) tlv;
            bodyLst.addAll(Bytes.asList(remoteInterfaceIpAddress.asBytes()));
        } else if (tlv instanceof TrafficEngineeringMetric) {
            TrafficEngineeringMetric trafficEngineeringMetric = (TrafficEngineeringMetric) tlv;
            bodyLst.addAll(Bytes.asList(trafficEngineeringMetric.asBytes()));
        } else if (tlv instanceof MaximumBandwidth) {
            MaximumBandwidth maximumBandwidth = (MaximumBandwidth) tlv;
            bodyLst.addAll(Bytes.asList(maximumBandwidth.asBytes()));
        } else if (tlv instanceof MaximumReservableBandwidth) {
            MaximumReservableBandwidth maximumReservableBandwidth = (MaximumReservableBandwidth) tlv;
            bodyLst.addAll(Bytes.asList(maximumReservableBandwidth.asBytes()));
        } else if (tlv instanceof UnreservedBandwidth) {
            UnreservedBandwidth unreservedBandwidth = (UnreservedBandwidth) tlv;
            bodyLst.addAll(Bytes.asList(unreservedBandwidth.asBytes()));
        } else if (tlv instanceof AdministrativeGroup) {
            AdministrativeGroup administrativeGroup = (AdministrativeGroup) tlv;
            bodyLst.addAll(Bytes.asList(administrativeGroup.asBytes()));
        } else {
            UnknownLinkSubType unknownLinkSubType = (UnknownLinkSubType) tlv;
            bodyLst.addAll(Bytes.asList(unknownLinkSubType.asBytes()));
        }
    }
    return Bytes.toArray(bodyLst);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:46,代码来源:LinkTlv.java

示例2: getTlvBodyAsByteArray

import org.onosproject.ospf.protocol.lsa.linksubtype.RemoteInterfaceIpAddress; //导入依赖的package包/类
/**
 * Gets tlv body as byte array.
 *
 * @return tlv body as byte array
 * @throws OspfParseException might throws exception while parsing buffer
 */
public byte[] getTlvBodyAsByteArray() throws OspfParseException {

    List<Byte> bodyLst = new ArrayList<>();
    for (LinkSubType tlv : subTlv) {
        //Check the type of tlv and build bytes accordingly
        if (tlv instanceof LinkType) {
            LinkType linkType = (LinkType) tlv;
            bodyLst.addAll(Bytes.asList(linkType.asBytes()));
        } else if (tlv instanceof LinkId) {
            LinkId linkId = (LinkId) tlv;
            bodyLst.addAll(Bytes.asList(linkId.asBytes()));
        } else if (tlv instanceof LocalInterfaceIpAddress) {
            LocalInterfaceIpAddress localInterfaceIpAddress = (LocalInterfaceIpAddress) tlv;
            bodyLst.addAll(Bytes.asList(localInterfaceIpAddress.asBytes()));
        } else if (tlv instanceof RemoteInterfaceIpAddress) {
            RemoteInterfaceIpAddress remoteInterfaceIpAddress = (RemoteInterfaceIpAddress) tlv;
            bodyLst.addAll(Bytes.asList(remoteInterfaceIpAddress.asBytes()));
        } else if (tlv instanceof TrafficEngineeringMetric) {
            TrafficEngineeringMetric trafficEngineeringMetric = (TrafficEngineeringMetric) tlv;
            bodyLst.addAll(Bytes.asList(trafficEngineeringMetric.asBytes()));
        } else if (tlv instanceof MaximumBandwidth) {
            MaximumBandwidth maximumBandwidth = (MaximumBandwidth) tlv;
            bodyLst.addAll(Bytes.asList(maximumBandwidth.asBytes()));
        } else if (tlv instanceof MaximumReservableBandwidth) {
            MaximumReservableBandwidth maximumReservableBandwidth = (MaximumReservableBandwidth) tlv;
            bodyLst.addAll(Bytes.asList(maximumReservableBandwidth.asBytes()));
        } else if (tlv instanceof UnreservedBandwidth) {
            UnreservedBandwidth unreservedBandwidth = (UnreservedBandwidth) tlv;
            bodyLst.addAll(Bytes.asList(unreservedBandwidth.asBytes()));
        } else if (tlv instanceof AdministrativeGroup) {
            AdministrativeGroup administrativeGroup = (AdministrativeGroup) tlv;
            bodyLst.addAll(Bytes.asList(administrativeGroup.asBytes()));
        } else {
            UnknownLinkSubType unknownLinkSubType = (UnknownLinkSubType) tlv;
            bodyLst.addAll(Bytes.asList(unknownLinkSubType.asBytes()));
        }
    }
    return Bytes.toArray(bodyLst);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:46,代码来源:LinkTlv.java

示例3: readFrom

import org.onosproject.ospf.protocol.lsa.linksubtype.RemoteInterfaceIpAddress; //导入依赖的package包/类
/**
 * Reads bytes from channel buffer .
 *
 * @param channelBuffer channel buffer instance
 * @throws Exception might throws exception while parsing packet
 */
public void readFrom(ChannelBuffer channelBuffer) throws Exception {
    while (channelBuffer.readableBytes() > 0) {
        TlvHeader tlvHeader = new TlvHeader();
        tlvHeader.setTlvType(channelBuffer.readUnsignedShort());
        tlvHeader.setTlvLength(channelBuffer.readUnsignedShort());

        if (LinkSubTypes.LINK_TYPE.value() == tlvHeader.tlvType()) {
            LinkType linktype = new LinkType(tlvHeader);
            linktype.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(linktype);
            if (tlvHeader.tlvLength() < OspfUtil.FOUR_BYTES) {
                int readerIndex = channelBuffer.readerIndex() + (OspfUtil.FOUR_BYTES - tlvHeader.tlvLength());
                channelBuffer.readerIndex(readerIndex);
            }
        } else if (LinkSubTypes.LINK_ID.value() == tlvHeader.tlvType()) {
            LinkId linkId = new LinkId(tlvHeader);
            linkId.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(linkId);
        } else if (LinkSubTypes.LOCAL_INTERFACE_IP_ADDRESS.value() == tlvHeader.tlvType()) {
            LocalInterfaceIpAddress localInterfaceIpAddress = new LocalInterfaceIpAddress(tlvHeader);
            localInterfaceIpAddress.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(localInterfaceIpAddress);
        } else if (LinkSubTypes.REMOTE_INTERFACE_IP_ADDRESS.value() == tlvHeader.tlvType()) {
            RemoteInterfaceIpAddress remoteInterfaceIpAddress = new RemoteInterfaceIpAddress(tlvHeader);
            remoteInterfaceIpAddress.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(remoteInterfaceIpAddress);
        } else if (LinkSubTypes.TRAFFIC_ENGINEERING_METRIC.value() == tlvHeader.tlvType()) {
            TrafficEngineeringMetric trafficEngineeringMetric = new TrafficEngineeringMetric(tlvHeader);
            trafficEngineeringMetric.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(trafficEngineeringMetric);
        } else if (LinkSubTypes.MAXIMUM_BANDWIDTH.value() == tlvHeader.tlvType()) {
            MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader);
            maximumBandwidth.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(maximumBandwidth);
        } else if (LinkSubTypes.MAXIMUM_RESERVABLE_BANDWIDTH.value() == tlvHeader.tlvType()) {
            MaximumReservableBandwidth maximumReservableBandwidth = new MaximumReservableBandwidth(tlvHeader);
            maximumReservableBandwidth.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(maximumReservableBandwidth);
        } else if (LinkSubTypes.UNRESERVED_BANDWIDTH.value() == tlvHeader.tlvType()) {
            UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader);
            unreservedBandwidth.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(unreservedBandwidth);
        } else if (LinkSubTypes.ADMINISTRATIVE_GROUP.value() == tlvHeader.tlvType()) {
            AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader);
            administrativeGroup.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(administrativeGroup);
        } else {
            UnknownLinkSubType unknownLinkSubType = new UnknownLinkSubType(tlvHeader);
            unknownLinkSubType.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(unknownLinkSubType);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:60,代码来源:LinkTlv.java

示例4: readFrom

import org.onosproject.ospf.protocol.lsa.linksubtype.RemoteInterfaceIpAddress; //导入依赖的package包/类
/**
 * Reads bytes from channel buffer .
 *
 * @param channelBuffer channel buffer instance
 * @throws OspfParseException might throws exception while parsing packet
 */
public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
    while (channelBuffer.readableBytes() > 0) {
        TlvHeader tlvHeader = new TlvHeader();
        tlvHeader.setTlvType(channelBuffer.readUnsignedShort());
        tlvHeader.setTlvLength(channelBuffer.readUnsignedShort());

        if (LinkSubTypes.LINK_TYPE.value() == tlvHeader.tlvType()) {
            LinkType linktype = new LinkType(tlvHeader);
            linktype.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(linktype);
            if (tlvHeader.tlvLength() < OspfUtil.FOUR_BYTES) {
                int readerIndex = channelBuffer.readerIndex() + (OspfUtil.FOUR_BYTES - tlvHeader.tlvLength());
                channelBuffer.readerIndex(readerIndex);
            }
        } else if (LinkSubTypes.LINK_ID.value() == tlvHeader.tlvType()) {
            LinkId linkId = new LinkId(tlvHeader);
            linkId.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(linkId);
        } else if (LinkSubTypes.LOCAL_INTERFACE_IP_ADDRESS.value() == tlvHeader.tlvType()) {
            LocalInterfaceIpAddress localInterfaceIpAddress = new LocalInterfaceIpAddress(tlvHeader);
            localInterfaceIpAddress.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(localInterfaceIpAddress);
        } else if (LinkSubTypes.REMOTE_INTERFACE_IP_ADDRESS.value() == tlvHeader.tlvType()) {
            RemoteInterfaceIpAddress remoteInterfaceIpAddress = new RemoteInterfaceIpAddress(tlvHeader);
            remoteInterfaceIpAddress.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(remoteInterfaceIpAddress);
        } else if (LinkSubTypes.TRAFFIC_ENGINEERING_METRIC.value() == tlvHeader.tlvType()) {
            TrafficEngineeringMetric trafficEngineeringMetric = new TrafficEngineeringMetric(tlvHeader);
            trafficEngineeringMetric.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(trafficEngineeringMetric);
        } else if (LinkSubTypes.MAXIMUM_BANDWIDTH.value() == tlvHeader.tlvType()) {
            MaximumBandwidth maximumBandwidth = new MaximumBandwidth(tlvHeader);
            maximumBandwidth.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(maximumBandwidth);
        } else if (LinkSubTypes.MAXIMUM_RESERVABLE_BANDWIDTH.value() == tlvHeader.tlvType()) {
            MaximumReservableBandwidth maximumReservableBandwidth = new MaximumReservableBandwidth(tlvHeader);
            maximumReservableBandwidth.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(maximumReservableBandwidth);
        } else if (LinkSubTypes.UNRESERVED_BANDWIDTH.value() == tlvHeader.tlvType()) {
            UnreservedBandwidth unreservedBandwidth = new UnreservedBandwidth(tlvHeader);
            unreservedBandwidth.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(unreservedBandwidth);
        } else if (LinkSubTypes.ADMINISTRATIVE_GROUP.value() == tlvHeader.tlvType()) {
            AdministrativeGroup administrativeGroup = new AdministrativeGroup(tlvHeader);
            administrativeGroup.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(administrativeGroup);
        } else {
            UnknownLinkSubType unknownLinkSubType = new UnknownLinkSubType(tlvHeader);
            unknownLinkSubType.readFrom(channelBuffer.readBytes(tlvHeader.tlvLength()));
            subTlv.add(unknownLinkSubType);
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:60,代码来源:LinkTlv.java


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