當前位置: 首頁>>代碼示例>>Java>>正文


Java MaximumBandwidth類代碼示例

本文整理匯總了Java中org.onosproject.ospf.protocol.lsa.linksubtype.MaximumBandwidth的典型用法代碼示例。如果您正苦於以下問題:Java MaximumBandwidth類的具體用法?Java MaximumBandwidth怎麽用?Java MaximumBandwidth使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MaximumBandwidth類屬於org.onosproject.ospf.protocol.lsa.linksubtype包,在下文中一共展示了MaximumBandwidth類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTlvBodyAsByteArray

import org.onosproject.ospf.protocol.lsa.linksubtype.MaximumBandwidth; //導入依賴的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.MaximumBandwidth; //導入依賴的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.MaximumBandwidth; //導入依賴的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.MaximumBandwidth; //導入依賴的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.MaximumBandwidth類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。