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


Java PcepLabelObject類代碼示例

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


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

示例1: read

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
/**
 * Reads form channel buffer and returns objects of PcepLabelObject.
 *
 * @param cb of type channel buffer
 * @return objects of PcepLabelObject
 * @throws PcepParseException when fails to read from channel buffer
 */
public static PcepLabelObject read(ChannelBuffer cb) throws PcepParseException {

    PcepObjectHeader labelObjHeader;

    boolean oBit;
    int label;

    // Optional TLV
    LinkedList<PcepValueType> optionalTlv = new LinkedList<>();
    labelObjHeader = PcepObjectHeader.read(cb);

    //take only LspObject buffer.
    ChannelBuffer tempCb = cb.readBytes(labelObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);

    int iTemp = tempCb.readInt();
    oBit = (iTemp & (byte) OFLAG_SET) == OFLAG_SET;
    iTemp = tempCb.readInt();
    label = (int) iTemp >> SHIFT_LABEL;

    // parse optional TLV
    optionalTlv = parseOptionalTlv(tempCb);
    return new PcepLabelObjectVer1(labelObjHeader, oBit, label, optionalTlv);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:31,代碼來源:PcepLabelObjectVer1.java

示例2: build

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
@Override
public PcepLabelObject build() throws PcepParseException {
    PcepObjectHeader labelObjHeader = this.bIsHeaderSet ? this.labelObjHeader : DEFAULT_LABEL_OBJECT_HEADER;
    boolean oBit = this.bIsOFlagSet ? this.oBit : DEFAULT_OFLAG;

    if (!this.bIsLabelSet) {
        throw new PcepParseException(" Label NOT Set while building PcepLabelObject.");
    }
    if (bIsPFlagSet) {
        labelObjHeader.setPFlag(bPFlag);
    }
    if (bIsIFlagSet) {
        labelObjHeader.setIFlag(bIFlag);
    }
    return new PcepLabelObjectVer1(labelObjHeader, oBit, this.label, this.optionalTlv);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:17,代碼來源:PcepLabelObjectVer1.java

示例3: buildLabelObject

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
@Override
public PcepLabelObject.Builder buildLabelObject() {
    return new PcepLabelObjectVer1.Builder();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:5,代碼來源:PcepFactoryVer1.java

示例4: pushGlobalNodeLabel

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
private void pushGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId,
        IpPrefix ipPrefix, PcepFlowType type, boolean isBos) throws PcepParseException {

    checkNotNull(deviceId);
    checkNotNull(labelId);
    checkNotNull(type);

    PcepClient pc = getPcepClient(deviceId);
    if (pc == null) {
        log.error("PCEP client not found");
        return;
    }

    LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();

    if (ipPrefix == null) {
        // Pushing self node label to device.
        ipPrefix = IpPrefix.valueOf(pc.getPccId().ipAddress(), 32);
    }

    PcepFecObjectIPv4 fecObject = pc.factory().buildFecObjectIpv4()
                                  .setNodeID(ipPrefix.address().getIp4Address().toInt())
                                  .build();

    boolean bSFlag = false;
    if (pc.labelDbSyncStatus() == IN_SYNC && !isBos) {
        // Need to set sync flag in all messages till sync completes.
        bSFlag = true;
    }

    PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);

    //Global NODE-SID as label object
    PcepLabelObject labelObject = pc.factory().buildLabelObject()
                                  .setLabel((int) labelId.labelId())
                                  .build();

    PcepLabelMap labelMap = new PcepLabelMap();
    labelMap.setFecObject(fecObject);
    labelMap.setLabelObject(labelObject);
    labelMap.setSrpObject(srpObj);

    labelUpdateList.add(pc.factory().buildPcepLabelUpdateObject()
                        .setLabelMap(labelMap)
                        .build());

    PcepLabelUpdateMsg labelMsg = pc.factory().buildPcepLabelUpdateMsg()
                                  .setPcLabelUpdateList(labelUpdateList)
                                  .build();

    pc.sendMessage(labelMsg);

    if (isBos) {
        // Sync is completed.
        pc.setLabelDbSyncStatus(SYNCED);
    }
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:58,代碼來源:BgpcepFlowRuleProvider.java

示例5: pushAdjacencyLabel

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
private void pushAdjacencyLabel(DeviceId deviceId, LabelResourceId labelId, IpPrefix ip4PrefixSrc,
                                IpPrefix ip4PrefixDst, PcepFlowType type)
        throws PcepParseException {

    checkNotNull(deviceId);
    checkNotNull(labelId);
    checkNotNull(ip4PrefixSrc);
    checkNotNull(ip4PrefixDst);
    checkNotNull(type);

    PcepClient pc = getPcepClient(deviceId);
    if (pc == null) {
        log.error("PCEP client not found");
        return;
    }

    LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();

    int srcPortNo = ip4PrefixSrc.address().getIp4Address().toInt();
    int dstPortNo = ip4PrefixDst.address().getIp4Address().toInt();

    PcepFecObjectIPv4Adjacency fecAdjObject = pc.factory().buildFecIpv4Adjacency()
                                              .seRemoteIPv4Address(dstPortNo)
                                              .seLocalIPv4Address(srcPortNo)
                                              .build();

    boolean bSFlag = false;
    if (pc.labelDbSyncStatus() == IN_SYNC) {
        // Need to set sync flag in all messages till sync completes.
        bSFlag = true;
    }

    PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);

    //Adjacency label object
    PcepLabelObject labelObject = pc.factory().buildLabelObject()
                                  .setLabel((int) labelId.labelId())
                                  .build();

    PcepLabelMap labelMap = new PcepLabelMap();
    labelMap.setFecObject(fecAdjObject);
    labelMap.setLabelObject(labelObject);
    labelMap.setSrpObject(srpObj);

    labelUpdateList.add(pc.factory().buildPcepLabelUpdateObject()
                        .setLabelMap(labelMap)
                        .build());

    PcepLabelUpdateMsg labelMsg = pc.factory().buildPcepLabelUpdateMsg()
                                  .setPcLabelUpdateList(labelUpdateList)
                                  .build();

    pc.sendMessage(labelMsg);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:55,代碼來源:BgpcepFlowRuleProvider.java

示例6: pushGlobalNodeLabel

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
void pushGlobalNodeLabel(PcepClient pc, LabelResourceId labelId,
        int labelForNode, PcepLabelOp type, boolean isBos) throws PcepParseException {

    checkNotNull(pc);
    checkNotNull(labelId);
    checkNotNull(type);

    LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();
    PcepFecObjectIPv4 fecObject = pc.factory().buildFecObjectIpv4()
                                  .setNodeID(labelForNode)
                                  .build();

    boolean bSFlag = false;
    if (pc.labelDbSyncStatus() == IN_SYNC && !isBos) {
        // Need to set sync flag in all messages till sync completes.
        bSFlag = true;
    }

    PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);

    //Global NODE-SID as label object
    PcepLabelObject labelObject = pc.factory().buildLabelObject()
                                  .setLabel((int) labelId.labelId())
                                  .build();

    PcepLabelMap labelMap = new PcepLabelMap();
    labelMap.setFecObject(fecObject);
    labelMap.setLabelObject(labelObject);
    labelMap.setSrpObject(srpObj);

    labelUpdateList.add(pc.factory().buildPcepLabelUpdateObject()
                        .setLabelMap(labelMap)
                        .build());

    PcepLabelUpdateMsg labelMsg = pc.factory().buildPcepLabelUpdateMsg()
                                  .setPcLabelUpdateList(labelUpdateList)
                                  .build();
    pc.sendMessage(labelMsg);

    if (isBos) {
        // Sync is completed.
        pc.setLabelDbSyncStatus(SYNCED);
    }
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:45,代碼來源:PceccSrTeBeHandler.java

示例7: pushAdjacencyLabel

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
void pushAdjacencyLabel(PcepClient pc, LabelResourceId labelId, int srcPortNo,
                                int dstPortNo, PcepLabelOp type)
        throws PcepParseException {

    checkNotNull(pc);
    checkNotNull(labelId);
    checkNotNull(type);

    LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();
    PcepFecObjectIPv4Adjacency fecAdjObject = pc.factory().buildFecIpv4Adjacency()
                                              .seRemoteIPv4Address(dstPortNo)
                                              .seLocalIPv4Address(srcPortNo)
                                              .build();

    boolean bSFlag = false;
    if (pc.labelDbSyncStatus() == IN_SYNC) {
        // Need to set sync flag in all messages till sync completes.
        bSFlag = true;
    }

    PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);

    //Adjacency label object
    PcepLabelObject labelObject = pc.factory().buildLabelObject()
                                  .setLabel((int) labelId.labelId())
                                  .build();

    PcepLabelMap labelMap = new PcepLabelMap();
    labelMap.setFecObject(fecAdjObject);
    labelMap.setLabelObject(labelObject);
    labelMap.setSrpObject(srpObj);

    labelUpdateList.add(pc.factory().buildPcepLabelUpdateObject()
                        .setLabelMap(labelMap)
                        .build());

    PcepLabelUpdateMsg labelMsg = pc.factory().buildPcepLabelUpdateMsg()
                                  .setPcLabelUpdateList(labelUpdateList)
                                  .build();
    pc.sendMessage(labelMsg);
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:42,代碼來源:PceccSrTeBeHandler.java

示例8: getLabelObject

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
/**
 * Returns labelObject.
 *
 * @return PCEP label object
 */
public PcepLabelObject getLabelObject() {
    return labelObject;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:9,代碼來源:PcepLabelMap.java

示例9: setLabelObject

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
/**
 * Sets the Pcep labelObject.
 *
 * @param labelObject PCEP label object
 */
public void setLabelObject(PcepLabelObject labelObject) {
    this.labelObject = labelObject;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:9,代碼來源:PcepLabelMap.java

示例10: getLabelList

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
/**
 * Returns a list of labels.
 *
 * @return llLabelList list of pcep label objects
 */
public LinkedList<PcepLabelObject> getLabelList() {
    return llLabelList;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:9,代碼來源:PcepLabelDownload.java

示例11: setLabelList

import org.onosproject.pcepio.protocol.PcepLabelObject; //導入依賴的package包/類
/**
 * set the llLabelList list of type PcepLableObject.
 *
 * @param llLabelList list of pcep label objects
 */
public void setLabelList(LinkedList<PcepLabelObject> llLabelList) {
    this.llLabelList = llLabelList;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:9,代碼來源:PcepLabelDownload.java


注:本文中的org.onosproject.pcepio.protocol.PcepLabelObject類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。