本文整理汇总了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);
}
示例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);
}
示例3: buildLabelObject
import org.onosproject.pcepio.protocol.PcepLabelObject; //导入依赖的package包/类
@Override
public PcepLabelObject.Builder buildLabelObject() {
return new PcepLabelObjectVer1.Builder();
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例8: getLabelObject
import org.onosproject.pcepio.protocol.PcepLabelObject; //导入依赖的package包/类
/**
* Returns labelObject.
*
* @return PCEP label object
*/
public PcepLabelObject getLabelObject() {
return labelObject;
}
示例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;
}
示例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;
}
示例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;
}