Implementation of PcInitate and PcUpdate messages
Change-Id: I746a5860a8b4a8022d747a02075ed3237741c53a
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepCloseMsgTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepCloseMsgTest.java
new file mode 100644
index 0000000..4a70517
--- /dev/null
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepCloseMsgTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pcepio;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepMessageReader;
+import org.onosproject.pcepio.protocol.PcepCloseMsg;
+
+import java.util.Arrays;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PcepCloseMsgTest {
+ protected static final Logger log = LoggerFactory.getLogger(PcepCloseMsgTest.class);
+
+ @Before
+ public void startUp() {
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+
+ @Test
+ public void closeMessageTest1() throws PcepParseException {
+ byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, /* common header */
+ 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 = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepCloseMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testCloseMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testCloseMsg = new byte[iReadLen];
+ buf.readBytes(testCloseMsg, 0, iReadLen);
+ if (Arrays.equals(closeMsg, testCloseMsg)) {
+ Assert.assertArrayEquals(closeMsg, testCloseMsg);
+ log.debug("CloseMsg are equal :" + closeMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+}
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java
new file mode 100644
index 0000000..0de0132
--- /dev/null
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest.java
@@ -0,0 +1,1493 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pcepio;
+
+import java.util.Arrays;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepInitiateMsg;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepMessageReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PcepInitiateMsgTest {
+
+ protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class);
+
+ @Before
+ public void startUp() {
+
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+
+ @Test
+ public void initiateMessageTest1() throws PcepParseException {
+
+ /* srp, lsp, end-point, ERO.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, 0x54,
+ 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
+ 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, //LSP object
+ 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
+ 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02,
+ 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathTlv
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest2() throws PcepParseException {
+ /* 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest3() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ 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, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
+ 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest4() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), END-POINT, ERO.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest5() throws PcepParseException {
+
+ /* 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest6() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, 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,
+ 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, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest7() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
+ * END-POINT, ERO.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+ 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, //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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest8() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
+ * END-POINT, ERO.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x4c,
+ 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};
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest9() throws PcepParseException {
+
+ /* 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest10() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv).
+ */
+ byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x44,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
+ 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, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
+ 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08 //StatefulLspErrorCodeTlv
+ };
+
+ byte[] testInitiateDeletionMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateDeletionMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest11() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ StatefulLspErrorCodeTlv).*/
+ byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x44,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
+ 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, //SymbolicPathTlv
+ 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08}; //StatefulLspErrorCodeTlv
+
+ byte[] testInitiateDeletionMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateDeletionMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest12() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
+ */
+ byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x3c,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
+ 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, 0x02, 0x54, 0x31, 0x00, 0x00 //SymbolicPathNameTlv
+ };
+
+ byte[] testInitiateDeletionMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateDeletionMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest13() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
+ */
+ byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x3c,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
+ 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, 0x02, 0x54, 0x31, 0x00, 0x00 }; //SymbolicPathNameTlv
+
+ byte[] testInitiateDeletionMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateDeletionMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest14() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
+ */
+ byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x34,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
+ 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 };
+
+ byte[] testInitiateDeletionMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateDeletionMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest15() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv).
+ */
+ byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x2c,
+ 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 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};
+
+ byte[] testInitiateDeletionMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateDeletionMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest16() throws PcepParseException {
+
+ //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x50,
+ 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};
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest17() throws PcepParseException {
+
+ //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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest18() throws PcepParseException {
+ //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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest19() throws PcepParseException {
+ //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x74,
+ 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, //SymbolicPathTlv
+ 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest20() throws PcepParseException {
+ /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
+ * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
+ */
+ byte[] initiateDeletionMsg = new byte[] {0x20, 0x0C, 0x00, 0x64,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 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,
+ 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 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};
+
+ byte[] testInitiateDeletionMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateDeletionMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateDeletionMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateDeletionMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateDeletionMsg, testInitiateDeletionMsg)) {
+ Assert.assertArrayEquals(initiateDeletionMsg, testInitiateDeletionMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateDeletionMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest21() throws PcepParseException {
+ /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
+ * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x94,
+ 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};
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest22() throws PcepParseException {
+ /*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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest23() throws PcepParseException {
+ /*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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest24() throws PcepParseException {
+ /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
+ * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth*/
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xBC,
+ 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest25() throws PcepParseException {
+
+ /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
+ * srp,lsp(StatefulIPv4LspIdentidiersTlv),
+ * end-point,ero,lspa,bandwidth,metric-list */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xC4,
+ 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,
+ 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest26() throws PcepParseException {
+
+ /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
+ * srp,lsp(StatefulIPv4LspIdentidiersTlv),
+ * end-point,ero,lspa,bandwidth,metric-list */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xD0,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest27() throws PcepParseException {
+
+ /*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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+}
\ No newline at end of file
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest2.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest2.java
new file mode 100644
index 0000000..a13691e
--- /dev/null
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepInitiateMsgTest2.java
@@ -0,0 +1,1932 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pcepio;
+
+import java.util.Arrays;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepInitiateMsg;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepMessageReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PcepInitiateMsgTest2 {
+
+ protected static final Logger log = LoggerFactory.getLogger(PcepInitiateMsgTest.class);
+
+ @Before
+ public void startUp() {
+
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+
+ @Test
+ public void initiateMessageTest1() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
+ * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0xA4,
+ 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,
+ 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
+ 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
+ 0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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, 0x04, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, //Metric 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest2() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
+ * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x98,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest3() throws PcepParseException {
+
+ /* 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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, 0x04, 0x00, 0x00, 0x00, 0x00 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest4() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
+ * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA.
+ */
+ 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, 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest5() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
+ * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA.
+ */
+ 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, 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
+ 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
+ 0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest6() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
+ * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
+ */
+ 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
+ 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
+ 0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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, 0x04, 0x00, 0x00, 0x00, 0x00 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest7() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
+ * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x98,
+ 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
+ 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
+ 0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest8() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
+ * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x90,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest9() throws PcepParseException {
+
+ /* 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest10() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
+ * END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x70,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest11() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
+ * END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x7C,
+ 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,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest12() throws PcepParseException {
+
+ /* 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest13() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
+ * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC 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, 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest14() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
+ * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x7c,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest15() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
+ * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x70,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest16() throws PcepParseException {
+
+ /* 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest17() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 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,
+ 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
+ 0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest18() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
+ */
+ 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, (byte) 0x83,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest19() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x70,
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest20() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC 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, 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
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest21() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest22() throws PcepParseException {
+
+ /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x4c,
+ 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, 0x07, 0x07, 0x00, 0x00 };
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest23() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest25() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA BANDWIDTH OBJECT.
+ */
+ 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, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest26() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS,
+ * ERO, LSPA, BANDWIDTH, METRIC 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, 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
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest27() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x54,
+ 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, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 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, 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
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest28() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x48,
+ 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, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 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, 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, 0x04, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest29() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x40,
+ 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, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 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, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest30() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x50,
+ 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, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest31() throws PcepParseException {
+
+ /* SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 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
+ 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
+ 0x07, 0x10, 0x00, 0x14, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest32() throws PcepParseException {
+
+ /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
+ * ERO, LSPA, BANDWIDTH, METRIC OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x64,
+ 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, 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, 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
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
+
+ byte[] testInitiateCreationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(initiateCreationMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest33() throws PcepParseException {
+
+ /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
+ * ERO, LSPA, BANDWIDTH 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, 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, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest34() throws PcepParseException {
+
+ /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
+ * ERO, LSPA OBJECT.
+ */
+ byte[] initiateCreationMsg = new byte[] {0x20, 0x0C, 0x00, (byte) 0x50,
+ 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, 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, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest35() throws PcepParseException {
+
+ /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
+ * ERO, LSPA 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, 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void initiateMessageTest36() throws PcepParseException {
+
+ /* 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, (byte) 0x01, 0x08, 0x0C, 0x01, //ERO object
+ 0x01, 0x01, 0x00, 0x00, (byte) 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepInitiateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testInitiateCreationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testInitiateCreationMsg = new byte[iReadLen];
+ buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
+
+ if (Arrays.equals(initiateCreationMsg, testInitiateCreationMsg)) {
+ Assert.assertArrayEquals(initiateCreationMsg, testInitiateCreationMsg);
+ log.debug("PCInitiate Msg are equal :" + initiateCreationMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+}
+
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepKeepaliveMsgTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepKeepaliveMsgTest.java
new file mode 100644
index 0000000..444f2d9
--- /dev/null
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepKeepaliveMsgTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pcepio;
+
+import java.util.Arrays;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepKeepaliveMsg;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepMessageReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PcepKeepaliveMsgTest {
+
+ protected static final Logger log = LoggerFactory.getLogger(PcepKeepaliveMsgTest.class);
+
+ @Before
+ public void startUp() {
+
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+
+ @Test
+ public void keepaliveMessageTest1() throws PcepParseException {
+
+ byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 };
+
+ byte[] testKeepaliveMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(keepaliveMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepKeepaliveMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testKeepaliveMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testKeepaliveMsg = new byte[iReadLen];
+ buf.readBytes(testKeepaliveMsg, 0, iReadLen);
+
+ if (Arrays.equals(keepaliveMsg, testKeepaliveMsg)) {
+ Assert.assertArrayEquals(keepaliveMsg, testKeepaliveMsg);
+ log.debug("keepaliveMsg are equal :" + keepaliveMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+}
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java
new file mode 100644
index 0000000..4aaf0c7
--- /dev/null
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest.java
@@ -0,0 +1,1852 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pcepio;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepMessageReader;
+import org.onosproject.pcepio.protocol.PcepUpdateMsg;
+
+import java.util.Arrays;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PcepUpdateMsgTest {
+
+ protected static final Logger log = LoggerFactory.getLogger(PcepUpdateMsgTest.class);
+
+ @Before
+ public void startUp() {
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+
+ @Test
+ public void pcepUpdateMsgTest1() throws PcepParseException {
+ //Srp, Lsp (StatefulIPv4LspIdentidiersTlv), Ero.
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x30,
+ 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, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv
+ 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
+ 0x07, 0x10, 0x00, 0x04 }; //ERO object
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+
+ }
+
+ @Test
+ public void pcepUpdateMsgTest2() throws PcepParseException {
+
+ /* Srp(SymbolicPathNameTlv), Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero, Lspa, Metric-list.
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x94,
+ 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 // lsp object
+ 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv
+ 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, 0x24, 0x01, 0x08, 0x11, 0x01, //ERO object
+ 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
+ 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
+ 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 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, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+
+ }
+
+
+ @Test
+ public void pcepUpdateMsgTest3() throws PcepParseException {
+
+ // Srp, Lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), Ero
+
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x38,
+ 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,
+ 0x07, 0x10, 0x00, 0x04 }; //ERO object
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+
+ }
+
+ @Test
+ public void pcepUpdateMsgTest4() throws PcepParseException {
+
+ // Srp, Lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv), Ero
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
+ 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
+ 0x07, 0x10, 0x00, 0x04 }; //ERO object
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+
+ }
+
+ @Test
+ public void pcepUpdateMsgTest5() throws PcepParseException {
+
+ /* Srp, Lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
+ * Ero
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
+ 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
+ 0x07, 0x10, 0x00, 0x04 }; //ERO object
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+
+ }
+
+ @Test
+ public void pcepUpdateMsgTest6() throws PcepParseException {
+
+ /* Srp, Lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
+ 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, 0x04 };
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+
+ }
+
+ @Test
+ public void pcepUpdateMsgTest7() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
+ 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, 0x04}; //ERO object
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest8() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero (IPv4SubObject)
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50,
+ 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, 0x0c, 0x01, 0x08, 0x11, 0x01, //ERO object
+ 0x01, 0x01, 0x04, 0x00 };
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest9() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero (IPv4SubObject, IPv4SubObject)
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 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, 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 };
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest10() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero (IPv4SubObject, IPv4SubObject), Lspa
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x6c,
+ 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 };
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest11() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero (IPv4SubObject, IPv4SubObject),Lspa, Metric Object
+ */
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest12() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero (IPv4SubObject, IPv4SubObject),Lspa, metric Object
+ */
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest13() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero (IPv4SubObject, IPv4SubObject),Lspa, metric Object
+ */
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest14() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
+ * Ero (IPv4SubObject, IPv4SubObject),Lspa, metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
+ 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest15() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
+ * Ero (IPv4SubObject, IPv4SubObject),Lspa, metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
+ 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest16() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject),Lspa, metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest17() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject),Lspa
+ */
+ 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, 0x1c, 0x00, 0x00, 0x10, 0x05, //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 };
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest18() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject),Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest19() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject),Metric-list
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 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,
+ 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
+ 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
+ 0x01, 0x01, 0x04, 0x00,
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest20() throws PcepParseException {
+
+ /* Srp, Lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv),Ero (IPv4SubObject, IPv4SubObject),Lspa, Bandwidth, Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest21() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject), Bandwidth
+ */
+ 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, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest22() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth
+ */
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest23() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
+ 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest24() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ 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, 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest25() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ 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, 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest26() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspErrorCodeTlv)
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest27() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspErrorCodeTlv)
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest28() throws PcepParseException {
+
+ /* Srp, Lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
+ * StatefulLspErrorCodeTlv), Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest29() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulIPv4LspIdentidiersTlv),
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
+ 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest30() throws PcepParseException {
+
+ /* Srp, Lsp ,
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ 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, 0x08, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest31() throws PcepParseException {
+
+ /* Srp, Lsp (StatefulLspErrorCodeTlv),
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ 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, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest32() throws PcepParseException {
+
+ /* Srp, Lsp,
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest33() throws PcepParseException {
+
+ /* Srp, Lsp (SymbolicPathNameTlv),
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ 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, 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest34() throws PcepParseException {
+
+ /* Srp, Lsp (SymbolicPathNameTlv, SymbolicPathNameTlv),
+ * Ero (IPv4SubObject, IPv4SubObject), Lspa, Bandwidth, Metric Object
+ */
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64,
+ 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, 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+}
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest2.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest2.java
new file mode 100644
index 0000000..2853dbf
--- /dev/null
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PcepUpdateMsgTest2.java
@@ -0,0 +1,1576 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pcepio;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepMessageReader;
+import org.onosproject.pcepio.protocol.PcepUpdateMsg;
+
+import java.util.Arrays;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test cases for PCEP update message.
+ */
+public class PcepUpdateMsgTest2 {
+
+ protected static final Logger log = LoggerFactory.getLogger(PcepUpdateMsgTest2.class);
+
+ @Before
+ public void startUp() {
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+
+ @Test
+ public void pcepUpdateMsgTest1() throws PcepParseException {
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest2() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
+ 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, //LSP 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest3() throws PcepParseException {
+ 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, 0x08, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest4() throws PcepParseException {
+ 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, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest5() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest6() throws PcepParseException {
+ 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, 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest7() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64,
+ 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, 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
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest8() throws PcepParseException {
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest9() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58,
+ 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x20, 0x10, 0x00, 0x18, 0x00, 0x00, 0x10, 0x03,
+ 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv
+ 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest10() throws PcepParseException {
+ 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, 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
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest11() throws PcepParseException {
+ 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, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 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, 0x04}; //Bandwidth object
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest12() throws PcepParseException {
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest13() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 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, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest14() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest15() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
+ 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x20, 0x10, 0x00, 0x08, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest16() throws PcepParseException {
+ 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, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest17() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest18() throws PcepParseException {
+ 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, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest19() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 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, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest20() throws PcepParseException {
+ 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, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest21() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
+ 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x20, 0x10, 0x00, 0x08, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest22() throws PcepParseException {
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest23() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest24() throws PcepParseException {
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest25() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50,
+ 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, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest26() throws PcepParseException {
+ 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, 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 };
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest27() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x34,
+ 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
+ 0x20, 0x10, 0x00, 0x08, 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest28() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
+ 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,
+ 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest29() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
+ 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, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 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 };
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest30() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
+ 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, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 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
+
+ byte[] testupdateMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(updateMsg);
+
+ PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
+ PcepMessage message = null;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest31() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
+ 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, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
+ 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
+ 0x01, 0x01, 0x04, 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+
+ @Test
+ public void pcepUpdateMsgTest32() throws PcepParseException {
+ byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64,
+ 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, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
+ 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
+ 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
+ 0x01, 0x01, 0x04, 0x00,
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
+ 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric 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;
+ try {
+ message = reader.readFrom(buffer);
+ } catch (PcepParseException e) {
+ e.printStackTrace();
+ }
+
+ if (message instanceof PcepUpdateMsg) {
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testupdateMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testupdateMsg = new byte[iReadLen];
+ buf.readBytes(testupdateMsg, 0, iReadLen);
+
+ if (Arrays.equals(updateMsg, testupdateMsg)) {
+ Assert.assertArrayEquals(updateMsg, testupdateMsg);
+ log.debug("updateMsg are equal :" + updateMsg);
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ } else {
+ Assert.fail("test case failed");
+ log.debug("not equal");
+ }
+ }
+}
+
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/SymbolicPathNameTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/SymbolicPathNameTlvTest.java
new file mode 100644
index 0000000..5099e35
--- /dev/null
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/SymbolicPathNameTlvTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pcepio;
+
+import org.junit.Test;
+import org.onosproject.pcepio.types.SymbolicPathNameTlv;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test case for Symbolic path tlv.
+ */
+public class SymbolicPathNameTlvTest {
+
+ byte[] value1 = {0x41 };
+ Short length1 = new Short((short) 2);
+ final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1);
+
+ byte[] value2 = {0x41 };
+ Short length2 = new Short((short) 2);
+ final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2);
+
+ byte[] value3 = {0x41, 0x43 };
+ Short length3 = new Short((short) 3);
+ final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3);
+
+ @Test
+ public void basics() {
+ new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
+ }
+
+}