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


Java PcepParseException类代码示例

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


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

示例1: closeMessageTest1

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * Common header, reason to close.
 */
@Test
public void closeMessageTest1() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, 0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 };

    byte[] testCloseMsg = {0 };
    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(closeMsg);

    PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
    PcepMessage message;

    message = reader.readFrom(buffer);
    assertThat(message, instanceOf(PcepCloseMsg.class));

    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    message.writeTo(buf);
    testCloseMsg = buf.array();

    int readLen = buf.writerIndex();
    testCloseMsg = new byte[readLen];
    buf.readBytes(testCloseMsg, 0, readLen);
    assertThat(testCloseMsg, is(closeMsg));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:PcepCloseMsgTest.java

示例2: read

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * Reads from channel buffer and returns object of PcepEndPointsObject.
 *
 * @param cb of channel buffer
 * @return object of PcepEndPointsObject
 * @throws PcepParseException while parsing channel buffer
 */
public static PcepEndPointsObject read(ChannelBuffer cb) throws PcepParseException {

    PcepObjectHeader endPointsObjHeader;
    int sourceIpAddress;
    int destIpAddress;

    endPointsObjHeader = PcepObjectHeader.read(cb);
    if (endPointsObjHeader.getObjType() == END_POINTS_OBJ_TYPE
            && endPointsObjHeader.getObjClass() == END_POINTS_OBJ_CLASS) {
        sourceIpAddress = cb.readInt();
        destIpAddress = cb.readInt();
    } else {
        throw new PcepParseException("Expected PcepEndPointsObject.");
    }
    return new PcepEndPointsObjectVer1(endPointsObjHeader, sourceIpAddress, destIpAddress);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:PcepEndPointsObjectVer1.java

示例3: build

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的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

示例4: read

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
@Override
public void read(ChannelBuffer cb) throws PcepParseException {
    PcepObjectHeader tempObjHeader;

    while (0 < cb.readableBytes()) {
        cb.markReaderIndex();
        tempObjHeader = PcepObjectHeader.read(cb);
        cb.resetReaderIndex();
        byte yObjClass = tempObjHeader.getObjClass();
        if ((yObjClass != PcepRPObjectVer1.RP_OBJ_CLASS) && (yObjClass != PcepLSObjectVer1.LS_OBJ_CLASS)
                && (yObjClass != PcepErrorObjectVer1.ERROR_OBJ_CLASS)) {
            throw new PcepParseException("Unknown Object is present in PCEP-ERROR. Object Class: " + yObjClass);
        }

        this.errList.add(PcepErrorVer1.read(cb));
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:PcepErrorInfoVer1.java

示例5: parseErrorObjectList

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的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;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:PcepErrorMsgVer1.java

示例6: build

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
@Override
public PcepEndPointsObject build() throws PcepParseException {

    PcepObjectHeader endpointsObjHeader = this.bIsHeaderSet ? this.endpointsObjHeader
            : DEFAULT_END_POINTS_OBJECT_HEADER;

    if (bIsPFlagSet) {
        endpointsObjHeader.setPFlag(bPFlag);
    }

    if (bIsIFlagSet) {
        endpointsObjHeader.setIFlag(bIFlag);
    }

    if (!this.bIsSourceIpAddressset) {
        throw new PcepParseException("SourceIpAddress not set while building EndPoints object");
    }

    if (!this.bIsDestIpAddressset) {
        throw new PcepParseException("DestIpAddress not set while building EndPoints object");
    }

    return new PcepEndPointsObjectVer1(endpointsObjHeader, this.sourceIpAddress, this.destIpAddress);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:PcepEndPointsObjectVer1.java

示例7: write

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
@Override
public int write(ChannelBuffer cb) throws PcepParseException {

    int objStartIndex = cb.writerIndex();

    //Write common header
    int objLenIndex = fecObjHeader.write(cb);
    cb.writeInt(localNodeID);
    cb.writeInt(localInterfaceID);
    cb.writeInt(remoteNodeID);
    cb.writeInt(remoteInterfaceID);

    //Now write FEC IPv4 Unnumbered Adjacency Object Length
    cb.setShort(objLenIndex, (short) (cb.writerIndex() - objStartIndex));

    return cb.writerIndex();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:PcepFecObjectIPv4UnnumberedAdjacencyVer1.java

示例8: initiateMessageTest17

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT
 * objects in PcInitiate message.
 */
@Test
public void initiateMessageTest17() throws PcepParseException, PcepOutOfBoundMessageException {

    // SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
    //
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
            0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
            0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
            0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
            (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
            (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
            0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
            0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
            0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
            0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};

    byte[] testInitiateCreationMsg = {0};
    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(initiateCreationMsg);

    PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
    PcepMessage message = null;

    message = reader.readFrom(buffer);

    assertThat(message, instanceOf(PcepInitiateMsg.class));
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();

    message.writeTo(buf);

    testInitiateCreationMsg = buf.array();

    int iReadLen = buf.writerIndex();
    testInitiateCreationMsg = new byte[iReadLen];
    buf.readBytes(testInitiateCreationMsg, 0, iReadLen);

    assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:PcepInitiateMsgExtTest.java

示例9: processPcepMessage

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
@Override
void processPcepMessage(PcepChannelHandler h, PcepMessage m) throws IOException, PcepParseException {

    //h.channel.getPipeline().remove("waittimeout");
    log.debug("Message received in established state " + m.getType());
    //dispatch the message
    h.dispatchMessage(m);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:PcepChannelHandler.java

示例10: read

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * Reads channel buffer and returns object of PcepLabelRange.
 *
 * @param cb of type channel buffer.
 * @return object of PcepLabelRange
 * @throws PcepParseException when fails to read from channel buffer
 */
public static PcepLabelRange read(ChannelBuffer cb) throws PcepParseException {

    //parse and store SRP mandatory object
    PcepSrpObject srpObj = null;
    srpObj = PcepSrpObjectVer1.read(cb);
    if (srpObj == null) {
        throw new PcepParseException("Exception while parsing srp object");
    }

    LinkedList<PcepLabelRangeObject> llLabelRangeList = new LinkedList<>();
    boolean bFoundLabelRangeObj = false;
    while (0 < cb.readableBytes()) {
        //parse and store <labelrange-list>
        PcepLabelRangeObject lrObj;
        lrObj = PcepLabelRangeObjectVer1.read(cb);
        if (lrObj == null) {
            throw new PcepParseException("Exception while parsing label range object");
        } else {
            llLabelRangeList.add(lrObj);
            bFoundLabelRangeObj = true;
        }
    }

    if (!bFoundLabelRangeObj) {
        throw new PcepParseException("At least one LABEL-RANGE MUST be present.");
    }
    return new PcepLabelRangeVer1(srpObj, llLabelRangeList);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:PcepLabelRangeVer1.java

示例11: sendHandshakeOpenMessage

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * Send handshake open message.
 *
 * @throws IOException,PcepParseException
 */
private void sendHandshakeOpenMessage() throws IOException, PcepParseException {
    PcepOpenObject pcepOpenobj = factory1.buildOpenObject()
            .setSessionId(sessionId)
            .setKeepAliveTime(keepAliveTime)
            .setDeadTime(deadTime)
            .build();
    PcepMessage msg = factory1.buildOpenMsg()
            .setPcepOpenObj(pcepOpenobj)
            .build();
    log.debug("Sending OPEN message to {}", channel.getRemoteAddress());
    channel.write(Collections.singletonList(msg));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:PcepChannelHandler.java

示例12: reportMessageTest20

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object
 * in PcRpt message.
 */
@Test
public void reportMessageTest20() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x88,
            0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
            0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
            0x07, 0x10, 0x00, 0x14, //ERO Object
            0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
            0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
            0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
            0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
            0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
            0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
            0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
            0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
            0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
            0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00};

    byte[] testReportMsg = {0};
    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(reportMsg);

    PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
    PcepMessage message = null;

    message = reader.readFrom(buffer);

    assertThat(message, instanceOf(PcepReportMsg.class));
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    message.writeTo(buf);

    int readLen = buf.writerIndex();
    testReportMsg = new byte[readLen];
    buf.readBytes(testReportMsg, 0, readLen);

    assertThat(testReportMsg, is(reportMsg));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:PcepReportMsgTest.java

示例13: errorMessageTest9

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * This test case checks for
 * PCEP-ERROR Object, PCEP-ERROR Object
 * in PcepErrorMsg message.
 */
@Test
public void errorMessageTest9() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x14, // common header
            0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
            0x00, 0x00, 0x01, 0x01, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
            0x00, 0x00, 0x01, 0x01};

    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(errorMsg);

    PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
    PcepMessage message = null;

    message = reader.readFrom(buffer);

    byte[] testErrorMsg = {0};
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    assertThat(message, instanceOf(PcepErrorMsg.class));
    message.writeTo(buf);
    int iReadLen = buf.writerIndex();
    testErrorMsg = new byte[iReadLen];
    buf.readBytes(testErrorMsg, 0, iReadLen);

    assertThat(testErrorMsg, is(errorMsg));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:PcepErrorMsgTest.java

示例14: pcepUpdateMsgTest11

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
 * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, Metric objects in PcUpd message.
 */
@Test
public void pcepUpdateMsgTest11() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78,
            0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
            0x00, 0x11, 0x00, 0x02,  0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
            0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
            0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
            (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
            (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
            0x00, 0x11, 0x00, 0x02,  0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
            0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
            0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
            0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
            0x01, 0x01, 0x04, 0x00,
            0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
            0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object

    byte[] testupdateMsg = {0};
    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(updateMsg);

    PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
    PcepMessage message = null;

    message = reader.readFrom(buffer);

    assertThat(message, instanceOf(PcepUpdateMsg.class));
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    message.writeTo(buf);
    testupdateMsg = buf.array();

    int readLen = buf.writerIndex() - 0;
    testupdateMsg = new byte[readLen];
    buf.readBytes(testupdateMsg, 0, readLen);

    assertThat(testupdateMsg, is(updateMsg));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:PcepUpdateMsgTest.java

示例15: errorMessageTest12

import org.onosproject.pcepio.exceptions.PcepParseException; //导入依赖的package包/类
/**
 * This test case checks for
 * RP Object, PCEP-ERROR Object
 * in PcepErrorMsg message.
 */
@Test
public void errorMessageTest12() throws PcepParseException, PcepOutOfBoundMessageException {

    //RP Object, PCEP-ERROR Object
    byte[] errorMsg = new byte[]{0x20, 0x06, 0x00, 0x18, // common header
            0x02, 0x10, 0x00, 0x0C, // RP Object Header
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0D, 0x10, 0x00, 0x08, // PCEP-ERROR Object Header
            0x00, 0x00, 0x01, 0x01};

    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(errorMsg);

    PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
    PcepMessage message = null;

    message = reader.readFrom(buffer);

    byte[] testErrorMsg = {0};
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    assertThat(message, instanceOf(PcepErrorMsg.class));
    message.writeTo(buf);
    int iReadLen = buf.writerIndex();
    testErrorMsg = new byte[iReadLen];
    buf.readBytes(testErrorMsg, 0, iReadLen);

    assertThat(testErrorMsg, is(errorMsg));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:PcepErrorMsgTest.java


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