Java Code Examples for org.jboss.netty.buffer.ChannelBuffer#writeBytes()

The following examples show how to use org.jboss.netty.buffer.ChannelBuffer#writeBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BgpUpdateMsgTest.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * This test case checks update message with no withdrawn routes
 * and path attributes.
 */
@Test
public void bgpUpdateMessageTest01() throws BgpParseException {
    byte[] updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
            (byte) 0xff, (byte) 0xff, 0x00, 0x17, 0x02, 0x00, 0x00, 0x00, 0x00};

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

    BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
    BgpMessage message;
    BgpHeader bgpHeader = new BgpHeader();

    message = reader.readFrom(buffer, bgpHeader);

    assertThat(message, instanceOf(BgpUpdateMsg.class));
    BgpUpdateMsg other = (BgpUpdateMsg) message;

    assertThat(other.getHeader().getMarker(), is(MARKER));
    assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
    assertThat(other.getHeader().getLength(), is((short) 23));
}
 
Example 2
Source File: IPv6RouterIdofLocalNodeSubTlv.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public int write(ChannelBuffer c) {
    int iStartIndex = c.writerIndex();
    c.writeShort(TYPE);
    c.writeShort(LENGTH);
    c.writeBytes(rawValue);
    return c.writerIndex() - iStartIndex;
}
 
Example 3
Source File: BgpKeepaliveMsgVer4.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void write(ChannelBuffer cb, BgpKeepaliveMsgVer4 message) {

    log.debug("Write marker");
    cb.writeBytes(marker, 0, MARKER_LENGTH);

    log.debug("Write length of header");
    cb.writeShort(PACKET_MINIMUM_LENGTH);

    log.debug("Write the type of message");
    cb.writeByte(MSG_TYPE.getType());
}
 
Example 4
Source File: PcepOpenMsgTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV,
 * PCECC-CAPABILITY-TLV, TED Capability TLV in Pcep Open message.
 */
@Test
public void openMessageTest11() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x2C, // common header
            0x01, 0x10, 0x00, 0x28, // common object header
            0x20, 0x05, 0x1E, 0x01, // OPEN object
            0x00, 0x10, 0x00, 0x04, // STATEFUL-PCE-CAPABILITY
            0x00, 0x00, 0x00, 0x05, 0x00, 0x0E, 0x00, 0x04, // GMPLS-CAPABILITY-TLV
            0x00, 0x00, 0x00, 0x00, (byte) 0xff, 0x07, 0x00, 0x04, // PCECC-CAPABILITY-TLV
            0x00, 0x00, 0x00, 0x03, (byte) 0xFF, (byte) 0x00, 0x00, 0x04, // LS Capability TLV
            0x00, 0x00, 0x00, 0x00 };

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

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

    message = reader.readFrom(buffer);

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

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

    assertThat(testOpenMsg, is(openMsg));
}
 
Example 5
Source File: PcepUpdateMsgExtTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,
 * Bandwidth , metric object in PcepUpdate message.
 */
@Test
public void pcepUpdateMsgTest24() throws PcepParseException, PcepOutOfBoundMessageException {
    byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
            0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
            0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
            0x00, 0x11, 0x00, 0x02,  0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
            0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
            0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
            0x01, 0x01, 0x04, 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

    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));
}
 
Example 6
Source File: PcepLSReportMsgTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case checks for
 * LS Object (Routing Universe TLV, Local Node Descriptors TLV(AutonomousSystemSubTlv)) with different LS-ID.
 * in PcLSRpt message.
 */
@Test
public void lsReportMessageTest2() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] lsReportMsg = new byte[]{0x20, (byte) 0xE0, 0x00, 0x2C, // common header
            (byte) 0xE0, 0x10, 0x00, 0x28, // LS Object Header
            0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, // LS-ID
            (byte) 0xFF, 0x01, 0x00, 0x08, // Routing Universe TLV
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
            (byte) 0xFF, 0x02, 0x00, 0x08, // Local Node Descriptors TLV
            0x00, 0x01, 0x00, 0x04, //AutonomousSystemSubTlv
            0x00, 0x00, 0x00, 0x11};

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

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

    message = reader.readFrom(buffer);

    byte[] testReportMsg = {0};
    assertThat(message, instanceOf(PcepLSReportMsg.class));
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    message.writeTo(buf);

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

    assertThat(testReportMsg, is(lsReportMsg));
}
 
Example 7
Source File: PcepReportMsgTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv)
 * ERO Object, LSPA Object, Metric-list, IRO object
 * in PcRpt message.
 */
@Test
public void reportMessageTest3() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70,
            0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //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, //ERO Object
            0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects
            0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
            0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects
            0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
    };

    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));
}
 
Example 8
Source File: BgpOpenMsgTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case checks open message with Four-octet AS number
 * capability.
 */
@Test
public void openMessageTest3() throws BgpParseException {

    // OPEN Message (Four-Octet AS number capability).
    byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
                                 (byte) 0xff, (byte) 0xff, (byte) 0xff,
                                 (byte) 0xff, (byte) 0xff, (byte) 0xff,
                                 (byte) 0xff, (byte) 0xff, (byte) 0xff,
                                 (byte) 0xff, (byte) 0xff, (byte) 0xff,
                                 (byte) 0xff, 0x00, 0x25,
                                 0x01, //BGPHeader
                                 0X04, //Version
                                 (byte) 0x00, (byte) 0xc8, //AS Number
                                 0x00, (byte) 0xb4, //Hold Time
                                 (byte) 0xb6, (byte) 0x02, 0x5d,
                                 (byte) 0xc8, //BGP Identifier
                                 0x08, 0x02, 0x06, //Opt Parameter Length
                                 0x41, 0x04, 0x00, 0x01, 0x00, 0x01}; //Four Octet AS Number-CAPABILITY-TLV

    byte[] testOpenMsg;
    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(openMsg);

    BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
    BgpMessage message;
    BgpHeader bgpHeader = new BgpHeader();

    message = reader.readFrom(buffer, bgpHeader);

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

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

    assertThat(testOpenMsg, is(openMsg));
}
 
Example 9
Source File: PcepUpdateMsgExtTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,
 * Bandwidth , metric object in PcepUpdate message.
 */
@Test
public void pcepUpdateMsgTest22() throws PcepParseException, PcepOutOfBoundMessageException {
    byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
            0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
            0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
            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,
            0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
            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));
}
 
Example 10
Source File: PcepInitiateMsgTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
 * END-POINT, ERO objects in PcInitiate message.
 */
@Test
public void initiateMessageTest9() throws PcepParseException, PcepOutOfBoundMessageException {

    /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
     * END-POINT, ERO.
     */
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x3c,
            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, 0x04};

    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));
}
 
Example 11
Source File: BgpFsPortNum.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public int write(ChannelBuffer cb) {
    int iLenStartIndex = cb.writerIndex();

    cb.writeByte(FLOW_SPEC_TYPE);

    for (BgpFsOperatorValue fsOperVal : operatorValue) {
        cb.writeByte(fsOperVal.option());
        cb.writeBytes(fsOperVal.value());
    }

    return cb.writerIndex() - iLenStartIndex;
}
 
Example 12
Source File: PcepLSReportMsgTest.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * This test case checks for LS Object (Routing Universe TLV,Local Node Descriptors TLV(IgpRouterIdSubTlv)).
 * in PcLSRpt message.
 */
@Test
public void lsReportMessageTest7() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] lsReportMsg = new byte[]{0x20, (byte) 0xE0, 0x00, 0x30, // common header
            (byte) 0xE0, 0x10, 0x00, 0x2C, // LS Object Header
            0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, // LS-ID
            (byte) 0xFF, 0x01, 0x00, 0x08, // Routing Universe TLV
            0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x01,
            (byte) 0xFF, 0x02, 0x00, 0x0C, // Local Node Descriptors TLV
            0x00, 0x04, 0x00, 0x08, //IgpRouterIdSubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x00, 0x00, 0x11};

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

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

    message = reader.readFrom(buffer);

    byte[] testReportMsg = {0};
    assertThat(message, instanceOf(PcepLSReportMsg.class));
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    message.writeTo(buf);

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

    assertThat(testReportMsg, is(lsReportMsg));
}
 
Example 13
Source File: PcepInitiateMsgTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
 * objects in PcInitiate message.
 */
@Test
public void initiateMessageTest27() throws PcepParseException, PcepOutOfBoundMessageException {

    /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
     * srp,lsp(StatefulIPv4LspIdentidiersTlv),
     * end-point,ero,lspa,bandwidth,metric-list */
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xE4,
            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, //ERO object
            0x01, 0x08, 0x0C, 0x01, 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, 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
            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, //ERO object
            0x01, 0x08, 0x0C, 0x01, 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, 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

    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));
}
 
Example 14
Source File: PcepInitiateMsgExtTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
 * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT
 * objects in PcInitiate message.
 */
@Test
public void initiateMessageTest9() throws PcepParseException, PcepOutOfBoundMessageException {

    // SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
    // END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
    //
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
            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, 0x30, 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, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
            0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
            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,
            0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object

    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));
}
 
Example 15
Source File: PcepLabelUpdateMsgTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for
 * <pce-label-download> SRP, LSP, LABEL, LABEL, <pce-label-download> SRP, LABEL, FEC.
 * in PcepLabelUpdate message.
 */
@Test
public void labelUpdateMessageTest6() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] labelUpdate = new byte[]{0x20, (byte) 0xE2, 0x00, 0x50, // common header
            0x21, 0x10, 0x00, 0x0C, // SRP Object Header
            0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x10,
            0x20, 0x10, 0x00, 0x08, // LSP Object Header
            0x00, 0x01, 0x00, 0x00,
            (byte) 0xE1, 0x10, 0x00, 0x0C, // LABEL Object Header
            0x00, 0x00, 0x00, 0x00,
            0x00, 0x44, 0x00, 0x00,
            (byte) 0xE1, 0x10, 0x00, 0x0C, // LABEL Object Header
            0x00, 0x00, 0x00, 0x00,
            0x00, 0x44, 0x00, 0x00,
            0x21, 0x10, 0x00, 0x0C, // SRP Object Header
            0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x12,
            (byte) 0xE1, 0x10, 0x00, 0x0C, // LABEL Object Header
            0x00, 0x00, 0x00, 0x00,
            0x00, 0x44, 0x00, 0x00,
            (byte) 0xE2, 0x10, 0x00, 0x08, // FEC Object Header
            0x0A, 0x0A, 0x0D, 0x0D};

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

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

    message = reader.readFrom(buffer);

    byte[] testLabelUpdateMsg = {0};
    assertThat(message, instanceOf(PcepLabelUpdateMsg.class));
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
    message.writeTo(buf);

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

    assertThat(testLabelUpdateMsg, is(labelUpdate));
}
 
Example 16
Source File: PcepInitiateMsgTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
 * objects in PcInitiate message.
 */
@Test
public void initiateMessageTest22() throws PcepParseException, PcepOutOfBoundMessageException {
    /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
     * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
     */
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8,
            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, //ERO object
            0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
            0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
            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, //ERO object
            0x01, 0x08, 0x0C, 0x01, 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, 0x00, 0x00, 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));
}
 
Example 17
Source File: PcepInitiateMsgTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
 * objects in PcInitiate message.
 */
@Test
public void initiateMessageTest18() throws PcepParseException, PcepOutOfBoundMessageException {
    //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
            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, 0x04, //ERO object
            0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
            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

    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));
}
 
Example 18
Source File: PcepLSReportMsgTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for
 * LS Object (Routing Universe TLV,Local Node Descriptors TLV(AutonomousSystemSubTlv, BGPLSidentifierSubTlv,
 * OSPFareaIDsubTlv, IgpRouterIdSubTlv), RemoteNodeDescriptorsTLV(AutonomousSystemSubTlv, BGPLSidentifierSubTlv,
 * OSPFareaIDsubTlv, IgpRouterIdSubTlv), LinkDescriptorsTLV(LinkLocalRemoteIdentifiersSubTlv,
 * IPv4InterfaceAddressSubTlv, IPv4NeighborAddressSubTlv), NodeAttributesTlv(NodeFlagBitsSubTlv,
 * OpaqueNodePropertiesSubTlv, NodeNameSubTlv, ISISAreaIdentifierSubTlv, IPv4RouterIdOfLocalNodeSubTlv),
 * LinkAttributesTlv(IPv4RouterIdOfRemoteNodeSubTlv, IPv6LSRouterIdofRemoteNodeTlv, AdministrativeGroupSubTlv,
 * MaximumLinkBandwidthSubTlv, MaximumReservableLinkBandwidthSubTlv, UnreservedBandwidthSubTlv,
 * TEDefaultMetricSubTlv, LinkProtectionTypeSubTlv, MPLSProtocolMaskSubTlv, IgpMetricSubTlv))
 * in PcLSRpt message.
 */
@Test
public void lsReportMessageTest25() throws PcepParseException, PcepOutOfBoundMessageException {

    byte[] lsReportMsg = new byte[]{0x20, (byte) 0xE0, 0x00, (byte) 0xFC, // common header
            (byte) 0xE0, 0x10, 0x00, (byte) 0xF8, // LS Object Header
            0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, // LS-ID
            (byte) 0xFF, 0x01, 0x00, 0x08, // Routing Universe TLV
            0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x01,
            (byte) 0xFF, 0x02, 0x00, 0x24, // Local Node Descriptors TLV
            0x00, 0x01, 0x00, 0x04, //AutonomousSystemSubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x02, 0x00, 0x04, //BGPLSidentifierSubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x03, 0x00, 0x04, //OSPFareaIDsubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x04, 0x00, 0x08, //IgpRouterIdSubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x00, 0x00, 0x11,
            (byte) 0xFF, 0x03, 0x00, 0x24, //RemoteNodeDescriptorsTLV
            0x00, 0x01, 0x00, 0x04, //AutonomousSystemSubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x02, 0x00, 0x04, //BGPLSidentifierSubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x03, 0x00, 0x04, //OSPFareaIDsubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x04, 0x00, 0x08, //IgpRouterIdSubTlv
            0x00, 0x00, 0x00, 0x11,
            0x00, 0x00, 0x00, 0x11,
            (byte) 0xFF, 0x04, 0x00, 0x1C, //LinkDescriptorsTLV
            0x00, 0x06, 0x00, 0x08, //LinkLocalRemoteIdentifiersSubTlv
            0x01, 0x11, 0x00, 0x09,
            0x01, 0x21, 0x00, 0x09,
            0x00, 0x07, 0x00, 0x04, //IPv4InterfaceAddressSubTlv
            0x01, 0x01, 0x01, 0x01,
            0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressSubTlv
            0x01, 0x011, 0x01, 0x10,
            (byte) 0xFF, 0x05, 0x00, 0x1C, //NodeAttributesTlv
            0x00, 0x0E, 0x00, 0x04, //OpaqueNodePropertiesSubTlv
            0x01, 0x011, 0x01, 0x10,
            0x00, 0x10, 0x00, 0x08, //ISISAreaIdentifierSubTlv
            0x20, 0x01, 0x22, 0x01,
            0x20, 0x01, 0x22, 0x01,
            0x00, 0x11, 0x00, 0x04, //IPv4RouterIdOfLocalNodeSubTlv
            0x00, 0x01, 0x01, 0x02,
            (byte) 0xFF, 0x06, 0x00, 0x48, //LinkAttributesTlv
            0x00, 0x13, 0x00, 0x04, //IPv4RouterIdOfRemoteNodeSubTlv
            0x00, 0x07, 0x08, 0x00,
            0x00, 0x16, 0x00, 0x04, //AdministrativeGroupSubTlv
            0x00, 0x09, 0x08, 0x00,
            0x00, 0x17, 0x00, 0x04, //MaximumLinkBandwidthSubTlv
            0x00, 0x09, 0x00, 0x00,
            0x00, 0x18, 0x00, 0x04, //MaximumReservableLinkBandwidthSubTlv
            0x00, 0x10, 0x00, 0x00,
            0x00, 0x19, 0x00, 0x04, //UnreservedBandwidthSubTlv
            0x00, 0x00, (byte) 0x90, 0x00,
            0x00, 0x1A, 0x00, 0x04, //TEDefaultMetricSubTlv
            0x00, (byte) 0x99, 0x09, 0x00,
            0x00, 0x1B, 0x00, 0x02, //LinkProtectionTypeSubTlv
            0x09, 0x00, 0x00, 0x00,
            0x00, 0x1C, 0x00, 0x01, //MPLSProtocolMaskSubTlv
            (byte) 0x80, 0x00, 0x00, 0x00,
            0x00, 0x1D, 0x00, 0x04, //IgpMetricSubTlv
            0x09, (byte) 0x89, 0x07, 0x00
    };

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

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

    message = reader.readFrom(buffer);

    byte[] testReportMsg = {0};

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

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

    assertThat(testReportMsg, is(lsReportMsg));
}
 
Example 19
Source File: PcepInitiateMsgExtTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
 * StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS,
 * ERO, LSPA, BANDWIDTH objects in PcInitiate message.
 */
@Test
public void initiateMessageTest3() throws PcepParseException, PcepOutOfBoundMessageException {

    // SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
    // StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH.
    //
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c,
            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, 0x38, 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, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
            0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
            0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
            // 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv
            //0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05,
            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,
            0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 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));
}
 
Example 20
Source File: PcepInitiateMsgExtTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
 * END-POINTS, ERO, LSPA BANDWIDTH OBJECT objects in PcInitiate message.
 */
@Test
public void initiateMessageTest25() throws PcepParseException, PcepOutOfBoundMessageException {

    // SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA BANDWIDTH OBJECT.
    //
    byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
            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, 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, 0x04, //ERO object
            0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
            0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object

    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));
}