Java Code Examples for org.jboss.netty.buffer.ChannelBuffer#array()
The following examples show how to use
org.jboss.netty.buffer.ChannelBuffer#array() .
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: PcepUpdateMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth objects in PcUpd message. */ @Test public void pcepUpdateMsgTest22() throws PcepParseException, PcepOutOfBoundMessageException { byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5C, 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, 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, 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth 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 2
Source File: PcepOpenMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV * in Pcep Open message. */ @Test public void openMessageTest10() throws PcepParseException, PcepOutOfBoundMessageException { byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x1C, // common header 0x01, 0x10, 0x00, 0x18, // 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[] 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 3
Source File: PcepInitiateMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth * objects in PcInitiate message. */ @Test public void initiateMessageTest17() throws PcepParseException, PcepOutOfBoundMessageException { //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, 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 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 4
Source File: PcepInitiateMsgExtTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, * ERO, LSPA OBJECT objects in PcInitiate message. */ @Test public void initiateMessageTest36() throws PcepParseException, PcepOutOfBoundMessageException { // SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, // ERO, LSPA OBJECT. // byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object 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}; 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 5
Source File: PcepUpdateMsgExtTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA * bandwidth object in PcepUpdate message. */ @Test public void pcepUpdateMsgTest12() throws PcepParseException, PcepOutOfBoundMessageException { byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, 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, 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[] 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: PcepInitiateMsgExtTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. */ @Test public void initiateMessageTest23() throws PcepParseException, PcepOutOfBoundMessageException { // SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT. // byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58, 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}; 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 7
Source File: PcepOpenMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks open object with STATEFUL-PCE-CAPABILITY, GMPLS-CAPABILITY-TLV, PCECC-CAPABILITY-TLV * with P & I bits set and invalid session id in Pcep Open message. */ @Test public void openMessageTest9() throws PcepParseException, PcepOutOfBoundMessageException { byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x24, 0x01, 0x13, 0x00, 0x20, //p bit set & i bit set 0x20, 0x1e, 0x78, 0x00, //invalid sessionID 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, //STATEFUL-PCE-CAPABILITY 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, //GMPLS-CAPABILITY-TLV (byte) 0xff, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, //PCECC-CAPABILITY-TLV }; 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 8
Source File: PcepUpdateMsgExtTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA * bandwidth object in PcepUpdate message. */ @Test public void pcepUpdateMsgTest8() throws PcepParseException, PcepOutOfBoundMessageException { byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, 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, 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, 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth 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 9
Source File: BgpNotificationMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * Notification message with wrong message length. * * @throws BgpParseException while decoding and encoding notification message */ @Test(expected = BgpParseException.class) public void bgpNotificationMessageTest5() throws BgpParseException { byte[] notificationMsg = 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, 0x14, 0x03, 0x02, 0x02}; byte[] testNotificationMsg = {0}; ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(notificationMsg); BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); BgpMessage message = null; BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); assertThat(message, instanceOf(BgpNotificationMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); testNotificationMsg = buf.array(); int iReadLen = buf.writerIndex() - 0; testNotificationMsg = new byte[iReadLen]; buf.readBytes(testNotificationMsg, 0, iReadLen); assertThat(testNotificationMsg, is(notificationMsg)); }
Example 10
Source File: PcepUpdateMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks for SRP, LSP, * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message. */ @Test public void pcepUpdateMsgTest32() throws PcepParseException, PcepOutOfBoundMessageException { byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object 0x20, 0x10, 0x00, 0x8, 0x00, 0x00, 0x10, 0x03, //LSP object 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, 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 11
Source File: PcepInitiateMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks for srp and lsp objects in PcInitiate message. */ @Test public void initiateMessageTest2() throws PcepParseException, PcepOutOfBoundMessageException { /* srp, lsp. */ byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34, 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x20, 0x10, //LSP object 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv 0x01, 0x01, 0x01, 0x01, 0x00, 0x43, (byte) 0x83, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33}; //SymbolicPathTlv byte[] testInitiateDeletionMsg = {0}; ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(initiateDeletionMsg); PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); PcepMessage message = null; message = reader.readFrom(buffer); assertThat(message, instanceOf(PcepInitiateMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); testInitiateDeletionMsg = buf.array(); int iReadLen = buf.writerIndex(); testInitiateDeletionMsg = new byte[iReadLen]; buf.readBytes(testInitiateDeletionMsg, 0, iReadLen); assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg)); }
Example 12
Source File: PcepUpdateMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message. */ @Test public void pcepUpdateMsgTest13() throws PcepParseException, PcepOutOfBoundMessageException { byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70, 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object 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)); }
Example 13
Source File: PcepOpenMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks open object with no tlv Pcep Open message. */ @Test public void openMessageTest15() throws PcepParseException, PcepOutOfBoundMessageException { byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x0c, // common header 0x01, 0x10, 0x00, 0x08, // common object header 0x20, 0x05, 0x1E, 0x01 // OPEN object }; 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 14
Source File: TestOutOfOrderWrite.java From big-c with Apache License 2.0 | 5 votes |
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { // Get handle from create response ChannelBuffer buf = (ChannelBuffer) e.getMessage(); XDR rsp = new XDR(buf.array()); if (rsp.getBytes().length == 0) { LOG.info("rsp length is zero, why?"); return; } LOG.info("rsp length=" + rsp.getBytes().length); RpcReply reply = RpcReply.read(rsp); int xid = reply.getXid(); // Only process the create response if (xid != 0x8000004c) { return; } int status = rsp.readInt(); if (status != Nfs3Status.NFS3_OK) { LOG.error("Create failed, status =" + status); return; } LOG.info("Create succeeded"); rsp.readBoolean(); // value follow handle = new FileHandle(); handle.deserialize(rsp); channel = e.getChannel(); }
Example 15
Source File: PcepOpenMsgTest.java From onos with Apache License 2.0 | 5 votes |
/** * This test case checks open object with LSR id encoded. */ @Test public void openMessageTest16() throws PcepParseException, PcepOutOfBoundMessageException { byte[] openMsg = new byte[] {0x20, 0x01, 0x00, 0x18, // common header 0x01, 0x10, 0x00, 0x14, // common object header 0x20, 0x05, 0x1E, 0x01, // OPEN object (byte) 0xFF, 0x05, 0x00, 0x08, // Node attribute TLV 0x00, 0x11, 0x00, 0x04, // PCEP-LS-IPv4-ROUTER-ID sub tlv 0x02, 0x02, 0x02, 0x02 }; 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 16
Source File: PcepUpdateMsgExtTest.java From onos with Apache License 2.0 | 4 votes |
/** * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object, * Metric object in PcepUpdate message. */ @Test public void pcepUpdateMsgTest1() throws PcepParseException, PcepOutOfBoundMessageException { byte[] updateMsg = new byte[] {0x20, 0x0b, 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, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 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, 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 17
Source File: PcepInitiateMsgTest.java From onos with Apache License 2.0 | 4 votes |
/** * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth * objects in PcInitiate message. */ @Test public void initiateMessageTest23() throws PcepParseException, PcepOutOfBoundMessageException { /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero, * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth */ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xB0, 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, 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 18
Source File: PcepInitiateMsgTest.java From onos with Apache License 2.0 | 4 votes |
/** * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), * END-POINT, ERO objects in PcInitiate message. */ @Test public void initiateMessageTest5() throws PcepParseException, PcepOutOfBoundMessageException { /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), * END-POINT, ERO. */ byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c, 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, 0x24, 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 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}; 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 19
Source File: PcepInitiateMsgExtTest.java From onos with Apache License 2.0 | 4 votes |
/** * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, * SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT * objects in PcInitiate message. */ @Test public void initiateMessageTest12() throws PcepParseException, PcepOutOfBoundMessageException { // SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), // END-POINTS, ERO, LSPA, BANDWIDTH OBJECT. // byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 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, 0x24, 0x00, 0x00, 0x10, 0x03, 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 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 20
Source File: PcepInitiateMsgExtTest.java From onos with Apache License 2.0 | 4 votes |
/** * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message. */ @Test public void initiateMessageTest16() throws PcepParseException, PcepOutOfBoundMessageException { // SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), // END-POINTS, ERO, LSPA OBJECT. // byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68, 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, 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)); }