本文整理汇总了Java中org.onosproject.pcepio.protocol.PcepErrorObject类的典型用法代码示例。如果您正苦于以下问题:Java PcepErrorObject类的具体用法?Java PcepErrorObject怎么用?Java PcepErrorObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PcepErrorObject类属于org.onosproject.pcepio.protocol包,在下文中一共展示了PcepErrorObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getErrMsg
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Returns pcep error message with specific error type and value.
*
* @param factory represents pcep factory
* @param errorType pcep error type
* @param errorValue pcep error value
* @return pcep error message
*/
public PcepErrorMsg getErrMsg(PcepFactory factory, byte errorType, byte errorValue) {
LinkedList<PcepError> llPcepErr = new LinkedList<>();
LinkedList<PcepErrorObject> llerrObj = new LinkedList<>();
PcepErrorMsg errMsg;
PcepErrorObject errObj = factory.buildPcepErrorObject().setErrorValue(errorValue).setErrorType(errorType)
.build();
llerrObj.add(errObj);
PcepError pcepErr = factory.buildPcepError().setErrorObjList(llerrObj).build();
llPcepErr.add(pcepErr);
PcepErrorInfo errInfo = factory.buildPcepErrorInfo().setPcepErrorList(llPcepErr).build();
errMsg = factory.buildPcepErrorMsg().setPcepErrorInfo(errInfo).build();
return errMsg;
}
示例2: read
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Reads from channel buffer and returns object of PcepErrorObject.
*
* @param cb of channel buffer.
* @return object of PCEP-ERROR-OBJECT
*/
public static PcepErrorObject read(ChannelBuffer cb) {
PcepObjectHeader errorObjHeader;
byte errorType;
byte errorValue;
LinkedList<PcepValueType> optionalTlv;
errorObjHeader = PcepObjectHeader.read(cb);
//take only ErrorObject buffer.
ChannelBuffer tempCb = cb.readBytes(errorObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);
tempCb.readByte(); //ignore Reserved
tempCb.readByte(); //ignore Flags
errorType = tempCb.readByte();
errorValue = tempCb.readByte();
optionalTlv = parseOptionalTlv(tempCb);
return new PcepErrorObjectVer1(errorObjHeader, errorType, errorValue, optionalTlv);
}
示例3: getErrorType
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
@Override
public List<Integer> getErrorType() {
List<Integer> errorType = new LinkedList<>();
ListIterator<PcepError> listIterator = errList.listIterator();
PcepErrorObject errObj;
int error;
while (listIterator.hasNext()) {
PcepError pcepError = listIterator.next();
List<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
if (llErrObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llErrObjList.listIterator();
while (errObjListIterator.hasNext()) {
errObj = errObjListIterator.next();
error = errObj.getErrorType();
errorType.add(error);
}
}
}
return errorType;
}
示例4: getErrorValue
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
@Override
public List<Integer> getErrorValue() {
List<Integer> errorValue = new LinkedList<>();
ListIterator<PcepError> listIterator = errList.listIterator();
PcepErrorObject errObj;
int error;
while (listIterator.hasNext()) {
PcepError pcepError = listIterator.next();
List<PcepErrorObject> llErrObjList = pcepError.getErrorObjList();
if (llErrObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llErrObjList.listIterator();
while (errObjListIterator.hasNext()) {
errObj = errObjListIterator.next();
error = errObj.getErrorValue();
errorValue.add(error);
}
}
}
return errorValue;
}
示例5: parseErrorObjectList
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Parse error-obj-list.
*
* @param llErrObjList error object list output
* @param cb channel buffer input
* @throws PcepParseException if mandatory fields are missing
* @return error object header
*/
public PcepObjectHeader parseErrorObjectList(List<PcepErrorObject> llErrObjList, ChannelBuffer cb)
throws PcepParseException {
PcepObjectHeader tempObjHeader = null;
while (0 < cb.readableBytes()) {
cb.markReaderIndex();
tempObjHeader = PcepObjectHeader.read(cb);
cb.resetReaderIndex();
if (tempObjHeader.getObjClass() == PcepErrorObjectVer1.ERROR_OBJ_CLASS) {
llErrObjList.add(PcepErrorObjectVer1.read(cb));
} else {
break;
}
}
return tempObjHeader;
}
示例6: write
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Write Error Object List and Open Object to channel buffer.
*
* @param cb output channel buffer
* @return length of written Error object list with open
* @throws PcepParseException when mandatory fields are not set
*/
public int write(ChannelBuffer cb) throws PcepParseException {
int iLenStartIndex = cb.writerIndex();
boolean bIsErrObjListFound = false;
//<error-obj-list> is mandatory , if not present throw exception.
if (llerrorObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llerrorObjList.listIterator();
while (errObjListIterator.hasNext()) {
errObjListIterator.next().write(cb);
bIsErrObjListFound = true;
}
}
if (!bIsErrObjListFound) {
throw new PcepParseException("<error-obj-list> is mandatory.");
}
//Open Object is optional , if present write.
if (openObject != null) {
openObject.write(cb);
}
return cb.writerIndex() - iLenStartIndex;
}
示例7: getErrorMsg
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Builds pcep error message based on error value and error type.
*
* @param errorType pcep error type
* @param errorValue pcep error value
* @return pcep error message
* @throws PcepParseException while bulding error message
*/
public PcepErrorMsg getErrorMsg(byte errorType, byte errorValue) throws PcepParseException {
LinkedList<PcepErrorObject> llerrObj = new LinkedList<>();
PcepErrorMsg errMsg;
PcepErrorObject errObj = factory1.buildPcepErrorObject()
.setErrorValue(errorValue)
.setErrorType(errorType)
.build();
llerrObj.add(errObj);
//If Error caught in other than Openmessage
LinkedList<PcepError> llPcepErr = new LinkedList<>();
PcepError pcepErr = factory1.buildPcepError()
.setErrorObjList(llerrObj)
.build();
llPcepErr.add(pcepErr);
PcepErrorInfo errInfo = factory1.buildPcepErrorInfo()
.setPcepErrorList(llPcepErr)
.build();
errMsg = factory1.buildPcepErrorMsg()
.setPcepErrorInfo(errInfo)
.build();
return errMsg;
}
示例8: build
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
@Override
public PcepErrorObject build() {
PcepObjectHeader errorObjHeader = this.bIsHeaderSet ? this.errorObjHeader : DEFAULT_ERROR_OBJECT_HEADER;
if (bIsPFlagSet) {
errorObjHeader.setPFlag(bPFlag);
}
if (bIsIFlagSet) {
errorObjHeader.setIFlag(bIFlag);
}
return new PcepErrorObjectVer1(errorObjHeader, errorType, errorValue, optionalTlv);
}
示例9: PcepErrorInfoVer1
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Constructor to add PCEP error object to the list.
*
* @param llRPObjList list of PCEP RP object
* @param llLSObjList list of PCEP LS object
* @param llErrObjList list of PCEP error object
*/
public PcepErrorInfoVer1(List<PcepRPObject> llRPObjList, List<PcepLSObject> llLSObjList,
List<PcepErrorObject> llErrObjList) {
this.errList = new LinkedList<>();
if ((llErrObjList != null) && (!llErrObjList.isEmpty())) {
this.errList.add(new PcepErrorVer1(llRPObjList, llLSObjList, llErrObjList));
}
}
示例10: parseErrObjList
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* parseErrObjList from the channel buffer.
*
* @param cb of type channel buffer
* @throws PcepParseException if mandatory fields are missing
*/
public void parseErrObjList(ChannelBuffer cb) throws PcepParseException {
byte yObjClass;
byte yObjType;
boolean bIsErrorObjFound = false;
errObjList = new LinkedList<>();
// caller should verify for RP object
if (cb.readableBytes() < OBJECT_HEADER_LENGTH) {
throw new PcepParseException("Unable to find PCEP-ERROR Object");
}
cb.markReaderIndex();
PcepObjectHeader tempObjHeader = PcepObjectHeader.read(cb);
cb.resetReaderIndex();
yObjClass = tempObjHeader.getObjClass();
yObjType = tempObjHeader.getObjType();
PcepErrorObject errorObject;
while ((yObjClass == PcepErrorObjectVer1.ERROR_OBJ_CLASS) && (yObjType == PcepErrorObjectVer1.ERROR_OBJ_TYPE)) {
errorObject = PcepErrorObjectVer1.read(cb);
errObjList.add(errorObject);
bIsErrorObjFound = true;
if (cb.readableBytes() > OBJECT_HEADER_LENGTH) {
cb.markReaderIndex();
tempObjHeader = PcepObjectHeader.read(cb);
cb.resetReaderIndex();
yObjClass = tempObjHeader.getObjClass();
yObjType = tempObjHeader.getObjType();
} else {
break;
}
}
if (!bIsErrorObjFound) {
throw new PcepParseException("At least one PCEP-ERROR Object should be present.");
}
}
示例11: write
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Writes the byte stream of PCEP error to the channel buffer.
*
* @param cb of type channel buffer
* @return object length index
* @throws PcepParseException if mandatory fields are missing
*/
@Override
public int write(ChannelBuffer cb) throws PcepParseException {
int iLenStartIndex = cb.writerIndex();
// RPlist is optional
if (this.isErroInfoSet) {
ListIterator<PcepRPObject> rpObjlistIterator = this.rpObjList.listIterator();
while (rpObjlistIterator.hasNext()) {
rpObjlistIterator.next().write(cb);
}
}
// LSlist is optional
if (this.isLSObjListSet) {
ListIterator<PcepLSObject> teObjlistIterator = this.lsObjList.listIterator();
while (teObjlistIterator.hasNext()) {
teObjlistIterator.next().write(cb);
}
}
//ErrList is mandatory
ListIterator<PcepErrorObject> errlistIterator = this.errObjList.listIterator();
while (errlistIterator.hasNext()) {
errlistIterator.next().write(cb);
}
return cb.writerIndex() - iLenStartIndex;
}
示例12: ErrorObjListWithOpen
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Constructor to initialize Error and OPEN object.
*
* @param errObj ERROR object list
* @param openObj OPEN object
*/
public ErrorObjListWithOpen(List<PcepErrorObject> errObj, PcepOpenObject openObj) {
this.llerrorObjList = errObj;
this.openObject = openObj;
if (openObj != null) {
isOpenObjectSet = true;
} else {
isOpenObjectSet = false;
}
}
示例13: getErrorType
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Return list of Error Types.
*
* @return error types list
*/
public List<Integer> getErrorType() {
List<Integer> errorType = new LinkedList<>();
if (llerrorObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llerrorObjList.listIterator();
int error;
PcepErrorObject errorObj;
while (errObjListIterator.hasNext()) {
errorObj = errObjListIterator.next();
error = errorObj.getErrorType();
errorType.add(error);
}
}
return errorType;
}
示例14: getErrorValue
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Return list of Error Values.
*
* @return error values list
*/
public List<Integer> getErrorValue() {
List<Integer> errorValue = new LinkedList<>();
if (llerrorObjList != null) {
ListIterator<PcepErrorObject> errObjListIterator = llerrorObjList.listIterator();
int error;
PcepErrorObject errorObj;
while (errObjListIterator.hasNext()) {
errorObj = errObjListIterator.next();
error = errorObj.getErrorValue();
errorValue.add(error);
}
}
return errorValue;
}
示例15: getErrorMsg
import org.onosproject.pcepio.protocol.PcepErrorObject; //导入依赖的package包/类
/**
* Builds pcep error message based on error value and error type.
*
* @param errorType pcep error type
* @param errorValue pcep error value
* @return pcep error message
* @throws PcepParseException while bulding error message
*/
public PcepErrorMsg getErrorMsg(byte errorType, byte errorValue) throws PcepParseException {
LinkedList<PcepErrorObject> llerrObj = new LinkedList<>();
PcepErrorMsg errMsg;
PcepErrorObject errObj = factory1.buildPcepErrorObject()
.setErrorValue(errorValue)
.setErrorType(errorType)
.build();
llerrObj.add(errObj);
//If Error caught in other than Openmessage
LinkedList<PcepError> llPcepErr = new LinkedList<>();
PcepError pcepErr = factory1.buildPcepError()
.setErrorObjList(llerrObj)
.build();
llPcepErr.add(pcepErr);
PcepErrorInfo errInfo = factory1.buildPcepErrorInfo()
.setPcepErrorList(llPcepErr)
.build();
errMsg = factory1.buildPcepErrorMsg()
.setPcepErrorInfo(errInfo)
.build();
return errMsg;
}